diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 408044f..a9d5c3c 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -12,9 +12,9 @@ is divided into following sections: - execution - debugging - javadoc - - junit compilation - - junit execution - - junit debugging + - test compilation + - test execution + - test debugging - applet - cleanup @@ -156,6 +156,7 @@ is divided into following sections: + @@ -200,6 +201,27 @@ is divided into following sections: + + + + + + + + + + + + + + + + + + + + + @@ -332,11 +354,52 @@ is divided into following sections: - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -345,32 +408,270 @@ is divided into following sections: - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -402,10 +703,13 @@ is divided into following sections: - + Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + @@ -463,6 +767,7 @@ is divided into following sections: + @@ -479,6 +784,7 @@ is divided into following sections: + @@ -486,6 +792,7 @@ is divided into following sections: + @@ -512,6 +819,9 @@ is divided into following sections: + + + @@ -557,7 +867,7 @@ is divided into following sections: - + - + + + This target only works when run from inside the NetBeans IDE. @@ -781,8 +1095,9 @@ is divided into following sections: - + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. @@ -790,12 +1105,8 @@ is divided into following sections: - - + + This target only works when run from inside the NetBeans IDE. @@ -807,12 +1118,8 @@ is divided into following sections: - - + + This target only works when run from inside the NetBeans IDE. @@ -834,6 +1141,42 @@ is divided into following sections: + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + @@ -920,14 +1263,14 @@ is divided into following sections: - + Some tests failed; see details above. @@ -940,39 +1283,40 @@ is divided into following sections: Must select some files in the IDE or set test.includes - + Some tests failed; see details above. + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + - + Must select one file in the IDE or set test.class - - - - - - - - - - - - - - - + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + @@ -1037,9 +1381,12 @@ is divided into following sections: - - - + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 267d65b..66f5a09 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.50.2.46 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=b147f9b6 -nbproject/build-impl.xml.script.CRC32=8a821c88 -nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.2.46 +nbproject/build-impl.xml.script.CRC32=6eb617a8 +nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 diff --git a/nbproject/project.properties b/nbproject/project.properties index 378deae..8174d05 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -28,7 +28,9 @@ dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= includes=** +jar.archive.disabled=${jnlp.enabled} jar.compress=false +jar.index=${jnlp.enabled} javac.classpath=\ ${libs.Apache_Commons_Lang.classpath}:\ ${libs.Apache_Commons_Net.classpath} @@ -55,6 +57,15 @@ javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= main.class=me.StevenLawson.BukkitTelnetClient.BukkitTelnetClient manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF diff --git a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form index c7b9753..2da4e2a 100644 --- a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form +++ b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form @@ -32,15 +32,10 @@ + - - - - - - - - + + @@ -70,10 +65,10 @@ - + @@ -124,14 +119,6 @@ - - - - - - - - @@ -150,5 +137,13 @@ + + + + + + + + diff --git a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java index e1bd115..ea611cf 100644 --- a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java +++ b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java @@ -1,30 +1,45 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package me.StevenLawson.BukkitTelnetClient; +import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; +import java.util.LinkedList; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; import javax.swing.text.Document; -/** - - @author - Steven - */ public class BukkitTelnetClient extends javax.swing.JFrame { + public static final String SERVERS_FILE_NAME = "btc_servers.cfg"; + private static final Logger logger = Logger.getLogger("BukkitTelnetClient"); private BTC_ConnectionManager connection_mgr; + private final LinkedList server_list = new LinkedList(); public BukkitTelnetClient() { initComponents(); + txt_server.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() + { + @Override + public void keyTyped(KeyEvent e) + { + if (e.getKeyChar() == KeyEvent.VK_ENTER) + { + saveServersAndTriggerConnect(); + } + } + }); redirectSystemStreams(); + loadServerList(); connection_mgr = new BTC_ConnectionManager(this); } @@ -76,9 +91,69 @@ public class BukkitTelnetClient extends javax.swing.JFrame System.setErr(new PrintStream(out, true)); } + private void loadServerList() + { + try + { + server_list.clear(); + txt_server.removeAllItems(); + + File file = new File(SERVERS_FILE_NAME); + if (file.exists()) + { + BufferedReader in = new BufferedReader(new FileReader(file)); + String line; + while ((line = in.readLine()) != null) + { + line = line.trim(); + server_list.add(line); + txt_server.addItem(line); + } + in.close(); + } + } + catch (Exception ex) + { + logger.log(Level.SEVERE, null, ex); + } + } + + private void saveServersAndTriggerConnect() + { + String selected_server = (String) txt_server.getSelectedItem(); + + try + { + if (server_list.contains(selected_server)) + { + server_list.remove(selected_server); + } + + server_list.addFirst(selected_server); + + BufferedWriter out = new BufferedWriter(new FileWriter(new File(SERVERS_FILE_NAME))); + + for (String server : server_list) + { + out.write(server + '\n'); + } + + out.close(); + } + catch (Exception ex) + { + logger.log(Level.SEVERE, null, ex); + } + + loadServerList(); + + connection_mgr.trigger_connect(selected_server); + } + @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents - private void initComponents() { + private void initComponents() + { jScrollPane1 = new javax.swing.JScrollPane(); main_output = new javax.swing.JTextPane(); @@ -86,9 +161,9 @@ public class BukkitTelnetClient extends javax.swing.JFrame btn_connect = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); - txt_server = new javax.swing.JTextField(); btn_disconnect = new javax.swing.JButton(); btn_send = new javax.swing.JButton(); + txt_server = new javax.swing.JComboBox(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("BukkitTelnetClient"); @@ -98,15 +173,19 @@ public class BukkitTelnetClient extends javax.swing.JFrame jScrollPane1.setViewportView(main_output); txt_command.setEnabled(false); - txt_command.addKeyListener(new java.awt.event.KeyAdapter() { - public void keyPressed(java.awt.event.KeyEvent evt) { + txt_command.addKeyListener(new java.awt.event.KeyAdapter() + { + public void keyPressed(java.awt.event.KeyEvent evt) + { txt_commandKeyPressed(evt); } }); btn_connect.setText("Connect"); - btn_connect.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { + btn_connect.addMouseListener(new java.awt.event.MouseAdapter() + { + public void mouseClicked(java.awt.event.MouseEvent evt) + { btn_connectMouseClicked(evt); } }); @@ -115,29 +194,28 @@ public class BukkitTelnetClient extends javax.swing.JFrame jLabel2.setText("Server:"); - txt_server.setText("tf.madgeekonline.com:28995"); - txt_server.addKeyListener(new java.awt.event.KeyAdapter() { - public void keyPressed(java.awt.event.KeyEvent evt) { - txt_serverKeyPressed(evt); - } - }); - btn_disconnect.setText("Disconnect"); btn_disconnect.setEnabled(false); - btn_disconnect.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { + btn_disconnect.addMouseListener(new java.awt.event.MouseAdapter() + { + public void mouseClicked(java.awt.event.MouseEvent evt) + { btn_disconnectMouseClicked(evt); } }); btn_send.setText("Send"); btn_send.setEnabled(false); - btn_send.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { + btn_send.addMouseListener(new java.awt.event.MouseAdapter() + { + public void mouseClicked(java.awt.event.MouseEvent evt) + { btn_sendMouseClicked(evt); } }); + txt_server.setEditable(true); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -150,13 +228,10 @@ public class BukkitTelnetClient extends javax.swing.JFrame .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(18, 18, 18) - .addComponent(txt_command)) - .addGroup(layout.createSequentialGroup() - .addGap(17, 17, 17) - .addComponent(txt_server, javax.swing.GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE))) + .addComponent(txt_command, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE) + .addComponent(txt_server, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() @@ -181,35 +256,23 @@ public class BukkitTelnetClient extends javax.swing.JFrame .addComponent(btn_send)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(txt_server, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2) .addComponent(btn_connect) - .addComponent(btn_disconnect)) + .addComponent(btn_disconnect) + .addComponent(txt_server, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); pack(); }// //GEN-END:initComponents - private void txt_serverKeyPressed(java.awt.event.KeyEvent evt)//GEN-FIRST:event_txt_serverKeyPressed - {//GEN-HEADEREND:event_txt_serverKeyPressed - if (!txt_server.isEnabled()) - { - return; - } - if (evt.getKeyCode() == KeyEvent.VK_ENTER) - { - connection_mgr.trigger_connect(txt_server.getText()); - } - }//GEN-LAST:event_txt_serverKeyPressed - private void btn_connectMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_btn_connectMouseClicked {//GEN-HEADEREND:event_btn_connectMouseClicked if (!btn_connect.isEnabled()) { return; } - connection_mgr.trigger_connect(txt_server.getText()); + saveServersAndTriggerConnect(); }//GEN-LAST:event_btn_connectMouseClicked private void btn_disconnectMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_btn_disconnectMouseClicked @@ -257,21 +320,9 @@ public class BukkitTelnetClient extends javax.swing.JFrame } } } - catch (ClassNotFoundException ex) + catch (Exception ex) { - java.util.logging.Logger.getLogger(BukkitTelnetClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - catch (InstantiationException ex) - { - java.util.logging.Logger.getLogger(BukkitTelnetClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - catch (IllegalAccessException ex) - { - java.util.logging.Logger.getLogger(BukkitTelnetClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - catch (javax.swing.UnsupportedLookAndFeelException ex) - { - java.util.logging.Logger.getLogger(BukkitTelnetClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + logger.log(Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() @@ -291,7 +342,7 @@ public class BukkitTelnetClient extends javax.swing.JFrame private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextPane main_output; private javax.swing.JTextField txt_command; - private javax.swing.JTextField txt_server; + private javax.swing.JComboBox txt_server; // End of variables declaration//GEN-END:variables public javax.swing.JButton getBtn_connect() @@ -319,7 +370,7 @@ public class BukkitTelnetClient extends javax.swing.JFrame return txt_command; } - public javax.swing.JTextField getTxt_server() + public javax.swing.JComboBox getTxt_server() { return txt_server; }