Mochalov D.V. Hard LabWork02 #2
@ -55,25 +55,25 @@ public class FormLocomotive extends JComponent{
|
||||
statusPanel.add(weightLabel);
|
||||
statusPanel.add(colorLabel);
|
||||
|
||||
JButton moveDownButton = new JButton("Down");
|
||||
JButton moveDownButton = new JButton("D");
|
||||
moveDownButton.addActionListener(e -> {
|
||||
if (_locomotive != null) _locomotive.MoveTransport(Direction.Down);
|
||||
repaint();
|
||||
});
|
||||
|
||||
JButton moveUpButton = new JButton("Up");
|
||||
JButton moveUpButton = new JButton("U");
|
||||
moveUpButton.addActionListener(e -> {
|
||||
if (_locomotive != null) _locomotive.MoveTransport(Direction.Up);
|
||||
repaint();
|
||||
});
|
||||
|
||||
JButton moveLeftButton = new JButton("Left");
|
||||
JButton moveLeftButton = new JButton("L");
|
||||
moveLeftButton.addActionListener(e -> {
|
||||
if (_locomotive != null) _locomotive.MoveTransport(Direction.Left);
|
||||
repaint();
|
||||
});
|
||||
|
||||
JButton moveRightButton = new JButton("Right");
|
||||
JButton moveRightButton = new JButton("R");
|
||||
moveRightButton.addActionListener(e -> {
|
||||
if (_locomotive != null) _locomotive.MoveTransport(Direction.Right);
|
||||
repaint();
|
||||
@ -96,6 +96,6 @@ public class FormLocomotive extends JComponent{
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
FormLocomotive formLocomotive = new FormLocomotive();
|
||||
new FormLocomotive();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user