Лабораторная работа №5 (начало)

This commit is contained in:
DjonniStorm 2024-06-09 14:17:18 +04:00
parent 4d36c0c65c
commit 4d1afeaa06
5 changed files with 350 additions and 4 deletions

View File

@ -14,7 +14,7 @@
<grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<border type="none" title="Инструменты:"/>
<children>
<component id="f051c" class="javax.swing.JComboBox" binding="comboBoxSelectorCompany">
<constraints>

View File

@ -53,7 +53,6 @@ public class FormCleaningCarCollection extends JFrame{
_resurrected = new LinkedList<>();
tools.setBackground(new Color(220, 220, 220));
tools.setBorder(BorderFactory.createTitledBorder("Инструменты"));
comboBoxSelectorCompany.addItem(new String(""));
comboBoxSelectorCompany.addItem(new String("Автопарк"));
//mask

View File

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="FormTruckConfig">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="828" height="281"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="50bbc" binding="GroupBoxConfig" layout-manager="GridLayoutManager" row-count="6" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false">
<minimum-size width="600" height="-1"/>
<preferred-size width="600" height="-1"/>
<maximum-size width="600" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none" title="Параметры:"/>
<children>
<component id="9090b" class="javax.swing.JLabel" binding="labelSimpleObject">
<constraints>
<grid row="5" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="2" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="90" height="40"/>
</grid>
</constraints>
<properties>
<horizontalAlignment value="0"/>
<text value="Простой"/>
<verticalAlignment value="0"/>
</properties>
</component>
<hspacer id="56992">
<constraints>
<grid row="5" column="0" row-span="1" col-span="3" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="f3150">
<constraints>
<grid row="0" column="2" row-span="2" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="bef18" class="javax.swing.JLabel" binding="labelModifiedObject">
<constraints>
<grid row="5" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="2" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="90" height="40"/>
</grid>
</constraints>
<properties>
<horizontalAlignment value="0"/>
<horizontalTextPosition value="0"/>
<text value="Продвинутый"/>
</properties>
</component>
<component id="4ddc3" class="javax.swing.JLabel" binding="labelSpeed">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Скорость:"/>
</properties>
</component>
<component id="e70e0" class="javax.swing.JSpinner" binding="spinnerSpeed">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="70" height="20"/>
<preferred-size width="61" height="20"/>
<maximum-size width="70" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="32f" class="javax.swing.JLabel" binding="labelWeight">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Вес:"/>
</properties>
</component>
<component id="532dd" class="javax.swing.JSpinner" binding="spinnerWeight">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="70" height="20"/>
<preferred-size width="61" height="20"/>
<maximum-size width="70" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="77aaa" class="javax.swing.JCheckBox" binding="checkBoxTank">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Признак наличия бака"/>
</properties>
</component>
<component id="189fd" class="javax.swing.JCheckBox" binding="checkBoxSweepingBrush">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Признак наличия щётки"/>
</properties>
</component>
<component id="69dcd" class="javax.swing.JCheckBox" binding="CheckBoxFlashLight">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Признак наличия маячка"/>
</properties>
</component>
<grid id="59a96" binding="groupBoxColors" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="3" row-span="5" col-span="2" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="300" height="-1"/>
<preferred-size width="300" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none" title="Цвета"/>
<children>
<grid id="dbd1a" binding="panelRed" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-65536"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="5cf79" binding="panelGreen" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-16711936"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="229b8" binding="panelBlue" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-16776961"/>
<foreground color="-12828863"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="89383" binding="panelYellow" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-5376"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="ed3d3" binding="panelWhite" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-1"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="eca1b" binding="panelGray" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-11316397"/>
<foreground color="-12828863"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="4beef" binding="panelBlack" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-16777216"/>
</properties>
<border type="none"/>
<children/>
</grid>
<grid id="c6721" binding="panelPurple" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="60" height="60"/>
</grid>
</constraints>
<properties>
<background color="-4910849"/>
</properties>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</children>
</grid>
<grid id="292f4" binding="panelRight" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="line"/>
<children>
<grid id="193d6" binding="panelObject" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="line"/>
<children/>
</grid>
<component id="6a122" class="javax.swing.JButton" binding="buttonAdd">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Добавить"/>
</properties>
</component>
<component id="896cf" class="javax.swing.JButton" binding="buttonCancel">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Отмена"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>

View File

@ -0,0 +1,70 @@
import Drawnings.DrawningTruck;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.util.ArrayList;
public class FormTruckConfig extends JFrame {
private DrawningTruck _truck;
private JPanel panel;
private JPanel GroupBoxConfig;
private JLabel labelSimpleObject;
private JLabel labelModifiedObject;
private JLabel labelSpeed;
private JSpinner spinnerSpeed;
private JSpinner spinnerWeight;
private JLabel labelWeight;
private JCheckBox checkBoxTank;
private JCheckBox checkBoxSweepingBrush;
private JCheckBox CheckBoxFlashLight;
private JPanel groupBoxColors;
private JPanel panelRed;
private JPanel panelGreen;
private JPanel panelBlue;
private JPanel panelYellow;
private JPanel panelWhite;
private JPanel panelGray;
private JPanel panelBlack;
private JPanel panelPurple;
private JPanel panelRight;
private JButton buttonAdd;
private JButton buttonCancel;
private JPanel panelObject;
public FormTruckConfig() {
setTitle("Создание объекта");
add(panel);
setMinimumSize(new Dimension(900, 300));
setDefaultCloseOperation(EXIT_ON_CLOSE);
Init();
}
protected void Init() {
labelSimpleObject.setBorder(new LineBorder(Color.BLACK));
labelModifiedObject.setBorder(new LineBorder(Color.BLACK));
spinnerSpeed.setModel(new SpinnerNumberModel(0, 0, 1000, 1));
spinnerWeight.setModel(new SpinnerNumberModel(0, 0, 1000, 1));
// ArrayList<JLabel> labelObject = new ArrayList<>();
// labelObject.add(labelSimpleObject);
// labelObject.add(labelModifiedObject);
MouseAdapter labelObject_MouseDown = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
}
};
MouseMotionAdapter mouseMotionAdapter = new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
super.mouseDragged(e);
}
};
}
}

View File

@ -1,7 +1,9 @@
class Main {
public static void main(String[] args) {
FormCleaningCarCollection form = new FormCleaningCarCollection();
form.setVisible(true);
//FormCleaningCarCollection form = new FormCleaningCarCollection();
//form.setVisible(true);
FormTruckConfig config = new FormTruckConfig();
config.setVisible(true);
}
}