MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / init

Method init

The 5zig Mod/src/eu/the5zig/mod/installer/MainPanel.java:28–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 }
27
28 private void init() {
29 setSize(500, 350);
30 setLayout(null);
31
32 JLabel title = new JLabel("The 5zig Mod v" + Frame.modVersion, SwingConstants.CENTER);
33 title.setBounds(0, 10, 500, 35);
34 title.setFont(new Font("Verdana", Font.BOLD, 26));
35 add(title);
36
37 JLabel subTitle = new JLabel("for Minecraft " + Frame.minecraftVersion, SwingConstants.CENTER);
38 subTitle.setBounds(0, 36, 500, 35);
39 subTitle.setFont(new Font("Verdana", Font.BOLD, 20));
40 add(subTitle);
41
42 text = new JLabel("", SwingConstants.CENTER);
43 text.setBounds(40, 50, 420, 170);
44 text.setFont(new Font("Helvetica", Font.BOLD, 18));
45 text.setText("<html>Welcome to the 5zig Mod installer!<br><br>Click on \"Install\" to install the mod! Select optionally other mods to install them together" +
46 ".<br>More information on <u>https://www.5zig.net</u></html>");
47 add(text);
48
49 changeDir = new JButton(Images.installBox);
50 changeDir.setBounds(30, 220, 430, 30);
51 changeDir.setBorderPainted(false);
52 changeDir.setFocusPainted(false);
53 changeDir.setContentAreaFilled(false);
54 changeDirlbl = new JLabel("Installing to " + Frame.installDirectory.getAbsolutePath(), SwingConstants.CENTER);
55 changeDirlbl.setBounds(35, 220, 420, 30);
56 changeDirlbl.setFont(new Font("Arial", Font.PLAIN, 16));
57 changeDirlbl.setForeground(Color.lightGray);
58 changeDirlbl.addMouseListener(new MouseAdapter() {
59 @Override
60 public void mouseEntered(MouseEvent e) {
61 changeDirlbl.setText("Click to change...");
62 changeDirlbl.setFont(new Font("Arial", Font.BOLD, 16));
63 }
64
65 @Override
66 public void mouseExited(MouseEvent e) {
67 changeDirlbl.setText("Installing to " + Frame.installDirectory.getAbsolutePath());
68 changeDirlbl.setFont(new Font("Arial", Font.PLAIN, 16));
69 }
70
71 @Override
72 public void mouseClicked(MouseEvent e) {
73 JFileChooser chooser = new JFileChooser(Frame.installDirectory);
74 chooser.setDialogTitle("Select Minecraft Installation Directory");
75 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
76 chooser.setAcceptAllFileFilterUsed(false);
77
78 if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
79 Frame.installDirectory = chooser.getSelectedFile();
80 changeDirlbl.setText("Installing to " + Frame.installDirectory.getAbsolutePath());
81 changeDirlbl.setFont(new Font("Arial", Font.PLAIN, 16));
82 }
83 }
84 });
85 add(changeDirlbl);

Callers 1

MainPanelMethod · 0.95

Calls 5

setSizeMethod · 0.80
setBoundsMethod · 0.80
setTextMethod · 0.65
setVisibleMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected