mirror of
https://gitlab.com/2009scape/09launcher.git
synced 2025-12-10 10:20:55 -07:00
Refactor launcher to address certain issues, add new close button
This commit is contained in:
parent
07180ce371
commit
43183a2302
4 changed files with 36 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ public class Settings {
|
||||||
public static final boolean enableMusicPlayer = false;
|
public static final boolean enableMusicPlayer = false;
|
||||||
|
|
||||||
// Frame Settings
|
// Frame Settings
|
||||||
public static final Dimension frameSize = new Dimension(600, 350);
|
public static final Dimension frameSize = new Dimension(600, 300);
|
||||||
public static final Color borderColor = new Color(0, 0, 0);
|
public static final Color borderColor = new Color(0, 0, 0);
|
||||||
public static final Color backgroundColor = new Color(158,134,94);
|
public static final Color backgroundColor = new Color(158,134,94);
|
||||||
public static final Color primaryColor = new Color(255,204,54);
|
public static final Color primaryColor = new Color(255,204,54);
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseMotionAdapter;
|
import java.awt.event.MouseMotionAdapter;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.*;
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JProgressBar;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.plaf.basic.BasicProgressBarUI;
|
import javax.swing.plaf.basic.BasicProgressBarUI;
|
||||||
|
|
@ -39,11 +36,12 @@ public class AppFrame extends JFrame {
|
||||||
|
|
||||||
//addMenuBar();
|
//addMenuBar();
|
||||||
addNewsBox();
|
addNewsBox();
|
||||||
addWorldSelect();
|
//addWorldSelect();
|
||||||
addLinks();
|
addLinks();
|
||||||
addHeader();
|
addHeader();
|
||||||
addPlayButton();
|
addPlayButton();
|
||||||
addProgressBar();
|
addProgressBar();
|
||||||
|
addCloseButton();
|
||||||
|
|
||||||
setIconImage(Utils.getImage("favicon_large.png").getImage());
|
setIconImage(Utils.getImage("favicon_large.png").getImage());
|
||||||
addMouseListener();
|
addMouseListener();
|
||||||
|
|
@ -79,11 +77,11 @@ public class AppFrame extends JFrame {
|
||||||
public static Control playButton = new Control("Play");
|
public static Control playButton = new Control("Play");
|
||||||
private void addPlayButton() {
|
private void addPlayButton() {
|
||||||
|
|
||||||
playButton.setActionCommand("play1");
|
playButton.setActionCommand("play2");
|
||||||
playButton.setBackground(Settings.primaryColor);
|
playButton.setBackground(Settings.primaryColor);
|
||||||
playButton.addActionListener(new ButtonListener());
|
playButton.addActionListener(new ButtonListener());
|
||||||
//(appWidth / 2) - (167 / 2)
|
//(appWidth / 2) - (167 / 2)
|
||||||
playButton.setBounds(151, appHeight - 88, 100, 35);
|
playButton.setBounds(0, appHeight - 35, 100, 35);
|
||||||
Utils.setFont(playButton, "OpenSans-Regular.ttf", 16);
|
Utils.setFont(playButton, "OpenSans-Regular.ttf", 16);
|
||||||
add(playButton);
|
add(playButton);
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +99,7 @@ public class AppFrame extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWorldSelect() {
|
private void addWorldSelect() {
|
||||||
JLabel world1box = new JLabel("");
|
/*JLabel world1box = new JLabel("");
|
||||||
JLabel world1text = new JLabel("World 1 - Authentic");
|
JLabel world1text = new JLabel("World 1 - Authentic");
|
||||||
world1text.setBounds(20, appHeight - 80, 145,20);
|
world1text.setBounds(20, appHeight - 80, 145,20);
|
||||||
world1text.setForeground(Color.WHITE);
|
world1text.setForeground(Color.WHITE);
|
||||||
|
|
@ -111,7 +109,7 @@ public class AppFrame extends JFrame {
|
||||||
world1box.setBackground(new Color(0.0f,0.0f,0.0f,0.2f));
|
world1box.setBackground(new Color(0.0f,0.0f,0.0f,0.2f));
|
||||||
add(world1box);
|
add(world1box);
|
||||||
add(world1text);
|
add(world1text);
|
||||||
|
*/
|
||||||
IconLabel globeIcon = new IconLabel("\uf0ac",50);
|
IconLabel globeIcon = new IconLabel("\uf0ac",50);
|
||||||
globeIcon.setBounds(275,appHeight - 98,64,64);
|
globeIcon.setBounds(275,appHeight - 98,64,64);
|
||||||
add(globeIcon);
|
add(globeIcon);
|
||||||
|
|
@ -135,7 +133,7 @@ public class AppFrame extends JFrame {
|
||||||
|
|
||||||
private void addLinks() {
|
private void addLinks() {
|
||||||
tooltip = new JLabel("");
|
tooltip = new JLabel("");
|
||||||
tooltip.setBounds(135, appHeight - 140, 335, 35);
|
tooltip.setBounds(135, appHeight - 90, 335, 35);
|
||||||
tooltip.setHorizontalAlignment(SwingConstants.CENTER);
|
tooltip.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
Utils.setFont(tooltip, "OpenSans-Light.ttf", 30);
|
Utils.setFont(tooltip, "OpenSans-Light.ttf", 30);
|
||||||
tooltip.setForeground(Color.white);
|
tooltip.setForeground(Color.white);
|
||||||
|
|
@ -290,4 +288,31 @@ public class AppFrame extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addCloseButton() {
|
||||||
|
ImageIcon close_dark = new ImageIcon(getClass().getResource("/data/img/close.png"));
|
||||||
|
ImageIcon close_hi = new ImageIcon(getClass().getResource("/data/img/close_hi.png"));
|
||||||
|
JLabel button = new JLabel(close_hi);
|
||||||
|
button.setDisabledIcon(close_dark);
|
||||||
|
button.setEnabled(false);
|
||||||
|
button.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent mouseEvent) {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent mouseEvent) {
|
||||||
|
button.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent mouseEvent) {
|
||||||
|
button.setEnabled(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
button.setBounds(appWidth - 40, 0, 40, 40);
|
||||||
|
add(button);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
src/main/resources/data/img/close.png
Normal file
BIN
src/main/resources/data/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 295 B |
BIN
src/main/resources/data/img/close_hi.png
Normal file
BIN
src/main/resources/data/img/close_hi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 316 B |
Loading…
Add table
Add a link
Reference in a new issue