Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public JavaErrorFrame()
- {
- setLayout(new GridBagLayout());
- gc = new GridBagConstraints();
- add(new JLabel("<html><p>Java 8 is required to run the launcher</p><p style='margin-left: 78px;'></html>"), 0, 0);
- JLabel download = new JLabel("<html><a href='https://java.com'>Dowload</a></html>");
- JButton ok = new JButton("OK");
- //Cannot use lambda becouse if we here, no java 8 detected
- ok.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- Core.log.fatal("Detected java older than 1.8, launcher is unable to run", true, Const.EXITCODE_INVALID_JAVA);
- }
- });
- download.addMouseListener(new MouseListener()
- {
- @Override
- public void mouseReleased(MouseEvent e)
- {
- }
- @Override
- public void mousePressed(MouseEvent e)
- {
- if (Desktop.isDesktopSupported())
- {
- try
- {
- Desktop.getDesktop().browse(new URI("http://www.java.com"));
- }
- catch (Exception ex)
- {
- Core.log.error("Unable to open java.com");
- ex.printStackTrace(Core.log);
- }
- }
- }
- @Override
- public void mouseExited(MouseEvent e)
- {
- }
- @Override
- public void mouseEntered(MouseEvent e)
- {
- }
- @Override
- public void mouseClicked(MouseEvent e)
- {
- }
- });
- download.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- add(download, 0, 1);
- add(ok, 0, 2);
- setResizable(false);
- setSize(Const.jerrorwidth, Const.jerrorheight);
- setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment