Mochalov D.V. Hard LabWork03 #3

Merged
eegov merged 13 commits from LabWork03 into LabWork02 2022-10-28 09:29:48 +04:00
2 changed files with 12 additions and 1 deletions
Showing only changes of commit 896285b4c5 - Show all commits

View File

@ -1,7 +1,7 @@
import java.awt.*;
import java.util.Random;
class DrawningLocomotive {
public class DrawningLocomotive {
public EntityLocomotive Locomotive;
public ExtraWheelsDraw extraWheelsDraw;
public IDrawningExtra drawningExtra;

View File

@ -5,6 +5,10 @@ import java.util.Random;
public class FormLocomotive extends JComponent{
private DrawningLocomotive _locomotive;
private DrawningLocomotive SelectedLocomotive;
public DrawningLocomotive getSelectedLocomotive() {
return SelectedLocomotive;
}
public FormLocomotive() {
JFrame formFrame = new JFrame("Locomotive");
formFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -62,8 +66,15 @@ public class FormLocomotive extends JComponent{
repaint();
});
JButton selectLocomotiveButton = new JButton("Select");
selectLocomotiveButton.addActionListener(e -> {
SelectedLocomotive = _locomotive;
JOptionPane.showMessageDialog(formFrame, "OK");
});
statusPanel.add(createButton);
statusPanel.add(modifiedButton);
statusPanel.add(selectLocomotiveButton);
statusPanel.add(speedLabel);
statusPanel.add(weightLabel);
statusPanel.add(colorLabel);