SettingsAntPanel.java

Index Score
ants.p2p.gui
ANtsP2P

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
OPERANDSNumber of operands
PROGRAM_LENGTHHalstead program length
OPERATORSNumber of operators
LOGICAL_LINESNumber of statements
JAVA0076JAVA0076 Use of magic number
ELOCEffective lines of code
SIZESize of the file in bytes
LOCLines of code
UNIQUE_OPERANDSNumber of unique operands
BLOCKSNumber of blocks
EXITSProcedure exits
FUNCTIONSNumber of function declarations
LINESNumber of lines in the source file
CYCLOMATICCyclomatic complexity
PROGRAM_VOCABHalstead program vocabulary
INTERFACE_COMPLEXITYInterface complexity
JAVA0173JAVA0173 Unused method parameter
PARAMSNumber of formal parameter declarations
RETURNSNumber of return points from functions
COMPARISONSNumber of comparison operators
JAVA0166JAVA0166 Generic exception caught
LINE_COMMENTNumber of line comments
LOOPSNumber of loops
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0008JAVA0008 Empty catch block
JAVA0087JAVA0087 Use of Thread.sleep()
WHITESPACENumber of whitespace lines
EXEC_COMMENTSComments in executable code
JAVA0285JAVA0285 Dereference of potentially null variable
JAVA0270JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0079JAVA0079 Use of instance to reference static member
JAVA0116JAVA0116 Missing javadoc: field 'field'
DECL_COMMENTSComments in declarations
UNIQUE_OPERATORSNumber of unique operators
JAVA0007JAVA0007 Should not declare public field
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0174JAVA0174 Assigned local variable never used
JAVA0160JAVA0160 Method does not throw specified exception
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
COMMENTSComment lines
DOC_COMMENTNumber of javadoc comment lines
JAVA0003JAVA0003 Minimize use of on-demand (.*) imports
NEST_DEPTHMaximum nesting depth
JAVA0145JAVA0145 Tab character used in source file
//****************************************************************** //****************************************************************** //********** ANts Peer To Peer Sources ************* // // ANts P2P realizes a third generation P2P net. It protects your // privacy while you are connected and makes you not trackable, hiding // your identity (ip) and crypting everything you are sending/receiving // from others. // Copyright (C) 2004 Roberto Rossi // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package ants.p2p.gui; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import javax.swing.event.*; import java.net.*; import ants.p2p.*; import ants.p2p.filesharing.*; import ants.p2p.irc.*; import ants.p2p.utils.addresses.*; import ants.p2p.utils.indexer.*; import com.borland.jbcl.layout.*; import org.apache.log4j.*; import javax.swing.border.*; public class SettingsAntPanel extends JPanel { public static String pic = "backgrounds/bg4.jpg"; public static final int maxNeighboursNumber = 50; public static final int minNeighboursNumber = 10; public static String lookAndFeel = "Trendy"; public static String currentLanguage = "English"; static File settings = new File(WarriorAnt.workingPath + "settings.ant"); static Logger _logger = Logger.getLogger(SettingsAntPanel.class.getName()); Image buffer; BorderLayout borderLayout1 = new BorderLayout(); JPanel jPanel1 = new JPanel(); XYLayout xYLayout1 = new XYLayout(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JComboBox jComboBox1 = new JComboBox(); JLabel jLabel3 = new JLabel(); GuiAnt caller; URL servers = null; JLabel jLabel4 = new JLabel(); JSlider jSlider1 = new JSlider(); JLabel jLabel5 = new JLabel(); JButton jButton1 = new JButton(); JLabel jLabel8 = new JLabel(); JTextField jTextField4 = new JTextField(); JLabel jLabel9 = new JLabel(); JTextField jTextField5 = new JTextField(); JComboBox jComboBox2 = new JComboBox(); JButton jButton2 = new JButton(); JLabel jLabel10 = new JLabel(); JTextField jTextField3 = new JTextField(); JLabel jLabel11 = new JLabel(); JComboBox jComboBox3 = null; JButton jButton3 = new JButton(); JCheckBox jCheckBox2 = new JCheckBox(); JCheckBox jCheckBox1 = new JCheckBox(); Border border1; JCheckBox jCheckBox3 = new JCheckBox(); JCheckBox jCheckBox4 = new JCheckBox(); JCheckBox jCheckBox5 = new JCheckBox(); JLabel jLabel7 = new JLabel(); JButton jButton4 = new JButton(); JLabel jLabel12 = new JLabel(); JSlider jSlider2 = new JSlider(); JCheckBox jCheckBox6 = new JCheckBox(); JTextField jTextField6 = new JTextField(); JTextArea jTextArea1 = new JTextArea(); JLabel jLabel15 = new JLabel(); JTextField jTextField7 = new JTextField(); JLabel jLabel13 = new JLabel(); JScrollPane jScrollPane1 = new JScrollPane(); JLabel jLabel14 = new JLabel(); JTextField jTextField8 = new JTextField(); JButton jButton5 = new JButton(); JLabel jLabel16 = new JLabel(); JPanel jPanel2 = new JPanel(); XYLayout xYLayout2 = new XYLayout(); JPanel jPanel3 = new JPanel(); XYLayout xYLayout3 = new XYLayout(); JPanel jPanel4 = new JPanel(); XYLayout xYLayout4 = new XYLayout(); JPanel jPanel5 = new JPanel(); XYLayout xYLayout5 = new XYLayout(); JLabel jLabel17 = new JLabel(); JSlider jSlider3 = new JSlider(); JSlider jSlider4 = new JSlider(); JSlider jSlider5 = new JSlider(); JLabel jLabel18 = new JLabel(); JComboBox jComboBox4 = new JComboBox(); JLabel jLabel19 = new JLabel(); JSlider jSlider6 = new JSlider(); JButton jButton6 = new JButton(); JCheckBox jCheckBox7 = new JCheckBox(); JComboBox jComboBox5 = new JComboBox(ji.JI.getAvaiableLanguages()); JLabel jLabel6 = new JLabel(); JButton jButton7 = new JButton(); JButton jButton8 = new JButton(); JPasswordField jPasswordField1 = new JPasswordField(); JLabel jLabel20 = new JLabel(); JLabel jLabel21 = new JLabel(); JSlider jSlider7 = new JSlider(); JCheckBox jCheckBox8 = new JCheckBox(); JCheckBox jCheckBox9 = new JCheckBox("", ConnectionManager.searchIpOnGWebCache); public SettingsAntPanel(GuiAnt caller) { this.caller = caller; this.servers = this.getClass().getClassLoader().getResource("servers.ini"); if (servers != null) { this.loadIrcServers(); } this.jComboBox2.addItem(""); if (this.jComboBox2.getItemCount() > 0) { ConnectionAntPanel.ircServer = (String)this.jComboBox2.getItemAt(0); this.jComboBox2.setSelectedIndex(0); } if (settings.exists()) { this.loadSettings(); } try { Toolkit tk = Toolkit.getDefaultToolkit(); MediaTracker mt = new MediaTracker(this); buffer = tk.getImage(this.getClass().getClassLoader().getResource(pic)); mt.waitForAll(); } catch (Exception e) {} try { jbInit(); } catch (Exception ex) { _logger.error("", ex); } if (!settings.exists()) { final JFrame connectionDialog = new JFrame(ji.JI.i("ANts setup")); connectionDialog.getContentPane().setLayout(new FlowLayout(FlowLayout. CENTER)); connectionDialog.getContentPane().add(new JLabel(ji.JI.i( "Select your connection speed: "))); connectionDialog.getContentPane().add(this.jComboBox1); JButton confirmConnection = new JButton(ji.JI.i("Ok")); confirmConnection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { connectionDialog.setVisible(false); } }); connectionDialog.getContentPane().add(confirmConnection); connectionDialog.pack(); connectionDialog.setLocation(300, 300); SettingsAntPanel.setLookAndFeel(connectionDialog); connectionDialog.setVisible(true); while (connectionDialog.isVisible()) { try { Thread.currentThread().sleep(1000); } catch (InterruptedException ex1) { } } jPanel1.add(jComboBox1, new XYConstraints(200, 120, -1, -1)); final JFrame ipDialog = new JFrame(ji.JI.i("ANts setup")); ipDialog.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER)); ipDialog.getContentPane().add(new JLabel(ji.JI.i("Check your ip") + ": ")); ipDialog.getContentPane().add(this.jComboBox3); ipDialog.getContentPane().add(this.jCheckBox2); ipDialog.getContentPane().add(this.jCheckBox9); JButton confirmIp = new JButton(ji.JI.i("Ok")); confirmIp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ipDialog.setVisible(false); } }); ipDialog.getContentPane().add(confirmIp); ipDialog.setSize(new Dimension(350, 150)); ipDialog.setLocation(300, 300); SettingsAntPanel.setLookAndFeel(ipDialog); ipDialog.setVisible(true); while (ipDialog.isVisible()) { try { Thread.currentThread().sleep(1000); } catch (InterruptedException ex1) { } } jPanel3.add(jComboBox3, new XYConstraints(135, 15, 200, -1)); jPanel3.add(jCheckBox2, new XYConstraints(245, 45, -1, -1)); jPanel1.add(jCheckBox9, new XYConstraints(465, 52, -1, -1)); JFileChooser jfc = new JFileChooser(); jfc.setMultiSelectionEnabled(true); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = jfc.showDialog(this, ji.JI.i("Add Share Directory")); if (returnVal == JFileChooser.APPROVE_OPTION) { File[] toAdd = jfc.getSelectedFiles(); for (int x = 0; x < toAdd.length; x++) { BackgroundEngine.getInstance().addDirectory(toAdd[x]); } } jfc = new JFileChooser(); jfc.setMultiSelectionEnabled(false); returnVal = jfc.showDialog(this, ji.JI.i("Select Browser")); if (returnVal == JFileChooser.APPROVE_OPTION) { File browser = jfc.getSelectedFile(); HttpAntPanel.browserPath = browser.getAbsolutePath(); this.jLabel16.setText(ji.JI.i("Browser") + ": " + HttpAntPanel.browserPath); } } this.jTextField3.setText(WarriorAnt.password + ""); this.jTextField4.setText(ConnectionAntPanel.ircPort + ""); this.jTextField5.setText(ConnectionAntPanel.ircChannel); this.jTextField6.setText(WarriorAnt.getHttpServerHomePage()); this.jTextField7.setText(WarriorAnt.getHttpLocalServerPort() + ""); this.jTextField8.setText(WarriorAnt.getHttpProxyPort() + ""); this.jTextArea1.setText(WarriorAnt.getHttpServerDescription()); this.caller.cap.jTextField4.setText(ConnectionAntPanel.nick); try { jComboBox1.removeActionListener(jComboBox1.getActionListeners()[0]); } catch (Exception e) {} this.jComboBox1.setSelectedItem(WarriorAnt.ConnectionType); jComboBox1.addActionListener(new SettingsAntPanel_jComboBox1_actionAdapter(this)); this.jSlider1.setValue(Ant.maxNeighbours < 10 ? 10 : Ant.maxNeighbours > 30 ? 30 : Ant.maxNeighbours); this.jSlider2.setValue(MultipleSourcesDownloadManager.MaxSources); this.jSlider3.setValue(DownloadAntPanel.maxConcurrentDownloads); this.jSlider4.setValue(WarriorAnt.maxSecureConnections); this.jSlider5.setValue(WarriorAnt.maxPullRequestsToServe); this.jSlider6.setValue(BackgroundEngine.maxRemoteDocsToTrace); this.jSlider7.removeChangeListener(this.jSlider7.getChangeListeners()[0]); if (WarriorAnt.ConnectionType.equals("56K")) { this.jSlider7.setMaximum(10); } else if (WarriorAnt.ConnectionType.equals("ISDN")) { this.jSlider7.setMaximum(20); } else if (WarriorAnt.ConnectionType.equals("DSL")) { this.jSlider7.setMaximum(100); } else if (WarriorAnt.ConnectionType.equals("CABLE")) { this.jSlider7.setMaximum(1024); } else if (WarriorAnt.ConnectionType.equals("LAN T3")) { this.jSlider7.setMaximum(2 * 1024); } else if (WarriorAnt.ConnectionType.equals("LAN T2")) { this.jSlider7.setMaximum(5 * 1024); } else if (WarriorAnt.ConnectionType.equals("LAN T1")) { this.jSlider7.setMaximum(10 * 1024); } else if (WarriorAnt.ConnectionType.equals("LAN or Fiber Net")) { this.jSlider7.setMaximum(10 * 1024); } this.jSlider7.addChangeListener(new SettingsAntPanel_jSlider7_changeAdapter(this)); this.jSlider7.setValue(NeighbourAnt.bandwidthLimit / 1024); this.jComboBox2.setSelectedItem(ConnectionAntPanel.ircServer); this.jComboBox3.setSelectedItem(this.caller.cap.getLocalInetAddress()); this.jCheckBox3.setSelected(ConnectionAntPanel.autoReconnectIRC); this.jCheckBox4.setSelected(WarriorAnt.autoresumeFilesOnRun); this.jCheckBox5.setSelected(ConnectionAntPanel.searchPeersOnIRC); this.jCheckBox6.setSelected(WarriorAnt.isHttpEnabled()); this.jCheckBox6_check(); this.jCheckBox7.setSelected(QueryLinksDaemon.monitorClipboard); this.jCheckBox8.setSelected(ConnectionManager.publishIpOnGWebCache); this.jCheckBox9.setSelected(ConnectionManager.searchIpOnGWebCache); this.setIrcConnected(false); this.setIrcEnabled(false); this.storeSettings(); } void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); this.jPanel1.setOpaque(false); this.setLayout(borderLayout1); jPanel1.setLayout(xYLayout1); jLabel1.setMaximumSize(new Dimension(300, 15)); jLabel1.setMinimumSize(new Dimension(300, 15)); jLabel1.setPreferredSize(new Dimension(300, 15)); jLabel1.setText(ji.JI.i("Max uploads to serve")); jLabel2.setMaximumSize(new Dimension(300, 15)); jLabel2.setMinimumSize(new Dimension(300, 15)); jLabel2.setPreferredSize(new Dimension(300, 15)); jLabel2.setText(ji.JI.i("Max allowed secure connections")); jComboBox1.setMaximumSize(new Dimension(100, 32767)); jComboBox1.setMinimumSize(new Dimension(100, 21)); jComboBox1.setOpaque(true); jComboBox1.setPreferredSize(new Dimension(100, 21)); jComboBox1.setToolTipText(ji.JI.i("Your connection speed")); jComboBox1.addItem("56K"); jComboBox1.addItem("ISDN"); jComboBox1.addItem("DSL"); jComboBox1.addItem("CABLE"); jComboBox1.addItem("LAN T3"); jComboBox1.addItem("LAN T2"); jComboBox1.addItem("LAN T1"); jComboBox1.addItem("LAN or Fiber Net"); jComboBox1.addActionListener(new SettingsAntPanel_jComboBox1_actionAdapter(this)); jLabel3.setMaximumSize(new Dimension(300, 15)); jLabel3.setMinimumSize(new Dimension(300, 15)); jLabel3.setPreferredSize(new Dimension(300, 15)); jLabel3.setText(ji.JI.i("Connection Speed")); jLabel4.setMaximumSize(new Dimension(300, 15)); jLabel4.setMinimumSize(new Dimension(300, 15)); jLabel4.setPreferredSize(new Dimension(300, 15)); jLabel4.setText(ji.JI.i("Max neighbours number") + ": " + Ant.maxNeighbours); jSlider1.setMinimum(SettingsAntPanel.minNeighboursNumber); jSlider1.setMaximum(SettingsAntPanel.maxNeighboursNumber); jSlider1.setValue(Ant.maxNeighbours); jSlider1.setMaximumSize(new Dimension(100, 24)); jSlider1.setMinimumSize(new Dimension(100, 24)); jSlider1.setPreferredSize(new Dimension(100, 24)); jSlider1.setToolTipText(ji.JI.i( "Max number of computer which you want to directly connect to")); jSlider1.setOpaque(false); jSlider1.addChangeListener(new SettingsAntPanel_jSlider1_changeAdapter(this)); jPanel1.setBorder(border1); jPanel1.setMinimumSize(new Dimension(600, 700)); jPanel1.setPreferredSize(new Dimension(600, 800)); jLabel5.setMaximumSize(new Dimension(400, 15)); jLabel5.setMinimumSize(new Dimension(400, 15)); jLabel5.setPreferredSize(new Dimension(400, 15)); jLabel5.setText(ji.JI.i("Download path") + ": " + WarriorAnt.downloadPath); jLabel7.setMaximumSize(new Dimension(400, 15)); jLabel7.setMinimumSize(new Dimension(400, 15)); jLabel7.setPreferredSize(new Dimension(400, 15)); jLabel7.setText(ji.JI.i("Chuncks Home") + ": " + WarriorAnt.chunksHome); jButton1.setMaximumSize(new Dimension(160, 23)); jButton1.setMinimumSize(new Dimension(160, 23)); jButton1.setPreferredSize(new Dimension(160, 23)); jButton1.setToolTipText(ji.JI.i( "Changes the path where your downloads are stored when finished")); jButton1.setText(ji.JI.i("Change Download Path")); jButton1.addActionListener(new SettingsAntPanel_jButton1_actionAdapter(this)); jLabel8.setMaximumSize(new Dimension(80, 15)); jLabel8.setMinimumSize(new Dimension(80, 15)); jLabel8.setPreferredSize(new Dimension(80, 15)); jLabel8.setText(ji.JI.i("IRC server")); jTextField4.setMaximumSize(new Dimension(50, 2147483647)); jTextField4.setMinimumSize(new Dimension(50, 21)); jTextField4.setPreferredSize(new Dimension(50, 21)); jTextField4.setVisible(false); jLabel9.setText("Ch."); jTextField5.addFocusListener(new SettingsAntPanel_jTextField5_focusAdapter(this)); jComboBox2.setOpaque(true); jComboBox2.setToolTipText(ji.JI.i("Select an IRC server")); jComboBox2.setEditable(true); jComboBox2.addActionListener(new SettingsAntPanel_jComboBox2_actionAdapter(this)); jButton2.setActionCommand(ji.JI.i("Connect")); jButton2.setText(ji.JI.i("Connect")); jButton2.addActionListener(new SettingsAntPanel_jButton2_actionAdapter(this)); jButton2.setEnabled(false); jButton2.setToolTipText(ji.JI.i( "Connect to the selected IRC server joining the specified channel")); this.setDebugGraphicsOptions(0); this.setMinimumSize(new Dimension(600, 700)); this.setPreferredSize(new Dimension(600, 700)); jLabel10.setMaximumSize(new Dimension(130, 15)); jLabel10.setMinimumSize(new Dimension(130, 15)); jLabel10.setPreferredSize(new Dimension(130, 15)); jLabel10.setText(ji.JI.i("Bot password")); jTextField3.setOpaque(true); jTextField3.setToolTipText(ji.JI.i( "This is the password that other peers will use to require you the " + "OP status on IRC")); jTextField3.setText(""); jTextField3.addFocusListener(new SettingsAntPanel_jTextField3_focusAdapter(this)); jLabel11.setMaximumSize(new Dimension(150, 15)); jLabel11.setMinimumSize(new Dimension(150, 15)); jLabel11.setPreferredSize(new Dimension(150, 15)); jLabel11.setText(ji.JI.i("IP or Hostname")); jTextField5.setOpaque(true); jTextField5.setToolTipText(ji.JI.i("Specify an IRC channel")); jTextField5.setText(""); try { InetAddress[] addressList = InetAddress.getAllByName(InetAddress. getLocalHost().getHostName()); this.jComboBox3 = new JComboBox(); for (int h = 0; h < addressList.length; h++) { this.jComboBox3.addItem(addressList[h]); } boolean found = false; for (int x = 0; x < this.jComboBox3.getItemCount(); x++) { if ( ( ( (InetAddress)this.jComboBox3.getItemAt(x)).getHostAddress()). equals(this.caller. cap.getLocalStringAddress())) { found = true; } } if (!found) { this.jComboBox3.addItem(this.caller.cap.getLocalStringAddress()); } } catch (Exception e) { _logger.error("Not a valid IP address in settings panel field", e); } jButton3.setToolTipText(ji.JI.i("Refresh the ip address list")); jButton3.setText(ji.JI.i("Refresh")); jButton3.addActionListener(new SettingsAntPanel_jButton3_actionAdapter(this)); jButton3.setVisible(false); jComboBox3.setToolTipText(ji.JI.i("<html><body>This is a list of the IP addresses currently<br>avaiable for your network " + "adapter,<br>please select your internet pubblic address</body></html>")); jComboBox3.setEditable(true); jComboBox3.addActionListener(new SettingsAntPanel_jComboBox3_actionAdapter(this)); jCheckBox2.setMaximumSize(new Dimension(230, 23)); jCheckBox2.setMinimumSize(new Dimension(230, 23)); jCheckBox2.setOpaque(false); jCheckBox2.setPreferredSize(new Dimension(230, 23)); jCheckBox2.setToolTipText(ji.JI.i( "If you have a static IP, you may want to select this to let ANts " + "remember it")); jCheckBox2.setText(ji.JI.i("Remember IP/Hostname value")); jCheckBox2.addActionListener(new SettingsAntPanel_jCheckBox2_actionAdapter(this)); jCheckBox1.setMaximumSize(new Dimension(300, 23)); jCheckBox1.setMinimumSize(new Dimension(300, 23)); jCheckBox1.setOpaque(false); jCheckBox1.setPreferredSize(new Dimension(300, 23)); jCheckBox1.setToolTipText(ji.JI.i( "Run ANts P2P without pressing start ants")); jCheckBox1.setText(ji.JI.i("Autostart ANts on run")); jCheckBox1.addActionListener(new SettingsAntPanel_jCheckBox1_actionAdapter(this)); jCheckBox3.setMaximumSize(new Dimension(140, 23)); jCheckBox3.setMinimumSize(new Dimension(140, 23)); jCheckBox3.setPreferredSize(new Dimension(140, 23)); jCheckBox3.setToolTipText(ji.JI.i( "Automatically reconnect to IRC if disconnected")); jCheckBox3.setText(ji.JI.i("Autoreconnect to IRC ")); jCheckBox3.addActionListener(new SettingsAntPanel_jCheckBox3_actionAdapter(this)); jCheckBox4.setMaximumSize(new Dimension(300, 23)); jCheckBox4.setMinimumSize(new Dimension(300, 23)); jCheckBox4.setPreferredSize(new Dimension(300, 23)); jCheckBox4.setToolTipText(ji.JI.i( "Automatically search active sources for downloads once connected")); jCheckBox4.setText(ji.JI.i("Autoresume files on run")); jCheckBox4.addActionListener(new SettingsAntPanel_jCheckBox4_actionAdapter(this)); jCheckBox5.setMaximumSize(new Dimension(140, 23)); jCheckBox5.setMinimumSize(new Dimension(140, 23)); jCheckBox5.setPreferredSize(new Dimension(140, 23)); jCheckBox5.setToolTipText(ji.JI.i( "Activate the peer search process on the specified IRC channel")); jCheckBox5.setText(ji.JI.i("Search peers on IRC")); jCheckBox5.addActionListener(new SettingsAntPanel_jCheckBox5_actionAdapter(this)); jButton4.setMaximumSize(new Dimension(160, 23)); jButton4.setMinimumSize(new Dimension(160, 23)); jButton4.setPreferredSize(new Dimension(160, 23)); jButton4.setToolTipText(ji.JI.i("<html><body>Changes the path to the folder containing<br>the subfolder of the downloads " + "chucks (unfinished files parts)</body></html>")); jButton4.setText(ji.JI.i("Change Chuncks Home")); jButton4.addActionListener(new SettingsAntPanel_jButton4_actionAdapter(this)); jSlider2.setMaximumSize(new Dimension(100, 24)); jSlider2.setMinimumSize(new Dimension(100, 24)); jSlider2.setPreferredSize(new Dimension(100, 24)); jSlider2.setToolTipText(ji.JI.i( "Max number of sources per file during a download")); jSlider2.setMinimum(1); jSlider2.setMaximum(50); jSlider2.setValue(MultipleSourcesDownloadManager.MaxSources); jSlider2.addChangeListener(new SettingsAntPanel_jSlider2_changeAdapter(this)); jLabel12.setMaximumSize(new Dimension(300, 15)); jLabel12.setMinimumSize(new Dimension(300, 15)); jLabel12.setPreferredSize(new Dimension(300, 15)); jLabel12.setText(ji.JI.i("Max sources per download") + ": " + MultipleSourcesDownloadManager.MaxSources); jCheckBox6.setText(ji.JI.i("Open http service")); jCheckBox6.setMaximumSize(new Dimension(200, 23)); jCheckBox6.setMinimumSize(new Dimension(200, 23)); jCheckBox6.setPreferredSize(new Dimension(200, 23)); jCheckBox6.setToolTipText(ji.JI.i("<html><body>This is an advanced feature. The webserver is NOT embedded in ANts!<br>" + "You must be running an active webserver on your PC.<br>Please read the documentation " + "for further informations!</body></html>")); jCheckBox6.setSelected(true); jCheckBox6.addActionListener(new SettingsAntPanel_jCheckBox6_actionAdapter(this)); jTextField6.setMinimumSize(new Dimension(100, 20)); jTextField6.setPreferredSize(new Dimension(100, 20)); jTextField6.setToolTipText(ji.JI.i( "The path to your homepage in your webserver.")); jTextField6.setText(""); jTextField6.addFocusListener(new SettingsAntPanel_jTextField6_focusAdapter(this)); jTextArea1.setMinimumSize(new Dimension(200, 200)); jTextArea1.setPreferredSize(new Dimension(200, 200)); jTextArea1.setToolTipText(ji.JI.i( "A brief description of your webserver content!")); jTextArea1.setText("My Personal Web Site"); jTextArea1.setLineWrap(true); jTextArea1.addFocusListener(new SettingsAntPanel_jTextArea1_focusAdapter(this)); jLabel15.setMaximumSize(new Dimension(80, 15)); jLabel15.setMinimumSize(new Dimension(80, 15)); jLabel15.setPreferredSize(new Dimension(80, 15)); jLabel15.setText(ji.JI.i("Home Page")); jTextField7.setMinimumSize(new Dimension(100, 20)); jTextField7.setPreferredSize(new Dimension(100, 20)); jTextField7.setToolTipText(ji.JI.i( "The local port of your ACTIVE and RUNNING webserver")); jTextField7.setText(""); jTextField7.addFocusListener(new SettingsAntPanel_jTextField7_focusAdapter(this)); jLabel13.setMaximumSize(new Dimension(80, 15)); jLabel13.setMinimumSize(new Dimension(80, 15)); jLabel13.setPreferredSize(new Dimension(80, 15)); jLabel13.setText(ji.JI.i("Local Port")); jScrollPane1.setMinimumSize(new Dimension(200, 100)); jScrollPane1.setPreferredSize(new Dimension(200, 100)); jLabel14.setMaximumSize(new Dimension(80, 15)); jLabel14.setMinimumSize(new Dimension(80, 15)); jLabel14.setPreferredSize(new Dimension(80, 15)); jLabel14.setText(ji.JI.i("Proxy port")); jTextField8.setMinimumSize(new Dimension(100, 20)); jTextField8.setPreferredSize(new Dimension(100, 20)); jTextField8.setToolTipText(ji.JI.i( "The local port which you access remote webserver through")); jTextField8.setText(""); jTextField8.addFocusListener(new SettingsAntPanel_jTextField8_focusAdapter(this)); jButton5.setMaximumSize(new Dimension(160, 23)); jButton5.setMinimumSize(new Dimension(160, 23)); jButton5.setPreferredSize(new Dimension(160, 23)); jButton5.setToolTipText(ji.JI.i( "You must choose a valid browser to access the ANts features that " + "require it!")); jButton5.setText(ji.JI.i("Browser Location")); jButton5.addActionListener(new SettingsAntPanel_jButton5_actionAdapter(this)); jLabel16.setMaximumSize(new Dimension(400, 15)); jLabel16.setMinimumSize(new Dimension(400, 15)); jLabel16.setPreferredSize(new Dimension(400, 15)); jLabel16.setText(ji.JI.i("Browser") + ": " + HttpAntPanel.browserPath); jPanel2.setLayout(xYLayout2); jPanel2.setBorder(BorderFactory.createEtchedBorder()); jPanel3.setBorder(BorderFactory.createEtchedBorder()); jPanel3.setLayout(xYLayout3); jPanel4.setBorder(BorderFactory.createEtchedBorder()); jPanel4.setLayout(xYLayout4); jPanel5.setLayout(xYLayout5); jPanel5.setBorder(BorderFactory.createEtchedBorder()); jPanel5.setDebugGraphicsOptions(0); jLabel17.setMaximumSize(new Dimension(300, 15)); jLabel17.setMinimumSize(new Dimension(300, 15)); jLabel17.setPreferredSize(new Dimension(300, 15)); jLabel17.setText(ji.JI.i("Max concurrent downloads") + ": " + DownloadAntPanel.maxConcurrentDownloads); jSlider3.setMaximumSize(new Dimension(100, 24)); jSlider3.setMinimumSize(new Dimension(100, 24)); jSlider3.setMinimum(0); jSlider3.setMaximum(100); jSlider3.setPreferredSize(new Dimension(100, 24)); jSlider3.setToolTipText(ji.JI.i("Max number of concurrent downloads")); jSlider3.addChangeListener(new SettingsAntPanel_jSlider3_changeAdapter(this)); jSlider4.setMaximum(10000); jSlider4.setMinimum(100); jSlider4.setMaximumSize(new Dimension(100, 24)); jSlider4.setMinimumSize(new Dimension(100, 24)); jSlider4.setPreferredSize(new Dimension(100, 24)); jSlider4.setToolTipText(ji.JI.i( "Max number of allowed secure channels with other ANts P2P net nodes.")); jSlider4.addChangeListener(new SettingsAntPanel_jSlider4_changeAdapter(this)); jSlider5.setMaximumSize(new Dimension(100, 24)); jSlider5.setMinimumSize(new Dimension(100, 24)); jSlider5.setPreferredSize(new Dimension(100, 24)); jSlider5.setToolTipText(ji.JI.i( "Max number of upload to be served at a time")); jSlider5.setMinimum(4); jSlider5.setMaximum(100); jSlider5.addChangeListener(new SettingsAntPanel_jSlider5_changeAdapter(this)); jLabel18.setMaximumSize(new Dimension(150, 15)); jLabel18.setMinimumSize(new Dimension(150, 15)); jLabel18.setPreferredSize(new Dimension(150, 15)); jLabel18.setText(ji.JI.i("Look & Feel")); if (System.getProperty("java.version").startsWith("1.5")) { jComboBox4.addItem("Napkin (only JDK 1.4.x)"); jComboBox4.addItem("Liquid (only JDK 1.4.x)"); } else { jComboBox4.addItem("Napkin"); jComboBox4.addItem("Liquid"); } jComboBox4.addItem("Java"); jComboBox4.addItem("System"); jComboBox4.addItem("Trendy"); jComboBox4.setToolTipText(ji.JI.i("Choose a nice skin your your ANts!")); jComboBox4.setSelectedItem(SettingsAntPanel.lookAndFeel); jComboBox4.addActionListener(new SettingsAntPanel_jComboBox4_actionAdapter(this)); jLabel19.setMaximumSize(new Dimension(150, 15)); jLabel19.setMinimumSize(new Dimension(150, 15)); jLabel19.setPreferredSize(new Dimension(150, 15)); jLabel19.setText(ji.JI.i("Remote indexing cache") + ": "); jSlider6.setMaximum(1000000); jSlider6.setMinimum(10000); jSlider6.setMinimumSize(new Dimension(150, 24)); jSlider6.setPreferredSize(new Dimension(150, 24)); jSlider6.setToolTipText(ji.JI.i("<html><body>This is the amount of file locally cached<br>in order to speed up yours " + "and others' searches</body></html>")); jSlider6.addChangeListener(new SettingsAntPanel_jSlider6_changeAdapter(this)); jButton6.setMaximumSize(new Dimension(150, 34)); jButton6.setMinimumSize(new Dimension(150, 34)); jButton6.setPreferredSize(new Dimension(150, 34)); jButton6.setToolTipText(ji.JI.i("Close this tab")); //jButton6.setText(ji.JI.i("Close")); jButton6.setIcon(new LabelIcon(ji.JI.i("Close"), DoubleBuffer.getInstance().getButton(13), jButton6)); jButton6.addActionListener(new SettingsAntPanel_jButton6_actionAdapter(this)); jCheckBox7.setMaximumSize(new Dimension(300, 23)); jCheckBox7.setMinimumSize(new Dimension(300, 23)); jCheckBox7.setPreferredSize(new Dimension(300, 23)); jCheckBox7.setToolTipText(ji.JI.i( "Monitor the system clipboard for ants2k:// and ed2k:// links, notify " + "me when you find one")); jCheckBox7.setText(ji.JI.i("Monitor clipboard for ed2k & ants2k links")); jCheckBox7.addActionListener(new SettingsAntPanel_jCheckBox7_actionAdapter(this)); jLabel6.setMaximumSize(new Dimension(150, 15)); jLabel6.setMinimumSize(new Dimension(150, 15)); jLabel6.setPreferredSize(new Dimension(150, 15)); jLabel6.setText(ji.JI.i("Language")); jComboBox5.setToolTipText(ji.JI.i( "Select the current language for ANts P2P")); jComboBox5.setSelectedItem(SettingsAntPanel.currentLanguage); jComboBox5.addActionListener(new SettingsAntPanel_jComboBox5_actionAdapter(this)); jButton7.setPreferredSize(new Dimension(89, 20)); jButton7.setToolTipText(ji.JI.i( "Download the latest language pack avaiable for ANtsP2P")); jButton7.setText(ji.JI.i("Download pack")); jButton7.addActionListener(new SettingsAntPanel_jButton7_actionAdapter(this)); jButton8.setPreferredSize(new Dimension(150, 26)); jButton8.setToolTipText(ji.JI.i("<html><body>Optimize the local inidex of shared files,<br>this will take several " + "minutes and it will stop<br>your activity on the ANts net, but it will<br>" + "also improve your node performances</body></html>")); jButton8.setText("Optimize Index"); jButton8.addActionListener(new SettingsAntPanel_jButton8_actionAdapter(this)); jPasswordField1.setPreferredSize(new Dimension(70, 20)); jPasswordField1.setToolTipText(ji.JI.i("The channel password if needed")); jLabel20.setMaximumSize(new Dimension(34, 15)); jLabel20.setMinimumSize(new Dimension(34, 15)); jLabel20.setPreferredSize(new Dimension(34, 15)); jLabel20.setText("passw"); jLabel21.setText(ji.JI.i("Upload Bandwidth") + ": " + (NeighbourAnt.bandwidthLimit * 8) / 1024 + " Kbit/s"); jSlider7.setPreferredSize(new Dimension(100, 24)); jSlider7.setMaximum(10 * 1024); jSlider7.setMinimum(1); jSlider7.setToolTipText(ji.JI.i("This is the amount of bandwidth dedicated to each neighbour you are connected to")); jSlider7.addChangeListener(new SettingsAntPanel_jSlider7_changeAdapter(this)); jCheckBox8.setText(ji.JI.i("Publish ip on GWebCache")); jCheckBox8.addActionListener(new SettingsAntPanel_jCheckBox8_actionAdapter(this)); jCheckBox9.setPreferredSize(new Dimension(230, 23)); jCheckBox9.setText(ji.JI.i("Search peers on GWebCache")); jCheckBox9.addActionListener(new SettingsAntPanel_jCheckBox9_actionAdapter(this)); jPanel1.add(jTextField4, new XYConstraints(313, 238, -1, -1)); jPanel1.add(jPanel2, new XYConstraints(0, 525, 700, 122)); jPanel2.add(jButton1, new XYConstraints(15, 15, -1, -1)); jPanel2.add(jButton4, new XYConstraints(15, 45, -1, -1)); jPanel2.add(jButton5, new XYConstraints(15, 75, -1, -1)); jPanel2.add(jLabel16, new XYConstraints(215, 85, -1, -1)); jPanel2.add(jLabel7, new XYConstraints(215, 55, -1, -1)); jPanel2.add(jLabel5, new XYConstraints(215, 25, -1, -1)); jPanel1.add(jPanel3, new XYConstraints(0, 350, 700, 160)); jPanel3.add(jLabel11, new XYConstraints(15, 15, -1, -1)); jPanel3.add(jCheckBox1, new XYConstraints(15, 75, -1, -1)); jPanel3.add(jCheckBox4, new XYConstraints(15, 100, -1, -1)); jPanel3.add(jCheckBox2, new XYConstraints(245, 45, -1, -1)); jPanel3.add(jComboBox3, new XYConstraints(185, 15, 200, -1)); jPanel3.add(jButton3, new XYConstraints(400, 15, -1, -1)); jPanel3.add(jLabel18, new XYConstraints(500, 100, -1, -1)); jPanel3.add(jComboBox4, new XYConstraints(500, 120, 150, -1)); jPanel3.add(jLabel19, new XYConstraints(500, 15, -1, -1)); jPanel3.add(jSlider6, new XYConstraints(500, 40, -1, -1)); jPanel3.add(jCheckBox7, new XYConstraints(15, 125, -1, -1)); jPanel3.add(jComboBox5, new XYConstraints(340, 120, 150, -1)); jPanel3.add(jLabel6, new XYConstraints(340, 75, -1, -1)); jPanel3.add(jButton7, new XYConstraints(340, 95, 150, -1)); jPanel3.add(jButton8, new XYConstraints(500, 70, -1, -1)); jPanel3.add(jCheckBox8, new XYConstraints(15, 45, -1, -1)); jPanel1.add(jPanel4, new XYConstraints(0, 225, 450, 113)); jPanel4.add(jLabel8, new XYConstraints(15, 15, -1, -1)); jPanel4.add(jLabel9, new XYConstraints(15, 45, -1, -1)); jPanel4.add(jLabel10, new XYConstraints(15, 75, -1, -1)); jPanel4.add(jComboBox2, new XYConstraints(115, 15, 155, -1)); jPanel4.add(jTextField5, new XYConstraints(40, 45, 115, -1)); jPanel4.add(jTextField3, new XYConstraints(155, 75, 115, -1)); jPanel4.add(jButton2, new XYConstraints(290, 15, -1, -1)); jPanel4.add(jCheckBox3, new XYConstraints(290, 45, -1, -1)); jPanel4.add(jCheckBox5, new XYConstraints(290, 75, -1, -1)); jPanel4.add(jPasswordField1, new XYConstraints(200, 45, -1, -1)); jPanel4.add(jLabel20, new XYConstraints(160, 45, -1, -1)); jPanel1.add(jPanel5, new XYConstraints(464, 85, 234, 252)); jPanel5.add(jCheckBox6, new XYConstraints(15, 15, -1, -1)); jPanel5.add(jLabel14, new XYConstraints(15, 45, -1, -1)); jPanel5.add(jTextField8, new XYConstraints(115, 45, -1, -1)); jPanel5.add(jTextField7, new XYConstraints(115, 75, -1, -1)); jPanel5.add(jLabel13, new XYConstraints(15, 75, -1, -1)); jPanel5.add(jTextField6, new XYConstraints(115, 105, -1, -1)); jPanel5.add(jLabel15, new XYConstraints(15, 105, -1, -1)); jPanel5.add(jScrollPane1, new XYConstraints(15, 135, -1, -1)); jPanel1.add(jLabel4, new XYConstraints(0, 0, -1, -1)); jPanel1.add(jSlider1, new XYConstraints(350, 0, -1, -1)); jPanel1.add(jLabel1, new XYConstraints(0, 30, -1, -1)); jPanel1.add(jLabel2, new XYConstraints(0, 60, -1, -1)); jPanel1.add(jLabel3, new XYConstraints(0, 90, -1, -1)); jPanel1.add(jComboBox1, new XYConstraints(350, 90, -1, -1)); jPanel1.add(jLabel12, new XYConstraints(0, 120, -1, -1)); jPanel1.add(jSlider2, new XYConstraints(350, 120, -1, -1)); jPanel1.add(jLabel17, new XYConstraints(0, 150, -1, -1)); jPanel1.add(jSlider3, new XYConstraints(350, 150, -1, -1)); jPanel1.add(jSlider4, new XYConstraints(350, 60, -1, -1)); jPanel1.add(jSlider5, new XYConstraints(350, 30, -1, -1)); jPanel1.add(jButton6, new XYConstraints(464, 2, -1, -1)); jPanel1.add(jLabel21, new XYConstraints(0, 180, -1, -1)); jPanel1.add(jSlider7, new XYConstraints(350, 180, -1, -1)); jPanel1.add(jCheckBox9, new XYConstraints(465, 52, -1, -1)); jScrollPane1.getViewport().add(jTextArea1, null); this.add(jPanel1, BorderLayout.NORTH); } public void storeSettings() { ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(new FileOutputStream( settings)); oos.writeObject(Ant.getVersion()); oos.writeInt(WarriorAnt.maxPullRequestsToServe); oos.writeInt(WarriorAnt.maxSecureConnections); oos.writeInt(WarriorAnt.blockSizeInDownload); oos.writeInt(MultipleSourcesDownloadManager.blocksPerSource); oos.writeInt(MultipleSourcesDownloadManager.MaxSources); oos.writeObject(WarriorAnt.ConnectionType); oos.writeInt(Ant.maxNeighbours); oos.writeObject(WarriorAnt.downloadPath); oos.writeObject(WarriorAnt.chunksHome); oos.writeObject(ConnectionAntPanel.lastRoutingPoint); oos.writeInt(ConnectionAntPanel.lastRoutingPointPort); oos.writeObject(ConnectionAntPanel.ircServer); oos.writeInt(ConnectionAntPanel.ircPort); oos.writeObject(ConnectionAntPanel.ircChannel); oos.writeObject(ConnectionAntPanel.nick); oos.writeBoolean(ConnectionAntPanel.autoReconnectIRC); oos.writeBoolean(ConnectionAntPanel.searchPeersOnIRC); oos.writeObject(WarriorAnt.password); oos.writeBoolean(this.jCheckBox2.isSelected()); if (this.jCheckBox2.isSelected()) { oos.writeObject(this.caller.cap.getLocalStringAddress()); } oos.writeBoolean(this.jCheckBox1.isSelected()); oos.writeBoolean(WarriorAnt.autoresumeFilesOnRun); oos.writeObject(WarriorAnt.getHttpServerHomePage()); oos.writeObject(WarriorAnt.getHttpServerDescription()); oos.writeInt(WarriorAnt.getHttpLocalServerPort()); oos.writeInt(WarriorAnt.getHttpProxyPort()); oos.writeBoolean(WarriorAnt.isHttpEnabled()); oos.writeObject(HttpAntPanel.browserPath); oos.writeObject(this.caller.cap.jTextField3.getText()); oos.writeInt(DownloadAntPanel.maxConcurrentDownloads); oos.writeBoolean(BackgroundEngine.recursiveExplore); oos.writeObject(SettingsAntPanel.lookAndFeel); oos.writeInt(BackgroundEngine.maxRemoteDocsToTrace); oos.writeBoolean(QueryLinksDaemon.monitorClipboard); oos.writeObject(SettingsAntPanel.currentLanguage); oos.writeInt(NeighbourAnt.bandwidthLimit); oos.writeBoolean(ConnectionManager.publishIpOnGWebCache); oos.writeBoolean(ConnectionManager.searchIpOnGWebCache); oos.writeBoolean(BackgroundEngine.shareDownloadPath); oos.writeBoolean(Ant.proxied); if (Ant.proxied) { oos.writeObject(InetAddress.getByName(System.getProperty( "https.proxyHost"))); oos.writeInt(Integer.parseInt(System.getProperty("https.proxyPort"))); } oos.writeBoolean(this.caller.cap.jCheckBox4.isSelected()); oos.close(); } catch (Exception e) { _logger.error("", e); try { if (oos != null) { oos.close(); } } catch (IOException ioe) {} } } public String getIrcPassword() { return this.jPasswordField1.getText(); } public void loadIrcServers() { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(servers.openStream())); String line = reader.readLine(); while (!line.equals("[servers]")) { line = reader.readLine(); } line = reader.readLine(); while (! (line.indexOf("[") >= 0 && line.indexOf("]") >= 0)) { if (!line.equals("")) { line = line.substring(line.indexOf(":") + 1, line.length()); line = line.substring(line.indexOf(":") + 1, line.length()); line = line.substring(0, line.indexOf(":")); this.jComboBox2.addItem(line); } line = reader.readLine(); } } catch (Exception e) { try { reader.close(); } catch (Exception ex) {} _logger.error("IRC Server file not found"); } } public void loadSettings() { ObjectInputStream ois = null; try { ois = new ObjectInputStream(new FileInputStream(settings)); String settingsVersion = (String) ois.readObject(); if (!Ant.getVersion().equals(settingsVersion)) { _logger.warn( "Non static settings file does not match ANts version: partial settings loaded"); } WarriorAnt.maxPullRequestsToServe = ois.readInt(); WarriorAnt.maxSecureConnections = ois.readInt(); WarriorAnt.blockSizeInDownload = ois.readInt(); MultipleSourcesDownloadManager.blocksPerSource = ois.readInt(); MultipleSourcesDownloadManager.MaxSources = ois.readInt(); WarriorAnt.ConnectionType = (String) ois.readObject(); Ant.maxNeighbours = ois.readInt(); WarriorAnt.downloadPath = (String) ois.readObject(); WarriorAnt.chunksHome = (String) ois.readObject(); ConnectionAntPanel.lastRoutingPoint = (String) ois.readObject(); caller.cap.jTextField5.setText(ConnectionAntPanel.lastRoutingPoint); ConnectionAntPanel.lastRoutingPointPort = ois.readInt(); caller.cap.jTextField6.setText(ConnectionAntPanel.lastRoutingPointPort + ""); ConnectionAntPanel.ircServer = (String) ois.readObject(); this.jComboBox2.setSelectedItem(ConnectionAntPanel.ircServer); ConnectionAntPanel.ircPort = ois.readInt(); this.jTextField4.setText(ConnectionAntPanel.ircPort + ""); ConnectionAntPanel.ircChannel = (String) ois.readObject(); this.jTextField5.setText(ConnectionAntPanel.ircChannel + ""); ConnectionAntPanel.nick = (String) ois.readObject(); this.caller.cap.jTextField4.setText(ConnectionAntPanel.nick); ConnectionAntPanel.autoReconnectIRC = ois.readBoolean(); ConnectionAntPanel.searchPeersOnIRC = ois.readBoolean(); WarriorAnt.password = (String) ois.readObject(); this.jTextField3.setText(WarriorAnt.password); this.jCheckBox2.setSelected(ois.readBoolean()); if (this.jCheckBox2.isSelected()) { this.caller.cap.localStringAddress = (String) ois.readObject(); } this.jCheckBox1.setSelected(ois.readBoolean()); WarriorAnt.autoresumeFilesOnRun = ois.readBoolean(); WarriorAnt.setHttpServerProperties( (String) ois.readObject(), (String) ois.readObject()); WarriorAnt.setHttpLocalServerPort(ois.readInt()); WarriorAnt.setHttpProxyPort(ois.readInt()); WarriorAnt.httpEnabled(ois.readBoolean()); HttpAntPanel.browserPath = (String) ois.readObject(); this.caller.cap.jTextField3.setText( (String) ois.readObject()); DownloadAntPanel.maxConcurrentDownloads = ois.readInt(); BackgroundEngine.recursiveExplore = ois.readBoolean(); SettingsAntPanel.lookAndFeel = (String) ois.readObject(); BackgroundEngine.maxRemoteDocsToTrace = ois.readInt(); QueryLinksDaemon.monitorClipboard = ois.readBoolean(); SettingsAntPanel.currentLanguage = (String) ois.readObject(); NeighbourAnt.bandwidthLimit = ois.readInt(); ConnectionManager.publishIpOnGWebCache = ois.readBoolean(); ConnectionManager.searchIpOnGWebCache = ois.readBoolean(); ois.readBoolean(); boolean proxy = ois.readBoolean(); if (proxy) { ois.readObject(); ois.readInt(); } this.caller.cap.jCheckBox4.setSelected(ois.readBoolean()); ois.close(); } catch (Exception e) { _logger.error("Error in loading settings", e); try { ois.close(); } catch (IOException ioe) {} } } public static void askForLanguage() { final JFrame languageDialog = new JFrame(ji.JI.i("ANts setup")); SettingsAntPanel.setLookAndFeel(languageDialog); languageDialog.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER)); languageDialog.getContentPane().add(new JLabel(ji.JI.i( "Select ANts language: "))); final JComboBox jComboBox = new JComboBox(ji.JI.getAvaiableLanguages()); jComboBox.setSelectedItem(SettingsAntPanel.currentLanguage); jComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (jComboBox.getSelectedItem() != null && currentLanguage != null && ! ( (String) jComboBox.getSelectedItem()).equals(currentLanguage)) { currentLanguage = (String) jComboBox.getSelectedItem(); ji.JI.setCurrentLanguage( (String) jComboBox.getSelectedItem()); } } }); languageDialog.getContentPane().add(jComboBox); JButton confirmConnection = new JButton(ji.JI.i("Ok")); confirmConnection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { languageDialog.setVisible(false); } }); languageDialog.getContentPane().add(confirmConnection); languageDialog.pack(); languageDialog.setLocation(300, 300); SettingsAntPanel.setLookAndFeel(languageDialog); languageDialog.setVisible(true); while (languageDialog.isVisible()) { try { Thread.currentThread().sleep(1000); } catch (InterruptedException ex1) { } } } public static void loadStaticSettings() { if (!settings.exists()) { askForLanguage(); return; } ObjectInputStream ois = null; try { ois = new ObjectInputStream(new FileInputStream(settings)); String settingsVersion = (String) ois.readObject(); if (!Ant.getVersion().equals(settingsVersion)) { String releaseMessage = "CHaNGe LoG\n" + "File chunks modified. Please FULLY reinstall ANTs,\n" + "remove the main ANts directory and\n" + "every partially downloaded file.\n"; JOptionPane.showMessageDialog(null, releaseMessage, "Release Notice", JOptionPane.INFORMATION_MESSAGE); _logger.warn( "Static settings file does not match ANts version: partial settings loaded"); com.limegroup.gnutella.bootstrap.BootstrapServerManager.bootstrapServers.delete(); //ois.close(); //settings.delete(); System.exit(-1); return; } WarriorAnt.maxPullRequestsToServe = ois.readInt(); WarriorAnt.maxSecureConnections = ois.readInt(); WarriorAnt.blockSizeInDownload = ois.readInt(); MultipleSourcesDownloadManager.blocksPerSource = ois.readInt(); MultipleSourcesDownloadManager.MaxSources = ois.readInt(); WarriorAnt.ConnectionType = (String) ois.readObject(); Ant.maxNeighbours = ois.readInt(); WarriorAnt.downloadPath = (String) ois.readObject(); WarriorAnt.chunksHome = (String) ois.readObject(); ConnectionAntPanel.lastRoutingPoint = (String) ois.readObject(); ConnectionAntPanel.lastRoutingPointPort = ois.readInt(); ConnectionAntPanel.ircServer = (String) ois.readObject(); ConnectionAntPanel.ircPort = ois.readInt(); ConnectionAntPanel.ircChannel = (String) ois.readObject(); ConnectionAntPanel.nick = (String) ois.readObject(); ConnectionAntPanel.autoReconnectIRC = ois.readBoolean(); ConnectionAntPanel.searchPeersOnIRC = ois.readBoolean(); WarriorAnt.password = (String) ois.readObject(); if (ois.readBoolean()) { ois.readObject(); } ois.readBoolean(); WarriorAnt.autoresumeFilesOnRun = ois.readBoolean(); WarriorAnt.setHttpServerProperties( (String) ois.readObject(), (String) ois.readObject()); WarriorAnt.setHttpLocalServerPort(ois.readInt()); WarriorAnt.setHttpProxyPort(ois.readInt()); WarriorAnt.httpEnabled(ois.readBoolean()); HttpAntPanel.browserPath = (String) ois.readObject(); ois.readObject(); DownloadAntPanel.maxConcurrentDownloads = ois.readInt(); BackgroundEngine.recursiveExplore = ois.readBoolean(); SettingsAntPanel.lookAndFeel = (String) ois.readObject(); BackgroundEngine.maxRemoteDocsToTrace = ois.readInt(); QueryLinksDaemon.monitorClipboard = ois.readBoolean(); SettingsAntPanel.currentLanguage = (String) ois.readObject(); NeighbourAnt.bandwidthLimit = ois.readInt(); ois.readBoolean(); ois.readBoolean(); BackgroundEngine.shareDownloadPath = ois.readBoolean(); boolean proxy = ois.readBoolean(); if (proxy) { InetAddress proxyAddress = (InetAddress) ois.readObject(); int port = ois.readInt(); Ant.setProxied(proxyAddress, port); } ois.readBoolean(); ois.close(); } catch (Exception e) { _logger.error("Error in loading settings", e); try { ois.close(); } catch (IOException ioe) {} } } void jComboBox1_actionPerformed(ActionEvent e) { WarriorAnt.ConnectionType = (String) jComboBox1.getSelectedItem(); if (jComboBox1.getSelectedItem().equals("LAN or Fiber Net")) { /* WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 20); MultipleSourcesDownloadManager.blocksPerSource = 5; MultipleSourcesDownloadManager.MaxSources = 20; this.storeSettings(); */ WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(10 * 1024); this.jSlider7.setValue(10 * 1024); this.jSlider5.setValue(4); this.jSlider2.setValue(2); //this.jSlider1.setValue(1); this.jSlider1.setValue(50); this.storeSettings(); jComboBox1.setSelectedItem("56K"); } else if (jComboBox1.getSelectedItem().equals("LAN T1")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(10 * 1024); this.jSlider7.setValue(5 * 1024); this.jSlider6.setValue(100000); this.jSlider5.setValue(100); this.jSlider2.setValue(40); //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 29); this.jSlider1.setValue(30); this.storeSettings(); } else if (jComboBox1.getSelectedItem().equals("LAN T2")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(5 * 1024); this.jSlider7.setValue(2 * 1024); this.jSlider6.setValue(100000); this.jSlider5.setValue(50); this.jSlider2.setValue(30); //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 17); this.jSlider1.setValue(30); this.storeSettings(); } else if (jComboBox1.getSelectedItem().equals("LAN T3")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(2 * 1024); this.jSlider7.setValue(1024); this.jSlider6.setValue(70000); this.jSlider5.setValue(30); this.jSlider2.setValue(20); //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 17); this.jSlider1.setValue(30); this.storeSettings(); } else if (jComboBox1.getSelectedItem().equals("CABLE")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(1024); this.jSlider7.setValue(500); this.jSlider6.setValue(50000); this.jSlider5.setValue(15); this.jSlider2.setValue(10); //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) * 2 + 11); this.jSlider1.setValue(20); this.storeSettings(); } else if (jComboBox1.getSelectedItem().equals("DSL")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(100); this.jSlider7.setValue(30); this.jSlider6.setValue(10000); this.jSlider5.setValue(10); this.jSlider2.setValue(5); //this.jSlider1.setValue( ( (int) Math.floor(Math.random() * 2)) + 5); this.jSlider1.setValue(15); this.storeSettings(); } else if (jComboBox1.getSelectedItem().equals("ISDN")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(20); this.jSlider6.setValue(10000); this.jSlider7.setValue(10); this.jSlider5.setValue(6); this.jSlider2.setValue(3); //this.jSlider1.setValue(1); this.jSlider1.setValue(10); this.storeSettings(); } else if (jComboBox1.getSelectedItem().equals("56K")) { WarriorAnt.blockSizeInDownload = (int) Math.pow(2, 19); MultipleSourcesDownloadManager.blocksPerSource = PartialFile.computeGroupFactor(WarriorAnt.blockSizeInDownload); this.jSlider7.setMaximum(10); this.jSlider7.setValue(5); this.jSlider6.setValue(10000); this.jSlider5.setValue(4); this.jSlider2.setValue(2); //this.jSlider1.setValue(1); this.jSlider1.setValue(10); this.storeSettings(); } } void jSlider1_stateChanged(ChangeEvent e) { this.jLabel4.setText(ji.JI.i("Max neighbours number") + ": " + jSlider1.getValue()); Ant.maxNeighbours = this.jSlider1.getValue(); if (FrameAnt.getInstance(null).getGuiAnt() != null && FrameAnt.getInstance(null).getGuiAnt().getConnectionAntPanel() != null && FrameAnt.getInstance(null).getGuiAnt().getConnectionAntPanel(). connectionManager != null) { FrameAnt.getInstance(null).getGuiAnt().getConnectionAntPanel(). connectionManager.resume(); } this.storeSettings(); } void jButton1_actionPerformed(ActionEvent e) { JFileChooser jfc = new JFileChooser(); jfc.setMultiSelectionEnabled(false); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = jfc.showDialog(this, ji.JI.i("Select Directory")); if (returnVal == JFileChooser.APPROVE_OPTION) { File downloadTo = jfc.getSelectedFile(); int length = downloadTo.getAbsolutePath().length(); if (downloadTo.getAbsolutePath().charAt(length - 1) == '\\' || downloadTo.getAbsolutePath().charAt(length - 1) == '/') { WarriorAnt.downloadPath = downloadTo.getAbsolutePath(); this.jLabel5.setText(ji.JI.i("Download path") + ": " + WarriorAnt.downloadPath); this.storeSettings(); } else { WarriorAnt.downloadPath = downloadTo.getAbsolutePath() + "/"; this.jLabel5.setText(ji.JI.i("Download path") + ": " + WarriorAnt.downloadPath); this.storeSettings(); } } } void jTextField5_focusLost(FocusEvent e) { ConnectionAntPanel.ircChannel = this.jTextField5.getText(); this.storeSettings(); } void jComboBox2_actionPerformed(ActionEvent e) { try { if (! ( (String)this.jComboBox2.getSelectedItem()).equals("")) { //InetAddress.getByName(((String)this.jComboBox2.getSelectedItem())).getHostAddress(); ConnectionAntPanel.ircServer = ( (String)this.jComboBox2. getSelectedItem()); ConnectionAntPanel.ircPort = Integer.parseInt(this.jTextField4.getText()); } else { ConnectionAntPanel.ircServer = ""; this.jComboBox2.setSelectedItem(""); ConnectionAntPanel.ircPort = 6666; this.jTextField4.setText(6666 + ""); } this.storeSettings(); } catch (Exception ex) { ConnectionAntPanel.ircServer = ""; this.jComboBox2.setSelectedItem(""); ConnectionAntPanel.ircPort = 6666; this.jTextField4.setText(6666 + ""); } } public void setIrcConnected(boolean val) { if (val) { this.jTextField5.setEnabled(false); this.jComboBox2.setEnabled(false); this.jButton2.setText(ji.JI.i("Disconnect")); this.jButton2.setEnabled(true); } else { if (this.caller.cap != null && this.caller.cap.ircBot != null) { ChatAntPanel chatPanel = this.caller.cap.ircBot.getChatPanel(); if (chatPanel != null) { chatPanel.setChannel(ji.JI.i("Channel") + ": "); //this.caller.cap.setIrcUsersNumberInChannel( -1, ""); this.caller.getTabbedPane().remove(chatPanel); chatPanel.setUserList(null); chatPanel = null; } for (int x = this.caller.getTabbedPane().getComponentCount() - 1; x >= 0; x--) { if (this.caller.getTabbedPane().getComponentAt(x) instanceof ChatAntPanel) { this.caller.getTabbedPane().remove(x); } } } this.jTextField5.setEnabled(true); this.jComboBox2.setEnabled(true); this.jButton2.setText(ji.JI.i("Connect")); if (this.caller.cap != null && this.caller.cap.warriorAnt != null) { this.jButton2.setEnabled(!this.caller.cap.warriorAnt.isDisconnected()); } } } public void setIrcEnabled(boolean val) { this.caller.cap.jButton9.setEnabled(val); } public boolean autoStartANts() { return this.jCheckBox1.isSelected(); } public boolean autoResumeOnRun() { return this.jCheckBox4.isSelected(); } void jButton2_actionPerformed(ActionEvent e) { if (this.jButton2.getText().equals(ji.JI.i("Connect"))) { try { this.jButton2.setEnabled(false); if (this.caller.cap.ircBot != null) { this.caller.cap.ircBot.shutdown(); } /* IrcBot Setup*/ if (!ConnectionAntPanel.ircServer.equals("")) { this.caller.cap.ircBot = new IrcBot(ConnectionAntPanel.nick, this.caller.cap); String password = this.jPasswordField1.getText(); if (!password.equals("")) { this.caller.cap.ircBot.connect(ConnectionAntPanel.ircServer, 6667, password); } else { this.caller.cap.ircBot.connect(ConnectionAntPanel.ircServer); } Thread.sleep(2000); this.caller.cap.ircBot.joinChannel(ConnectionAntPanel.ircChannel); Thread.sleep(3000); this.caller.cap.ircBot.refreshUsers(ConnectionAntPanel.ircChannel); //this.caller.cap.jButton9.setEnabled(true); //this.setIrcEnabled(true); //this.setIrcConnected(true); if (!this.caller.cap.isFirewallChecked()) { this.caller.cap.jLabel23.setText(ji.JI.i( "Your firewall is being probed...")); } } /*Fine IrcBot setup*/ this.jButton2.setEnabled(true); } catch (Exception ex) { this.setIrcConnected(false); this.setIrcEnabled(false); _logger.error("IRC not started: " + ex.getMessage()); if (ex.getMessage().toLowerCase().indexOf("nickname is already in use") >= 0) { JOptionPane.showMessageDialog(this, ji.JI.i("Nickname is already in use"), ji.JI.i("Error in starting IRC"), JOptionPane.ERROR_MESSAGE); } this.jButton2.setEnabled(true); final SwingWorker worker = new SwingWorker() { public Object construct() { caller.cap.ircBot.autoReconnect(); return null; } }; worker.start(); } } else { try { this.jButton2.setEnabled(false); if (this.caller.cap.ircBot != null) { this.caller.cap.ircBot.shutdown(); } this.setIrcEnabled(false); this.setIrcConnected(false); this.jButton2.setEnabled(true); } catch (Exception ex) { this.jButton2.setEnabled(true); _logger.error("Error in IRC swithcing", ex); } } } public void paintComponent(Graphics g) { super.paintComponent(g); if (buffer != null) { int posX = (this.getWidth() - 650) / 2; int posY = (this.getHeight() - 550) / 2; if (posX < 0) { posX = 0; } if (posY < 0) { posY = 0; } g.drawImage(buffer, posX, posY, this); } } void jTextField3_focusLost(FocusEvent e) { WarriorAnt.password = this.jTextField3.getText(); this.storeSettings(); } public void addNATInetaddress(InetAddress nat) { for(int x = 0; x < this.jComboBox3.getItemCount(); x++){ if(this.jComboBox3.getItemAt(x).toString().equals(nat.toString())){ if(this.jComboBox3.getSelectedIndex() != x){ this.jComboBox3.setSelectedIndex(x); } return; } } this.jComboBox3.addItem(nat); this.jComboBox3.setSelectedItem(nat); } public void resetInetaddress() { try { if(ants.p2p.utils.net.UPnPManager.instance().mappingsExist()) return; this.caller.cap.localStringAddress = null; InetAddress[] addressList = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName()); this.jComboBox3.removeAllItems(); for (int h = 0; h < addressList.length; h++) { this.jComboBox3.addItem(addressList[h]); } boolean found = false; for (int x = 0; x < this.jComboBox3.getItemCount(); x++) { if ( ( ( (InetAddress)this.jComboBox3.getItemAt(x)).getHostAddress()).equals(this.caller.cap.getLocalStringAddress())) { found = true; } } if (!found) { InetAddress address = this.caller.cap.getLocalInetAddress(); this.jComboBox3.addItem(address); this.jComboBox3.setSelectedItem(address); } } catch (Exception ex) { _logger.error("Not a valid IP address in settings panel field", ex); } } void jButton3_actionPerformed(ActionEvent e) { this.resetInetaddress(); } void jComboBox3_actionPerformed(ActionEvent e) { try { if (this.jComboBox3.getSelectedItem() == null) { return; } else if (this.jComboBox3.getSelectedItem() instanceof String) { InetAddress address = InetAddress.getByName( (String)this.jComboBox3.getSelectedItem()); this.caller.cap.localStringAddress = (String)this.jComboBox3.getSelectedItem(); if(this.caller.cap.warriorAnt != null) this.caller.cap.warriorAnt.setLocalInetAddress((String)this.jComboBox3.getSelectedItem()); boolean found = false; for (int x = 0; x < this.jComboBox3.getItemCount(); x++) { if (this.jComboBox3.getItemAt(x).equals(address)) { found = true; break; } } if (!found) { this.jComboBox3.addItem(address); } this.caller.cap.jLabel9.setText("IP: " + this.caller.cap.localStringAddress); this.storeSettings(); } else if (this.jComboBox3.getSelectedItem() instanceof InetAddress) { this.caller.cap.localStringAddress = ( (InetAddress)this.jComboBox3. getSelectedItem()).getHostAddress(); if(this.caller.cap.warriorAnt != null) this.caller.cap.warriorAnt.setLocalInetAddress((String)this.jComboBox3.getSelectedItem()); this.caller.cap.jLabel9.setText("IP: " + this.caller.cap.localStringAddress); this.storeSettings(); } else { throw new Exception("Not a valid IP address in settings panel field"); } } catch (Exception ex) { JOptionPane.showMessageDialog(this, ji.JI.i("Not a valid IP address typed: ") + this.jComboBox3.getSelectedItem() + ji.JI.i("\nthe address must be like xxx.xxx.xxx.xxx\nor a host address address.myhost.net"), ji.JI.i("Address error"), JOptionPane.ERROR_MESSAGE); this.jComboBox3.setSelectedItem(this.caller.cap.getLocalInetAddress()); _logger.error("Not a valid IP address in settings panel field", ex); } } void jCheckBox2_actionPerformed(ActionEvent e) { this.storeSettings(); } void jCheckBox1_actionPerformed(ActionEvent e) { this.storeSettings(); } void jCheckBox3_actionPerformed(ActionEvent e) { ConnectionAntPanel.autoReconnectIRC = this.jCheckBox3.isSelected(); this.storeSettings(); } void jCheckBox4_actionPerformed(ActionEvent e) { WarriorAnt.autoresumeFilesOnRun = jCheckBox4.isSelected(); this.storeSettings(); } void jCheckBox5_actionPerformed(ActionEvent e) { ConnectionAntPanel.searchPeersOnIRC = this.jCheckBox5.isSelected(); this.storeSettings(); } void jButton4_actionPerformed(ActionEvent e) { JFileChooser jfc = new JFileChooser(); jfc.setMultiSelectionEnabled(false); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = jfc.showDialog(this, ji.JI.i("Select Directory")); if (returnVal == JFileChooser.APPROVE_OPTION) { File downloadTo = jfc.getSelectedFile(); int length = downloadTo.getAbsolutePath().length(); if (downloadTo.getAbsolutePath().charAt(length - 1) == '\\' || downloadTo.getAbsolutePath().charAt(length - 1) == '/') { WarriorAnt.chunksHome = downloadTo.getAbsolutePath(); if (this.caller.dap != null) { this.caller.dap.loadInterrupted(); } this.jLabel7.setText(ji.JI.i("Chuncks Home") + ": " + WarriorAnt.chunksHome); this.storeSettings(); } else { WarriorAnt.chunksHome = downloadTo.getAbsolutePath() + "/"; if (this.caller.dap != null) { this.caller.dap.loadInterrupted(); } this.jLabel7.setText(ji.JI.i("Chuncks Home") + ": " + WarriorAnt.chunksHome); this.storeSettings(); } } } void jSlider2_stateChanged(ChangeEvent e) { this.jLabel12.setText(ji.JI.i("Max sources per download") + ": " + jSlider2.getValue()); MultipleSourcesDownloadManager.MaxSources = this.jSlider2.getValue(); this.storeSettings(); } void jTextArea1_focusLost(FocusEvent e) { WarriorAnt.setHttpServerProperties(this.jTextField6.getText(), this.jTextArea1.getText()); this.storeSettings(); } void jTextField6_focusLost(FocusEvent e) { WarriorAnt.setHttpServerProperties(this.jTextField6.getText(), this.jTextArea1.getText()); this.storeSettings(); } void jTextField7_focusLost(FocusEvent e) { try { int port = Integer.parseInt(this.jTextField7.getText()); WarriorAnt.setHttpLocalServerPort(port); this.storeSettings(); } catch (Exception ex) { jTextField7.setText(WarriorAnt.getHttpLocalServerPort() + ""); } } public void jCheckBox6_check() { this.jTextField7.setEnabled(jCheckBox6.isSelected()); this.jTextField6.setEnabled(jCheckBox6.isSelected()); this.jTextField8.setEnabled(jCheckBox6.isSelected()); this.jTextArea1.setEnabled(jCheckBox6.isSelected()); } void jCheckBox6_actionPerformed(ActionEvent e) { this.jCheckBox6_check(); WarriorAnt.httpEnabled(jCheckBox6.isSelected()); this.storeSettings(); } void jTextField8_focusLost(FocusEvent e) { try { int port = Integer.parseInt(this.jTextField8.getText()); WarriorAnt.setHttpProxyPort(port); this.storeSettings(); } catch (Exception ex) { jTextField8.setText(WarriorAnt.getHttpProxyPort() + ""); } } void jButton5_actionPerformed(ActionEvent e) { JFileChooser jfc = new JFileChooser(); jfc.setMultiSelectionEnabled(false); int returnVal = jfc.showDialog(this, ji.JI.i("Select Browser")); if (returnVal == JFileChooser.APPROVE_OPTION) { File browser = jfc.getSelectedFile(); HttpAntPanel.browserPath = browser.getAbsolutePath(); this.jLabel16.setText(ji.JI.i("Browser") + ": " + HttpAntPanel.browserPath); this.storeSettings(); } } void jSlider3_stateChanged(ChangeEvent e) { if (jSlider3.getValue() > 0) { this.jLabel17.setText(ji.JI.i("Max concurrent downloads") + ": " + jSlider3.getValue()); } else { this.jLabel17.setText(ji.JI.i("Max concurrent downloads: inf")); } DownloadAntPanel.maxConcurrentDownloads = this.jSlider3.getValue(); this.storeSettings(); } void jSlider5_stateChanged(ChangeEvent e) { WarriorAnt.maxPullRequestsToServe = jSlider5.getValue(); this.jLabel1.setText(ji.JI.i("Max download requests to serve") + ": " + WarriorAnt.maxPullRequestsToServe); this.storeSettings(); } void jSlider4_stateChanged(ChangeEvent e) { WarriorAnt.maxSecureConnections = jSlider4.getValue(); this.jLabel2.setText(ji.JI.i("Max allowed secure connections") + ": " + WarriorAnt.maxSecureConnections); this.storeSettings(); } public static void setLookAndFeel() { try { String lnfName = UIManager.getCrossPlatformLookAndFeelClassName(); if (SettingsAntPanel.lookAndFeel.equals("Liquid")) { lnfName = "com.birosoft.liquid.LiquidLookAndFeel"; } else if (SettingsAntPanel.lookAndFeel.equals("Java")) { lnfName = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (SettingsAntPanel.lookAndFeel.equals("System")) { lnfName = UIManager.getSystemLookAndFeelClassName(); } else if (SettingsAntPanel.lookAndFeel.equals("Napkin")) { lnfName = "napkin.NapkinLookAndFeel"; } else if (SettingsAntPanel.lookAndFeel.equals("Trendy")) { lnfName = "com.Trendy.swing.plaf.TrendyLookAndFeel"; } UIManager.setLookAndFeel(lnfName); } catch (Exception ex) { _logger.error("Error in setting L&F", ex); } } public static void setLookAndFeel(FrameAnt frame) { try { String lnfName = UIManager.getCrossPlatformLookAndFeelClassName(); if (SettingsAntPanel.lookAndFeel.equals("Liquid")) { lnfName = "com.birosoft.liquid.LiquidLookAndFeel"; } else if (SettingsAntPanel.lookAndFeel.equals("Java")) { lnfName = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (SettingsAntPanel.lookAndFeel.equals("System")) { lnfName = UIManager.getSystemLookAndFeelClassName(); } else if (SettingsAntPanel.lookAndFeel.equals("Napkin")) { lnfName = "napkin.NapkinLookAndFeel"; } else if (SettingsAntPanel.lookAndFeel.equals("Trendy")) { lnfName = "com.Trendy.swing.plaf.TrendyLookAndFeel"; } UIManager.setLookAndFeel(lnfName); if (!System.getProperty("java.version").startsWith("1.5")) { SwingUtilities.updateComponentTreeUI(frame); } SwingUtilities.updateComponentTreeUI(frame.ga); SwingUtilities.updateComponentTreeUI(frame.ga.settingsScrollPane); SwingUtilities.updateComponentTreeUI(frame.ga.dsap); SwingUtilities.updateComponentTreeUI(frame.ga.shareap); frame.ga.shareap.sharedFilesTable.getTableHeader().updateUI(); } catch (Exception ex) { _logger.error("Error in setting L&F", ex); } } public static void setLookAndFeel(JFrame frame) { try { String lnfName = UIManager.getCrossPlatformLookAndFeelClassName(); if (SettingsAntPanel.lookAndFeel.equals("Liquid")) { lnfName = "com.birosoft.liquid.LiquidLookAndFeel"; } else if (SettingsAntPanel.lookAndFeel.equals("Java")) { lnfName = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (SettingsAntPanel.lookAndFeel.equals("System")) { lnfName = UIManager.getSystemLookAndFeelClassName(); } else if (SettingsAntPanel.lookAndFeel.equals("Napkin")) { lnfName = "napkin.NapkinLookAndFeel"; } else if (SettingsAntPanel.lookAndFeel.equals("Trendy")) { lnfName = "com.Trendy.swing.plaf.TrendyLookAndFeel"; } UIManager.setLookAndFeel(lnfName); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception ex) { _logger.error("Error in setting L&F", ex); } } void jComboBox4_actionPerformed(ActionEvent e) { SettingsAntPanel.lookAndFeel = (String)this.jComboBox4.getSelectedItem(); SettingsAntPanel.setLookAndFeel(FrameAnt.getInstance(null)); this.storeSettings(); } void jSlider6_stateChanged(ChangeEvent e) { BackgroundEngine.maxRemoteDocsToTrace = this.jSlider6.getValue(); this.jLabel19.setText(ji.JI.i("Remote indexing cache") + ": " + this.jSlider6.getValue()); jSlider6.setToolTipText(ji.JI.i("<html><body>This is the amount of file locally cached<br>in order to speed up yours<br>" + "and others' searches: " + this.jSlider6.getValue() + " files</body></html>")); this.storeSettings(); } void jButton6_actionPerformed(ActionEvent e) { this.caller.getTabbedPane().remove(this.caller.settingsScrollPane); } void jCheckBox7_actionPerformed(ActionEvent e) { QueryLinksDaemon.monitorClipboard = this.jCheckBox7.isSelected(); this.storeSettings(); } void jComboBox5_actionPerformed(ActionEvent e) { if ( (String) jComboBox5.getSelectedItem() != null && currentLanguage != null && ! ( (String) jComboBox5.getSelectedItem()).equals(currentLanguage)) { currentLanguage = (String) jComboBox5.getSelectedItem(); ji.JI.setCurrentLanguage( (String) jComboBox5.getSelectedItem()); this.storeSettings(); JOptionPane.showMessageDialog(this, ji.JI.i( "You need to restart ANts for the modifies to take place!"), ji.JI.i("ANts P2P"), JOptionPane.PLAIN_MESSAGE); } } void jButton7_actionPerformed(ActionEvent e) { ji.JI.getInstance().downloadTranslationsAndReload(); this.jComboBox5.setModel(new DefaultComboBoxModel(ji.JI. getAvaiableLanguages())); this.jComboBox5.setSelectedItem(SettingsAntPanel.currentLanguage); } void jButton8_actionPerformed(ActionEvent e) { int rv = JOptionPane.showConfirmDialog(this, ji.JI.i( "The process can take long and cannot be interrupted!"), ji.JI.i("Are you sure?"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (rv == JOptionPane.OK_OPTION) { try { BackgroundEngine.getInstance().synchronizeLocalIndex(true, false); } catch (Exception ex) { JOptionPane.showMessageDialog(this, ji.JI.i("Error"), ji.JI.i("Index optimization error"), JOptionPane.ERROR_MESSAGE); } } } void jSlider7_stateChanged(ChangeEvent e) { NeighbourAnt.bandwidthLimit = this.jSlider7.getValue() * 1024; this.jLabel21.setText(ji.JI.i("Upload Bandwidth") + ": " + this.jSlider7.getValue() * 8 + " Kbit/s"); this.storeSettings(); } void jCheckBox8_actionPerformed(ActionEvent e) { ConnectionManager.publishIpOnGWebCache = jCheckBox8.isSelected(); this.caller.cap.connectionManager.lastGWebCacheUpdate = 0; this.storeSettings(); } void jCheckBox9_actionPerformed(ActionEvent e) { ConnectionManager.searchIpOnGWebCache = jCheckBox9.isSelected(); this.storeSettings(); } } class SettingsAntPanel_jComboBox1_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jComboBox1_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jComboBox1_actionPerformed(e); } } class SettingsAntPanel_jSlider1_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider1_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider1_stateChanged(e); } } class SettingsAntPanel_jButton1_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton1_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); } } class SettingsAntPanel_jTextField3_focusAdapter extends java.awt.event.FocusAdapter { SettingsAntPanel adaptee; SettingsAntPanel_jTextField3_focusAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void focusLost(FocusEvent e) { adaptee.jTextField3_focusLost(e); } } class SettingsAntPanel_jTextField5_focusAdapter extends java.awt.event.FocusAdapter { SettingsAntPanel adaptee; SettingsAntPanel_jTextField5_focusAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void focusLost(FocusEvent e) { adaptee.jTextField5_focusLost(e); } } class SettingsAntPanel_jComboBox2_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jComboBox2_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jComboBox2_actionPerformed(e); } } class SettingsAntPanel_jButton2_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton2_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { final ActionEvent event = e; final SwingWorker worker = new SwingWorker() { public Object construct() { adaptee.jButton2_actionPerformed(event); return null; } }; worker.start(); } } class SettingsAntPanel_jButton3_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton3_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton3_actionPerformed(e); } } class SettingsAntPanel_jComboBox3_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jComboBox3_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jComboBox3_actionPerformed(e); } } class SettingsAntPanel_jCheckBox2_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox2_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox2_actionPerformed(e); } } class SettingsAntPanel_jCheckBox1_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox1_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox1_actionPerformed(e); } } class SettingsAntPanel_jCheckBox3_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox3_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox3_actionPerformed(e); } } class SettingsAntPanel_jCheckBox4_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox4_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox4_actionPerformed(e); } } class SettingsAntPanel_jCheckBox5_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox5_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox5_actionPerformed(e); } } class SettingsAntPanel_jButton4_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton4_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton4_actionPerformed(e); } } class SettingsAntPanel_jSlider2_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider2_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider2_stateChanged(e); } } class SettingsAntPanel_jTextArea1_focusAdapter extends java.awt.event.FocusAdapter { SettingsAntPanel adaptee; SettingsAntPanel_jTextArea1_focusAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void focusLost(FocusEvent e) { adaptee.jTextArea1_focusLost(e); } } class SettingsAntPanel_jTextField6_focusAdapter extends java.awt.event.FocusAdapter { SettingsAntPanel adaptee; SettingsAntPanel_jTextField6_focusAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void focusLost(FocusEvent e) { adaptee.jTextField6_focusLost(e); } } class SettingsAntPanel_jTextField7_focusAdapter extends java.awt.event.FocusAdapter { SettingsAntPanel adaptee; SettingsAntPanel_jTextField7_focusAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void focusLost(FocusEvent e) { adaptee.jTextField7_focusLost(e); } } class SettingsAntPanel_jCheckBox6_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox6_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox6_actionPerformed(e); } } class SettingsAntPanel_jTextField8_focusAdapter extends java.awt.event.FocusAdapter { SettingsAntPanel adaptee; SettingsAntPanel_jTextField8_focusAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void focusLost(FocusEvent e) { adaptee.jTextField8_focusLost(e); } } class SettingsAntPanel_jButton5_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton5_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton5_actionPerformed(e); } } class SettingsAntPanel_jSlider3_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider3_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider3_stateChanged(e); } } class SettingsAntPanel_jSlider5_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider5_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider5_stateChanged(e); } } class SettingsAntPanel_jSlider4_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider4_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider4_stateChanged(e); } } class SettingsAntPanel_jComboBox4_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jComboBox4_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jComboBox4_actionPerformed(e); } } class SettingsAntPanel_jSlider6_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider6_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider6_stateChanged(e); } } class SettingsAntPanel_jButton6_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton6_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton6_actionPerformed(e); } } class SettingsAntPanel_jCheckBox7_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox7_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox7_actionPerformed(e); } } class SettingsAntPanel_jComboBox5_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jComboBox5_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jComboBox5_actionPerformed(e); } } class SettingsAntPanel_jButton7_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton7_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton7_actionPerformed(e); } } class SettingsAntPanel_jButton8_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jButton8_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { final ActionEvent event = e; Thread runner = new Thread() { public void run() { adaptee.jButton8_actionPerformed(event); } }; runner.setPriority(1); runner.start(); } } class SettingsAntPanel_jSlider7_changeAdapter implements javax.swing.event.ChangeListener { SettingsAntPanel adaptee; SettingsAntPanel_jSlider7_changeAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void stateChanged(ChangeEvent e) { adaptee.jSlider7_stateChanged(e); } } class SettingsAntPanel_jCheckBox8_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox8_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox8_actionPerformed(e); } } class SettingsAntPanel_jCheckBox9_actionAdapter implements java.awt.event.ActionListener { SettingsAntPanel adaptee; SettingsAntPanel_jCheckBox9_actionAdapter(SettingsAntPanel adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCheckBox9_actionPerformed(e); } }

