5
5
import java .awt .event .*;
6
6
import javax .swing .*;
7
7
8
+ import static java .lang .Integer .valueOf ;
9
+
8
10
public class Core extends JFrame {
9
11
10
12
public void print (String str ) {
@@ -14,7 +16,7 @@ public void print(String str) {
14
16
public String printPath () {
15
17
String path = String .valueOf (this .getClass ().getClassLoader ().getResource ("" ));
16
18
if (path .matches ("file:(.*)/classes/" )) {
17
- path = path .substring (6 , path .length () - 15 )+"/ src/main/resources/top/mryan2005/managesysteminjava/" ;
19
+ path = path .substring (6 , path .length () - 15 )+"src/main/resources/top/mryan2005/managesysteminjava/" ;
18
20
} else if (path == "null" ) {
19
21
path = "" ;
20
22
}
@@ -24,36 +26,38 @@ public String printPath() {
24
26
25
27
public void buildWindows () {
26
28
ImageIcon icon =new ImageIcon (printPath ()+"1.png" );
27
- print (printPath ()+"1.png" );
28
29
JLabel label =new JLabel (icon );
29
30
label .setBounds (0 ,0 ,1729 ,972 );
30
31
Container container = getContentPane ();
32
+ container .setSize (1729 ,972 );
31
33
container .setLayout (new BorderLayout ());
32
34
((JPanel )container ).setOpaque (false );
33
- getLayeredPane ().add (label ,new Integer (Integer .MIN_VALUE ));
35
+ getLayeredPane ().add (label , valueOf (Integer .MIN_VALUE ));
34
36
JMenuBar jMenuBar = new JMenuBar ();
35
37
setJMenuBar (jMenuBar );
36
38
JMenu jMenu = new JMenu ("File" );
37
- jMenuBar .add (jMenu );
38
39
JMenuItem jMenuItemExit = new JMenuItem ("Exit" );
39
40
jMenu .add (jMenuItemExit );
41
+ jMenuBar .add (jMenu );
40
42
JMenu jMenu2 = new JMenu ("About" );
41
43
jMenuBar .add (jMenu2 );
42
44
JMenuItem jMenuItemAbout = new JMenuItem ("New Issue" );
43
45
jMenu2 .add (jMenuItemAbout );
44
46
jMenuItemAbout .addActionListener (this ::newIssue );
45
47
jMenuItemExit .addActionListener (this ::actionPerformed );
46
- // build a dock bar like Mac OS
48
+ // build a dock bar like macOS
47
49
// Create the dock bar
48
50
JPanel dockBar = new JPanel ();
51
+ dockBar .setPreferredSize (new Dimension (0 , 100 ));
52
+ dockBar .setSize (120 , 80 );
49
53
dockBar .setLayout (new FlowLayout (FlowLayout .CENTER , 10 , 10 ));
50
- dockBar .setBackground (new Color (0 , 0 , 0 , 0 )); // Transparent background
51
-
54
+ dockBar .setBackground (new Color (0 , 0 , 0 , 20 )); // Transparent background
55
+ dockBar . setOpaque ( true );
52
56
// Add buttons to the dock bar
53
57
for (int i = 1 ; i <= 5 ; i ++) {
54
- JButton button = new JButton (new ImageIcon (printPath () + "/icon " + i + ".jpg " ));
58
+ JButton button = new JButton (new ImageIcon (printPath () + "/icons/ " + i + ".png " ));
55
59
button .setSize (50 , 50 );
56
- button .setContentAreaFilled (false );
60
+ button .setContentAreaFilled (true );
57
61
button .setBorderPainted (false );
58
62
button .setFocusPainted (false );
59
63
button .setOpaque (true );
0 commit comments