clear
This commit is contained in:
parent
aa5414867c
commit
6477ad58b7
@ -12,11 +12,6 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alena
|
||||
@ -550,7 +545,6 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
if (_machine!=null) {
|
||||
_machine.Count = rollers;
|
||||
_machine.SetPosition(panelDraw.getWidth() - 200, panelDraw.getHeight() - 150, panelDraw.getWidth(), panelDraw.getHeight());
|
||||
// pictureBox.add(_machine, BorderLayout.CENTER);
|
||||
Graphics g = panelDraw.getGraphics();
|
||||
g.drawImage(Pic(), 0, 0, this);
|
||||
}
|
||||
|
@ -1,369 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="src.FormTractorConfig">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="932" height="498"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="305c4" binding="groupBoxConfig" layout-manager="GridLayoutManager" row-count="11" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="30ed4" class="javax.swing.JLabel" binding="labelSpeed">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Скорость"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e77f5" class="javax.swing.JLabel" binding="labelWeight">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Вес"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="29647" class="javax.swing.JCheckBox" binding="checkBoxAttachment">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="3" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Признак наличия отвала"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="e424b" binding="groupBoxColors" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="6" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="fa5c8" binding="redPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-65536"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="b9ebc" binding="greenPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16753150"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="707dd" binding="bluePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16776999"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="e60ce" binding="whitePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-1181441"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="a6fd8" binding="grayPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-11776175"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="38c30" binding="blackPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16777216"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="b8565" binding="yellowPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-1024"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="39b92" binding="purplePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="30" height="30"/>
|
||||
<preferred-size width="30" height="30"/>
|
||||
<maximum-size width="30" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-11009884"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="64f16" class="javax.swing.JLabel" binding="labelSimpleObject">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="100" height="20"/>
|
||||
<preferred-size width="100" height="20"/>
|
||||
<maximum-size width="100" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Простой"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1997" class="javax.swing.JLabel" binding="labelModifiedObject">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="100" height="20"/>
|
||||
<preferred-size width="100" height="20"/>
|
||||
<maximum-size width="100" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Продвинутый"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<hspacer id="87dea">
|
||||
<constraints>
|
||||
<grid row="8" column="2" row-span="1" col-span="3" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="cc16c" class="javax.swing.JCheckBox" binding="checkBoxRipper">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="2" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Признак начилия рыхлителя"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="82e7f" class="javax.swing.JSpinner" binding="speedSpinner">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="b6f98" class="javax.swing.JSpinner" binding="weightSpinner">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="4827b" class="javax.swing.JLabel" binding="paramLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Параметры"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ec7a4" class="javax.swing.JLabel" binding="colorLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Цвета"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5bdb7" class="javax.swing.JSpinner" binding="rollerSpinner">
|
||||
<constraints>
|
||||
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="700de" class="javax.swing.JLabel" binding="rollerLabel">
|
||||
<constraints>
|
||||
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Катки"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ae794" class="javax.swing.JLabel" binding="simpleRollerLabel">
|
||||
<constraints>
|
||||
<grid row="9" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Обычные"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f6911" class="javax.swing.JLabel" binding="pieRollerLabel">
|
||||
<constraints>
|
||||
<grid row="9" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="В виде пирога"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9fc5" class="javax.swing.JLabel" binding="lineRollerLabel">
|
||||
<constraints>
|
||||
<grid row="9" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="С линиями"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="1893b">
|
||||
<constraints>
|
||||
<grid row="10" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<vspacer id="8b0d4">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="9ab93" binding="panelObject" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="351ad" binding="pictureBox" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="300" height="300"/>
|
||||
<preferred-size width="300" height="300"/>
|
||||
<maximum-size width="300" height="300"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="947d8" class="javax.swing.JLabel" binding="labelBaseColor">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="70" height="30"/>
|
||||
<preferred-size width="70" height="30"/>
|
||||
<maximum-size width="70" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Цвет"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e15c8" class="javax.swing.JLabel" binding="labelDopColor">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="70" height="30"/>
|
||||
<preferred-size width="70" height="30"/>
|
||||
<maximum-size width="70" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Доп. цвет"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fb2e4" class="javax.swing.JLabel" binding="labelSetRoller">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="70" height="30"/>
|
||||
<preferred-size width="70" height="30"/>
|
||||
<maximum-size width="70" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Катки"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="9b0cc" class="javax.swing.JButton" binding="buttonOk">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Добавить"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a4be7" class="javax.swing.JButton" binding="buttonCancel">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Отмена"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="662e1">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
@ -1,175 +0,0 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class FormMachineConfig extends JFrame {
|
||||
DrawingArmoredVehicle _machine;
|
||||
Consumer<DrawingArmoredVehicle> EventAddMachine;
|
||||
private JPanel mainPanel;
|
||||
private JPanel groupBoxConfig;
|
||||
private JPanel panelObject;
|
||||
private JLabel labelSpeed;
|
||||
private JLabel labelWeight;
|
||||
private JCheckBox checkBoxTower;
|
||||
private JCheckBox checkBoxGun;
|
||||
private JPanel groupBoxColors;
|
||||
private JButton buttonOk;
|
||||
private JButton buttonCancel;
|
||||
private JPanel redPanel;
|
||||
private JPanel greenPanel;
|
||||
private JPanel bluePanel;
|
||||
private JPanel yellowPanel;
|
||||
private JPanel whitePanel;
|
||||
private JPanel grayPanel;
|
||||
private JPanel blackPanel;
|
||||
private JPanel purplePanel;
|
||||
private JLabel labelSimpleObject;
|
||||
private JLabel labelModifiedObject;
|
||||
private JSpinner speedSpinner;
|
||||
private JSpinner weightSpinner;
|
||||
private JLabel paramLabel;
|
||||
private JLabel colorLabel;
|
||||
private JPanel pictureBox;
|
||||
private JLabel labelBaseColor;
|
||||
private JLabel labelDopColor;
|
||||
private JSpinner rollerSpinner;
|
||||
private JLabel rollerLabel;
|
||||
private JLabel simpleRollerLabel;
|
||||
private JLabel lineRollerLabel;
|
||||
private JLabel pieRollerLabel;
|
||||
private JLabel labelSetRoller;
|
||||
public boolean DialogResult = false;
|
||||
|
||||
public FormMachineConfig() {
|
||||
super("");
|
||||
CreateWindow();
|
||||
}
|
||||
|
||||
public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev; }
|
||||
public DrawingArmoredVehicle getSelectedCar() {
|
||||
return _machine;
|
||||
}
|
||||
private void CreateWindow() {
|
||||
setPreferredSize(new Dimension(1000, 450));
|
||||
getContentPane().add(mainPanel);
|
||||
|
||||
//границы
|
||||
labelSimpleObject.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
labelModifiedObject.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
labelBaseColor.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
labelDopColor.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
simpleRollerLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
lineRollerLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
pieRollerLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
labelSetRoller.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
pictureBox.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
|
||||
//ограничения
|
||||
speedSpinner.setModel(new SpinnerNumberModel(100, 100, 1000, 1));
|
||||
weightSpinner.setModel(new SpinnerNumberModel(100, 100, 1000, 1));
|
||||
rollerSpinner.setModel(new SpinnerNumberModel(4, 4, 6, 1));
|
||||
|
||||
MouseAdapter drag = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
Drop((JComponent) e.getSource());
|
||||
}
|
||||
};
|
||||
|
||||
MouseAdapter defCursor = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
};
|
||||
|
||||
pictureBox.addMouseListener(defCursor);
|
||||
labelBaseColor.addMouseListener(defCursor);
|
||||
labelDopColor.addMouseListener(defCursor);
|
||||
labelSetRoller.addMouseListener(defCursor);
|
||||
|
||||
redPanel.addMouseListener(drag);
|
||||
greenPanel.addMouseListener(drag);
|
||||
bluePanel.addMouseListener(drag);
|
||||
yellowPanel.addMouseListener(drag);
|
||||
whitePanel.addMouseListener(drag);
|
||||
grayPanel.addMouseListener(drag);
|
||||
blackPanel.addMouseListener(drag);
|
||||
purplePanel.addMouseListener(drag);
|
||||
|
||||
labelSimpleObject.addMouseListener(drag);
|
||||
labelModifiedObject.addMouseListener(drag);
|
||||
simpleRollerLabel.addMouseListener(drag);
|
||||
lineRollerLabel.addMouseListener(drag);
|
||||
pieRollerLabel.addMouseListener(drag);
|
||||
|
||||
buttonOk.addActionListener(e -> {
|
||||
EventAddMachine.accept(_machine);
|
||||
DialogResult = true;
|
||||
dispose();
|
||||
});
|
||||
|
||||
buttonCancel.addActionListener(e -> dispose());
|
||||
}
|
||||
|
||||
public void Drop(JComponent droppedItem) {
|
||||
if (droppedItem == null) {
|
||||
return;
|
||||
}
|
||||
Color color = Color.WHITE;
|
||||
Color dopColor = Color.BLACK;
|
||||
if (droppedItem instanceof JPanel panel) {
|
||||
if (_machine == null)
|
||||
return;
|
||||
if (labelBaseColor.getMousePosition() != null) {
|
||||
//_machine.SetColor(panel.getBackground());
|
||||
color = panel.getBackground();
|
||||
}
|
||||
if (labelDopColor.getMousePosition() != null && _machine instanceof DrawingTank tank) {
|
||||
//tank.SetDopColor(panel.getBackground());
|
||||
dopColor = panel.getBackground();
|
||||
}
|
||||
}
|
||||
if (droppedItem instanceof JLabel label && pictureBox.getMousePosition() != null) {
|
||||
int speed = (int)speedSpinner.getValue();
|
||||
int weight = (int)weightSpinner.getValue();
|
||||
int rollers = (int)rollerSpinner.getValue();
|
||||
boolean tower = checkBoxTower.isSelected();
|
||||
boolean gun = checkBoxGun.isSelected();
|
||||
if (label == labelSimpleObject) {
|
||||
//try { pictureBox.remove(_machine); } catch (Exception ex) { }
|
||||
_machine = new DrawingArmoredVehicle(speed, weight, color);
|
||||
|
||||
} else if (label == labelModifiedObject) {
|
||||
//try { pictureBox.remove(_machine); } catch (Exception ex) { }
|
||||
_machine = new DrawingTank(speed, weight, color, dopColor, tower, gun);
|
||||
}
|
||||
|
||||
if (_machine!=null) {
|
||||
_machine.SetPosition(pictureBox.getWidth() - 200, pictureBox.getHeight() - 150, pictureBox.getWidth(), pictureBox.getHeight());
|
||||
// pictureBox.add(_machine, BorderLayout.CENTER);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
} else if (droppedItem instanceof JLabel label && labelSetRoller.getMousePosition() != null && _machine!=null) {
|
||||
if (label == simpleRollerLabel) {
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new Roller(color));
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new Roller(color));
|
||||
} else if (label == lineRollerLabel) {
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new DrawingFirstRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingFirstRoller(color));
|
||||
} else if (label == pieRollerLabel) {
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new DrawingSecondRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingSecondRoller(color));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user