Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sign.signlink;
- import java.net.*;
- import java.awt.*;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.*;
- import javax.swing.plaf.metal.MetalLookAndFeel;
- public class Jframe extends client implements ActionListener {
- private static JMenuItem menuItem;
- private JFrame frame;
- public Jframe(String args[]) {
- super();
- try {
- sign.signlink.startpriv(InetAddress.getByName(server));
- initUI();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- public void initUI() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- JPopupMenu.setDefaultLightWeightPopupEnabled(false);
- frame = new JFrame("DesolationX");
- frame.setLayout(new BorderLayout());
- frame.setResizable(false);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JPanel gamePanel = new JPanel();
- gamePanel.setLayout(new BorderLayout());
- gamePanel.add(this);
- gamePanel.setPreferredSize(new Dimension(765, 503));
- JMenu fileMenu = new JMenu("DesolationX Information");
- String[] mainButtons = new String[] { "DesolationX Client", "Version: 1.0", "-", "Forums", "-", "Exit DesolationX Client" };
- for (String name : mainButtons) {
- JMenuItem menuItem = new JMenuItem(name);
- if (name.equalsIgnoreCase("-")) {
- fileMenu.addSeparator();
- } else {
- menuItem.addActionListener(this);
- fileMenu.add(menuItem);
- }
- }
- JMenuBar menuBar = new JMenuBar();
- JMenuBar jmenubar = new JMenuBar();
- frame.add(jmenubar);
- menuBar.add(fileMenu);
- frame.getContentPane().add(menuBar, BorderLayout.NORTH);
- frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
- frame.pack();
- frame.setVisible(true); // can see the client
- frame.setResizable(false); // resizeable frame
- init();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public URL getCodeBase() {
- try {
- return new URL("http://" + server + "/cache");
- } catch (Exception e) {
- return super.getCodeBase();
- }
- }
- public URL getDocumentBase() {
- return getCodeBase();
- }
- public void loadError(String s) {
- System.out.println("loadError: " + s);
- }
- public String getParameter(String key) {
- return "";
- }
- private static void openUpWebSite(String url) {
- Desktop d = Desktop.getDesktop();
- try {
- d.browse(new URI(url));
- } catch (Exception e) {
- }
- }
- public void actionPerformed(ActionEvent evt) {
- String cmd = evt.getActionCommand();
- try {
- if (cmd != null) {
- if (cmd.equalsIgnoreCase("Exit DesolationX Client")) {
- System.exit(0);
- }
- if (cmd.equalsIgnoreCase("Forums")) {
- openUpWebSite("http://www.DesolationXpk.com/");
- }
- }
- } catch (Exception e) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment