Browse Source

DTSUD-62 Implemented Sandbox MenuItem with new Frame starting SandboxFrame.java on action

remotes/origin/develop
fdai6499 2 years ago
parent
commit
7e2ecb2abf
  1. 10
      src/main/java/src/MainFrame.java
  2. 15
      src/main/java/src/SandboxFrame.java

10
src/main/java/src/MainFrame.java

@ -136,6 +136,7 @@ public class MainFrame extends JFrame {
JMenu m_menu=new JMenu("Sudoku");
JMenu m_submenu=new JMenu("Neues Spiel");
JMenuItem menu_i7=new JMenuItem("Speichern");
JMenuItem sandbox=new JMenuItem("Sandbox");
JMenuItem menu_i1=new JMenuItem("Nochmal");
JMenuItem menu_i2=new JMenuItem("Tipp");
JMenuItem menu_i4=new JMenuItem("Einfach");
@ -145,6 +146,7 @@ public class MainFrame extends JFrame {
m_menu.add(menu_i1);
m_menu.add(menu_i2);
m_menu.add(menu_i7);
m_menu.add(sandbox);
m_submenu.add(menu_i4);
m_submenu.add(menu_i5);
m_submenu.add(menu_i6);
@ -161,6 +163,14 @@ public class MainFrame extends JFrame {
});
m_menu_help.add(help);
sandbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SandboxFrame sandboxFrame = new SandboxFrame();
sandboxFrame.run();
}
});
menu_mb.add(m_menu);
menu_mb.add(m_menu_help);

15
src/main/java/src/SandboxFrame.java

@ -0,0 +1,15 @@
package src;
import javax.swing.*;
public class SandboxFrame extends JFrame {
public void run() {
this.setLayout(null);
this.setVisible(true);
this.setBounds(400, 200, 500, 500);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
}
Loading…
Cancel
Save