The table below shows all metrics for SettingsAntPanel.java.

MetricValueDescription
BLOCKS294.00Number of blocks
BLOCK_COMMENT 8.00Number of block comment lines
COMMENTS44.00Comment lines
COMMENT_DENSITY 0.03Comment density
COMPARISONS153.00Number of comparison operators
CYCLOMATIC275.00Cyclomatic complexity
DECL_COMMENTS20.00Comments in declarations
DOC_COMMENT 0.00Number of javadoc comment lines
ELOC1680.00Effective lines of code
EXEC_COMMENTS16.00Comments in executable code
EXITS218.00Procedure exits
FUNCTIONS131.00Number of function declarations
HALSTEAD_DIFFICULTY148.92Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY259.00Interface complexity
JAVA0001 1.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 1.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 1.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 3.00JAVA0007 Should not declare public field
JAVA0008 9.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA0034 3.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 0.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076474.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 4.00JAVA0079 Use of instance to reference static member
JAVA0080 1.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 5.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 1.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 0.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 0.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 0.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 5.00JAVA0116 Missing javadoc: field 'field'
JAVA011717.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 1.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 1.00JAVA0144 Line exceeds maximum M characters
JAVA0145 0.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 1.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA016620.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA017335.00JAVA0173 Unused method parameter
JAVA0174 1.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 1.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 0.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 3.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 3.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES2225.00Number of lines in the source file
LINE_COMMENT36.00Number of line comments
LOC2004.00Lines of code
LOGICAL_LINES1204.00Number of statements
LOOPS13.00Number of loops
NEST_DEPTH 5.00Maximum nesting depth
OPERANDS5918.00Number of operands
OPERATORS10607.00Number of operators
PARAMS116.00Number of formal parameter declarations
PROGRAM_LENGTH16525.00Halstead program length
PROGRAM_VOCAB1127.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS143.00Number of return points from functions
SIZE90470.00Size of the file in bytes
UNIQUE_OPERANDS1073.00Number of unique operands
UNIQUE_OPERATORS54.00Number of unique operators
WHITESPACE177.00Number of whitespace lines