готовые кнопки

This commit is contained in:
Данил Лопатин 2024-02-18 21:28:15 +03:00
parent 4139b082ae
commit 4a8486316f
6 changed files with 39 additions and 4 deletions

View File

@ -1,3 +1,3 @@
public enum DirectionType { public enum DirectionType {
Up, Down, Right, Left; Up, Down, Right, Left
} };

View File

@ -1,6 +1,10 @@
import java.awt.*;
import java.net.URL;
import javax.swing.*; import javax.swing.*;
public class FormWarmlyLocomotive extends JFrame { public class FormWarmlyLocomotive extends JFrame {
public void Initialize(){ public void Initialize(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(900, 500); setSize(900, 500);
@ -18,9 +22,40 @@ public class FormWarmlyLocomotive extends JFrame {
createButton.setBounds(20, 420, 90, 25); createButton.setBounds(20, 420, 90, 25);
pictureBox.add(createButton); pictureBox.add(createButton);
//upButton
//ImageIcon img1 = new ImageIcon("Resources/UpArrow.png");
JButton upButton = new JButton();
//upButton.setIcon(img1);
//upButton.setPreferredSize(new Dimension(30, 30));
upButton.setBounds(810, 385, 30, 30);
pictureBox.add(upButton);
//downButton
//ImageIcon img1 = new ImageIcon("Resources/UpArrow.png");
JButton downButton = new JButton();
//upButton.setIcon(img1);
//upButton.setPreferredSize(new Dimension(30, 30));
downButton.setBounds(810, 420, 30, 30);
pictureBox.add(downButton);
//rightButton
//ImageIcon img1 = new ImageIcon("Resources/UpArrow.png");
JButton rightButton = new JButton();
//upButton.setIcon(img1);
//upButton.setPreferredSize(new Dimension(30, 30));
rightButton.setBounds(845, 420, 30, 30);
pictureBox.add(rightButton);
//downButton
//ImageIcon img1 = new ImageIcon("Resources/UpArrow.png");
JButton leftButton = new JButton();
//upButton.setIcon(img1);
//upButton.setPreferredSize(new Dimension(30, 30));
leftButton.setBounds(775, 420, 30, 30);
pictureBox.add(leftButton);
add(pictureBox); add(pictureBox);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B