Mochalov D.V. Hard LabWork03 #3
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user