diff --git a/README.md b/README.md
index 8c2e3b4..38454ed 100644
--- a/README.md
+++ b/README.md
@@ -4,4 +4,4 @@ BukkitTelnetClient
BukkitTelnetClient is a very, very basic telnet client for use with the BukkitTelnet CraftBukkit plugin.
A recent binary can be found here:
-http://s3.madgeekonline.com/BukkitTelnetClient.jar
+http://s3.madgeekonline.com/BukkitTelnetClient-v1_3.jar
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
index a9d5c3c..e43ea92 100644
--- a/nbproject/build-impl.xml
+++ b/nbproject/build-impl.xml
@@ -134,9 +134,7 @@ is divided into following sections:
-
-
-
+
@@ -229,7 +227,6 @@ is divided into following sections:
Must set src.dir
- Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
@@ -370,6 +367,11 @@ is divided into following sections:
+
+
+
+
+
@@ -393,7 +395,7 @@ is divided into following sections:
-
+
@@ -404,8 +406,8 @@ is divided into following sections:
-
-
+
+
@@ -432,11 +434,7 @@ is divided into following sections:
-
-
-
-
-
+
@@ -534,7 +532,7 @@ is divided into following sections:
-
+
@@ -545,8 +543,8 @@ is divided into following sections:
-
-
+
+
@@ -920,7 +918,7 @@ is divided into following sections:
-
+
@@ -1231,13 +1229,11 @@ is divided into following sections:
-
+
-
-
-
-
+
+
@@ -1251,10 +1247,8 @@ is divided into following sections:
Must select some files in the IDE or set javac.includes
-
-
-
-
+
+
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
index 66f5a09..25c8ed8 100644
--- a/nbproject/genfiles.properties
+++ b/nbproject/genfiles.properties
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=b147f9b6
+build.xml.data.CRC32=b53f58a0
build.xml.script.CRC32=71290436
-build.xml.stylesheet.CRC32=28e38971@1.50.2.46
+build.xml.stylesheet.CRC32=28e38971@1.56.1.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=6eb617a8
-nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
+nbproject/build-impl.xml.data.CRC32=b53f58a0
+nbproject/build-impl.xml.script.CRC32=5a1afff7
+nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 8174d05..a8756e0 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -35,12 +35,12 @@ javac.classpath=\
${libs.Apache_Commons_Lang.classpath}:\
${libs.Apache_Commons_Net.classpath}
# Space-separated list of extra javac options
-javac.compilerargs=
+javac.compilerargs=-Xlint:unchecked
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
-javac.source=1.6
-javac.target=1.6
+javac.source=1.7
+javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
@@ -83,4 +83,3 @@ run.test.classpath=\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
-test.src.dir=test
diff --git a/nbproject/project.xml b/nbproject/project.xml
index 08ad5eb..aca1fea 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -7,9 +7,7 @@
-
-
-
+
diff --git a/src/me/StevenLawson/BukkitTelnetClient/BTC_ConnectionManager.java b/src/me/StevenLawson/BukkitTelnetClient/BTC_ConnectionManager.java
index 9d8ba57..996c5e5 100644
--- a/src/me/StevenLawson/BukkitTelnetClient/BTC_ConnectionManager.java
+++ b/src/me/StevenLawson/BukkitTelnetClient/BTC_ConnectionManager.java
@@ -29,6 +29,8 @@ public class BTC_ConnectionManager
btc.getTxt_server().setEnabled(false);
btc.getBtn_disconnect().setEnabled(true);
+ this.btc.setTitle("BukkitTelnetClient - v1.3 - " + hostname + ":" + port);
+
System.out.println("Connecting to " + hostname + ":" + port + "...");
this.hostname = hostname;
@@ -86,6 +88,8 @@ public class BTC_ConnectionManager
btc.getBtn_send().setEnabled(false);
btc.getTxt_command().setEnabled(false);
+ this.btc.setTitle("BukkitTelnetClient - v1.3 - Disconnected");
+
System.out.println("\nDisconnected.");
}
diff --git a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form
index 2da4e2a..62b3b0c 100644
--- a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form
+++ b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.form
@@ -7,6 +7,7 @@
+
@@ -34,17 +35,18 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -56,12 +58,13 @@
-
+
+
@@ -106,7 +109,7 @@
-
+
@@ -125,7 +128,7 @@
-
+
@@ -134,7 +137,7 @@
-
+
@@ -145,5 +148,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java
index a6f6502..4afb27d 100644
--- a/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java
+++ b/src/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java
@@ -22,25 +22,36 @@ 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();
+ private final LinkedList server_list = new LinkedList<>();
+ private static BukkitTelnetClient btc = null;
- public BukkitTelnetClient()
+ private static void setup()
{
- initComponents();
- txt_server.getEditor().getEditorComponent().addKeyListener(new KeyAdapter()
+ btc = new BukkitTelnetClient();
+
+ btc.initComponents();
+
+ btc.setLocationRelativeTo(null);
+
+ btc.txt_server.getEditor().getEditorComponent().addKeyListener(new KeyAdapter()
{
@Override
public void keyTyped(KeyEvent e)
{
if (e.getKeyChar() == KeyEvent.VK_ENTER)
{
- saveServersAndTriggerConnect();
+ btc.saveServersAndTriggerConnect();
}
}
});
- redirectSystemStreams();
- loadServerList();
- connection_mgr = new BTC_ConnectionManager(this);
+
+ btc.redirectSystemStreams();
+
+ btc.loadServerList();
+
+ btc.connection_mgr = new BTC_ConnectionManager(btc);
+
+ btc.setVisible(true);
}
private void updateTextPane(final String text)
@@ -59,7 +70,10 @@ public class BukkitTelnetClient extends javax.swing.JFrame
{
throw new RuntimeException(e);
}
- main_output.setCaretPosition(doc.getLength() - 1);
+ if (btc.chkAutoScroll.isSelected() && btc.main_output.getSelectedText() == null)
+ {
+ btc.main_output.setCaretPosition(doc.getLength() - 1);
+ }
}
});
}
@@ -91,6 +105,7 @@ public class BukkitTelnetClient extends javax.swing.JFrame
System.setErr(new PrintStream(out, true));
}
+ @SuppressWarnings("unchecked")
private void loadServerList()
{
try
@@ -101,15 +116,16 @@ public class BukkitTelnetClient extends javax.swing.JFrame
File file = new File(SERVERS_FILE_NAME);
if (file.exists())
{
- BufferedReader in = new BufferedReader(new FileReader(file));
- String line;
- while ((line = in.readLine()) != null)
+ try (BufferedReader in = new BufferedReader(new FileReader(file)))
{
- line = line.trim();
- server_list.add(line);
- txt_server.addItem(line);
+ String line;
+ while ((line = in.readLine()) != null)
+ {
+ line = line.trim();
+ server_list.add(line);
+ txt_server.addItem(line);
+ }
}
- in.close();
}
}
catch (Exception ex)
@@ -136,15 +152,13 @@ public class BukkitTelnetClient extends javax.swing.JFrame
}
server_list.addFirst(selected_server);
-
- BufferedWriter out = new BufferedWriter(new FileWriter(new File(SERVERS_FILE_NAME)));
-
- for (String server : server_list)
+ try (BufferedWriter out = new BufferedWriter(new FileWriter(new File(SERVERS_FILE_NAME))))
{
- out.write(server + '\n');
+ for (String server : server_list)
+ {
+ out.write(server + '\n');
+ }
}
-
- out.close();
}
catch (Exception ex)
{
@@ -170,6 +184,7 @@ public class BukkitTelnetClient extends javax.swing.JFrame
btn_disconnect = new javax.swing.JButton();
btn_send = new javax.swing.JButton();
txt_server = new javax.swing.JComboBox();
+ chkAutoScroll = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("BukkitTelnetClient");
@@ -188,11 +203,11 @@ public class BukkitTelnetClient extends javax.swing.JFrame
});
btn_connect.setText("Connect");
- btn_connect.addMouseListener(new java.awt.event.MouseAdapter()
+ btn_connect.addActionListener(new java.awt.event.ActionListener()
{
- public void mouseClicked(java.awt.event.MouseEvent evt)
+ public void actionPerformed(java.awt.event.ActionEvent evt)
{
- btn_connectMouseClicked(evt);
+ btn_connectActionPerformed(evt);
}
});
@@ -202,26 +217,36 @@ public class BukkitTelnetClient extends javax.swing.JFrame
btn_disconnect.setText("Disconnect");
btn_disconnect.setEnabled(false);
- btn_disconnect.addMouseListener(new java.awt.event.MouseAdapter()
+ btn_disconnect.addActionListener(new java.awt.event.ActionListener()
{
- public void mouseClicked(java.awt.event.MouseEvent evt)
+ public void actionPerformed(java.awt.event.ActionEvent evt)
{
- btn_disconnectMouseClicked(evt);
+ btn_disconnectActionPerformed(evt);
}
});
btn_send.setText("Send");
btn_send.setEnabled(false);
- btn_send.addMouseListener(new java.awt.event.MouseAdapter()
+ btn_send.addActionListener(new java.awt.event.ActionListener()
{
- public void mouseClicked(java.awt.event.MouseEvent evt)
+ public void actionPerformed(java.awt.event.ActionEvent evt)
{
- btn_sendMouseClicked(evt);
+ btn_sendActionPerformed(evt);
}
});
txt_server.setEditable(true);
+ chkAutoScroll.setSelected(true);
+ chkAutoScroll.setText("AutoScroll");
+ chkAutoScroll.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(java.awt.event.ActionEvent evt)
+ {
+ chkAutoScrollActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -236,30 +261,32 @@ public class BukkitTelnetClient extends javax.swing.JFrame
.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)
- .addComponent(txt_command, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE)
+ .addComponent(txt_command, javax.swing.GroupLayout.DEFAULT_SIZE, 483, 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()
- .addComponent(btn_connect)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btn_disconnect))
- .addComponent(btn_send, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
+ .addComponent(btn_connect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(btn_send, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(btn_disconnect)
+ .addComponent(chkAutoScroll))))
.addContainerGap())
);
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_connect, btn_disconnect});
+ layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_connect, btn_disconnect, btn_send, chkAutoScroll});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txt_command, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
- .addComponent(btn_send))
+ .addComponent(btn_send)
+ .addComponent(chkAutoScroll))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
@@ -272,24 +299,6 @@ public class BukkitTelnetClient extends javax.swing.JFrame
pack();
}// //GEN-END:initComponents
- private void btn_connectMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_btn_connectMouseClicked
- {//GEN-HEADEREND:event_btn_connectMouseClicked
- if (!btn_connect.isEnabled())
- {
- return;
- }
- saveServersAndTriggerConnect();
- }//GEN-LAST:event_btn_connectMouseClicked
-
- private void btn_disconnectMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_btn_disconnectMouseClicked
- {//GEN-HEADEREND:event_btn_disconnectMouseClicked
- if (!btn_disconnect.isEnabled())
- {
- return;
- }
- connection_mgr.trigger_disconnect();
- }//GEN-LAST:event_btn_disconnectMouseClicked
-
private void txt_commandKeyPressed(java.awt.event.KeyEvent evt)//GEN-FIRST:event_txt_commandKeyPressed
{//GEN-HEADEREND:event_txt_commandKeyPressed
if (!txt_command.isEnabled())
@@ -303,39 +312,84 @@ public class BukkitTelnetClient extends javax.swing.JFrame
}
}//GEN-LAST:event_txt_commandKeyPressed
- private void btn_sendMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_btn_sendMouseClicked
- {//GEN-HEADEREND:event_btn_sendMouseClicked
+ private void chkAutoScrollActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_chkAutoScrollActionPerformed
+ {//GEN-HEADEREND:event_chkAutoScrollActionPerformed
+ updateTextPane("");
+ }//GEN-LAST:event_chkAutoScrollActionPerformed
+
+ private void btn_connectActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btn_connectActionPerformed
+ {//GEN-HEADEREND:event_btn_connectActionPerformed
+ if (!btn_connect.isEnabled())
+ {
+ return;
+ }
+ saveServersAndTriggerConnect();
+ }//GEN-LAST:event_btn_connectActionPerformed
+
+ private void btn_disconnectActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btn_disconnectActionPerformed
+ {//GEN-HEADEREND:event_btn_disconnectActionPerformed
+ if (!btn_disconnect.isEnabled())
+ {
+ return;
+ }
+ connection_mgr.trigger_disconnect();
+ }//GEN-LAST:event_btn_disconnectActionPerformed
+
+ private void btn_sendActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btn_sendActionPerformed
+ {//GEN-HEADEREND:event_btn_sendActionPerformed
if (!btn_send.isEnabled())
{
return;
}
connection_mgr.send_command(txt_command.getText());
txt_command.selectAll();
- }//GEN-LAST:event_btn_sendMouseClicked
+ }//GEN-LAST:event_btn_sendActionPerformed
- public static void main(String args[])
+ private static void findAndSetLookAndFeel(final String searchStyleName)
{
try
{
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
+ javax.swing.UIManager.LookAndFeelInfo foundStyle = null;
+ javax.swing.UIManager.LookAndFeelInfo fallbackStyle = null;
+
+ for (javax.swing.UIManager.LookAndFeelInfo style : javax.swing.UIManager.getInstalledLookAndFeels())
{
- if ("Nimbus".equals(info.getName()))
+ if (searchStyleName.equalsIgnoreCase(style.getName()))
{
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
+ foundStyle = style;
break;
}
+ else if ("Nimbus".equalsIgnoreCase(style.getName()))
+ {
+ fallbackStyle = style;
+ }
+ }
+
+ if (foundStyle != null)
+ {
+ javax.swing.UIManager.setLookAndFeel(foundStyle.getClassName());
+ }
+ else if (fallbackStyle != null)
+ {
+ javax.swing.UIManager.setLookAndFeel(fallbackStyle.getClassName());
}
}
- catch (Exception ex)
+ catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex)
{
logger.log(Level.SEVERE, null, ex);
}
+ }
+
+ public static void main(String args[])
+ {
+ findAndSetLookAndFeel("Windows");
java.awt.EventQueue.invokeLater(new Runnable()
{
+ @Override
public void run()
{
- new BukkitTelnetClient().setVisible(true);
+ BukkitTelnetClient.setup();
}
});
}
@@ -343,6 +397,7 @@ public class BukkitTelnetClient extends javax.swing.JFrame
private javax.swing.JButton btn_connect;
private javax.swing.JButton btn_disconnect;
private javax.swing.JButton btn_send;
+ private javax.swing.JCheckBox chkAutoScroll;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;