Help with loading dynamic classes ..need help please

i'm trying to design a program where by i can load dynamic classes
the problem i'm getting is that only one class is loading.
classes are loaded by their names,and index numbers of public methods from a linklist
.When the program runs only the first class is ever loaded and only the methods of that class ..
help please
//class loader
import java.lang.reflect.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
public class Test2 extends Thread
     public Class c;
     public Class Ray;
     public Class[] x;
     public static Object object = null;
     public Method[] theMethods;
     public static Method[] method,usemethod;
     public int methodcount;
     public static int MethodCt;     
     public static JList list;
public Method[] startClass(String SetMethodName)
     try
          c = Class.forName(SetMethodName);
          object = c.newInstance();
          theMethods = c.getDeclaredMethods();
          // number of methods
          //methodcount = theMethods.length;
     catch (Exception e)
          e.printStackTrace();
// return the array then invoke the particular method later
return theMethods ;
public void RunMethod(Method[] SomeMethod, int methodcount)
     try
          SomeMethod[methodcount].invoke( object,null );
     catch (Exception e)
          e.printStackTrace();
// end class loader
//main calling program
import java.awt.*;
import java.awt.event.*;
import javax.swing .*;
import java.lang.reflect.*;
public class JFMenu extends JFrame
     public static JMenu pluginMenu;
     public static JMenuBar bar;
     public static final Test2 w = new Test2();
public static Method[] setmethod;
private static ClassLinkList startRef = null;
private static ClassLinkList linkRef3 = null;
private static ClassLinkList startRef2 = null;
private String ClassName,ShortCut;
private int MethodNumber;
private JMenuItem PluginItem;
     JFMenu()
          super (" JFluro ");     
          JMenu fileMenu = new JMenu("File");
          fileMenu.setMnemonic('F');
          JMenuItem exitItem = new JMenuItem("Exit");
          exitItem.setMnemonic('X');
          fileMenu.add(exitItem);
          exitItem.addActionListener
               new ActionListener()
                    public void actionPerformed(ActionEvent event )
                         System.exit(0);
          JMenu pluginMenu = new JMenu("Plugins");
          pluginMenu.setMnemonic('P');
          startRef = new ClassLinkList ("Hello","Hello ",2,1926,"Painter");
          addToList("Foo","Foo ",0,1930,"Author");
          while (startRef.linkRef5 != null)
               //pluginMenu.addSeparator();
               ClassName = startRef.linkRef5.className;
               ShortCut = startRef.linkRef5.shortcutName;
MethodNumber = startRef.linkRef5.methodNumber;
AddMenuItem(pluginMenu,ShortCut,ClassName,MethodNumber);
               startRef.linkRef5 = startRef.linkRef5.next;
          // create menu bar and add JFMenu window to it
          JMenuBar bar = new JMenuBar();
          setJMenuBar(bar);
          bar.add(fileMenu);
          bar.add(pluginMenu);
          //attributes for JFMenu frame
          setSize(500,200);
          setVisible(true);
     }// end JFMenu constructor
     public void AddMenuItem(JMenu MainMenu, String shortcut,String className, final int methodCount )
          if (MainMenu==null)
               return;
          //JMenuItem item;
          JMenuItem item = new JMenuItem(shortcut);
          MainMenu.add(item);
          setmethod = w.startClass(className);
          item.addActionListener
               new ActionListener()
                    public void actionPerformed(ActionEvent event )
                         w.RunMethod(setmethod,methodCount);
          //item.addActionListener(ij);
     public JMenuItem AddMenuItem2(JMenu MainMenu, String shortcut)
          //if (MainMenu==null)
          //     return Main;
          //JMenuItem item;
          JMenuItem item = new JMenuItem(shortcut);
          MainMenu.add(item);
          //setmethod = w.startClass(className);
          //item.addActionListener(this);
               new ActionListener()
                    public void actionPerformed(ActionEvent event )
                         w.RunMethod(setmethod,methodCount);
          //item.addActionListener(ij);
     return item;
     public void ReloadMenu(JMenuBar Bar, JMenu PluginMenu)
          if (Bar==null)
               return;
          //     setJMenuBar(Bar);
          Bar.add(PluginMenu);
          //item.addActionListener(ij);
public static void main (String args[])
          JFMenu menapp = new JFMenu();
