Browse Source
habe die projekt struktur geändert und main in eine klasse exportiert.
remotes/origin/develop
habe die projekt struktur geändert und main in eine klasse exportiert.
remotes/origin/develop
fdai6499
2 years ago
8 changed files with 101 additions and 80 deletions
-
2src/main/java/src/GameField.java
-
82src/main/java/src/Main.java
-
85src/main/java/src/MainFrame.java
-
2src/main/java/src/Notes.java
-
2src/main/java/src/Tests.java
-
2src/test/java/GameFieldTest.java
-
5src/test/java/MainTest.java
-
1src/test/java/NotesTest.java
@ -1,3 +1,5 @@ |
|||||
|
package src; |
||||
|
|
||||
import javax.swing.*; |
import javax.swing.*; |
||||
import javax.swing.border.LineBorder; |
import javax.swing.border.LineBorder; |
||||
import java.awt.*; |
import java.awt.*; |
@ -0,0 +1,85 @@ |
|||||
|
package src; |
||||
|
|
||||
|
import javax.swing.*; |
||||
|
import java.awt.*; |
||||
|
|
||||
|
public class MainFrame extends JFrame { |
||||
|
|
||||
|
public void run() { |
||||
|
|
||||
|
this.setLayout(null); |
||||
|
this.setVisible(true); |
||||
|
this.setBounds(300, 200, 500, 600); |
||||
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||
|
|
||||
|
JPanel rootPanel = new JPanel(); |
||||
|
rootPanel.setVisible(true); |
||||
|
rootPanel.setBounds(0, 0, 500, 500); |
||||
|
rootPanel.setBackground(Color.LIGHT_GRAY); |
||||
|
rootPanel.setLayout(null); |
||||
|
|
||||
|
GameField gameField = new GameField(360); |
||||
|
gameField.setBounds(70, 50, 360, 360); |
||||
|
rootPanel.add(gameField); |
||||
|
|
||||
|
this.setContentPane(rootPanel); |
||||
|
|
||||
|
JPanel numberPanel = new JPanel(); |
||||
|
numberPanel.setVisible(true); |
||||
|
numberPanel.setBounds(100, 450, 300, 30); |
||||
|
rootPanel.add(numberPanel); |
||||
|
|
||||
|
for (int i = 1, j=0; i < 10; i++) { |
||||
|
JLabel numberi= new JLabel(); |
||||
|
numberi.setText(""+i); |
||||
|
numberi.setBounds(5+j, 5, 20, 20); |
||||
|
numberPanel.setLayout(null); |
||||
|
|
||||
|
JPanel ni = new JPanel(); |
||||
|
ni.setBounds(5+j, 5, 20, 20); |
||||
|
ni.setVisible(true); |
||||
|
ni.setBackground(Color.pink); |
||||
|
ni.add(numberi); |
||||
|
numberPanel.add(ni); |
||||
|
j=j+25; |
||||
|
} |
||||
|
|
||||
|
JLabel number10= new JLabel(); |
||||
|
number10.setText(" "); |
||||
|
number10.setBounds(250, 5, 20, 20); |
||||
|
numberPanel.setLayout(null); |
||||
|
|
||||
|
JPanel n10 = new JPanel(); |
||||
|
n10.setBounds(250, 5, 20, 20); |
||||
|
n10.setVisible(true); |
||||
|
n10.setBackground(Color.pink); |
||||
|
n10.add(number10); |
||||
|
numberPanel.add(n10); |
||||
|
|
||||
|
|
||||
|
|
||||
|
JButton back = new JButton(); |
||||
|
back.setVisible(true); |
||||
|
back.setBounds(5, 5, 100, 25); |
||||
|
rootPanel.add(back); |
||||
|
back.setText("Back"); |
||||
|
|
||||
|
JButton newButton = new JButton(); |
||||
|
newButton.setVisible(true); |
||||
|
newButton.setBounds(395, 5, 100, 25); |
||||
|
newButton.setText("New"); |
||||
|
rootPanel.add(newButton); |
||||
|
|
||||
|
JButton retryButton = new JButton(); |
||||
|
retryButton.setVisible(true); |
||||
|
retryButton.setText("Retry"); |
||||
|
retryButton.setBounds(5, 525, 100, 25); |
||||
|
rootPanel.add(retryButton); |
||||
|
|
||||
|
JButton correctButton = new JButton(); |
||||
|
correctButton.setVisible(true); |
||||
|
correctButton.setText("Correct"); |
||||
|
correctButton.setBounds(395, 525, 100, 25); |
||||
|
rootPanel.add(correctButton); |
||||
|
} |
||||
|
} |
@ -1,3 +1,5 @@ |
|||||
|
package src; |
||||
|
|
||||
import javax.swing.*; |
import javax.swing.*; |
||||
import java.awt.*; |
import java.awt.*; |
||||
|
|
@ -1,3 +1,5 @@ |
|||||
|
package src; |
||||
|
|
||||
public class Tests { |
public class Tests { |
||||
|
|
||||
public static void main(String[] args) { |
public static void main(String[] args) { |
Write
Preview
Loading…
Cancel
Save
Reference in new issue