Browse Source

Setup Panel with label nr 3

remotes/origin/develop
fdai7460 2 years ago
parent
commit
cfdbc60461
  1. 37
      src/main/java/src/MainFrame.java

37
src/main/java/src/MainFrame.java

@ -5,9 +5,13 @@ import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class MainFrame extends JFrame {
private GameField gameField;
public void run() {
this.setLayout(null);
@ -28,7 +32,7 @@ public class MainFrame extends JFrame {
header.setBounds(125, 5, 250, 50);
rootPanel.add(header);
GameField gameField = new GameField(360);
gameField = new GameField(360);
gameField.setBounds(70, 50, 360, 360);
rootPanel.add(gameField);
@ -42,9 +46,14 @@ public class MainFrame extends JFrame {
JPanel jPanel1 = setupNums("1");
boxPanel.add(jPanel1);
JPanel jPanel2 = setupNums("2");
boxPanel.add(jPanel2);
JPanel jPanel3 = setupNums("3");
boxPanel.add(jPanel3);
JButton back = new JButton();
back.setVisible(true);
back.setBounds(5, 5, 100, 25);
@ -76,7 +85,33 @@ public class MainFrame extends JFrame {
jPanel.setBackground(Color.BLUE);
jPanel.setVisible(true);
jPanel.setBorder(new LineBorder(Color.PINK, 1));
jPanel.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
gameField.getActivePanel().setValue(Integer.valueOf(number));
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
JLabel numLabel1 = new JLabel();
numLabel1.setText(number);
numLabel1.setLayout(null);

Loading…
Cancel
Save