Пятая лабораторная работа.

This commit is contained in:
abazov73 2022-11-15 13:03:57 +04:00
parent de6f7d3342
commit 28b017bb21
7 changed files with 1290 additions and 15 deletions

View File

@ -238,6 +238,10 @@ public class DrawingAirBomber {
return pos; return pos;
} }
public void setEngines(IDrawingObjectDop newEngines){
drawingEngines = newEngines;
}
public void ChangeBorders(int width, int height) public void ChangeBorders(int width, int height)
{ {
_pictureWidth = width; _pictureWidth = width;

View File

@ -31,6 +31,10 @@ public class EntityAirBomber {
return BodyColor; return BodyColor;
} }
public void setBodyColor(Color newColor){
BodyColor = newColor;
}
public EntityAirBomber(int speed, float weight, Color bodyColor){ public EntityAirBomber(int speed, float weight, Color bodyColor){
Random rnd = new Random(); Random rnd = new Random();
Speed = speed <= 0 ? rnd.nextInt(50, 150) : speed; Speed = speed <= 0 ? rnd.nextInt(50, 150) : speed;

View File

@ -42,6 +42,10 @@ public class EntityHeavyAirBomber extends EntityAirBomber {
return tailLine; return tailLine;
} }
public void setDopColor(Color newColor){
DopColor = newColor;
}
/// <summary> /// <summary>
/// Инициализация свойств /// Инициализация свойств
/// </summary> /// </summary>

View File

@ -0,0 +1,13 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package AirBomberPackage;
/**
*
* @author Андрей
*/
public interface ITransferAirBomberDelegate {
public void Invoke(DrawingAirBomber airBomber);
}

View File

@ -0,0 +1,589 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="&#x421;&#x43e;&#x437;&#x434;&#x430;&#x43d;&#x438;&#x435; &#x43e;&#x431;&#x44a;&#x435;&#x43a;&#x442;&#x430;"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBoxBombs" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBoxFuelTanks" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBoxTailLine" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="44" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jSpinnerWeight" pref="79" max="32767" attributes="0"/>
<Component id="jSpinnerSpeed" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jSpinnerNumOfEngines" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelRect" min="-2" pref="102" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelTriangle" min="-2" pref="102" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabelRound" min="-2" pref="102" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="121" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jLabel4" alignment="0" max="32767" attributes="0"/>
<Component id="jPanelWhite" alignment="0" max="32767" attributes="0"/>
<Component id="jPanelRed" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanelGreen" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelBlue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelYellow" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jPanelGray" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelBlack" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelPurple" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelSimpleObject" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelModifiedObject" min="-2" pref="90" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="96" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jButtonOk" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonCancel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="canvasMyObject" min="-2" pref="166" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelBaseColor" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabelDopColor" min="-2" pref="72" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace pref="20" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSpinnerSpeed" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSpinnerWeight" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabelBaseColor" alignment="3" min="-2" pref="35" max="-2" attributes="0"/>
<Component id="jLabelDopColor" alignment="3" min="-2" pref="35" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSpinnerNumOfEngines" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jPanelGray" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jPanelYellow" min="-2" max="-2" attributes="0"/>
<Component id="jPanelRed" min="-2" max="-2" attributes="0"/>
<Component id="jPanelGreen" min="-2" max="-2" attributes="0"/>
<Component id="jPanelBlue" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabelRect" alignment="3" min="-2" pref="37" max="-2" attributes="0"/>
<Component id="jLabelTriangle" alignment="3" min="-2" pref="37" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
<Component id="jPanelWhite" min="-2" max="-2" attributes="0"/>
<Component id="jPanelBlack" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jPanelPurple" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabelRound" min="-2" pref="37" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="11" max="32767" attributes="0"/>
<Component id="jCheckBoxBombs" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="canvasMyObject" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="jCheckBoxFuelTanks" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jCheckBoxTailLine" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabelSimpleObject" alignment="0" max="32767" attributes="0"/>
<Component id="jButtonOk" alignment="0" max="32767" attributes="0"/>
<Component id="jLabelModifiedObject" alignment="1" max="32767" attributes="0"/>
<Component id="jButtonCancel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41f;&#x430;&#x440;&#x430;&#x43c;&#x435;&#x442;&#x440;&#x44b;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="&#x421;&#x43a;&#x43e;&#x440;&#x43e;&#x441;&#x442;&#x44c;:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinnerSpeed">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="&#x412;&#x435;&#x441;:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinnerWeight">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBoxFuelTanks">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41f;&#x440;&#x438;&#x437;&#x43d;&#x430;&#x43a; &#x43d;&#x430;&#x43b;&#x438;&#x447;&#x438;&#x44f; &#x442;&#x43e;&#x43f;&#x43b;&#x438;&#x432;&#x43d;&#x44b;&#x445; &#x431;&#x430;&#x43a;&#x43e;&#x432;"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBoxBombs">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41f;&#x440;&#x438;&#x437;&#x43d;&#x430;&#x43a; &#x43d;&#x430;&#x43b;&#x438;&#x447;&#x438;&#x44f; &#x431;&#x43e;&#x43c;&#x431;"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBoxTailLine">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41f;&#x440;&#x438;&#x437;&#x43d;&#x430;&#x43a; &#x43d;&#x430;&#x43b;&#x438;&#x447;&#x438;&#x44f; &#x43f;&#x43e;&#x43b;&#x43e;&#x441;&#x43e;&#x43a; &#x43d;&#x430; &#x445;&#x432;&#x43e;&#x441;&#x442;&#x435;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelSimpleObject">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x41f;&#x440;&#x43e;&#x441;&#x442;&#x43e;&#x439;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelObjectMouseReleased"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelModifiedObject">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x41f;&#x440;&#x43e;&#x434;&#x432;&#x438;&#x43d;&#x443;&#x442;&#x44b;&#x439;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelObjectMouseReleased"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanelGreen">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="ff" red="66" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelWhite">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelRed">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="0" red="ff" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelGray">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelBlue">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="33" red="33" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelBlack">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelYellow">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="ff" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanelPurple">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="33" red="cc" type="rgb"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
</Events>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="&#x426;&#x432;&#x435;&#x442;&#x430;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41a;&#x43e;&#x43b;&#x438;&#x447;&#x435;&#x441;&#x442;&#x432;&#x43e; &#x434;&#x432;&#x438;&#x433;&#x430;&#x442;&#x435;&#x43b;&#x435;&#x439;:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinnerNumOfEngines">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="2"/>
<ListItem value="4"/>
<ListItem value="6"/>
</SpinnerModel>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelRect">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x41a;&#x432;&#x430;&#x434;&#x440;&#x430;&#x442;&#x43d;&#x44b;&#x435;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineTypeMouseReleased"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelTriangle">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x422;&#x440;&#x435;&#x443;&#x433;&#x43e;&#x43b;&#x44c;&#x43d;&#x44b;&#x435;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineTypeMouseReleased"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelRound">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x41a;&#x440;&#x443;&#x433;&#x43b;&#x44b;&#x435;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineTypeMouseReleased"/>
</Events>
</Component>
<Container class="AirBomberPackage.CanvasMy" name="canvasMyObject">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="canvasMyObjectMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="canvasMyObjectMouseExited"/>
</Events>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
</Container>
<Component class="javax.swing.JLabel" name="jLabelBaseColor">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x426;&#x432;&#x435;&#x442;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelBaseColorMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelBaseColorMouseExited"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelDopColor">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&#x414;&#x43e;&#x43f;. &#x426;&#x432;&#x435;&#x442;"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
<BevelBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelDopColorMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelDopColorMouseExited"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonOk">
<Properties>
<Property name="text" type="java.lang.String" value="&#x414;&#x43e;&#x431;&#x430;&#x432;&#x438;&#x442;&#x44c;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOkActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonCancel">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41e;&#x442;&#x43c;&#x435;&#x43d;&#x430;"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,672 @@
/*
* 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
*/
package AirBomberPackage;
import java.awt.Color;
import javax.swing.*;
import java.util.ArrayList;
/**
*
* @author Андрей
*/
public class JFrameAirBomberConfig extends javax.swing.JFrame {
private IDrawingObjectDop engines;
private Color dragColor;
private String typeOfAirBomber;
private DrawingAirBomber _airBomber = null;
private boolean cursorInCanvasLocation = false;
private boolean cursorInBaseLabelLocation = false;
private boolean cursorInDopLabelLocation = false;
private ArrayList<ITransferAirBomberDelegate> eventAddAirBomber = new ArrayList<>();
/**
* Creates new form JFrameAirBomberConfig
*/
public JFrameAirBomberConfig() {
initComponents();
jButtonCancel.addActionListener(e -> dispose());
}
/**
* 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
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSpinnerSpeed = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
jSpinnerWeight = new javax.swing.JSpinner();
jCheckBoxFuelTanks = new javax.swing.JCheckBox();
jCheckBoxBombs = new javax.swing.JCheckBox();
jCheckBoxTailLine = new javax.swing.JCheckBox();
jLabelSimpleObject = new javax.swing.JLabel();
jLabelModifiedObject = new javax.swing.JLabel();
jPanelGreen = new javax.swing.JPanel();
jPanelWhite = new javax.swing.JPanel();
jPanelRed = new javax.swing.JPanel();
jPanelGray = new javax.swing.JPanel();
jPanelBlue = new javax.swing.JPanel();
jPanelBlack = new javax.swing.JPanel();
jPanelYellow = new javax.swing.JPanel();
jPanelPurple = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jSpinnerNumOfEngines = new javax.swing.JSpinner();
jLabelRect = new javax.swing.JLabel();
jLabelTriangle = new javax.swing.JLabel();
jLabelRound = new javax.swing.JLabel();
canvasMyObject = new AirBomberPackage.CanvasMy();
jLabelBaseColor = new javax.swing.JLabel();
jLabelDopColor = new javax.swing.JLabel();
jButtonOk = new javax.swing.JButton();
jButtonCancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Создание объекта");
jLabel1.setText("Параметры");
jLabel2.setText("Скорость:");
jSpinnerSpeed.setModel(new javax.swing.SpinnerNumberModel(100, 1, null, 1));
jLabel3.setText("Вес:");
jSpinnerWeight.setModel(new javax.swing.SpinnerNumberModel(100, 1, null, 1));
jCheckBoxFuelTanks.setText("Признак наличия топливных баков");
jCheckBoxBombs.setText("Признак наличия бомб");
jCheckBoxTailLine.setText("Признак наличия полосок на хвосте");
jLabelSimpleObject.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelSimpleObject.setText("Простой");
jLabelSimpleObject.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelSimpleObject.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jLabelMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jLabelObjectMouseReleased(evt);
}
});
jLabelModifiedObject.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelModifiedObject.setText("Продвинутый");
jLabelModifiedObject.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelModifiedObject.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jLabelMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jLabelObjectMouseReleased(evt);
}
});
jPanelGreen.setBackground(new java.awt.Color(102, 255, 102));
jPanelGreen.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelGreenLayout = new javax.swing.GroupLayout(jPanelGreen);
jPanelGreen.setLayout(jPanelGreenLayout);
jPanelGreenLayout.setHorizontalGroup(
jPanelGreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelGreenLayout.setVerticalGroup(
jPanelGreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelWhite.setBackground(new java.awt.Color(255, 255, 255));
jPanelWhite.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelWhiteLayout = new javax.swing.GroupLayout(jPanelWhite);
jPanelWhite.setLayout(jPanelWhiteLayout);
jPanelWhiteLayout.setHorizontalGroup(
jPanelWhiteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelWhiteLayout.setVerticalGroup(
jPanelWhiteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelRed.setBackground(new java.awt.Color(255, 0, 51));
jPanelRed.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelRedLayout = new javax.swing.GroupLayout(jPanelRed);
jPanelRed.setLayout(jPanelRedLayout);
jPanelRedLayout.setHorizontalGroup(
jPanelRedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelRedLayout.setVerticalGroup(
jPanelRedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelGray.setBackground(new java.awt.Color(153, 153, 153));
jPanelGray.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelGrayLayout = new javax.swing.GroupLayout(jPanelGray);
jPanelGray.setLayout(jPanelGrayLayout);
jPanelGrayLayout.setHorizontalGroup(
jPanelGrayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelGrayLayout.setVerticalGroup(
jPanelGrayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelBlue.setBackground(new java.awt.Color(51, 51, 255));
jPanelBlue.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelBlueLayout = new javax.swing.GroupLayout(jPanelBlue);
jPanelBlue.setLayout(jPanelBlueLayout);
jPanelBlueLayout.setHorizontalGroup(
jPanelBlueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelBlueLayout.setVerticalGroup(
jPanelBlueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelBlack.setBackground(new java.awt.Color(0, 0, 0));
jPanelBlack.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelBlackLayout = new javax.swing.GroupLayout(jPanelBlack);
jPanelBlack.setLayout(jPanelBlackLayout);
jPanelBlackLayout.setHorizontalGroup(
jPanelBlackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelBlackLayout.setVerticalGroup(
jPanelBlackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelYellow.setBackground(new java.awt.Color(255, 255, 51));
jPanelYellow.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelYellowLayout = new javax.swing.GroupLayout(jPanelYellow);
jPanelYellow.setLayout(jPanelYellowLayout);
jPanelYellowLayout.setHorizontalGroup(
jPanelYellowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelYellowLayout.setVerticalGroup(
jPanelYellowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelPurple.setBackground(new java.awt.Color(204, 51, 255));
jPanelPurple.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanelColorMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanelColorMouseReleased(evt);
}
});
javax.swing.GroupLayout jPanelPurpleLayout = new javax.swing.GroupLayout(jPanelPurple);
jPanelPurple.setLayout(jPanelPurpleLayout);
jPanelPurpleLayout.setHorizontalGroup(
jPanelPurpleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jPanelPurpleLayout.setVerticalGroup(
jPanelPurpleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);
jLabel4.setText("Цвета");
jLabel5.setText("Количество двигателей:");
jSpinnerNumOfEngines.setModel(new javax.swing.SpinnerListModel(new String[] {"2", "4", "6"}));
jLabelRect.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelRect.setText("Квадратные");
jLabelRect.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelRect.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jLabelEngineMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jLabelEngineTypeMouseReleased(evt);
}
});
jLabelTriangle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelTriangle.setText("Треугольные");
jLabelTriangle.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelTriangle.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jLabelEngineMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jLabelEngineTypeMouseReleased(evt);
}
});
jLabelRound.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelRound.setText("Круглые");
jLabelRound.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelRound.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jLabelEngineMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jLabelEngineTypeMouseReleased(evt);
}
});
canvasMyObject.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
canvasMyObject.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
canvasMyObjectMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
canvasMyObjectMouseExited(evt);
}
});
jLabelBaseColor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelBaseColor.setText("Цвет");
jLabelBaseColor.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelBaseColor.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabelBaseColorMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabelBaseColorMouseExited(evt);
}
});
jLabelDopColor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabelDopColor.setText("Доп. Цвет");
jLabelDopColor.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabelDopColor.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabelDopColorMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabelDopColorMouseExited(evt);
}
});
jButtonOk.setText("Добавить");
jButtonOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonOkActionPerformed(evt);
}
});
jButtonCancel.setText("Отмена");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jCheckBoxBombs)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBoxFuelTanks)
.addComponent(jCheckBoxTailLine)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(44, 44, 44)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jSpinnerWeight, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
.addComponent(jSpinnerSpeed)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSpinnerNumOfEngines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelRect, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabelTriangle, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(49, 49, 49))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabelRound, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(121, 121, 121)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelWhite, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelRed, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanelGreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelBlue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelYellow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanelGray, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelBlack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelPurple, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelSimpleObject, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabelModifiedObject, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(96, 96, 96)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButtonOk)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonCancel))
.addComponent(canvasMyObject, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelBaseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(20, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jSpinnerSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jSpinnerWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelBaseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jSpinnerNumOfEngines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanelGray, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanelYellow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanelRed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanelGreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanelBlue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelRect, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelTriangle, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanelWhite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanelBlack, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanelPurple, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelRound, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
.addComponent(jCheckBoxBombs))
.addComponent(canvasMyObject, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jCheckBoxFuelTanks)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBoxTailLine))
.addComponent(jLabelSimpleObject, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonOk, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabelModifiedObject, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jPanelColorMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanelColorMousePressed
dragColor = ((JPanel) evt.getSource()).getBackground();
}//GEN-LAST:event_jPanelColorMousePressed
private void jLabelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelMousePressed
typeOfAirBomber = ((JLabel) evt.getComponent()).getText();
}//GEN-LAST:event_jLabelMousePressed
private void drawAirBomber(){
if (_airBomber != null){
_airBomber.SetPosition(5, 5, canvasMyObject.getWidth(), canvasMyObject.getHeight());
canvasMyObject.setAirBomber(_airBomber);
canvasMyObject.repaint();
}
}
public void addEvent(ITransferAirBomberDelegate ev){
eventAddAirBomber.add(ev);
}
private void jLabelEngineMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelEngineMousePressed
switch (((JLabel) evt.getComponent()).getText()){
case "Квадратные":
engines = new DrawingEngines();
break;
case "Треугольные":
engines = new DrawingEnginesTriangle();
break;
case "Круглые":
engines = new DrawingEnginesOval();
break;
}
}//GEN-LAST:event_jLabelEngineMousePressed
private void canvasMyObjectMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_canvasMyObjectMouseEntered
cursorInCanvasLocation = true;
}//GEN-LAST:event_canvasMyObjectMouseEntered
private void jLabelObjectMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelObjectMouseReleased
if (cursorInCanvasLocation && typeOfAirBomber != null) {
if (typeOfAirBomber == "Простой"){
_airBomber = new DrawingAirBomber((int) jSpinnerSpeed.getValue(), (int) jSpinnerWeight.getValue(), Color.WHITE, 2, EnginesType.RECTANGLE);
}
else {
_airBomber = new DrawingHeavyAirBomber((int) jSpinnerSpeed.getValue(), (int) jSpinnerWeight.getValue(), Color.WHITE, 2, EnginesType.RECTANGLE,
Color.WHITE, jCheckBoxBombs.isSelected(), jCheckBoxFuelTanks.isSelected(), jCheckBoxTailLine.isSelected());
}
typeOfAirBomber = null;
drawAirBomber();
}
}//GEN-LAST:event_jLabelObjectMouseReleased
private void jLabelEngineTypeMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelEngineTypeMouseReleased
if (cursorInCanvasLocation && engines != null && _airBomber != null){
engines.setNumberOfEngines(Integer.parseInt((String)jSpinnerNumOfEngines.getValue()));
_airBomber.setEngines(engines);
engines = null;
drawAirBomber();
}
}//GEN-LAST:event_jLabelEngineTypeMouseReleased
private void canvasMyObjectMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_canvasMyObjectMouseExited
cursorInCanvasLocation = false;
}//GEN-LAST:event_canvasMyObjectMouseExited
private void jPanelColorMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanelColorMouseReleased
if (dragColor != null){
if (cursorInBaseLabelLocation && _airBomber != null){
_airBomber.AirBomber.setBodyColor(dragColor);
dragColor = null;
drawAirBomber();
}
else if (cursorInDopLabelLocation && _airBomber != null && _airBomber.AirBomber instanceof EntityHeavyAirBomber heavyAirBomber){
heavyAirBomber.setDopColor(dragColor);
dragColor = null;
drawAirBomber();
}
}
}//GEN-LAST:event_jPanelColorMouseReleased
private void jLabelBaseColorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelBaseColorMouseEntered
cursorInBaseLabelLocation = true;
}//GEN-LAST:event_jLabelBaseColorMouseEntered
private void jLabelBaseColorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelBaseColorMouseExited
cursorInBaseLabelLocation = false;
}//GEN-LAST:event_jLabelBaseColorMouseExited
private void jLabelDopColorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDopColorMouseEntered
cursorInDopLabelLocation = true;
}//GEN-LAST:event_jLabelDopColorMouseEntered
private void jLabelDopColorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDopColorMouseExited
cursorInDopLabelLocation = false;
}//GEN-LAST:event_jLabelDopColorMouseExited
private void jButtonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOkActionPerformed
for (ITransferAirBomberDelegate ev : eventAddAirBomber){
ev.Invoke(_airBomber);
}
dispose();
}//GEN-LAST:event_jButtonOkActionPerformed
/**
* @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(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFrameAirBomberConfig().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private AirBomberPackage.CanvasMy canvasMyObject;
private javax.swing.JButton jButtonCancel;
private javax.swing.JButton jButtonOk;
private javax.swing.JCheckBox jCheckBoxBombs;
private javax.swing.JCheckBox jCheckBoxFuelTanks;
private javax.swing.JCheckBox jCheckBoxTailLine;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabelBaseColor;
private javax.swing.JLabel jLabelDopColor;
private javax.swing.JLabel jLabelModifiedObject;
private javax.swing.JLabel jLabelRect;
private javax.swing.JLabel jLabelRound;
private javax.swing.JLabel jLabelSimpleObject;
private javax.swing.JLabel jLabelTriangle;
private javax.swing.JPanel jPanelBlack;
private javax.swing.JPanel jPanelBlue;
private javax.swing.JPanel jPanelGray;
private javax.swing.JPanel jPanelGreen;
private javax.swing.JPanel jPanelPurple;
private javax.swing.JPanel jPanelRed;
private javax.swing.JPanel jPanelWhite;
private javax.swing.JPanel jPanelYellow;
private javax.swing.JSpinner jSpinnerNumOfEngines;
private javax.swing.JSpinner jSpinnerSpeed;
private javax.swing.JSpinner jSpinnerWeight;
// End of variables declaration//GEN-END:variables
}

View File

@ -288,21 +288,10 @@ public class JFrameMapWithSetAirBombers extends javax.swing.JFrame {
if (listBoxMaps.getSelectedIndex() == -1){ if (listBoxMaps.getSelectedIndex() == -1){
return; return;
} }
JFrameAirBomber form = new JFrameAirBomber(this); JFrameAirBomberConfig airBomberConfig = new JFrameAirBomberConfig();
DrawingAirBomber selectedAirBomber = form.run(); airBomberConfig.addEvent(airBomber -> {_mapsCollection.Get(listBoxMaps.getSelectedValue()).add(new DrawingObjectAirBomber(airBomber));
if (selectedAirBomber != null) airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowSet(), 0, 0, null);});
{ airBomberConfig.setVisible(true);
DrawingObjectAirBomber objectAirBomber = new DrawingObjectAirBomber(selectedAirBomber);
if (_mapsCollection.Get(listBoxMaps.getSelectedValue()).add(objectAirBomber) != -1)
{
JOptionPane.showMessageDialog(this, "Объект добавлен");
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowSet(), 0, 0, null);
}
else
{
JOptionPane.showMessageDialog(this, "Не удалось добавить объект");
}
}
}//GEN-LAST:event_buttonAddAirBomberActionPerformed }//GEN-LAST:event_buttonAddAirBomberActionPerformed
private void buttonRemoveAirBomberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRemoveAirBomberActionPerformed private void buttonRemoveAirBomberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRemoveAirBomberActionPerformed