STATIC REFERENCE

THE CODE IS ATTACHED. I NEED TO SOLVE THE ERROS.
THIS IS THE ERRORS AFTER COMPILE
C:\My Documents\Java\Assignment\Assign3\PwdClient.java:47: Can't make static reference to method void setLayout(java.awt.LayoutManager) in class java.awt.Container.
                    setLayout(new FlowLayout());
                    ^
C:\My Documents\Java\Assignment\Assign3\PwdClient.java:48: Can't make static reference to method void setBackground(java.awt.Color) in class java.awt.Component.
                    setBackground(Color.green);
                    ^
C:\My Documents\Java\Assignment\Assign3\PwdClient.java:53: Can't make static reference to method java.awt.Component add(java.awt.Component) in class java.awt.Container.
                    add(l);
                    ^
C:\My Documents\Java\Assignment\Assign3\PwdClient.java:58: Can't make static reference to method java.awt.Component add(java.awt.Component) in class java.awt.Container.
                    add(name);
                    ^
C:\My Documents\Java\Assignment\Assign3\PwdClient.java:61: Can't make a static reference to nonstatic variable tf_name in class PwdClient.
                    tf_name = new TextField(20);
                    ^
5 errors
//HERE IS THE CODE
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
class PwdClient extends Frame
     private TextField tf_name;
     private TextField tf_password;
     private String input_str_name;
     private String input_str_password;
     private String str_to_pass;
     //private String str;
     //private String str_name;
     //private String str_password;
     //private Button button1;
     private final static int buffsize = 512;
     public static void main(String args[])
          try
                    String server = args[0];
                    int port = Integer.parseInt(args[1]);
                    //create socket
                    Socket s = new Socket(server, port);
                    //readresult from server
                    InputStream is = s.getInputStream();
                    DataInputStream dis = new DataInputStream(is);
                    OutputStream os = s.getOutputStream();
                    DataOutputStream dos = new DataOutputStream(os);
                    InputStreamReader isr = new InputStreamReader(System.in);
                    BufferedReader br = new BufferedReader(isr);
                    //Frame frm = new Frame( "Client Server" );
                    setLayout(new FlowLayout());
                    setBackground(Color.green);
                    String str = "Enter Name and Password:";
                    Label l= new Label( str, Label.CENTER);
                    l.setBackground(Color.red);
                    add(l);
                    String str_name = "Name:";
                    Label name = new Label( str_name, Label.CENTER);
                    name.setBackground(Color.red);
                    add(name);
                    //Name textfield User input for name
                    tf_name = new TextField(20);
                    add(tf_name);
                    String str_password = "Password:";
                    Label password = new Label( str_password, Label.CENTER);
                    password.setBackground(Color.red);
                    add(password);
                    //Password Textfield (user input for password)
                    tf_password = new TextField(20);
                    tf_password.setEchoChar('*');
                    add(tf_password);
                    Button Button1 = new Button("Submit");
                    add(Button1);
                    Button1.addActionListener( new ActionListener()
                         public void actionPerformed(ActionEvent ae)
                              input_str_name = tf_name.getText();
                              tf_name.setText(new String(""));
                              input_str_password = tf_password.getText();
                              tf_password.setText(new String(""));
                              str_to_pass = input_str_name+"/"+input_str_password;
                              dos.writeBytes(str_to_pass);
                              String received_from_server = brr.readLine();
                              l.setText(received_from_server, Label.CENTER);
                    frm.setSize( 300, 200 );
                    frm.show();
                    frm.addWindowListener( new WindowAdapter()
                         public void windowClosing(WindowEvent e)
                         { System.exit(0);}
          }//closes the try
          catch(Exception e){}

Put the code you have in static main in a constructor, or make an instance of PwdClient in main that you can call those methods on. You can't call non-static methods directly from a static method (main). You need to instantiate the class.
public class PwdClient extends JFrame {
  public PwdClient() {
    // the code from your main method
  public static void main(String[] args) {
    new PwdClient(); // makes a new instance of PwdClient
}

Similar Messages

  • Open VI reference from a static reference

    Hello guys,
    To open VIs dynamically, instead of hardcoding the VI name in a string constant, I do this as shown below to keep a dependency to my VI, so if someone ever delete the VI from the project, move it, rename it, it will create a broken wire somewhere so we'll be able to fix it faster.
    However, don't you think it's a bit weird to have the reference to the VI already, but we need to open a new reference, is there a way to get rid of the property node to get the VI path? Is the static VI reference should be closed after the other reference is opened?
    Would it make sense to be able to right clic the static reference and specify the option to open a call and forget reference?
    Is there a better practice?
    Cheers,
    Solved!
    Go to Solution.

    From the LabVIEW help:
    vi path accepts a string containing the name of the VI that you want to reference or a path to the VI that you want to reference. If you wire a name string, the string must match the full delimited name of a VI in memory on that target. If you wire a path, LabVIEW searches for a VI in memory that you previously loaded from that path on the same target. If a matching VI is not found in memory, LabVIEW then tries to load the VI from that file on disk. An error occurs if LabVIEW cannot find the file or if the file conflicts with another VI in memory.
    So, basically, if you use the string, you load the VI in memory and get an error if not found.  If you use path, it will still use the VI in memory at that path, or attempt to load it.  In your case, it won't make much difference.  I typically use VI Name myself since I know it is in memory.

  • How do you make a static reference to a method?  I've included code.

    I'm sorry but this is a cross post. This should be here but it is also in the 100% pure Java forum. It won't happen again.
    Now...
    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{   
        static String sString = "TESTING";   
        public int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;      
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );   
    }Again, I apologize for the cross post.

    hi,
    this seems to be pretty easy, isn't it?
    Oh c'mon! You try to invoke a non-static method from within a static method. Solution: Create a specific instance of class testClass:
    testClass test=new testClass();
    test.add(3,4);best regards, Michael

  • Can't make static reference to method while it is static

    Hello, can somebody please help me with my problem. I created a jsp page wich includes a .java file I wrote. In this JSP I called a method in the class I created. It worked but when I made the method static and adjusted the calling of the method it started to complain while i didnt make an instance of the class. the error is:Can't make static reference to method
    here is the code for the class and jsp:
    public class PhoneCheckHelper {
    public static String checkPhoneNumber(String phoneNumber) {
    String newPhoneNumber ="";
    for(int i=0; i<phoneNumber.length(); i++) {
    char ch = phoneNumber.charAt(i);
    if(Character.isDigit(ch)) {
    newPhoneNumber += String.valueOf(ch);
    return newPhoneNumber;
    <html>
    <head>
    <title>phonecheck_handler jsp pagina</title>
    <%@page import="java.util.*,com.twofoldmedia.text.*, java.lang.*" %>
    </head>
    <body>
    <input type="text" value="<%= PhoneCheckHelper.checkPhoneNumber(request.getParameter("phonenumberfield")) %>">
    </body>
    </html>

    Go over to the "New to Java" forum where that message is frequently explained. Do a search if you don't see it in the first page of posts.

  • Can't make static reference to method

    hi all,
    pls help me in the code i'm getting
    " can't make static reference to method....."
    kindly help me
    the following code gives the error:
    import java.rmi.*;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.io.*;
    import java.io.IOException;
    import java.io.LineNumberReader;
    public class client
    static String vcno;
    static String vpin;
    static String vamt;
    static String vordid;
    static String vptype;
    //static String vreq;
    static String vreq = "1";
    static String vorgid;
    static String vm1;
    static String vs1;
    static String vqty1;
    static String vm2;
    static String vs2;
    static String vqty2;
    static String vm3;
    static String vs3;
    static String vqty3;
    static String vm4;
    static String vs4;
    static String vqty4;
    public static void main(String args[])
    try
    ServerIntf serverintf=(ServerIntf)Naming.lookup("rmi://shafeeq/server");
    int c;
    StringBuffer sb;
    FileReader f1=new FileReader("c:/testin.txt");
    sb=new StringBuffer();
    int line=0;
    while ((c=f1.read())!=-1) {
    sb.append((char)c);
    LineNumberReader inLines = new LineNumberReader(f1);
    String inputline;
    String test;
    while((inputline=inLines.readLine())!=null)
    line=inLines.getLineNumber();
    switch(line)
    case 1: {
    vcno = inLines.readLine();
    System.out.println(vcno);
    case 2: {
    vpin = inLines.readLine();
    System.out.println(vpin);
    case 3: {
    vptype = inLines.readLine();
    System.out.println(vptype);
    case 4: {
    vamt = inLines.readLine();
    System.out.println(vamt);
    case 5: {
    vordid = inLines.readLine();
    System.out.println(vordid);
    case 6: {
    vorgid = inLines.readLine();
    System.out.println(vorgid);
         case 7: {
    vm1 = inLines.readLine();
    System.out.println(vm1);
         case 8: {
    vs1 = inLines.readLine();
    System.out.println(vs1);
         case 9: {
    vqty1 = inLines.readLine();
    System.out.println(vqty1);
         case 10: {
    vm2 = inLines.readLine();
    System.out.println(vm2);
         case 11: {
    vs2 = inLines.readLine();
    System.out.println(vs2);
    case 12: {
    vqty2 = inLines.readLine();
    System.out.println(vqty2);
    case 13: {
    vm3 = inLines.readLine();
    System.out.println(vm3);
         case 14: {
    vs3 = inLines.readLine();
    System.out.println(vs3);
    case 15: {
    vqty3 = inLines.readLine();
    System.out.println(vqty3);
    case 16: {
    vm4 = inLines.readLine();
    System.out.println(vm4);
    case 17: {
    vs4 = inLines.readLine();
    System.out.println(vs4);
    case 18: {
    vqty4 = inLines.readLine();
    System.out.println(vqty4);
    f1.close();
    FileWriter f2=new FileWriter("c:/testout.txt");
    String t;
    t=ServerIntf.add(vcno,vpin,vamt,vordid,vptype,vreq,vorgid,vm1,vs1,vqty1,vm2,vs2, vqty2,vm3,vs3,vqty3,vm4,vs4,vqty4);
    String str1 = " >>";
    str1 = t + str1;
    f2.write(str1);
    System.out.println('\n'+"c:/testout.txt File updated");
    f2.close();
    catch(Exception e)
    System.out.println("Error " +e);

    Yes, ServerIntf is the interface type. The instance serverIntf. You declared it somewhere at the top of the routine.
    So what you must do is call t=serverIntf.add(...)This is probably just a mistype.

  • Static reference; how am I instantiating this incorrectly?

    Hi, all:
    I'm getting a static reference error, but I don't know how to fix it. I'm trying to generate a list of objects, and I can't tell where the problem is located. I've chopped all the irrelevant stuff out of this class so you can see what's going on:
    public class VonNeumannGridNet {
         public int nCols = -1;
         public int nNodes;
         public int nRows = -1;
         public int radius = -1;
         public ArrayList <Node> nodeList;
         public Class <Node> nodeClass;
         public Class <Edge> edgeClass;
         public VonNeumannGridNet ( Class<Node> node, Class <Edge> edge, int cols, int rows, int connectRadius) {
              nodeClass = node;
              edgeClass = edge;
              nCols = cols;
              nRows = rows;
              nNodes = nCols * nRows;
              radius = connectRadius;
         public ArrayList<Node> makeVonNeumannGridNet(Class<Node> node, Class<Edge> edge,
                   int cols, int rows, int connectRadius) throws IllegalAccessException, InstantiationException     {
              return nodeList;
         public static List <Node> makeVonNeumannGridNet(int cols, int rows, int connectRadius,
                   double rewireProb, Class <Node> node, Class <Edge> edge) {
              ArrayList <Node> list = makeVonNeumannGridNet(node, edge, cols, rows, connectRadius); //ERROR HERE
              ArrayList <Node> network = new ArrayList <Node> (NetUtilities.randomRewireSymmetric(list, rewireProb));
              return network;
    public Class <Node> getNodeClass() {     return nodeClass;}
    public void setNodeClass(Class <Node> node)     {nodeClass = node;}
    public Class <Edge> getEdgeClass()     { return edgeClass;}
    public void setEdgeClass(Class <Edge> edge) {edgeClass = edge;}
    }The error happens when I try to "makeVonNeumannGridNet"; how is that a static reference?

    Geesh what a worthless discussion.
    After all, the cause of your problem is that you're trying to access an instance method from within a static (non-instance!) method. The possible solutions might be obvious:
    1) make both methods non-static.
    2) make both methods static.
    3) make the calling method non-static and make the method-to-be-called static.
    4) instantiate the class having the instance method and invoke that method using the reference.
    Read a good Java book/tutorial and learn about static vs. non-static. Don't use them randomly, but use them when the design and behaviour require.

  • Static references to images

    Adobe RoboHelp 7 creates static references for images I
    import into my webhelp pages. Aside from manually converting the
    references to relative references, how can I get RH7 to correctly
    reference my images?

    Hi there
    I'm not sure what's up with your version of RoboHelp 7. Maybe
    it's how you are inserting images? I've never known RoboHelp to
    ever really create absolute references to images. It has always
    been quite adept at creating relative references.
    Are you absolutely certain absolute references are being
    created? I ask, because when you initially select an image by
    browsing to it, the reference may look like an absolute reference
    until you click OK to commit the information to the page. If you
    examine the properties later, the image has been copied to the
    project and bears a relative path.
    Cheers... Rick

  • Create static references array

    Hello,
    i have done a labview program which controls six different test machines.
    the different tests are VIs which are kept by the main program in an array of static references. this way i have to write the vi only once. afterwards i create six different references of the same vi, each of them managing one test machine.
    everything is working fine. the only drawback I have found, is how to create the six references of each VI.
    the first thing I tried, was to locate the static reference function inside a loop. I enabled indexing, and i expected to obtain an array of six different references of the same vi. unfortunately this is not working: i obtain an array with six times the same reference.
    to fix this, i located the static reference function inside a switch with six cases. all of this, inside the same loop. i have to use the static reference function six times, one for each test machine. this is working, but is more work. everytime a add a new test vi, I have to add the switch with the six cases. it is a lot of copy & paste work, and errors are likely to be done doing this.
    I would like to know if there is any other (and simpler) way of obtaining this array.
    enclosed you find an example showing this: the upper loop creates an array of six references but all of them are the same. the other one, uses a switch-case so that different references are generated.
    thank you in advance
    Attachments:
    static references array.zip ‏11 KB

    I think you missed the point of what I was getting at. If you create a template VI and programmatically open a reference to it 6 times you will get references to 6 independent instances of the template all running in memory. Nothing needs to get saved to disk. If the template changes simply close the 6 old references and open 6 new ones.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Error: Cannot make a static reference to the non-static method

    Below is a java code. I attempt to call method1 and method2 and I got this error:
    Cannot make a static reference to the non-static method but If I add the keyword static in front of my method1 and method2 then I would be freely call the methods with no error!
    Anyone has an idea about such error? and I wrote all code in the same one file.
    public class Lab1 {
         public static void main(String[] args) {
              method1(); //error
         public  void method1 ()
         public  void method2 ()
    }

    See the Search Forums at the left of the screen?
    If you had searched with "Cannot make a static reference to the non-static method"
    http://search.sun.com/search/onesearch/index.jsp?qt=Cannot+make+a+static+reference+to+the+non-static+method+&rfsubcat=siteforumid%3Ajava54&col=developer-forums
    you would have the answer. Almost every question you will ask has already been asked and answered.

  • How do I make a static reference to a method?  Sample Code Included

    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{
        static String sString = "TESTING";
        int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;  
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );
    }

    Why doesn't this work?Because you can't call a non-static method like add (which operates on the object called this) from a static method like main (for which there is no this).
    There are two ways to fix this:
    (1) In main, create a TestClass object, and call add() for that object:
    class TestClass implements TestInterface {
       public int add(int a, int b) {
          return a+b;
       public static void main(String[] args) {
          TestClass testObject = new TestClass();
          int sum = testObject.add(3, 4);
          System.out.println("test");
          System.out.println(sum);
    }(2) Make add() static. This is the preferred approach, because add() doesn't really need a TestClass object.
    class TestClass implements TestInterface {
       public static int add(int a, int b) {
          return a+b;
       // main is same as the original
    }

  • How do I use a static reference to keep a VI in memory but then call it in parallel?

    Hello all,
    I have a MainVI and I want to call from it a SubVI in parallel so that I can have both windows open and responsive at the same time.  The SubVI may be closed and reopened any number of times, but only one in existance at a time.  I know how to do this using Open VI Reference, providing a relative path to my SubVI, checking its state to see if its already running, and if so bring the window to the front (using Front Panel: Open method with True/Standard inputs), and if not run it using the Invoke:Run method (and optionally opening its front panel programmatically).  This method was working fine.
    Now I have added functional global variables in my SubVI, and I want to keep them in memory inbetween opening the SubVI window.  I can do this by putting a copy of the functional global in my MainVI, even though I don't use it there for anything.  This works fine.
    By accident, I have come across a reference to a Static VI Reference, which sounded like a vast improvement to my methodology, for the following reasons:
    1) Keeps SubVI in memory all the time, eliminating the need to put the functional global in MainVI when it is not used there.
    2) Tells LabVIEW to include SubVI when I build my executable, rather than me having to specifically mark it as Always Include in the build specification.
    3) Eliminates the need to keep the path and SubVI name updated in a string constant in my code, in order to use the Open VI Reference.
    However, trying to implement this solution, I have run into the problem that once you put a strictly-typed static VI reference (strict typing is required to keep it in memory) onto the block diagram, that VI is reserved for execution.  That means I cannot run it using the Invoke:Run method.  I haven't tried just putting it on the diagram directly as a subVI because I need it to run in parallel to the MainVI.  I have searched through these forums extensively, and although there are several references to a static VI reference, none of them say explicitly how to actually run the darn thing!  :-P
    I very much appreciate any insight into my problem.  If I have to go back to the old way it will work fine, but I really like the seeming elegance of this solution.  I hope that it is technically feasible and I'm not misunderstanding something.
    Thank you for your help,
    -Joe
    Solved!
    Go to Solution.

    > If I understand you correctly, they can only really be used for re-entrant VIs. 
    No, a static VI reference can be used anywhere a regular VI reference (property nodes etc.) The reason for the hoop-jumping above is that we are really opening a reference to a CLONE (copy) of the VI identified by the static VI reference.
    > Okay, I tried it, and got the code shown below... Any idea why it isn't working?
    The VI you want to clone can't be on the diagram as a "normal" subVI. When you run your application you should be able to open that VI and see it just sitting there with a run arrow waiting to run. See attached example (LV2009SP1).
    "share clones" vs "preallocate" has to do with whether you want each clone to preserve state (such as in an uninitialized shift register). Generally you use share clones. Occasionally it is useful to have multiple copies on a diagram that each remember some data, like "timestamp of last execution" in a shift register.
    Other VIs in your spawned process don't have to be re-entrant unless they are functions that "wait forever". All the built-in G functions are re-entrant. It's pretty common to use a queue to feed data to a spawned process.
    Spawning a process is more difficult than just running two parallel loops. It's useful because once you've made 1 copy, you can make 50. If you just want to do two things (vs n things) at once, I would just use two loops.
    Attachments:
    SpawnProcess.zip ‏20 KB

  • Unload class (to free static references)?

    My problem: apache fop has a bug that it has a static Map field in a class that increases constantly. Is it possible to "unload" this class to ensure freeing up the references from this static field? And subsequent calls would reload the class when needed?

    Those streams often are created within a method
    and there's no reference (variable) to it outside
    the method (e.g. in the class or super class)?Not sure that reflection will provide you with a work-around for this; although, you could write your own classloader to load JFreeChart, and have it provide your own implementation of ImageInputStream which retains references to un-closed streams so they can be killed off later.
    We're definitely on the way to the land of ick with this sort of hack, though... I think maintaining your own fork of the source code and keeping it in sync with the main project might actually turn out to be easier. That or beating the dev's around the head to get your fixes accepted.
    Dave.

  • Thread safety: exposing "this" via a "static" reference  in constructor

    please consider:
    public class Foo  {
      public static List<Foo> list = new ArrayList<Foo>();
      public int i = 1;
      Foo() {
        Foo.list.add(this);
        i++;
        // ...... other stuff that does not effect "i"
    }Exiting, I want "i" to always be 2. But what if a thread got the reference to "this" from the static List before the constructor exited and did:
    ((Foo) Foo.list.get(0)).i++;Is the only solution a synchronized wrapper for "list"?
    Thanks.

    A synchronized wrapper is not sufficient:
    public static List<Foo> list = Collections.synchronizedList(new ArrayList<Foo>());This is because the list is now thread-safe, but what about the items in it?
    Look at your constructor:
    Foo.list.add(this);
    i++;Another thread could access the list in between the execution of these two lines and see the value of i before i is incremented.

  • The Good Old Static Reference Problem

    Hey All,
    I know you are probabely all sick of this question but non-static variable RobotServerStatusConditionLabel cannot be referenced from a static context
    I dont know how to go about fixing this problem, i have read the other feeds on this and more or less understood why the error is happening but cant think of a way to solve it. I am developing a GUI progam in Netbeans The code is shown below.
    The prolem i am having is that i have a thread called ModuleThreadRobot which is in a class called final class ModuleThreadRobot. I need to be able to access the variables in the GUI so that i can update them for the user so for example i want to change the text of a label in the gui:
    LabANTServerProxyGUI.RobotServerStatusConditionLabel.setText("wagamma!!");
    And the error i get is as follows:
    non-static variable RobotServerStatusConditionLabel cannot be referenced from a static context
    So if anyone can help me out here, i more or less get why its happening just don't know a way around it.
    Thanks inadvance,
    Richard
    * LabANTServerProxyGUI.java
    * Created on 26 December 2005, 07:58
    package LabANTServerProxy;
    * @author  Yap
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    public class LabANTServerProxyGUI extends javax.swing.JFrame {
        /** Creates new form LabANTServerProxyGUI */
        public LabANTServerProxyGUI() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            LabANTTabbedPane = new javax.swing.JTabbedPane();
            LabANTSplashPanel = new javax.swing.JPanel();
            Title = new javax.swing.JLabel();
            Author = new javax.swing.JLabel();
            UniversityMark = new javax.swing.JTextArea();
            Copyright = new javax.swing.JTextArea();
            PicturePanel = new javax.swing.JPanel();
            jLabel2 = new javax.swing.JLabel();
            EmailLabel = new javax.swing.JLabel();
            WebAddressLabel = new javax.swing.JLabel();
            ServerControlPanel = new javax.swing.JPanel();
            StepOnePanel = new javax.swing.JPanel();
            RobotServerSettingsPanel = new javax.swing.JPanel();
            ServerIPAddressLabel = new javax.swing.JLabel();
            ServerIPAddressTextField = new javax.swing.JTextField();
            ServerPortLabel = new javax.swing.JLabel();
            ServerPortTextField = new javax.swing.JTextField();
            RobotServerSettingsTextArea = new javax.swing.JTextArea();
            StatusLabel = new javax.swing.JLabel();
            RobotServerStatusConditionLabel = new javax.swing.JLabel();
            RobotServerSettingsConnectButton = new javax.swing.JButton();
            StepTwoPanel = new javax.swing.JPanel();
            DatabaseSettingsPanel = new javax.swing.JPanel();
            DatabaseIPAddressLabel = new javax.swing.JLabel();
            DatabasePortLabel = new javax.swing.JLabel();
            DatabaseIPTextField = new javax.swing.JTextField();
            DatabasePortTextField = new javax.swing.JTextField();
            DatabaseSettingsTextArea = new javax.swing.JTextArea();
            UsernameLabel = new javax.swing.JLabel();
            PasswordLabel = new javax.swing.JLabel();
            UsernameTextField = new javax.swing.JTextField();
            PasswordTextField = new javax.swing.JPasswordField();
            DatabaseSaveButton = new javax.swing.JButton();
            TestStatusPanel = new javax.swing.JPanel();
            TestStatusConditionLabel = new javax.swing.JLabel();
            DatabaseTestButton = new javax.swing.JButton();
            StepThreePanel = new javax.swing.JPanel();
            ServerStatus = new javax.swing.JPanel();
            LabANTServerPortLabel = new javax.swing.JLabel();
            LabANTServerPortTextField = new javax.swing.JTextField();
            ServerStatusTextArea = new javax.swing.JTextArea();
            StartServerButton = new javax.swing.JButton();
            ServerMonitorPane = new javax.swing.JPanel();
            SensorDataScrollPane = new javax.swing.JScrollPane();
            SensorDataTextArea = new javax.swing.JTextArea();
            CommandDataScrollPane = new javax.swing.JScrollPane();
            CommandDataTextArea = new javax.swing.JTextArea();
            ServerMonitorNoteLabel = new javax.swing.JLabel();
            ClientDataPane = new javax.swing.JPanel();
            ClientIPAddressLabel = new javax.swing.JLabel();
            ClientIPAddressConditionLabel = new javax.swing.JLabel();
            LogsPanel = new javax.swing.JPanel();
            LogsTextArea = new javax.swing.JTextArea();
            HelpPanel = new javax.swing.JPanel();
            HelpScrollPane = new javax.swing.JScrollPane();
            HelpTextArea = new javax.swing.JTextArea();
            jPanel5 = new javax.swing.JPanel();
            AboutScrollPane = new javax.swing.JScrollPane();
            AboutTextArea = new javax.swing.JTextArea();
            getContentPane().setLayout(null);
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            LabANTTabbedPane.setFont(new java.awt.Font("Tahoma", 1, 11));
            LabANTSplashPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
            LabANTSplashPanel.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            Title.setFont(new java.awt.Font("Tahoma", 1, 36));
            Title.setText("LabANT Version 1.0");
            LabANTSplashPanel.add(Title, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 20, -1, -1));
            Author.setFont(new java.awt.Font("Tahoma", 0, 18));
            Author.setText("Author: Richard McElligott ");
            LabANTSplashPanel.add(Author, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 60, -1, -1));
            UniversityMark.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
            UniversityMark.setFont(new java.awt.Font("Tahoma", 0, 12));
            UniversityMark.setText("The University of Reading\nActive Robotics Laboratory");
            LabANTSplashPanel.add(UniversityMark, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 440, -1, -1));
            Copyright.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
            Copyright.setFont(new java.awt.Font("Tahoma", 0, 12));
            Copyright.setText("Copyright Richard McElligott");
            LabANTSplashPanel.add(Copyright, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 470, -1, -1));
            PicturePanel.setLayout(null);
            PicturePanel.setBorder(new javax.swing.border.TitledBorder("Picutre"));
            jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Yap\\My Documents\\My Pictures\\leafcutterant1.jpg"));
            PicturePanel.add(jLabel2);
            jLabel2.setBounds(10, 20, 800, 300);
            LabANTSplashPanel.add(PicturePanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 90, 820, 340));
            EmailLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            EmailLabel.setText("[email protected]");
            LabANTSplashPanel.add(EmailLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 450, -1, -1));
            WebAddressLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            WebAddressLabel.setText("www.arl.reading.ac.uk");
            LabANTSplashPanel.add(WebAddressLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 470, -1, -1));
            LabANTTabbedPane.addTab("LabANT", LabANTSplashPanel);
            ServerControlPanel.setLayout(null);
            ServerControlPanel.setMinimumSize(new java.awt.Dimension(861, 485));
            ServerControlPanel.setPreferredSize(new java.awt.Dimension(861, 485));
            StepOnePanel.setLayout(null);
            StepOnePanel.setBorder(new javax.swing.border.TitledBorder(null, "Step One", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            RobotServerSettingsPanel.setLayout(null);
            RobotServerSettingsPanel.setBorder(new javax.swing.border.TitledBorder(null, "Robot Server Settings", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            ServerIPAddressLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            ServerIPAddressLabel.setText("Server IP Address:");
            RobotServerSettingsPanel.add(ServerIPAddressLabel);
            ServerIPAddressLabel.setBounds(30, 20, 100, 14);
            ServerIPAddressTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
            ServerIPAddressTextField.setText("127.0.0.1");
            RobotServerSettingsPanel.add(ServerIPAddressTextField);
            ServerIPAddressTextField.setBounds(30, 40, 180, 14);
            ServerPortLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            ServerPortLabel.setText("Server Port:");
            RobotServerSettingsPanel.add(ServerPortLabel);
            ServerPortLabel.setBounds(30, 60, 70, 14);
            ServerPortTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
            ServerPortTextField.setText("4444");
            RobotServerSettingsPanel.add(ServerPortTextField);
            ServerPortTextField.setBounds(30, 80, 50, 14);
            RobotServerSettingsTextArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
            RobotServerSettingsTextArea.setFont(new java.awt.Font("Tahoma", 0, 12));
            RobotServerSettingsTextArea.setLineWrap(true);
            RobotServerSettingsTextArea.setText("Please supply the settings to connect to the robots wireless rs232 to tcp/ip module. This module recieves a wireless RS232 signal via a transiever on board the robot and one on the modlue and sends this data to a small embeded server to which you must connect. To connect you need to supply the IP Address and Port Number of the module. The Default is IP Address is 127.0.0.1 and Port Number is 4444. The MAC address of the module is:  00-33-44-55-55-66\n");
            RobotServerSettingsTextArea.setWrapStyleWord(true);
            RobotServerSettingsPanel.add(RobotServerSettingsTextArea);
            RobotServerSettingsTextArea.setBounds(390, 20, 440, 110);
            StatusLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
            StatusLabel.setText("Status:");
            RobotServerSettingsPanel.add(StatusLabel);
            StatusLabel.setBounds(30, 110, 50, 14);
            RobotServerStatusConditionLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            RobotServerStatusConditionLabel.setText("Disconnected");
            RobotServerSettingsPanel.add(RobotServerStatusConditionLabel);
            RobotServerStatusConditionLabel.setBounds(80, 110, 290, 14);
            RobotServerSettingsConnectButton.setFont(new java.awt.Font("Tahoma", 1, 11));
            RobotServerSettingsConnectButton.setText("Connect");
            RobotServerSettingsConnectButton.setBorder(new javax.swing.border.EtchedBorder());
            RobotServerSettingsConnectButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    RobotServerSettingsConnectButtonActionPerformed(evt);
            RobotServerSettingsConnectButton.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseReleased(java.awt.event.MouseEvent evt) {
                    RobotServerSettingsConnectButtonMouseReleased(evt);
            RobotServerSettingsPanel.add(RobotServerSettingsConnectButton);
            RobotServerSettingsConnectButton.setBounds(140, 70, 80, 30);
            StepOnePanel.add(RobotServerSettingsPanel);
            RobotServerSettingsPanel.setBounds(10, 20, 850, 140);
            ServerControlPanel.add(StepOnePanel);
            StepOnePanel.setBounds(0, 0, 870, 170);
            StepTwoPanel.setLayout(null);
            StepTwoPanel.setBorder(new javax.swing.border.TitledBorder(null, "Step Two", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            DatabaseSettingsPanel.setLayout(null);
            DatabaseSettingsPanel.setBorder(new javax.swing.border.TitledBorder(null, "Database Settings", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            DatabaseIPAddressLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            DatabaseIPAddressLabel.setText("Database IP Address:");
            DatabaseSettingsPanel.add(DatabaseIPAddressLabel);
            DatabaseIPAddressLabel.setBounds(30, 30, 110, 14);
            DatabasePortLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            DatabasePortLabel.setText("Database Port:");
            DatabaseSettingsPanel.add(DatabasePortLabel);
            DatabasePortLabel.setBounds(30, 70, 80, 14);
            DatabaseIPTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
            DatabaseIPTextField.setText("127.0.0.1");
            DatabaseSettingsPanel.add(DatabaseIPTextField);
            DatabaseIPTextField.setBounds(30, 50, 170, 14);
            DatabasePortTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
            DatabasePortTextField.setText("4443");
            DatabaseSettingsPanel.add(DatabasePortTextField);
            DatabasePortTextField.setBounds(30, 90, 70, 14);
            DatabaseSettingsTextArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
            DatabaseSettingsTextArea.setFont(new java.awt.Font("Tahoma", 0, 12));
            DatabaseSettingsTextArea.setLineWrap(true);
            DatabaseSettingsTextArea.setText("Supply settings to connect to the database, which is used for authenthicating clients and checking timetable. You must save before pressing test.");
            DatabaseSettingsTextArea.setWrapStyleWord(true);
            DatabaseSettingsPanel.add(DatabaseSettingsTextArea);
            DatabaseSettingsTextArea.setBounds(630, 20, 210, 90);
            UsernameLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            UsernameLabel.setText("Username:");
            DatabaseSettingsPanel.add(UsernameLabel);
            UsernameLabel.setBounds(250, 30, 60, 14);
            PasswordLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            PasswordLabel.setText("Password: ");
            DatabaseSettingsPanel.add(PasswordLabel);
            PasswordLabel.setBounds(250, 70, 60, 14);
            UsernameTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
            UsernameTextField.setText("Enter Your Username");
            DatabaseSettingsPanel.add(UsernameTextField);
            UsernameTextField.setBounds(250, 50, 170, 14);
            DatabaseSettingsPanel.add(PasswordTextField);
            PasswordTextField.setBounds(250, 90, 170, 17);
            DatabaseSaveButton.setFont(new java.awt.Font("Tahoma", 1, 11));
            DatabaseSaveButton.setText("Save");
            DatabaseSaveButton.setBorder(new javax.swing.border.EtchedBorder());
            DatabaseSettingsPanel.add(DatabaseSaveButton);
            DatabaseSaveButton.setBounds(440, 20, 70, 30);
            TestStatusPanel.setLayout(null);
            TestStatusPanel.setBorder(new javax.swing.border.TitledBorder("Test Status"));
            TestStatusConditionLabel.setText("Disconnected");
            TestStatusPanel.add(TestStatusConditionLabel);
            TestStatusConditionLabel.setBounds(40, 20, 70, 15);
            DatabaseSettingsPanel.add(TestStatusPanel);
            TestStatusPanel.setBounds(440, 60, 150, 50);
            DatabaseTestButton.setFont(new java.awt.Font("Tahoma", 1, 11));
            DatabaseTestButton.setText("Test");
            DatabaseTestButton.setBorder(new javax.swing.border.EtchedBorder());
            DatabaseSettingsPanel.add(DatabaseTestButton);
            DatabaseTestButton.setBounds(520, 20, 70, 30);
            StepTwoPanel.add(DatabaseSettingsPanel);
            DatabaseSettingsPanel.setBounds(10, 20, 850, 130);
            ServerControlPanel.add(StepTwoPanel);
            StepTwoPanel.setBounds(0, 170, 870, 160);
            StepThreePanel.setLayout(null);
            StepThreePanel.setBorder(new javax.swing.border.TitledBorder(null, "Step Three", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            ServerStatus.setLayout(null);
            ServerStatus.setBorder(new javax.swing.border.TitledBorder(null, "Server Status:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            LabANTServerPortLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            LabANTServerPortLabel.setText("LabANT Server Port:");
            ServerStatus.add(LabANTServerPortLabel);
            LabANTServerPortLabel.setBounds(30, 40, 100, 14);
            LabANTServerPortTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
            LabANTServerPortTextField.setText("5000");
            ServerStatus.add(LabANTServerPortTextField);
            LabANTServerPortTextField.setBounds(30, 60, 100, 14);
            ServerStatusTextArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
            ServerStatusTextArea.setFont(new java.awt.Font("Tahoma", 0, 12));
            ServerStatusTextArea.setLineWrap(true);
            ServerStatusTextArea.setText("Before starting the server ensure that you have sucessfully completed both step one and step two. Then please set the port number you whish the server to run on. Once the server is started clients can then connect to the server and log on and control the robot via the website client. \nServer Monitor will display live data and logs.\n");
            ServerStatusTextArea.setWrapStyleWord(true);
            ServerStatus.add(ServerStatusTextArea);
            ServerStatusTextArea.setBounds(230, 30, 580, 80);
            StartServerButton.setFont(new java.awt.Font("Tahoma", 1, 11));
            StartServerButton.setText("Start Server");
            StartServerButton.setBorder(new javax.swing.border.EtchedBorder());
            ServerStatus.add(StartServerButton);
            StartServerButton.setBounds(30, 90, 120, 30);
            StepThreePanel.add(ServerStatus);
            ServerStatus.setBounds(10, 20, 850, 130);
            ServerControlPanel.add(StepThreePanel);
            StepThreePanel.setBounds(0, 330, 870, 160);
            LabANTTabbedPane.addTab("Server Control", ServerControlPanel);
            ServerMonitorPane.setLayout(null);
            ServerMonitorPane.setBorder(new javax.swing.border.TitledBorder(null, "Server Monitor:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            SensorDataScrollPane.setBorder(new javax.swing.border.TitledBorder(null, "Sensor Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            SensorDataScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            SensorDataTextArea.setFont(new java.awt.Font("Tahoma", 0, 12));
            SensorDataTextArea.setLineWrap(true);
            SensorDataTextArea.setText("There once was a tree a very beautiful tree");
            SensorDataTextArea.setWrapStyleWord(true);
            SensorDataScrollPane.setViewportView(SensorDataTextArea);
            ServerMonitorPane.add(SensorDataScrollPane);
            SensorDataScrollPane.setBounds(10, 20, 470, 330);
            CommandDataScrollPane.setBorder(new javax.swing.border.TitledBorder(null, "Command Data From Client", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            CommandDataScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            CommandDataTextArea.setFont(new java.awt.Font("Tahoma", 0, 12));
            CommandDataTextArea.setLineWrap(true);
            CommandDataTextArea.setText("The only way is up ... you and me babe");
            CommandDataTextArea.setWrapStyleWord(true);
            CommandDataScrollPane.setViewportView(CommandDataTextArea);
            ServerMonitorPane.add(CommandDataScrollPane);
            CommandDataScrollPane.setBounds(490, 20, 380, 330);
            ServerMonitorNoteLabel.setFont(new java.awt.Font("Tahoma", 0, 11));
            ServerMonitorNoteLabel.setText("NOTE: Logs of both Sensor Data and Command Data along with users IP address are saved in log files for later analysis.");
            ServerMonitorPane.add(ServerMonitorNoteLabel);
            ServerMonitorNoteLabel.setBounds(130, 470, 590, 20);
            ClientDataPane.setLayout(null);
            ClientDataPane.setBorder(new javax.swing.border.TitledBorder(null, "Client Data:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            ClientIPAddressLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
            ClientIPAddressLabel.setText("Client IP Address:");
            ClientDataPane.add(ClientIPAddressLabel);
            ClientIPAddressLabel.setBounds(20, 20, 110, 20);
            ClientIPAddressConditionLabel.setFont(new java.awt.Font("Tahoma", 0, 12));
            ClientIPAddressConditionLabel.setText("Unknown");
            ClientDataPane.add(ClientIPAddressConditionLabel);
            ClientIPAddressConditionLabel.setBounds(130, 20, 70, 20);
            ServerMonitorPane.add(ClientDataPane);
            ClientDataPane.setBounds(10, 360, 230, 60);
            LogsPanel.setLayout(null);
            LogsPanel.setBorder(new javax.swing.border.TitledBorder(null, "Logs", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)));
            LogsTextArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
            LogsTextArea.setLineWrap(true);
            LogsTextArea.setText("The logs from Sensor Data, Command Data and Client Details are save in the following files sensor.log, command.log and client.log respectfully. They are saved in the same folder that the server is run in.");
            LogsTextArea.setWrapStyleWord(true);
            LogsPanel.add(LogsTextArea);
            LogsTextArea.setBounds(10, 20, 570, 60);
            ServerMonitorPane.add(LogsPanel);
            LogsPanel.setBounds(260, 370, 600, 90);
            LabANTTabbedPane.addTab("Server Monitor", ServerMonitorPane);
            HelpPanel.setLayout(null);
            HelpPanel.setBorder(new javax.swing.border.TitledBorder("Help"));
            HelpScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            HelpScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            HelpTextArea.setLineWrap(true);
            HelpTextArea.setText("The standard Lorem Ipsum passage, used since the 1500s\n\n\"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n\nSection 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC\n\n\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"\n\n1914 translation by H. Rackham\n\n\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"\n\nSection 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC\n\n\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.\"\n\n1914 translation by H. Rackham\n\n\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.\" ");
            HelpTextArea.setWrapStyleWord(true);
            HelpScrollPane.setViewportView(HelpTextArea);
            HelpPanel.add(HelpScrollPane);
            HelpScrollPane.setBounds(50, 60, 770, 310);
            LabANTTabbedPane.addTab("Help", HelpPanel);
            jPanel5.setLayout(null);
            jPanel5.setBorder(new javax.swing.border.TitledBorder("About"));
            jPanel5.setMinimumSize(new java.awt.Dimension(861, 485));
            AboutScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            AboutScrollPane.setAutoscrolls(true);
            AboutScrollPane.setMinimumSize(new java.awt.Dimension(100, 340));
            AboutTextArea.setLineWrap(true);
            AboutTextArea.setText("The standard Lorem Ipsum passage, used since the 1500s\n\n\"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n\nSection 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC\n\n\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"\n\n1914 translation by H. Rackham\n\n\"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &nbs

    You got flack for not providing - in your own words - the solution to your own problem
    (from which someone might be able to see where you went wrong).
    Also, try not to "break" the forum formatting with those annoyingly long lines,
    see how nice it looks when refactored.
            AboutTextArea.setText("The standard Lorem Ipsum passage, used since the 1500s\n"+
                    "\n\"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+
                    "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud "+
                    "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute "+
                    "irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "+
                    "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit "+
                    "anim id est laborum.\"\n"+
                    "\nSection 1.10.32 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC\n"+
                    "\n\"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium "+
                    "doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore "+
                    "veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam "+
                    "voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur "+
                    "magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam "+
                    "est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non "+
                    "numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat "+
                    "voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam "+
                    "corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? "+
                    "Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil "+
                    "molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?\"\n"+
                    "\n1914 translation by H. Rackham\n\n\"But I must explain to you how all this mistaken "+
                    "idea of denouncing pleasure and praising pain was born and I will give you a complete "+
                    "account of the system, and expound the actual teachings of the great explorer of the "+
                    "truth, the master-builder of human happiness. No one rejects, dislikes, or avoids "+
                    "pleasure itself, because it is pleasure, but because those who do not know how to "+
                    "pursue pleasure rationally encounter consequences that are extremely painful. "+
                    "Nor again is there anyone who loves or pursues or desires to obtain pain of itself, "+
                    "because it is pain, but because occasionally circumstances occur in which toil and "+
                    "pain can procure him some great pleasure. To take a trivial example, which "+
                    "of us ever undertakes laborious physical exercise, except to obtain some advantage "+
                    "from it? But who has any right to find fault with a man who chooses to enjoy a pleasure "+
                    "that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?\"\n"+
                    "\nSection 1.10.33 of \"de Finibus Bonorum et Malorum\", written by Cicero in 45 BC\n"+
                    "\n\"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis "+
                    "praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias "+
                    "excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia "+
                    "deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum "+
                    "facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi "+
                    "optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, "+
                    "omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem "+
                    "quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et "+
                    "voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic "+
                    "tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur "+
                    "aut perferendis doloribus asperiores repellat.\"\n\n1914 translation by H. Rackham\n"+
                    "\n\"On the other hand, we denounce with righteous indignation and dislike men who "+
                    "are so beguiled and demoralized by the charms of pleasure of the moment, so "+
                    "blinded by desire, that they cannot foresee the pain and trouble that are bound to "+
                    "ensue; and equal blame belongs to those who fail in their duty through weakness "+
                    "of will, which is the same as saying through shrinking from toil and pain. These cases "+
                    "are perfectly simple and easy to distinguish. In a free hour, when our power of choice "+
                    "is untrammelled and when nothing prevents our being able to do what we like best, "+
                    "every pleasure is to be welcomed and every pain avoided. But in certain circumstances "+
                    "and owing to the claims of duty or the obligations of business it will frequently occur that "+
                    "pleasures have to be repudiated and annoyances accepted. The wise man therefore "+
                    "always holds in these matters to this principle of selection: he rejects pleasures to "+
                    "secure other greater pleasures, or else he endures pains to avoid worse pains.\" \n");

  • Any help with this program (a bit of a problem with static references)

    Can anyone give me any suggestions for fixing this code:
    package vivarium;
    import javax.swing.JApplet;
    import javax.swing.JFrame;
    import java.awt.*;
    import java.applet.*;
    import java.net.*;
    public class Render extends java.applet.Applet {
         static Animal[] animal_array_world;
         public static void main(String s[])  {
              JFrame frame = null;
              Graphics g = null;
              int[][] grassarray = new int[16][16];
              createapplet(frame);
              Render r = new Render();
              r.rendergrass(g, grassarray);
              frame.paint(g);
              //createcreatures(20);
              //live();
         public void rendergrass(Graphics g, int[][] array) {
              URL codebase = getCodeBase();
              java.awt.Image grass =  getImage(codebase, "grass.JPG");
              java.awt.Image deadgrass =  getImage(codebase, "deadgrass.JPG");
              for(int i = 0; i < 16; i++)
                   for(int j = 0; j < 16; j++) {
                        int y = (i * 16);
                        int x = (j * 16);
                   if(array[i][j] == 0) {
                        drawimage(g, grass, y, x);
                   else
                        drawimage(g, deadgrass, y, x);
         public  void drawimage(Graphics g, java.awt.Image img, int y, int x) {
              g.drawImage(img, y, x, this);
         public static void createapplet(JFrame frame) {
              frame = new JFrame();
              frame.setTitle("Kirby's Vivarium Demo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JApplet applet = new RenderApplet();
              applet.init();
              frame.getContentPane().add(applet);
              frame.pack();
              frame.setVisible(true);
         //this creates an array of creatures
         public static void createcreatures(int x) {
              animal_array_world = new Animal[x*2];
         //this will than act on that
         public static void live() {
              while(true) {
              int i = 0;
              while(i != animal_array_world.length - 1) {
                   animal_array_world.live(animal_array_world);
    The problem seems to be with
    URL codebase = getCodeBase();
    java.awt.Image grass =  getImage(codebase, "grass.JPG");
    java.awt.Image deadgrass =  getImage(codebase, but I do not get how. This is a non-static field, but no matter what I do it seems to complain in some manner. Does anyone have any suggestions? Thanks!

    Exception in thread "main" java.lang.NullPointerException
         at java.applet.Applet.getCodeBase(Unknown Source)
         at vivarium.Render.rendergrass(Render.java:29)
         at vivarium.Render.main(Render.java:20)I get this despite whether I put the getCodeBase part in a method, the main or the initialization block.
    Heres line 29: URL codebase = getCodeBase();This is called within my nonstatic method rendergrass.
    And heres line 20: r.rendergrass(g, grassarray);(Where r is a new Render class object)

Maybe you are looking for