Skip to content

Commit

Permalink
Redesign the initialisation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
RoanH committed Jun 2, 2018
1 parent bb005c7 commit 717773f
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions KeysPerSecond/src/me/roan/kps/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,14 +791,19 @@ public Component getListCellRendererComponent(JList<?> list, Object value, int i
save.setEnabled(true);
}
});
JLabel ver = new JLabel("<html><center><i>Version: v7.4, latest version: <font color=gray>loading</font><br>"
+ "<u><font color=blue> https://osu.ppy.sh/community/forums/topics/552405 </font></u></i></center></html>", SwingConstants.CENTER);
JPanel info = new JPanel(new GridLayout(2, 1, 0, 2));
JLabel ver = new JLabel("<html><center><i>Version: v7.4, latest version: <font color=gray>loading</font></i></center></html>", SwingConstants.CENTER);
info.add(ver);
new Thread(()->{
String version = checkVersion();//XXX the version number
ver.setText("<html><center><i>Version: v7.4, latest version: " + (version == null ? "unknown :(" : version) + "<br>"
+ "<u><font color=blue> https://osu.ppy.sh/community/forums/topics/552405 </font></u></i></center></html>");
ver.setText("<html><center><i>Version: v7.4, latest version: " + (version == null ? "unknown :(" : version) + "</i></center></html>");
}, "Version Checker").start();
ver.addMouseListener(new MouseListener(){
JPanel links = new JPanel(new GridLayout(1, 2, -2, 0));
JLabel forum = new JLabel("<html><font color=blue><u>Forums</u></font> -</html>", SwingConstants.RIGHT);
JLabel git = new JLabel("<html>- <font color=blue><u>GitHub</u></font></html>", SwingConstants.LEFT);
links.add(forum);
links.add(git);
forum.addMouseListener(new MouseListener(){

@Override
public void mouseClicked(MouseEvent e) {
Expand Down Expand Up @@ -827,8 +832,38 @@ public void mouseEntered(MouseEvent e) {
public void mouseExited(MouseEvent e) {
}
});
form.add(ver, BorderLayout.PAGE_END);
int option = JOptionPane.showOptionDialog(null, form, "Keys per second", 0, JOptionPane.QUESTION_MESSAGE, null, new String[]{"OK", "Exit"}, 0);
git.addMouseListener(new MouseListener(){

@Override
public void mouseClicked(MouseEvent e) {
if(Desktop.isDesktopSupported()){
try {
Desktop.getDesktop().browse(new URL("https://github.com/RoanH/KeysPerSecond").toURI());
} catch (IOException | URISyntaxException e1) {
//pity
}
}
}

@Override
public void mousePressed(MouseEvent e) {
}

@Override
public void mouseReleased(MouseEvent e) {
}

@Override
public void mouseEntered(MouseEvent e) {
}

@Override
public void mouseExited(MouseEvent e) {
}
});
info.add(links);
form.add(info, BorderLayout.PAGE_END);
int option = JOptionPane.showOptionDialog(null, form, "Keys per second", 0, JOptionPane.PLAIN_MESSAGE, null, new String[]{"OK", "Exit"}, 0);
if(1 == option || option == JOptionPane.CLOSED_OPTION){
try {
GlobalScreen.unregisterNativeHook();
Expand Down

0 comments on commit 717773f

Please sign in to comment.