diff --git a/src/main/java/src/MainFrame.java b/src/main/java/src/MainFrame.java index 405ff81..0071c01 100644 --- a/src/main/java/src/MainFrame.java +++ b/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); @@ -45,6 +49,27 @@ public class MainFrame extends JFrame { JPanel jPanel2 = setupNums("2"); boxPanel.add(jPanel2); + JPanel jPanel3 = setupNums("3"); + boxPanel.add(jPanel3); + + JPanel jPanel4 = setupNums("4"); + boxPanel.add(jPanel4); + + JPanel jPanel5 = setupNums("5"); + boxPanel.add(jPanel5); + + JPanel jPanel6 = setupNums("6"); + boxPanel.add(jPanel6); + + JPanel jPanel7 = setupNums("7"); + boxPanel.add(jPanel7); + + JPanel jPanel8 = setupNums("8"); + boxPanel.add(jPanel8); + + JPanel jPanel9 = setupNums("9"); + boxPanel.add(jPanel9); + JButton back = new JButton(); back.setVisible(true); back.setBounds(5, 5, 100, 25); @@ -76,7 +101,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);