public static void addToList(String clname, String shcutname, int metnumber, int year2,
                              String description) {
     // Create instance of class ClassLinkList
ClassLinkList newRef = new ClassLinkList(clname,shcutname,metnumber,year2,
                                   description);
// Add to linked list;
     startRef = startRef.addRecordToLinkedList(newRef);
// end main calling program
class Hello extends Thread
public int getNum()
System.out.println("I can be ");
return 5;
public void rayshowName()
System.out.println("anything i want ");
public void rayshowName3()
System.out.println("to be ");
class Foo extends Thread
public int getNum()
System.out.println("IMHOFF");
return 5;
public void rayshowName()
System.out.println("raYMOND");
// FAMOUS PERSONS LINKED LIST EXAMPLE
// Frans Coenen
// Saturday 15 January 2000
// Depaertment of Computer Science, University of Liverpool
class ClassLinkList {
/* FIELDS */
public String className;
public String shortcutName;
public int methodNumber;
public int yearOfDeath;
public String occupation;
public ClassLinkList next = null;
public ClassLinkList linkRef5 = this;
public ClassLinkList startRef = null;
/* CONSTRUCTORS */
/* FamousPerson constructor */
public ClassLinkList(String classname, String shortcutname, int methodnumber, int year2,
                              String description) {
     className = classname;
     shortcutName = shortcutname;
     methodNumber = methodnumber;
     yearOfDeath = year2;
     occupation = description;
     next = null;
/* METHODS */
/* Output famous person linked list */
public void outputClassLinkedList()
     //public ClassLinkList outputClassLinkedList() {
     ClassLinkList linkRef = this;
     // Loop through linked list till end outputting each record in turn
while (linkRef != null)
     //System.out.println(linkRef5);
     System.out.println(linkRef.className + ", " + linkRef.shortcutName +
               " (" + linkRef.methodNumber + "-" + linkRef.methodNumber +
               "): " + linkRef.occupation);
     linkRef = linkRef.next;     
//return linkRef;
//public String ShowCasname()
//return String ;     
/* Add a new record to the linked list */
public ClassLinkList addRecordToLinkedList(ClassLinkList newRef) {
     ClassLinkList tempRef, linkRef;
     // Test if new person is to be added to start of list if so return
if (newRef.testRecord(this) ) {
     newRef.next = this;
     return(newRef);
     // Loop through remainder of linked list
     tempRef = this;
     linkRef = this.next;
     while (linkRef != null) {
     if (newRef.testRecord(linkRef)) {
     tempRef.next = newRef;
          newRef.next = linkRef;
          return(this);
     tempRef = linkRef;
     linkRef = linkRef.next;
// Add to end
tempRef.next = newRef;
     return(this);
/* Delete a record from the linked list given the first and last name. Four
posibilities:
1) Record to be deleted is at front of list
2) Record to be deleted is at end of list
3) Record to be deleted is in middle of list
4) Record not found. */
public ClassLinkList deleteRecord(String lName, String fName) {
ClassLinkList tempRef, linkRef;
// Record at start of list
if ((this.className == lName) & (this.shortcutName == fName))
     return(this.next);
     // Loop through linked list to discover if record is in middle of list.
     tempRef = this;
linkRef = this.next;
while (linkRef != null) {
     if ((linkRef.className == lName) & (linkRef.shortcutName == fName)) {
tempRef.next = linkRef.next;
return(this);
tempRef = linkRef;
linkRef = linkRef.next;
// Record at end of list, or not found
if ((linkRef.className == lName) & (linkRef.shortcutName == fName))
                    linkRef = null;
     else System.out.println("Record: " + lName + " " + fName + " not found!");
     return(this);
/* TEST METHODS */
/* Test whether new record comes before existing record or not. If so return
true, false otherwise. */
private boolean testRecord(ClassLinkList existingRef) {
     int testResult = className.compareTo(existingRef.className);
     if (testResult < 0) return(true);
     else {
     if ((testResult == 0) & (shortcutName.compareTo(existingRef.shortcutName) < 0 ))
                         return(true);
     // Return false
     return(false);
     public void addToList(String clname, String shcutname, int metnumber, int year2,
                              String description)
     // Create instance of class Famous Person
ClassLinkList newRef = new ClassLinkList(clname,shcutname,metnumber,year2,
                                   description);
// Add to linked list;
     startRef = startRef.addRecordToLinkedList(newRef);

I have a similar problem. I am writing a program to read the class names from database and instantiate several classes which extends from ServiceThread (an abstract class extending from Thread).
rs = pStmt.executeQuery();
while(rs.next()) {
String threadclassname = rs.getString("classname").trim();
try{
ServiceThread threadinstance = (ServiceThread)Class.forName(threadclassname).newInstance();
}catch ...
So far, only the first class is ever instantiated and runs fine. But subsequent classes do not even get pass the "... ... Class.forName(...).newInstance();" line.
Funny thing is that there are also no exceptions. The JVM just seem to hang there.

Similar Messages

  • Help with Locked files? Need help asap

    When I tried to open a file in DW8 today I got this message:
    File.html is a locked file and can be viewed but not changed.
    What would you like to do with this file?
    (buttons) Cancel View
    How did this happen and how can I undo this?
    Thanks-
    Anne

    If you had to use FINDER to unlock them, then it wouldn't
    have been anything
    in DW. That's fairly typical for files that have been copied
    from a CD,
    though.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Melliska" <[email protected]> wrote in
    message
    news:g14j8l$onj$[email protected]..
    >I did not copy it from a CD. I m not sure how this
    happened, but the entire
    > site was locked and I had to unlock each file through
    the finder on (Mac).
    > I must have enabled and disabled the check-in/check-out
    at some point in
    > order
    > for this to happen. I don't know what else would have
    caused this.
    > But they are unlocked now. Thanks for your response.
    >

  • I need Help with the dynamic link feature in CS3

    Hi I was wondering if anyone could help me with an issue I am having? I have the adobe cs3 master collection. Having watched tutorials on the dynamic link feature my version seems not to have the same options as those I have viewed. I wish to send my premiere video creation to encore using dynamic link, however when I click "file" and then "adobe dynamic link" the only options available are about "adobe after effects". I can export to encore however I am only alloowed to export one premiere sequence to one new encore file, I cannot create an encore file and import several premiere sequence into the same encore project. That means currently I can only have an encore creation with one premiere sequence in it, and I have no adobe dynamic link. Any help anyone could offer would be greatly appreciated.

    Thanks very much for that guys but my premiere media encoder only lets me export as: MPEG1, MPEG1-VCD, MPEG2, MPEG2 blu-ray, MPEG2-DVD, MPEG2-SVCD, H.264, H.264 blu-ray, Adobe Flash Video, Quicktime, Real Media, Windows Media. Are any of these formats DV AVI?
    Am I to export my videos direct to encore or save them elsewhere (e.g desktop). It seems that I cannot export sequences from different premiere projects to the same encore project.
    Sorry if any of these questions seem obvious, I am just new to premiere and keen to do things right from the off.
    Many thanks again guys.
    Date: Tue, 24 Nov 2009 19:32:47 -0700
    From: [email protected]
    To: [email protected]
    Subject: I need Help with the dynamic link feature in CS3
    Harm is correct.  For SD DVD, exporting as a DV AVI file from Pr will give you good results.  Encore's Automatic Transcoding will give you maximum quality for the available disc space.
    -Jeff
    >

  • HT4199 I need help with getting my printer to print, PLEASE.

    I need help with getting my printer to print, Please.

    What have you done so far?
    I suggest you connect it via a usb  cable first.  Once you get the printer working, move to wifi.  You will have to use an existing printer usb cable or purchase a cable.  Be sure to get the correct cable.  Ask for help.
    The warrenty indicates there is phone support.  Give HP a call.
    Warranty
    One-year limited hardware warranty; 24-hour, 7 days a week phone support
    Robert

  • MOVED: need help with my k7n2 delta series motherboard please

    This topic has been moved to AMD SocketA based board.
    need help with my k7n2 delta series motherboard please

    "...the other memory ive been using is  memorymaxx 512mb ddr 3200..." If I understood right, your'e actually using both memories at same time so, your'e lucky if it works. We have said thousand times that mixing dif. brand/make/speed memories is a bad idea, most with this Mobo that is very picky about ram. If you want to avoid slowdown problems, stay with only one stick ( the better one ) until you can buy at same time in same store, 2 identical memories to replace the old one.

  • After entering the redemption code from Adobe Photoshop CC, I keep getting an error saying "This card was purchased in a country that does not match your Adobe ID. You can try signing in with a different Adobe ID or get in touch with us if you need help."

    Hi. I'm a Mac user. After entering the redemption code from Adobe Photoshop CC, I keep getting an error saying "This card was purchased in a country that does not match your Adobe ID. You can try signing in with a different Adobe ID or get in touch with us if you need help." What should I do?

    Did you purchase the software in another country than where you live?

  • I need help with the https class please.

    Hello, i need add an authentication field in my GET request using HTTPS to authenticate users. I put the authentication field using the setRequestProperty method, but it doesn't appear when i print all properties using the getRequestProperties method. I wrote the following code:
    try{
    URL url = new URL ("https://my_url..");
    URLConnection conexion;
    conexion = url.openConnection();
    conexion.setRequestProperty("Authorization",my_urlEncoder_string);
    conexion.setRequestProperty("Host",my_loginServer);
    HttpsURLConnection httpsConexion = (HttpsURLConnection) conexion;
    httpsConexion.setRequestMethod("GET");
    System.out.println("All properties\r\n: " + httpsConexion.getRequestProperties());
    }catch ....
    when i run the program it show the following text:
    All properties: {Host=[my_loginServer]}
    Only the Host field is added to my HttpsURLConnection. The authentication field doesnt appear in standar output. How can i add to my HttpsURLConnection an Authentication field?
    thanks

    I have moved this to the main Dreamweaver forum, as the other forum is intended to deal with the Getting Started video tutorial.
    The best way to get help with layout problems is to upload the files to a website and post the URL in the forum. Someone can then look at the code, and identify the problem. Judging from your description, it sounds as though the Document window is narrow, which would result in the final menu tab dropping down to the next row. Try turning on Live view or previewing the page in a browser. Design view gives only an approximate idea of the final layout. Live view renders the page as it should look in a browser.

  • Need help with load balancing and DNS proxy

    Hi,
    I need help on how to configure my router so it will work with my DNS proxy and load balancing.
    I have a Linksys LRT224 router. I have two broadband connections from two separate ISPs,500Mbps each (WAN1 & WAN2). WAN1 has a static IP and WAN2 is dynamic assigned. I use Unlocator (www.unlocator.com) so I can access geographically restricted sites (Pandora, Netflix, etc.).
    The problem I have is that unlocator registers only one IP address (WAN1 address) and since I am doing load balancing I have no way of knowing if the DNS request will go through the registered IP (WAN1) or through the other (WAN2). I am not an expert in routing or networking but I'm guessing I have a way of configuring the router so all the DNS requests go out through WAN1, right?
    In the router's Dual WAN config page there is a section for Protocol Binding. I tried to configure but only managed to screw up the internet at home. I used:
    DNS[UDP/53-53]->192.168.1.1-192.168.1.254(0.0.0.0-0.0.0.0)WAN2
    Any help or suggestions are appreciated.
    Alex

    Good solution though. That's probably the only way you could do true Load Balancing anyway.
    Please remember to Kudo those that help you.
    Linksys
    Communities Technical Support

  • Need help with load balancing and DNS proxy -Repost

    Hi,
    I need help on how to configure my router so it will work with my DNS proxy and load balancing.
    I have a Linksys LRT224 router. I have two broadband connections from two separate ISPs,500Mbps each (WAN1 & WAN2). WAN1 has a static IP and WAN2 is dynamic assigned. I use Unlocator (www.unlocator.com) so I can access geographically restricted sites (Pandora, Netflix, etc.).
    The problem I have is that unlocator registers only one IP address (WAN1 address) and since I am doing load balancing I have no way of knowing if the DNS request will go through the registered IP (WAN1) or through the other (WAN2). I am not an expert in routing or networking but I'm guessing I have a way of configuring the router so all the DNS requests go out through WAN1, right?
    In the router's Dual WAN config page there is a section for Protocol Binding. I tried to configure but only managed to screw up the internet at home. I used:
    DNS[UDP/53-53]->192.168.1.1-192.168.1.254(0.0.0.0-​0.0.0.0)WAN2
    Any help or suggestions are appreciated.
    Alex

    Good solution though. That's probably the only way you could do true Load Balancing anyway.
    Please remember to Kudo those that help you.
    Linksys
    Communities Technical Support

  • Need help with assignment for class. its for my high school project :(

    i really need help, my problem is that with my code i cannot get the "previous", "done" and "next" buttons to work.they cannot seem to find the items from each other. so could someone look at those buttons in the code and tell me how to fix please? the code is as follows:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class GradeCalculator extends JFrame {
         private JTextField gradeA = new JTextField(3);
         private JTextField gradeB = new JTextField(3);
         private JTextField gradeC = new JTextField(3);
         private JTextField gradeD = new JTextField(3);
         private JTextField gradeE = new JTextField(3);
         private JTextField studentsName = new JTextField(15);
         private JTextField assignmentOne = new JTextField(5);
         private JTextField assignmentTwo = new JTextField(5);
         private JTextField assignmentThree = new JTextField(5);
         private JTextField examOne = new JTextField(5);
         private JTextField examTwo = new JTextField(5);
         private JTextArea textOutput;
         private JPanel buttonJPanel;
         public GradeCalculator(){
              JMenu fileMenu = new JMenu("File");
              JMenuItem aboutItem = new JMenuItem( "About" );
    fileMenu.add( aboutItem );
    aboutItem.addActionListener(
    new ActionListener()
    public void actionPerformed( ActionEvent event )
    JOptionPane.showMessageDialog( GradeCalculator.this,
    "Grade Calculator Version 1.00. \nMade by Carlson Smith.\nSchool: Pre-University\nSubject: Cape Computer Science.",
    "About", JOptionPane.PLAIN_MESSAGE );
              JMenuItem exitItem = new JMenuItem( "Exit" );
    fileMenu.add( exitItem );
    exitItem.addActionListener(
    new ActionListener()
    public void actionPerformed( ActionEvent event )
    System.exit( 0 );
              JMenuBar bar = new JMenuBar();
              setJMenuBar(bar);
              bar.add(fileMenu);     
              JTabbedPane tabbedPane = new JTabbedPane();
              buttonJPanel = new JPanel();
              buttonJPanel.setLayout(new GridLayout(1,2));
              JButton ok = new JButton("OK");
              ok.addActionListener(new OkBtnListener());
              JButton edit = new JButton("EDIT");
              edit.addActionListener(new EditBtnListener());
              /**JButton previous = new JButton("PREVIOUS");
              previous.addActionListener(new PreviousBtnListener());
              JButton done = new JButton("DONE");
              done.addActionListener(new DoneBtnListener());
              JButton next = new JButton("NEXT");
              next.addActionListener(new NextBtnListener());
              JPanel contentPane = new JPanel();
              contentPane.setLayout(new FlowLayout());
              contentPane.add(new JLabel("Grade A")/**,BorderLayout.NORTH*/);
              contentPane.add(gradeA/**,BorderLayout.NORTH*/);
              contentPane.add(new JLabel("Grade B")/**,BorderLayout.WEST*/);
              contentPane.add(gradeB/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade C")/**,BorderLayout.WEST*/);
              contentPane.add(gradeC/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade D")/**,BorderLayout.WEST*/);
              contentPane.add(gradeD/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade E")/**,BorderLayout.WEST*/);
              contentPane.add(gradeE/**,BorderLayout.WEST*/);
              tabbedPane.addTab("Grade Entry Tab", null, contentPane, "Grade Tab");
              //contentPane.add(ok,BorderLayout.WEST);
              //contentPane.add(edit,BorderLayout.WEST);
              buttonJPanel.add(ok);
              buttonJPanel.add(edit);
              contentPane.add(buttonJPanel, BorderLayout.WEST);
              JPanel content = new JPanel();
              content.setLayout(new FlowLayout());
              content.add(new JLabel("Student's Name")/**,BorderLayout.EAST*/);
              content.add(studentsName/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 1 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 2 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentTwo/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 3 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentThree/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 1 score:")/**,BorderLayout.EAST*/);
              content.add(examOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 2 score:")/**,BorderLayout.EAST*/);
              content.add(examTwo/**,BorderLayout.EAST*/);
              //content.add(previous,BorderLayout.EAST);
              //content.add(done,BorderLayout.EAST);
              //content.add(next,BorderLayout.EAST);
              Box box = Box.createVerticalBox();
              String output = "test";
              String outputTwo = output;
              textOutput = new JTextArea(outputTwo,10,30);
              box.add(new JScrollPane(textOutput));
              textOutput.setEditable(false);
              content.add(box,BorderLayout.SOUTH);
              tabbedPane.addTab("Calculator Tab", null, content, "Calculation & Output Tab");
              setContentPane(tabbedPane);
              pack();
              setTitle("Grade Calculator");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setLocationRelativeTo(null);
              class OkBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        String gradeAA = gradeA.getText();
                        double gradA = Double.parseDouble(gradeAA);
                        gradeA.setText(" "+gradA);
                        String gradeBB = gradeB.getText();
                        double gradB = Double.parseDouble(gradeBB);
                        gradeB.setText(" "+gradB);
                        String gradeCC = gradeC.getText();
                        double gradC = Double.parseDouble(gradeCC);
                        gradeC.setText(" "+gradC);
                        String gradeDD = gradeD.getText();
                        double gradD = Double.parseDouble(gradeDD);
                        gradeD.setText(" "+gradD);
                        String gradeEE = gradeE.getText();
                        double gradE = Double.parseDouble(gradeEE);
                        gradeE.setText(" "+gradE);
                        gradeA.setEditable(false);
                        gradeB.setEditable(false);
                        gradeC.setEditable(false);
                        gradeD.setEditable(false);
                        gradeE.setEditable(false);
              class EditBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        gradeA.setEditable(true);
                        gradeB.setEditable(true);
                        gradeC.setEditable(true);
                        gradeD.setEditable(true);
                        gradeE.setEditable(true);
              /**class PreviousBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        if (i <= 0){
                             i = 0;
                        }else if(i > 0){
                             i = i-1;
              class DoneBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        output = "Results \n";
                        output+= studentName[i]+" Assignment Average = "+averageO[i]+" Exam Average = "+averageT[i]+" Overall average = ";
                        output+= tAverage[i]+" Letter Grade = "+letterGrade;
              class NextBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        String [] studentName = new String [40];
                        double [] assignOne = new double [40];
                        double [] assignTwo = new double [40];
                        double [] assignThree = new double [40];
                        double [] gradeOne = new double [40];
                        double [] gradeTwo = new double [40];
                        double [] averageO = new double [40];
                        double [] averageT = new double [40];
                        double [] tAverage = new double [40];
                        char [] letterGrade = new char [40];
                        double max = 0;
                        double min = 100;
                        int i = 0;
                        while(i < studentName.length){
                             studentName[i] = studentsName.getText();
                             studentsName.setText(studentName[i]);
                             String aOne = assignmentOne.getText();
                             assignOne[i] = Double.parseDouble(aOne);
                             assignmentOne.setText(assignOne[i]);
                             String aTwo = assignmentTwo.getText();
                             assignTwo[i] = Double.parseDouble(aTwo);
                             assignmentTwo.setText(assignTwo[i]);
                             String aThree = assignmentThree.getText();
                             assignThree[i] = Double.parseDouble(aThree);
                             assignmentThree.setText(assignThree[i]);
                             String gOne = examOne.getText();
                             gradeOne[i] = Double.parseDouble(gOne);
                             examOne.setText(gradeOne[i]);
                             String gTwo = examTwo.getText();
                             gradeTwo = Double.parseDouble(gTwo);
                             examTwo.setText(gradeTwo[i]);
                             averageO[i] = (assignOne[i]+assignTwo[i]+assignThree[i])/3;
                             averageT[i] = (gradeOne[i]+gradeTwo[i])/2;
                             tAverage[i] = (averageO[i]+averageT[i])/2;
                             if (tAverage[i] >= gradeA){
                                  letterGrade[i] = 'A';
                             }else if(tAverage[i] >= gradeB){
                                  letterGrade[i] = 'B';
                             }else if(tAverage[i] >= gradeC){
                                  letterGrade[i] = 'C';
                             }else if(tAverage[i] >= gradeD){
                                  letterGrade[i] = 'D';
                             }else if(tAverage[i] <= gradeE){
                                  letterGrade[i] = 'E';
              public static void main(String[]args){
                   GradeCalculator calWindow = new GradeCalculator();
                   calWindow.setVisible(true);

    i have to apologize to jittei for the misunderstand i do not know which defination of terms is for which line of code but i know what they do, to solve the problem i have actually made another class in the workspace file called students and now all the bottons work, all i have to do now is properly arrange and put in some additional lines of code and it will be completed. teacher gave me the idea of putting in a new class to help in calling codes from other subclasses in the main program. ah well guess non of you could think of that thanks for the help-ish and hope yall will atleast try to be nice to new people that come in the room. the new coding is:
    of course all the commented out lines are not being used in the program anymore but just there till i have the program working with everything in it runs and performs the actions required now though ^_^
    *Group CAPE Computer Science 2007/8
    *GradeCalculator.java
    *@author Carlson Smith
    *@version 3.01          07/02/2008
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class GradeCalculator extends JFrame {
         private JTextField gradeA = new JTextField(3);
         private JTextField gradeB = new JTextField(3);
         private JTextField gradeC = new JTextField(3);
         private JTextField gradeD = new JTextField(3);
         private JTextField gradeE = new JTextField(3);
         private JTextField studentsName = new JTextField(15);
         private JTextField assignmentOne = new JTextField(5);
         private JTextField assignmentTwo = new JTextField(5);
         private JTextField assignmentThree = new JTextField(5);
         private JTextField examOne = new JTextField(5);
         private JTextField examTwo = new JTextField(5);
         private JTextArea  textOutput;
         private JPanel buttonJPanel;
         private JPanel buttonJPanelTwo;
         private Student [] students = new Student[40];
         private int current = 0;
         private String output;
         public GradeCalculator(){
              JMenu fileMenu = new JMenu("File");
              JMenuItem aboutItem = new JMenuItem( "About" );
              for (int i=0;i<40;i++){
                   students[i] = new Student("");
            fileMenu.add( aboutItem );
            aboutItem.addActionListener(
               new ActionListener()
                  public void actionPerformed( ActionEvent event )
                     JOptionPane.showMessageDialog( GradeCalculator.this,
                        "Grade Calculator Version 1.00. \nMade by Carlson Smith.\nSchool: Pre-University\nSubject: Cape Computer Science.",
                        "About", JOptionPane.PLAIN_MESSAGE );
              JMenuItem exitItem = new JMenuItem( "Exit" ); 
            fileMenu.add( exitItem );
            exitItem.addActionListener(
               new ActionListener()
                  public void actionPerformed( ActionEvent event )
                     System.exit( 0 );
              JMenuBar bar = new JMenuBar();
              setJMenuBar(bar);
              bar.add(fileMenu);     
              JTabbedPane tabbedPane = new JTabbedPane();
              buttonJPanel = new JPanel();
              buttonJPanel.setLayout(new GridLayout(1,2));
              JButton ok = new JButton("OK");
              ok.addActionListener(new OkBtnListener());
              JButton edit = new JButton("EDIT");
              edit.addActionListener(new EditBtnListener());
              buttonJPanelTwo = new JPanel();
              buttonJPanelTwo.setLayout(new GridLayout(1,3));
              JButton previous = new JButton("PREVIOUS");
              previous.addActionListener(new PreviousBtnListener());
              JButton done = new JButton("DONE");
              done.addActionListener(new DoneBtnListener());
              JButton next = new JButton("NEXT");
              next.addActionListener(new NextBtnListener());
              JPanel contentPane = new JPanel();
              contentPane.setLayout(new FlowLayout());
              contentPane.add(new JLabel("Grade A")/**,BorderLayout.NORTH*/);
              contentPane.add(gradeA/**,BorderLayout.NORTH*/);
              contentPane.add(new JLabel("Grade B")/**,BorderLayout.WEST*/);
              contentPane.add(gradeB/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade C")/**,BorderLayout.WEST*/);
              contentPane.add(gradeC/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade D")/**,BorderLayout.WEST*/);
              contentPane.add(gradeD/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade E")/**,BorderLayout.WEST*/);
              contentPane.add(gradeE/**,BorderLayout.WEST*/);
              tabbedPane.addTab("Grade Entry Tab", null, contentPane, "Grade Tab");
              //contentPane.add(ok,BorderLayout.WEST);
              //contentPane.add(edit,BorderLayout.WEST);
              buttonJPanel.add(ok);
              buttonJPanel.add(edit);
              contentPane.add(buttonJPanel, BorderLayout.WEST);
              JPanel content = new JPanel();
              content.setLayout(new FlowLayout());
              content.add(new JLabel("Student's Name")/**,BorderLayout.EAST*/);
              content.add(studentsName/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 1 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 2 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentTwo/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 3 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentThree/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 1 score:")/**,BorderLayout.EAST*/);
              content.add(examOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 2 score:")/**,BorderLayout.EAST*/);
              content.add(examTwo/**,BorderLayout.EAST*/);
              //content.add(previous,BorderLayout.EAST);
              //content.add(done,BorderLayout.EAST);
              //content.add(next,BorderLayout.EAST);
              buttonJPanelTwo.add(previous);
              buttonJPanelTwo.add(done);
              buttonJPanelTwo.add(next);
              content.add(buttonJPanelTwo, BorderLayout.EAST);
              Box box = Box.createVerticalBox();
              //String outputTwo = output;
              //textOutput.setText(output);
              textOutput = new JTextArea(output,10,30);
              box.add(new JScrollPane(textOutput));
              //textOutput.setEditable(true);
              content.add(box,BorderLayout.SOUTH);
              tabbedPane.addTab("Calculator Tab", null, content, "Calculation & Output Tab");
              setContentPane(tabbedPane);
              pack();
              setTitle("Grade Calculator");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setLocationRelativeTo(null);
              class OkBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        String gradeAA = gradeA.getText();
                        double gradA = Double.parseDouble(gradeAA);
                        gradeA.setText(" "+gradA);
                        String gradeBB = gradeB.getText();
                        double gradB = Double.parseDouble(gradeBB);
                        gradeB.setText(" "+gradB);
                        String gradeCC = gradeC.getText();
                        double gradC = Double.parseDouble(gradeCC);
                        gradeC.setText(" "+gradC);
                        String gradeDD = gradeD.getText();
                        double gradD = Double.parseDouble(gradeDD);
                        gradeD.setText(" "+gradD);
                        String gradeEE = gradeE.getText();
                        double gradE = Double.parseDouble(gradeEE);
                        gradeE.setText(" "+gradE);
                        gradeA.setEditable(false);
                        gradeB.setEditable(false);
                        gradeC.setEditable(false);
                        gradeD.setEditable(false);
                        gradeE.setEditable(false);
              class EditBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        gradeA.setEditable(true);
                        gradeB.setEditable(true);
                        gradeC.setEditable(true);
                        gradeD.setEditable(true);
                        gradeE.setEditable(true);
              class PreviousBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        Student currentStudent = students[current];
                        currentStudent.setStudentName(studentsName.getText());          
                        currentStudent.setAssignOne(Double.parseDouble(assignmentOne.getText()));
                        currentStudent.setAssignTwo(Double.parseDouble(assignmentTwo.getText()));
                        currentStudent.setAssignThree(Double.parseDouble(assignmentThree.getText()));
                        currentStudent.setExamOneGrade(Double.parseDouble(examOne.getText()));
                        currentStudent.setExamTwoGrade(Double.parseDouble(examTwo.getText()));
                        currentStudent = students[current];
                        if (current <= 0){
                             current = 0;
                        }else if(current > 0){
                             current = current-1;
                        refresh();               
                        System.out.println(current);
              class DoneBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        Student currentStudent = students[current];
                        //output = "Result \n";
                        output = currentStudent.getStudentName()+". Assignment Average = "+currentStudent.getAverage()+". Exam Average = "+currentStudent.getExamAverage()+". Overall average = ";
                        output+= currentStudent.getTotalAverage()/**+" Letter Grade = "+letterGrade[current]*/;
                        textOutput.setText(output);
                        System.out.println(output);
                        currentStudent = students[current];
              class NextBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
    //                    String [] studentName = new String [40];
    //                    double [] assignOne = new double [40];
    //                    double [] assignTwo = new double [40];
    //                    double [] assignThree = new double [40];
    //                    double [] gradeOne = new double [40];
    //                    double [] gradeTwo = new double [40];
    //                    double [] averageO = new double [40];
    //                    double [] averageT = new double [40];
    //                    double [] tAverage = new double [40];
    //                    char [] letterGrade = new char [40];
                        //double max = 0;
                        //double min = 100;
                        Student currentStudent = students[current];
                        currentStudent.setStudentName(studentsName.getText());
                        currentStudent.setAssignOne(Double.parseDouble(assignmentOne.getText()));
                        currentStudent.setAssignTwo(Double.parseDouble(assignmentTwo.getText()));
                        currentStudent.setAssignThree(Double.parseDouble(assignmentThree.getText()));
                        currentStudent.setExamOneGrade(Double.parseDouble(examOne.getText()));
                        currentStudent.setExamTwoGrade(Double.parseDouble(examTwo.getText()));
    //                    currentStudent = students[current];
                        current++;
                        refresh();
    /**                    while(i < studentName.length){
                             String aOne = assignmentOne.getText();
                             assignOne[i] = Double.parseDouble(aOne);
                             assignmentOne.setText(" "+assignOne);
                             String aTwo = assignmentTwo.getText();
                             assignTwo[i] = Double.parseDouble(aTwo);
                             assignmentTwo.setText(" "+assignTwo[i]);
                             String aThree = assignmentThree.getText();
                             assignThree[i] = Double.parseDouble(aThree);
                             assignmentThree.setText(" "+assignThree[i]);
                             String gOne = examOne.getText();
                             gradeOne[i] = Double.parseDouble(gOne);
                             examOne.setText(" "+gradeOne[i]);
                             String gTwo = examTwo.getText();
                             gradeTwo[i] = Double.parseDouble(gTwo);
                             examTwo.setText(" "+gradeTwo[i]);
                             averageO[i] = (assignOne[i]+assignTwo[i]+assignThree[i])/3;
                             averageT[i] = (gradeOne[i]+gradeTwo[i])/2;
                             tAverage[i] = (averageO[i]+averageT[i])/2;
                             if (tAverage[i] >= Double.parseDouble(gradeA.getText())){
                                  letterGrade[i] = 'A';
                             }else if(tAverage[i] >= Double.parseDouble(gradeB.getText())){
                                  letterGrade[i] = 'B';
                             }else if(tAverage[i] >= Double.parseDouble(gradeC.getText())){
                                  letterGrade[i] = 'C';
                             }else if(tAverage[i] >= Double.parseDouble(gradeD.getText())){
                                  letterGrade[i] = 'D';
                             }else if(tAverage[i] <= Double.parseDouble(gradeE.getText())){
                                  letterGrade[i] = 'E';
              public void refresh(){
                   Student currentStudent = students[current];
                   studentsName.setText(currentStudent.getStudentName());
                   assignmentOne.setText(currentStudent.getAssignOne()+"");
                   assignmentTwo.setText(currentStudent.getAssignTwo()+"");
                   assignmentThree.setText(currentStudent.getAssignThree()+"");
                   examOne.setText(currentStudent.getExamOneGrade()+"");
                   examTwo.setText(currentStudent.getExamTwoGrade()+"");
              public static void main(String[]args){
                   GradeCalculator calWindow = new GradeCalculator();
                   calWindow.setVisible(true);
    Second class implemented./**
    *Group CAPE Computer Science 2007/8
    *Student.java
    *@author Carlson Smith
    *@version 3.01          07/02/2008
    public class Student {
         private String studentName;
         private double assignOne;
         private double assignTwo;
         private double assignThree;
         private double examOneGrade;
         private double examTwoGrade;
         public Student(String sName){
              studentName = sName;     
         public String getStudentName(){
              return studentName;
         public double getAssignOne(){
              return assignOne;
         public double getAssignTwo(){
              return assignTwo;
         public double getAssignThree(){
              return assignThree;
         public double getExamOneGrade(){
              return examOneGrade;
         public double getExamTwoGrade(){
              return examTwoGrade;
         public void setStudentName(String sName){
              studentName = sName;
         public void setAssignOne(double assignOne){
              this.assignOne = assignOne;
         public void setAssignTwo(double assignTwo){
              this.assignTwo = assignTwo;
         public void setAssignThree(double assignThree){
              this.assignThree = assignThree;
         public void setExamOneGrade(double examOneGrade){
              this.examOneGrade = examOneGrade;
         public void setExamTwoGrade(double examTwoGrade){
              this.examTwoGrade = examTwoGrade;
         public double getAverage(){
              return (assignOne + assignTwo + assignThree)/3;
         public double getExamAverage(){
              return (examOneGrade + examTwoGrade)/2;
         public double getTotalAverage(){
              return (getAverage() + getExamAverage())/2;
    this thread can be closed now. l8rz :P
    Edited by: Jacal on Feb 10, 2008 7:28 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

  • A problem with my mifi 2200 need help please

    Hey everyone. I came here to get help with my verizon mifi card that all the sudden after such a great run stops working!
    I had bought two mifi 2200 cards at the same time about a year ago. All I did was turn them on and was getting Internet connection wirelessly to my ipad right away. My connection worked for ages and never had a problem until recently. One of the cards stopped working roughly about three months ago. I looked around online for things that perhaps was stopping the device from working. I figured that the device was ready for an update and that was prohibiting the device from working, but here is the weird part; the other card (the exact same one) was working when this first card I mentioned wasn't. The card working continued to work until just recently like a day or so ago. Odd right. Anyway, the first card I connected to the USB cord that was provided in the box into my laptop. I was immediatly prompted to download Verizon Manager. My first time ever getting to this step. I was connected to my Internet connection at home via LAN line because that was my only option to Internet. After the software was downloaded, I was prompted to update firmware in which I did, then I was told to update wifi area coverage information which is just that search for finding local wifi spots, the next one is the important one that never seemed to work. The message read somewhere along the lines of you need to update coverage area information as if in there was some new program via coverage to get the stuff to communicate with the device. I said yes and then a message popped up saying Activation and had this bar going side to side, but after a while was told the programming failed. The device has already been activated so I don't understand the reason for the word Activation. Regardless, I tried doing other things I've read on this forum like resetting the device, turning standby mode to never, and so forth, but none worked. The device powers on/everything is on, and I can connect to the device, but I have no Internet. Please, some one tell me what is going on.
    Thank you and hope to hear from you soon.

    Sounds like you botched a firmware update and bricked your MiFi.
    Have you tried contacting VZW for a replacement device yet?

  • Please help with writing a class

    i need help getting started with this assignment. i haven't done anything with writing classes, so i don't know where to start.
    i need to create a bank account class that will keep a name, balance, up to 50 deposits, and up to 50 withdrawls. i need to include 2 arrays for the deposits and withdrawls.
    Here's what i know:
    I need a constructor that takes zero arguments. This constructor would initialize the numeric value to zero.
    I need a 2nd constructor that takes one argument, a name as a String value. This constructor would initialize the numeric value to zero.
    I need a 3rd constructor that takes two arguments, a name as a String value and a starting "balance" as a double value

    Sorry, I was watching a movie with my wife ...imagine that. Study my examples here and try to understand what I have done. You will follow the same methodology for the rest of the program. Use main to test the methods in your program.
    public class mdlAccount {
      String name;
      double balance;
      int currentDeposit = 0;
      int currentWithdrawl = 0;
      double[] deposits = new double[50];
      double[] withdrawals = new double[50];
      public mdlAccount() {
        name = "";
        balance = 0.0;
      public mdlAccount(String name) {
        this.name = name;
        balance = 0.0;
      public mdlAccount(String name, double balance) {
        this.name = name;
        this.balance = balance;
      // When the instructor says: Have a method that does deposits...
      // You need to create a method, similar to the constructors,
      // but with a return value, even if it returns void (nothing).
      // Like this:
      public void deposit( double amount ) {
        // Do some error checking.
        if ( currentDeposit < 50 && amount > 0 ) { // > is a greater than sign
          // If all is ok, add to the balance...
          balance += amount;
          // and add the entry to the array of deposits
          deposits[currentDeposit] = amount;
          // Finally, add 1 to the currentDeposit variable.
          currentDeposit++;
      // We need the 'return the balance' method so we can see if
      // the program runs correctly. This time we return a double,
      // instead of void. (void means don't return anything at all).
      public double getBalance() {
        return balance;
    // Now you create the next method for withdrawals...
    //  if ( currentWithdrawl < 50 ) {
    //    deposits[currentWithdrawl] = amount;
    //    currentWithdrawl++;
      // You want a main method so this class can be executed.
      // You can remove it later if you want to use this class
      // from within another larger program.
      public static void main(String[] args) {
        mdlAccount acct = new mdlAccount( "GumB", 100.0 );
        System.out.println("Initial balance is " + acct.getBalance());
        acct.deposit( 50.0 );
        System.out.println("Current balance is " + acct.getBalance());

  • Need help with loading Windows 7 onto Macbook Pro - Bootcamp and parallels

    Hi,
    I have a windows PC and changing over to a Mac. I purchased today Parallels and Microsoft Office for Mac in order to use them on the MacBook.
    Also please note - I need to use Bootcamp for some programs that I need to use - and then also be able to use parallels.
    Where I am up to at the moment is - since there is no disc drive on the laptop where I can insert the disc - I have gone onto my PC and downloaded the Windows 7  usb/dvd download tool setup - however I dont know where I find the ISO file for Windows 7? So if someone could help me with that.
    Alternatively - can someone please let me know if I can just pay and download Window 7 for Mac - and then run it through boot camp etc. If someone can please give me some advice on this - and also a handy step by step guide on how to achieve it.
    Thank you so much in advance for your help!!!! I really appreciate it!
    K

    Thanks Clinton  - When I went into Apple store today, I told him about the programs my husband needs to use for a CBUS course. The guy there said his room mate has done the same thing and cannot use parallels for the programs they need to run (it doesnt seem to work properly) so he is using boot camp to run them and it works fine. So I am wanting to run Boot camp first and then once the course is finished run everything through parallels. 
    So I have gone into Boot Camp - and because there is no Disc drive I cannot insert the disc - so I have gone back onto the PC to put windows onto a USB to then use with Bootcamp. I just cannot find the ISO file path for Windows.
    I hope this all makes sense!
    I am thinking I maybe i will buy the windows ISO file instead of trying to hunt it down on the PC. Do you think this is the best way to do it?

  • Please help with correcting calling class and method errors

    Hi All,
    I have created a game (like battleship) for 2 tanks. I can't seem to connect the classes and methods to get the values for the last die face rolled; last direction rolled on a 4 headed dice; the x and y position for each tank; the armour value and the firePower (or hit value) to print.
    Each row of these values is supposed to print 50 times using a while loop.
    (N.B. The code is appended below my name.)
    Could anyone please help me? I would be most grateful. Thank you.
    Steve
    import java.util.*;
    class Client
    static Die die;
    static Direction dir;
    static Tank tk1;
    static Tank tk2;
    public static final
    void main( String[] argv)
    die = new Die();
    dir = new Direction();
    tk1 = new Tank();
    tk2 = new Tank();
    int lastFace;
    int setfaceLast;
    int x;
    int y;
    int armourVal;
    int firePower;
    int battleNum=0;
    int battles;
    int moves = 0;
    System.out.println("Tank");
    System.out.println("'\t' Number");
    System.out.println("'\t' Dir");
    System.out.println("'\t' xValue");
    System.out.println("'\t' yValue");
    System.out.println("'\t' Armour");
    System.out.println("Firepower"+'\n');
    int i=0;
    //int getLastFace();
    //int LastDirName();
    while (i <= 50);
    int XPos;
    int YPos;
    Pos p = new Pos();
    p.setXPos(x);
    p.setYPos(y);
    System.out.println ("'\t' Tank 1-");
    //System.out.println ( die.getLastFace());
    //System.out.println( dir.getLastDirName());
    System.out.println(Pos(x));
    System.out.println(Pos(y));
    System.out.println(armourVal);
    System.out.println(firePower+'\n');
    System.out.println ("Tank 2-");
    System.out.println ( lastFace);
    //System.out.println(LastDir);
    System.out.println(x);
    System.out.println(y);
    System.out.println(armourVal);
    System.out.println(firePower+'\n');
    moves++;
    System.out.println(" '\n' + BATTLE");
    class Tank
    public static final int MINGRID;
    public static final int MAXGRID;
    static Die die = new Die();
    static Direction dir = new Direction();
    private static int battleCount;
    private static int moveCount;
    private int x;
    private int y;
    private int armourVal;
    private int firePower;
    public Tank()
    int MINGRID=-10;
    int MAXGRID=10;
    battleCount=0;
    moveCount=0;
    x=0;
    y=0;
    armourVal=10;
    firePower=1;
    public
    int getmove()
    die.roll();
    dir.roll();
    dir.getLastDir();
    die.getLastFace();
    int x;
    int y;
    int Pos;
    switch( dir.getLastDir() )
    case Direction.UP:
    y += die.getLastFace();
    break;
    case Direction.DOWN:
    y -= die.getLastFace();
    break;
    case Direction.RIGHT:
    x += die.getLastFace();
    case Direction.LEFT:
    x-= die.getLastFace();
    break;
    if ( x > MAXGRID )
    x = (2 * MAXGRID) - x;
    else if ( x < MINGRID )
    x = (-2 * MINGRID) - x;
    if ( y > MAXGRID )
    y = (-2 * MAXGRID) - y;
    else if ( y < MINGRID )
    y = (-2 * MINGRID) - y;
    if ( x == -3 && y == -3 )
    firePower++;
    System.out.println("Yipee - more firepower.");
    if ( x == 3 && y == 3)
    this.armourVal += 10;
    System.out.println("Yipee - more armour.");
    return Pos;
    //printDetails();
    public boolean getcontinueBattle(Tank tk2)
    moveCount++;
    if ( x == tk2.x && y == tk2.y)
    battleCount++;
    System.out.println("Battle");
    tk2.armourVal -= firePower;
    armourVal -= tk2.firePower;
    if (tk2.armourVal < 0 )
    int moveCount, battleCount;
    return false;
    if ( armourVal < 0 )
    int moveCount, battleCount;
    return false;
    return true;
    public int getprintDetails()
    int ptDet;
    return ptDet;
    class Direction
    private int lastFaceDir;
    private Random rnd;
    public static final int UP = 1;
    public static final int DOWN = 2;
    public static final int LEFT = 3;
    public static final int RIGHT = 4;
    String direction;
    private
    int getRandomNum()
    int raw = rnd.nextInt();
    raw = Math.abs( raw );
    raw %= 4;
    raw++;
    return raw;
    public
    Direction()
    rnd = new Random();
    roll();
    public
    int roll()
    lastFaceDir = getRandomNum();
    if (lastFaceDir == UP)
    direction = "up";
    else if (lastFaceDir == DOWN)
    direction= "down";
    else if (lastFaceDir == LEFT)
    direction = "left";
    else if (lastFaceDir == RIGHT)
    direction= "right";
    return lastFaceDir;
    public
    int getLastFaceDir()
    return lastFaceDir;
    }// end class
    class Die
    private int lastFace;
    private Random rnd;
    private
    int getRandomNum()
    int raw = rnd.nextInt();
    raw = Math.abs( raw );
    raw %= 6;
    raw++;
    return raw;
    public
    Die()
    rnd = new Random();
    roll();
    public
    int roll()
    lastFace = getRandomNum();
    return lastFace;
    public
    int getLastFace()
    return lastFace;
    }// end class

    I got this sorted!
    I unzipped the JAR and loaded the classes individually - so now the "reference" issue went away. Instead I now have a new problem, but I will post that seperately.

  • Please help with Load Variables / ASP

    Hello,
    I am using Load Variables to retreive a variable from an ASP
    page, (which uses a response.write) to output the variable
    getfile.onRelease = function()
    myData = new LoadVars();
    myData.onLoad = function(success){
    if(success) {
    getfile_txt.text = this.strString;
    } else {
    getfile_txt.text = "error";
    myData.load("sendFile.asp");
    stop();
    the problem is that the output says "undefined", but when I
    access the .asp page through my web browser I get the expected
    result of the variable which is "Test1.Doc"
    if any1 can help with this, i would be massivley thankful,
    thanks.

    p.s strString is the variable that I am trying to pass from
    the ASP page.

Maybe you are looking for

  • Zip file is created with 0 bytes

    In my below code, I am trying to zip a folder containing files and folders. But the zip file is getting created with 0 bytes. Could anyone please tell me what is wrong in my coding. private void jButton5ZipActionPerformed(java.awt.event.ActionEvent e

  • How do I replace font colors across the whole document?

    So I know how to change a certain font across the whole document. I can replace let's say, Times New Roman with Arial throughout the whole document. However, what if I want to replace a font color? For example, I want to change the black 0,0,0,0 with

  • Need help with 30gb M

    Ive had this Zen-M 30GB for about 3 or so years. For the past year I Can Not get my computer to reconize it. Ive uninstalled and reinstalled the zen disk "factory disk" 0x with No luck. Ive changed usb cables, I tried using the Front &rear usb port.

  • Prepare to export ABAP

    Hi ALL Now i try to prepare to export ABAP useing SAPinst,but it's a error we paltform: ECC6 SR3 with EPH3 Oracle 10.2.0.4 HP-UX 11i 31 TRACE      2010-10-14 17:29:31.630 Function setMessageIdOfExceptionMessage: nw.processError ERROR      2010-10-14

  • Exchange Connector to O365 is dropping

    Hello, we have configured Exchange Connector in SCSM 2012 R2 with Office 365. Connector fails few times per week and usually restart of the workflow server works. When I look on connectors, finished time on connector is up to date but work items are