add logic
This commit is contained in:
parent
b0f86f1f75
commit
da6cf36c9d
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@ -76,34 +76,45 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="labelParams" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="labelSpeed" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelWeight" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="SpinnerWeight" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="SpinnerSpeed" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="checkboxGun" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="148" max="-2" attributes="0"/>
|
||||
<Component id="LabelModify" min="-2" pref="87" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="LabelCountRollers" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="ComboBoxCountRollers" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="checkboxTower" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkboxGun" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="labelParams" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="labelSpeed" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelWeight" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="SpinnerWeight" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="SpinnerSpeed" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="LabelCountRollers" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="ComboBoxCountRollers" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelColors" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="115" max="-2" attributes="0"/>
|
||||
<Component id="LabelModify" min="-2" pref="87" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="LabelFirstRoller" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="LabelSecondRoller" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="checkboxTower" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="LabelSimpleRollers" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
@ -120,10 +131,9 @@
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="panelColors" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
|
||||
<Component id="labelParams" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
@ -140,9 +150,19 @@
|
||||
<Component id="LabelCountRollers" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="ComboBoxCountRollers" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelColors" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="LabelFirstRoller" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabelSecondRoller" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabelSimpleRollers" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
@ -257,7 +277,7 @@
|
||||
<Component id="PanelBlue" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="PanelYellow" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="62" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="33" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -479,6 +499,21 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="LabelFirstRoller">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Первый тип"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="LabelSecondRoller">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Второй тип"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="LabelSimpleRollers">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Простые"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="java.awt.Panel" name="panelObject">
|
||||
|
@ -1,3 +1,13 @@
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.function.Consumer;
|
||||
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
|
||||
@ -8,14 +18,63 @@
|
||||
* @author Alena
|
||||
*/
|
||||
public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
|
||||
DrawingArmoredVehicle _machine;
|
||||
Consumer<DrawingArmoredVehicle> EventAddMachine;
|
||||
public boolean DialogResult = false;
|
||||
/**
|
||||
* Creates new form FormArmoredVehicleConfig
|
||||
*/
|
||||
public FormArmoredVehicleConfig() {
|
||||
initComponents();
|
||||
}
|
||||
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));
|
||||
}
|
||||
};
|
||||
panelDraw.addMouseListener(defCursor);
|
||||
LabelColor.addMouseListener(defCursor);
|
||||
LabelDopColor.addMouseListener(defCursor);
|
||||
//labelSetRoller.addMouseListener(defCursor);
|
||||
|
||||
PanelRed.addMouseListener(drag);
|
||||
PanelBlack.addMouseListener(drag);
|
||||
PanelGray.addMouseListener(drag);
|
||||
PanelOrange.addMouseListener(drag);
|
||||
PanelYellow.addMouseListener(drag);
|
||||
PanelPink.addMouseListener(drag);
|
||||
PanelGreen.addMouseListener(drag);
|
||||
PanelBlue.addMouseListener(drag);
|
||||
|
||||
LabelSimple.addMouseListener(drag);
|
||||
LabelModify.addMouseListener(drag);
|
||||
LabelFirstRoller.addMouseListener(drag);
|
||||
LabelSecondRoller.addMouseListener(drag);
|
||||
|
||||
buttonAdd.addActionListener(e -> {
|
||||
EventAddMachine.accept(_machine);
|
||||
DialogResult = true;
|
||||
dispose();
|
||||
});
|
||||
|
||||
buttonCancel.addActionListener(e -> dispose());
|
||||
}
|
||||
public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev; }
|
||||
public DrawingArmoredVehicle getSelectedCar() {
|
||||
return _machine;
|
||||
}
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
@ -44,10 +103,15 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
PanelGreen = new javax.swing.JPanel();
|
||||
PanelBlue = new javax.swing.JPanel();
|
||||
PanelYellow = new javax.swing.JPanel();
|
||||
label2 = new java.awt.Label();
|
||||
label1 = new java.awt.Label();
|
||||
LabelCountRollers = new javax.swing.JLabel();
|
||||
ComboBoxCountRollers = new javax.swing.JComboBox<>();
|
||||
LabelModify = new javax.swing.JLabel();
|
||||
LabelSimple = new javax.swing.JLabel();
|
||||
LabelFirstRoller = new javax.swing.JLabel();
|
||||
LabelSecondRoller = new javax.swing.JLabel();
|
||||
LabelSimpleRollers = new javax.swing.JLabel();
|
||||
panelObject = new java.awt.Panel();
|
||||
LabelDopColor = new javax.swing.JLabel();
|
||||
LabelColor = new javax.swing.JLabel();
|
||||
@ -221,7 +285,7 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
.addComponent(PanelGreen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(PanelBlue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(PanelYellow, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(0, 62, Short.MAX_VALUE))
|
||||
.addContainerGap(33, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
label1.setText("label1");
|
||||
@ -236,6 +300,12 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
LabelSimple.setText("Простой");
|
||||
LabelSimple.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
|
||||
LabelFirstRoller.setText("Первый тип");
|
||||
|
||||
LabelSecondRoller.setText("Второй тип");
|
||||
|
||||
LabelSimpleRollers.setText("Простые");
|
||||
|
||||
javax.swing.GroupLayout panelParamsLayout = new javax.swing.GroupLayout(panelParams);
|
||||
panelParams.setLayout(panelParamsLayout);
|
||||
panelParamsLayout.setHorizontalGroup(
|
||||
@ -243,28 +313,36 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(labelParams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addComponent(checkboxGun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(148, 148, 148)
|
||||
.addComponent(LabelModify, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(labelSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(labelWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(SpinnerWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(SpinnerSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addComponent(LabelCountRollers)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(ComboBoxCountRollers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(checkboxTower, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(checkboxGun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addComponent(labelParams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(labelSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(labelWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(SpinnerWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(SpinnerSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addComponent(LabelCountRollers)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(ComboBoxCountRollers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(panelColors, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addGap(115, 115, 115)
|
||||
.addComponent(LabelModify, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addComponent(LabelFirstRoller)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(LabelSecondRoller))
|
||||
.addComponent(checkboxTower, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(LabelSimpleRollers)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
@ -275,10 +353,9 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
panelParamsLayout.setVerticalGroup(
|
||||
panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(panelColors, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addGap(34, 34, 34)
|
||||
.addComponent(labelParams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -291,8 +368,16 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(LabelCountRollers)
|
||||
.addComponent(ComboBoxCountRollers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(40, 40, 40)))
|
||||
.addComponent(ComboBoxCountRollers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(panelColors, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(LabelFirstRoller)
|
||||
.addComponent(LabelSecondRoller)
|
||||
.addComponent(LabelSimpleRollers))
|
||||
.addGap(12, 12, 12)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@ -402,39 +487,59 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(FormArmoredVehicleConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(FormArmoredVehicleConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(FormArmoredVehicleConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(FormArmoredVehicleConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
|
||||
public void Drop(JComponent droppedItem) {
|
||||
if (droppedItem == null) {
|
||||
return;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new FormArmoredVehicleConfig().setVisible(true);
|
||||
Color color = Color.WHITE;
|
||||
Color dopColor = Color.BLACK;
|
||||
if (droppedItem instanceof JPanel panel) {
|
||||
if (_machine == null)
|
||||
return;
|
||||
if (LabelColor.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 && panelDraw.getMousePosition() != null) {
|
||||
int speed = (int)SpinnerSpeed.getValue();
|
||||
int weight = (int)SpinnerWeight.getValue();
|
||||
int rollers = Integer.parseInt((String) ComboBoxCountRollers.getSelectedItem());
|
||||
boolean tower = checkboxTower.getState();
|
||||
boolean gun = checkboxGun.getState();
|
||||
|
||||
if (label == LabelSimple) {
|
||||
//try { pictureBox.remove(_machine); } catch (Exception ex) { }
|
||||
_machine = new DrawingArmoredVehicle(speed, weight, color);
|
||||
} else if (label == LabelModify) {
|
||||
//try { pictureBox.remove(_machine); } catch (Exception ex) { }
|
||||
_machine = new DrawingTank(speed, weight, color, dopColor, tower, gun);
|
||||
}
|
||||
|
||||
if (_machine!=null) {
|
||||
_machine.SetPosition(panelDraw.getWidth() - 200, panelDraw.getHeight() - 150, panelDraw.getWidth(), panelDraw.getHeight());
|
||||
// pictureBox.add(_machine, BorderLayout.CENTER);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
} else if (droppedItem instanceof JLabel label /*&& labelSetRoller.getMousePosition() != null*/ && _machine!=null) {
|
||||
if (label == LabelSimpleRollers) {
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new Roller(color));
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new Roller(color));
|
||||
} else if (label == LabelFirstRoller) {
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new DrawingFirstRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingFirstRoller(color));
|
||||
} else if (label == LabelSecondRoller) {
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new DrawingSecondRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingSecondRoller(color));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
@ -442,8 +547,11 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
private javax.swing.JLabel LabelColor;
|
||||
private javax.swing.JLabel LabelCountRollers;
|
||||
private javax.swing.JLabel LabelDopColor;
|
||||
private javax.swing.JLabel LabelFirstRoller;
|
||||
private javax.swing.JLabel LabelModify;
|
||||
private javax.swing.JLabel LabelSecondRoller;
|
||||
private javax.swing.JLabel LabelSimple;
|
||||
private javax.swing.JLabel LabelSimpleRollers;
|
||||
private javax.swing.JPanel PanelBlack;
|
||||
private javax.swing.JPanel PanelBlue;
|
||||
private javax.swing.JPanel PanelGray;
|
||||
|
@ -301,7 +301,7 @@ private Image img;
|
||||
JOptionPane.showMessageDialog(null, "Не выбрана карта");
|
||||
return;
|
||||
}
|
||||
FormMachineConfig form = new FormMachineConfig();
|
||||
FormArmoredVehicleConfig form = new FormArmoredVehicleConfig();
|
||||
form.setVisible(true);
|
||||
form.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user