Mochalov D.V. Hard LabWork02 #2

Merged
eegov merged 14 commits from LabWork02 into LabWork01 2022-10-21 10:06:17 +04:00
Showing only changes of commit 8e2dd53ece - Show all commits

View File

@ -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();
}
}