aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/launcher/ChangeJVMFrame.java
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2008-03-03 19:13:22 +0000
committerYana Stamcheva <yana@jitsi.org>2008-03-03 19:13:22 +0000
commit5b4a4cfa69f949f2a48756f880ba17e28111b316 (patch)
tree2b460c729463353471734290137ce9736f83b2f2 /src/net/java/sip/communicator/launcher/ChangeJVMFrame.java
parentb40ce115fb89cf3b8da845c66adbae8507ebd837 (diff)
downloadjitsi-5b4a4cfa69f949f2a48756f880ba17e28111b316.zip
jitsi-5b4a4cfa69f949f2a48756f880ba17e28111b316.tar.gz
jitsi-5b4a4cfa69f949f2a48756f880ba17e28111b316.tar.bz2
The defaul felix launcher is replaced by the SIP Communicator launcher, which will check the java version before starting the application and will show the appropriate message for the requirements.
Diffstat (limited to 'src/net/java/sip/communicator/launcher/ChangeJVMFrame.java')
-rw-r--r--src/net/java/sip/communicator/launcher/ChangeJVMFrame.java102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/launcher/ChangeJVMFrame.java b/src/net/java/sip/communicator/launcher/ChangeJVMFrame.java
new file mode 100644
index 0000000..32283dd
--- /dev/null
+++ b/src/net/java/sip/communicator/launcher/ChangeJVMFrame.java
@@ -0,0 +1,102 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.launcher;
+
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+
+/**
+ * The <tt>ChangeJVMFrame</tt> will ask the user to install the newest java
+ * version if she's using an old and icompatible one.
+ *
+ * @author Yana Stamcheva
+ */
+public class ChangeJVMFrame
+ extends JFrame
+{
+ /**
+ * The MacOSX operating system.
+ */
+ public static final String MAC_OSX = "MacOSX";
+
+ /**
+ * The Windows operating system.
+ */
+ public static final String WINDOWS = "Windows";
+
+ /**
+ * The Linux operating system.
+ */
+ public static final String LINUX = "Linux";
+
+ private JTextArea textArea = new JTextArea();
+
+ private JEditorPane javaLinkPane = new JEditorPane();
+
+ private String text = "Sorry. Your Java version is too old. The minimum"
+ + " Java version required is 1.5. Please folow the link below to install"
+ + " the newest version for your environment.";
+
+ private String macLink
+ = "<a href=\"http://www.apple.com/downloads/macosx/apple/macosx_updates/" +
+ "javaformacosx104release6.html\">Download Java 1.5 for MacOSX</a>";
+
+ private String defaultLink
+ = "<a href=\"https://cds.sun.com/is-bin/INTERSHOP.enfinity/" +
+ "WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?" +
+ "ProductRef=jre-6u4-b-oth-JPR@CDS-CDS_Developer\">Download Java 1.6</a>";
+
+ private JPanel mainPanel = new JPanel(new BorderLayout());
+
+ public ChangeJVMFrame(String osName)
+ {
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ this.setTitle("SIP Communicator requirements");
+
+ this.mainPanel.setPreferredSize(
+ new Dimension(450, 150));
+
+ this.mainPanel.setBorder(
+ BorderFactory.createEmptyBorder(10, 10, 10, 10));
+
+ this.textArea.setOpaque(false);
+ this.textArea.setLineWrap(true);
+ this.textArea.setWrapStyleWord(true);
+ this.textArea.setText(text);
+ this.textArea.setEditable(false);
+
+ this.javaLinkPane.setOpaque(false);
+ this.javaLinkPane.setContentType("text/html");
+ this.javaLinkPane.setEditable(false);
+
+ if (osName.equals(MAC_OSX))
+ this.javaLinkPane.setText(macLink);
+ else
+ this.javaLinkPane.setText(defaultLink);
+
+ this.javaLinkPane.addHyperlinkListener(new HyperlinkListener()
+ {
+ public void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
+ {
+ new BrowserLauncher().openURL(e.getDescription());
+ }
+ }
+ });
+
+ this.mainPanel.add(textArea, BorderLayout.NORTH);
+ this.mainPanel.add(javaLinkPane, BorderLayout.CENTER);
+
+ this.getContentPane().add(mainPanel);
+
+ this.pack();
+ }
+}