done hard path
This commit is contained in:
parent
da6cf36c9d
commit
aa5414867c
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@ -23,11 +23,11 @@ public class DrawingArmoredVehicle{
|
||||
/// <summary>
|
||||
/// Ширина окна отрисовки
|
||||
/// </summary>
|
||||
protected int _pictureWidth = 0;
|
||||
protected int _pictureWidth = 100;
|
||||
/// <summary>
|
||||
/// Высота окна отрисовки
|
||||
/// </summary>
|
||||
protected int _pictureHeight = 0;
|
||||
protected int _pictureHeight = 100;
|
||||
/// <summary>
|
||||
/// Ширина отрисовки
|
||||
/// </summary>
|
||||
@ -50,7 +50,7 @@ public class DrawingArmoredVehicle{
|
||||
{
|
||||
Random r = new Random();
|
||||
ArmoredVehicle = new ArmoredVehicleEntity(speed, weight, bodyColor);
|
||||
int variant = r.nextInt(3);
|
||||
int variant = 0;
|
||||
switch(variant)
|
||||
{
|
||||
case 0:
|
||||
@ -78,9 +78,9 @@ public class DrawingArmoredVehicle{
|
||||
public DrawingArmoredVehicle(ArmoredVehicleEntity machine, IDrawingRoller rollers)
|
||||
{
|
||||
ArmoredVehicle = machine;
|
||||
roller = rollers;
|
||||
|
||||
roller = rollers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
|
@ -60,7 +60,7 @@
|
||||
<Component id="buttonCancel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="panelParams" min="-2" pref="268" max="-2" attributes="0"/>
|
||||
<Component id="panelParams" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@ -78,7 +78,9 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="checkboxGun" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="148" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="54" max="-2" attributes="0"/>
|
||||
<Component id="LabelSimple" min="-2" pref="67" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
|
||||
<Component id="LabelModify" min="-2" pref="87" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
@ -119,13 +121,6 @@
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="227" max="-2" attributes="0"/>
|
||||
<Component id="LabelSimple" min="-2" pref="67" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="159" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
@ -157,33 +152,29 @@
|
||||
</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"/>
|
||||
<Group type="103" groupAlignment="0" 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 type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="LabelFirstRoller" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="LabelSimpleRollers" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</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"/>
|
||||
<Component id="checkboxTower" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkboxGun" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||||
<Component id="LabelModify" min="-2" pref="29" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="LabelModify" alignment="3" min="-2" pref="29" max="-2" attributes="0"/>
|
||||
<Component id="LabelSimple" alignment="3" min="-2" pref="29" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="216" max="32767" attributes="0"/>
|
||||
<Component id="LabelSimple" min="-2" pref="29" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="68" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="15" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -521,21 +512,19 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="LabelDopColor" min="-2" pref="67" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||||
<Component id="panelDraw" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
|
||||
<Component id="LabelColor" min="-2" pref="67" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="157" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="panelDraw" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="LabelColor" min="-2" pref="80" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="LabelDopColor" min="-2" pref="86" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -544,17 +533,13 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
|
||||
<Component id="LabelDopColor" min="-2" pref="29" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelDraw" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
|
||||
<Component id="LabelColor" min="-2" pref="29" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="196" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="LabelColor" pref="29" max="32767" attributes="0"/>
|
||||
<Component id="LabelDopColor" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="27" max="32767" attributes="0"/>
|
||||
<Component id="panelDraw" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -590,7 +575,7 @@
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="177" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="160" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
@ -601,6 +586,9 @@
|
||||
<Properties>
|
||||
<Property name="label" type="java.lang.String" value="Добавить"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="buttonAddMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="java.awt.Button" name="buttonCancel">
|
||||
<Properties>
|
||||
|
@ -1,8 +1,12 @@
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.function.Consumer;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
@ -21,6 +25,7 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
DrawingArmoredVehicle _machine;
|
||||
Consumer<DrawingArmoredVehicle> EventAddMachine;
|
||||
public boolean DialogResult = false;
|
||||
Image img;
|
||||
/**
|
||||
* Creates new form FormArmoredVehicleConfig
|
||||
*/
|
||||
@ -47,7 +52,6 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
panelDraw.addMouseListener(defCursor);
|
||||
LabelColor.addMouseListener(defCursor);
|
||||
LabelDopColor.addMouseListener(defCursor);
|
||||
//labelSetRoller.addMouseListener(defCursor);
|
||||
|
||||
PanelRed.addMouseListener(drag);
|
||||
PanelBlack.addMouseListener(drag);
|
||||
@ -62,6 +66,7 @@ public class FormArmoredVehicleConfig extends javax.swing.JFrame {
|
||||
LabelModify.addMouseListener(drag);
|
||||
LabelFirstRoller.addMouseListener(drag);
|
||||
LabelSecondRoller.addMouseListener(drag);
|
||||
LabelSimpleRollers.addMouseListener(drag);
|
||||
|
||||
buttonAdd.addActionListener(e -> {
|
||||
EventAddMachine.accept(_machine);
|
||||
@ -315,7 +320,9 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addComponent(checkboxGun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(148, 148, 148)
|
||||
.addGap(54, 54, 54)
|
||||
.addComponent(LabelSimple, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(27, 27, 27)
|
||||
.addComponent(LabelModify, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -344,11 +351,6 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
.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()
|
||||
.addGap(227, 227, 227)
|
||||
.addComponent(LabelSimple, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(159, Short.MAX_VALUE)))
|
||||
);
|
||||
panelParamsLayout.setVerticalGroup(
|
||||
panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -373,27 +375,23 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
.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)
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(LabelSecondRoller)
|
||||
.addComponent(LabelSimpleRollers))
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(LabelFirstRoller)
|
||||
.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)
|
||||
.addComponent(checkboxTower, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkboxGun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(59, 59, 59))
|
||||
.addComponent(checkboxGun, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(panelParamsLayout.createSequentialGroup()
|
||||
.addGap(20, 20, 20)
|
||||
.addComponent(LabelModify, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelParamsLayout.createSequentialGroup()
|
||||
.addContainerGap(216, Short.MAX_VALUE)
|
||||
.addComponent(LabelSimple, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(68, 68, 68)))
|
||||
.addGroup(panelParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(LabelModify, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(LabelSimple, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addContainerGap(15, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
LabelDopColor.setText("Доп. цвет");
|
||||
@ -410,43 +408,43 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
);
|
||||
panelDrawLayout.setVerticalGroup(
|
||||
panelDrawLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 177, Short.MAX_VALUE)
|
||||
.addGap(0, 160, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout panelObjectLayout = new javax.swing.GroupLayout(panelObject);
|
||||
panelObject.setLayout(panelObjectLayout);
|
||||
panelObjectLayout.setHorizontalGroup(
|
||||
panelObjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelObjectLayout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(LabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(60, 60, 60))
|
||||
.addGroup(panelObjectLayout.createSequentialGroup()
|
||||
.addGap(20, 20, 20)
|
||||
.addComponent(panelDraw, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(panelObjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelObjectLayout.createSequentialGroup()
|
||||
.addGap(42, 42, 42)
|
||||
.addComponent(LabelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(157, Short.MAX_VALUE)))
|
||||
.addGap(32, 32, 32)
|
||||
.addGroup(panelObjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelObjectLayout.createSequentialGroup()
|
||||
.addComponent(panelDraw, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelObjectLayout.createSequentialGroup()
|
||||
.addComponent(LabelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(LabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(41, 41, 41))))
|
||||
);
|
||||
panelObjectLayout.setVerticalGroup(
|
||||
panelObjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelObjectLayout.createSequentialGroup()
|
||||
.addGap(15, 15, 15)
|
||||
.addComponent(LabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(panelDraw, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(panelObjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(LabelColor, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
|
||||
.addComponent(LabelDopColor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
|
||||
.addComponent(panelDraw, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGroup(panelObjectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelObjectLayout.createSequentialGroup()
|
||||
.addGap(16, 16, 16)
|
||||
.addComponent(LabelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(196, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
buttonAdd.setLabel("Добавить");
|
||||
buttonAdd.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
buttonAddMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonCancel.setLabel("Отмена");
|
||||
|
||||
@ -480,13 +478,18 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(buttonAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(panelParams, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(panelParams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonAddMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_buttonAddMouseClicked
|
||||
DialogResult = true;
|
||||
dispose();
|
||||
}//GEN-LAST:event_buttonAddMouseClicked
|
||||
|
||||
|
||||
public void Drop(JComponent droppedItem) {
|
||||
if (droppedItem == null) {
|
||||
@ -494,54 +497,73 @@ public void AddEvent(Consumer<DrawingArmoredVehicle> ev) { EventAddMachine = ev;
|
||||
}
|
||||
Color color = Color.WHITE;
|
||||
Color dopColor = Color.BLACK;
|
||||
int rollers = Integer.parseInt((String) ComboBoxCountRollers.getSelectedItem());
|
||||
if (droppedItem instanceof JPanel panel) {
|
||||
if (_machine == null)
|
||||
return;
|
||||
if (LabelColor.getMousePosition() != null) {
|
||||
//_machine.SetColor(panel.getBackground());
|
||||
boolean p = LabelColor.getMousePosition() != null;
|
||||
if (p) {
|
||||
color = panel.getBackground();
|
||||
if(_machine instanceof DrawingTank tank)
|
||||
{
|
||||
var obj = (TankEntity)_machine.ArmoredVehicle;
|
||||
_machine = new DrawingTank(obj.Speed, obj.Weight,
|
||||
color, obj.DopColor, obj.MachineGun, obj.Tower);
|
||||
}
|
||||
else _machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle.Speed, _machine.ArmoredVehicle.Weight, color);
|
||||
}
|
||||
if (LabelDopColor.getMousePosition() != null && _machine instanceof DrawingTank tank) {
|
||||
//tank.SetDopColor(panel.getBackground());
|
||||
dopColor = panel.getBackground();
|
||||
var obj = (TankEntity)_machine.ArmoredVehicle;
|
||||
_machine = new DrawingTank(obj.Speed, obj.Weight,
|
||||
obj.BodyColor, dopColor, obj.MachineGun, obj.Tower);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
Graphics g = panelDraw.getGraphics();
|
||||
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);
|
||||
_machine = new DrawingTank(speed, weight, color, dopColor, gun, tower);
|
||||
}
|
||||
_machine.Count = rollers;
|
||||
|
||||
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 (droppedItem instanceof JLabel label && _machine!=null) {
|
||||
if (label == LabelSimpleRollers) {
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new Roller(color));
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new Roller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new Roller(_machine.ArmoredVehicle.BodyColor));
|
||||
} else if (label == LabelFirstRoller) {
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new DrawingFirstRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingFirstRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingFirstRoller(_machine.ArmoredVehicle.BodyColor));
|
||||
} else if (label == LabelSecondRoller) {
|
||||
//_machine.SetRollers((int)rollerSpinner.getValue(), new DrawingSecondRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingSecondRoller(color));
|
||||
_machine = new DrawingArmoredVehicle(_machine.ArmoredVehicle, new DrawingSecondRoller(_machine.ArmoredVehicle.BodyColor));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Image Pic()
|
||||
{
|
||||
BufferedImage img = new BufferedImage(panelDraw.getWidth(), panelDraw.getHeight(), BufferedImage.TYPE_INT_BGR);
|
||||
Graphics2D gr = img.createGraphics();
|
||||
gr.setBackground(Color.yellow);
|
||||
_machine.DrawTransport(gr);
|
||||
return img;
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JComboBox<String> ComboBoxCountRollers;
|
||||
private javax.swing.JLabel LabelColor;
|
||||
|
@ -143,10 +143,10 @@ public class FormMachineConfig extends JFrame {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user