Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 1 of 2 12 LastLast
Results 1 to 25 of 32

Thread: just one more error that i cannot figure out please help me.

  1. #1
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Angry just one more error that i cannot figure out please help me.

    ok i need to get playerscore consistently updated sort of like a clock every one second and it is annoying me about how i cant get the value into the label or text field

    package match.bonus.calculator;
    import java.util.Timer;
    import java.util.TimerTask;
     
    import java.lang.Double;
            /* @author Parad0xs
     */
    public class exp extends javax.swing.JApplet {
     
        /** Initializes the applet exp */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
     
                    public void run() {
                        initComponents();
                    }
                });
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
     
        /** This method is called from within the init() method to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
     
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
     
            jScrollPane1 = new javax.swing.JScrollPane();
            jList1 = new javax.swing.JList();
            jScrollPane3 = new javax.swing.JScrollPane();
            jTextArea2 = new javax.swing.JTextArea();
            jLabel1 = new javax.swing.JLabel();
     
            addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    formPropertyChange(evt);
                }
            });
     
            jList1.setModel(new javax.swing.AbstractListModel() {
                String[] strings = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50" };
                public int getSize() { return strings.length; }
                public Object getElementAt(int i) { return strings[i]; }
            });
            jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            jScrollPane1.setViewportView(jList1);
     
            jTextArea2.setColumns(20);
            jTextArea2.setRows(5);
            jScrollPane3.setViewportView(jTextArea2);
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap(88, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(56, 56, 56)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(113, 113, 113)
                            .addComponent(jLabel1)))
                    .addGap(57, 57, 57))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(119, 119, 119)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel1)
                            .addGap(100, 100, 100)))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
        }// </editor-fold>
        @SuppressWarnings("FieldNameHidesFieldInSuperclass")
    double On = 1 ;
        private void formPropertyChange(java.beans.PropertyChangeEvent evt) {                                    
            // TODO add your handling code here:
        }                                   
     
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        public javax.swing.JList jList1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JScrollPane jScrollPane3;
        private javax.swing.JTextArea jTextArea2;
        // End of variables declaration
    double winnerscale1 = 1;
    int index= jList1.getSelectedIndex();
    double spm = ((((61 % index )+1)/2)+3);
    double gamelength;
    boolean val ;
    double playerscore1 = ( (winnerscale1 * ((gamelength/60) * spm))*(1) ); ;
     
     
     
     
     
     
     
    class GCTask extends TimerTask {
      public void run() {
          ++gamelength
                  ;
        System.gc();
      }
    }
     
     
     
     
    class timer {
      public  void main(String[] args) {
        Timer timer = new Timer();
        GCTask task = new GCTask();
        timer.schedule(task, 1000, 1000);
        int counter = 1;
        while (true) {
          try {
            Thread.sleep(500);
          } catch (InterruptedException e) {
          }
        }
      }
    }                
    }




    please help me!!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.

    There's a problem with your code. When I run it I get:
    java.lang.NullPointerException
    at ExpApplet.<init>(ExpApplet.java:111)

    First get your code to execute w/o errors.

    Then fix the GUI so it shows the value you want to change.

    When you get that working, come back for advice on how to update the displayed value.
    Last edited by Norm; June 13th, 2011 at 04:44 PM.

  3. #3
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    oh sry i forgot it's not a code error [but thanks abou telling me about that] it's that i need to get playerscore1 into javax.swing.JTextArea(); but i cannot for the life of me find anything that will help me do that

    ....... and how would i fix the error that you came up with?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.

    get playerscore1 into javax.swing.JTextArea();
    Have you read the API doc for the JTextArea class?
    What methods does it have that will change the contents of the JTextArea?

  5. #5
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    i dont know i am a complete and utter fail i just want this thing done and working properly and tehn i will NEVER touch a proggramming language again ........ until i go back to school in the fall but ya i just dont know anything about java at all and ya so .... help?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.

    Work on one small problem, solve it and then move on to the next one.
    Programming can be very tedious and requires a lot of attention to detail. Lots of details.
    Go slowly one step at a time until it starts making sense.
    Trying to do too much too soon will only confuse things.

  7. #7
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    i've been doing that and i just have one [now two] problems to fix

    FML

    this isn't the first time i've programmed it's just that this is the longest program i've ever made and the first one in java
    Last edited by knoxy5467; June 13th, 2011 at 05:02 PM.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.

    Why did you pick a complicated one instead of a simple one? Where did you get the code about the property change? Too much IDE generated stuff that beginners don't know how to read and use.
    You have code outside of a method that is getting executed before the GUI is present.

  9. #9
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    so put all the stuff before the gui after it?

    and then ya this is the code with out the netbeans ide stuff

    package match.bonus.calculator;
    import java.util.Timer;
    import java.util.TimerTask;
     
    import java.lang.Double;
            /* @author Parad0xs
     */
    public class exp extends javax.swing.JApplet {
     
        /** Initializes the applet exp */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
     
                    public void run() {
                        initComponents();
                    }
                });
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
     
        /** This method is called from within the init() method to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
     
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
     
            jScrollPane1 = new javax.swing.JScrollPane();
            jList1 = new javax.swing.JList();
            jScrollPane3 = new javax.swing.JScrollPane();
            jTextArea2 = new javax.swing.JTextArea();
            jLabel1 = new javax.swing.JLabel();
     
            addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    formPropertyChange(evt);
                }
            });
     
            jList1.setModel(new javax.swing.AbstractListModel() {
                String[] strings = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50" };
                public int getSize() { return strings.length; }
                public Object getElementAt(int i) { return strings[i]; }
            });
            jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            jScrollPane1.setViewportView(jList1);
     
            jTextArea2.setColumns(20);
            jTextArea2.setRows(5);
            jScrollPane3.setViewportView(jTextArea2);
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap(88, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(56, 56, 56)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(113, 113, 113)
                            .addComponent(jLabel1)))
                    .addGap(57, 57, 57))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(119, 119, 119)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel1)
                            .addGap(100, 100, 100)))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
        }// </editor-fold>
        @SuppressWarnings("FieldNameHidesFieldInSuperclass")
    double On = 1 ;
        private void formPropertyChange(java.beans.PropertyChangeEvent evt) {                                    
            // TODO add your handling code here:
        }                                   
     
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        public javax.swing.JList jList1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JScrollPane jScrollPane3;
        private javax.swing.JTextArea jTextArea2;
        // End of variables declaration
    double winnerscale1 = 1;
    int index= jList1.getSelectedIndex();
    double spm = ((((61 % index )+1)/2)+3);
    double gamelength;
    boolean val ;
    double playerscore1 = ( (winnerscale1 * ((gamelength/60) * spm))*(1) ); ;
     
     
     
     
     
     
     
    class GCTask extends TimerTask {
      public void run() {
          ++gamelength
                  ;
        System.gc();
      }
    }
     
     
     
     
    class timer {
      public  void main(String[] args) {
        Timer timer = new Timer();
        GCTask task = new GCTask();
        timer.schedule(task, 1000, 1000);
        int counter = 1;
        while (true) {
          try {
            Thread.sleep(500);
          } catch (InterruptedException e) {
          }
        }
      }
    }                
    }

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.

    Does it work now? If not, please explain what it does or doesn't do.

    Try debugging your code by adding printlns statements to show the execution flow and where variables are changed.

  11. #11
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    uh all i want it to do is time the seconds that go by since user presses specific button and then using that and the rank of the user [selected from list] it acts like a stopwatch exept just showing your match bonus instead of time [yes this is for CoD i know i'm a noob but until battlefield 3 wtf am i supposed to do?]

    and i have no idea what you just said's meaning

  12. #12
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    do you mean the
     // hello and i am a noob

    thingys?

  13. #13
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: just one more error that i cannot figure out please help me.

    What is playscore1?

    Could you try using the setText() method?

    If playscore1 is a JLabel or something like that, can't do something like this

    JTextArea area = new JTextArea(100,100);
    area.setText(playscore1.getText());

  14. #14
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    Quote Originally Posted by javapenguin View Post
    What is playscore1?

    Could you try using the setText() method?

    If playscore1 is a JLabel or something like that, can't do something like this

    JTextArea area = new JTextArea(100,100);
    area.setText(playscore1.getText());
    i think i tried that but i'll give it another shot.

  15. #15
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: just one more error that i cannot figure out please help me.

    Wait, playerscore1 is a double.

    You'll have to make it a Double and then call a toString() as you must set the text to a String.

    Double ps1 = playerscore1;

    String text = ps1.toString();

    area.setText(text);

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.

    time the seconds that go by since user presses specific button
    How are you doing this?
    How do you detect the button press?
    When/where do you record the starting time?
    Where do you compute the duration from the starting time?
    Where do you display that duration?

  17. #17
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    ok i know i've already tried this but i'll try it again

    for some reason that somtimes works when somthing doesn't work the first time or the 4th but works the 100th

    and what do you know IT WORKED THANK YOU SO GOD D**M Much *breaks out into song and dance*

  18. #18
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    and all of your questions i have not started yet like you said one hurdle at a time r somthing like that



    Quote Originally Posted by Norm View Post
    Work on one small problem, solve it and then move on to the next one.
    Programming can be very tedious and requires a lot of attention to detail. Lots of details.
    ya thats it

  19. #19
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    ok um how would i make a toggle button turn the timer on and then when it's off it freezes the text field where it's at while when it's turned back on the gamelength is reset back to 0 ??

    and to answer these things

    When/where do you record the starting time?
    Where do you compute the duration from the starting time?
    Where do you display that duration?
     class GCTask extends TimerTask {
      public void run() {
          ++gamelength
                  ;
        System.gc();
      }
    }
     
     
     
     
    class timer {
      public  void main(String[] args) {
        Timer timer = new Timer();
        GCTask task = new GCTask();
        timer.schedule(task, 1000, 1000);
        int counter = 1;
        while (true) {
          try {
            Thread.sleep(500);
          } catch (InterruptedException e) {
          }
        }
      }
    }                
    }
    [told ya i fails]

  20. #20
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: just one more error that i cannot figure out please help me.

    I think I found that a bunch of code appears in the middle of nowhere outside any methods.

    Where does this go:
     private javax.swing.JLabel jLabel1;
                public javax.swing.JList jList1;
                private javax.swing.JScrollPane jScrollPane1;
                private javax.swing.JScrollPane jScrollPane3;
                private JTextArea jTextArea2;
     
                // End of variables declaration
            double winnerscale1 = 1;
            int index= jList1.getSelectedIndex();
            double spm = ((((61 % index )+1)/2)+3);
            double gamelength;
            boolean val ;
            double playerscore1 = ( (winnerscale1 * ((gamelength/60) * spm))*(1) );
    		  Double ps1 = playerscore1 ;
    		  String str = ps1.toString();
     
    		  jTextArea2.setText(str);

  21. #21
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    um exept the very top stuff i made all of that stuff it's declaring variables and setting the text in a text field

  22. #22
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: just one more error that i cannot figure out please help me.


  23. #23
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: just one more error that i cannot figure out please help me.

    A button turn the timer on?

    Perhaps add an ActionListener to the Toggle Button.

  24. #24
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: just one more error that i cannot figure out please help me.

    I've gotten it to compile and show some stuff now.

       package match.bonus.calculator;
       import java.util.Timer;
       import java.util.TimerTask;
       import javax.swing.*;
       import java.awt.*;
       import javax.swing.JTextArea;
     
       import java.lang.Double;
                    /* @author Parad0xs
             */
       public class exp extends javax.swing.JApplet {
          double gamelength;
                /** Initializes the applet exp */
          public void init() {
             try {
                java.awt.EventQueue.invokeAndWait(
                      new Runnable() {
     
                         public void run() {
                            initComponents();
                         }
                      });
             } 
                catch (Exception ex) {
                   ex.printStackTrace();
                }
          }
     
                /** This method is called from within the init() method to
                 * initialize the form.
                 * WARNING: Do NOT modify this code. The content of this method is
                 * always regenerated by the Form Editor.
                 */
     
          @SuppressWarnings("unchecked")
                // <editor-fold defaultstate="collapsed" desc="Generated Code">
                private void initComponents() {
     
             JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
             JList jList1 = new javax.swing.JList();
             JScrollPane jScrollPane3 = new javax.swing.JScrollPane();
             JTextArea  jTextArea2 = new javax.swing.JTextArea();
             JLabel  jLabel1 = new javax.swing.JLabel();
     
             double winnerscale1 = 1;
             int index= jList1.getSelectedIndex();
             double spm = ((((61 % index )+1)/2)+3);
     
             boolean val ;
             double playerscore1 = ( (winnerscale1 * ((gamelength/60) * spm))*(1) );
     
             Double ps1 = playerscore1 ;
             String str = ps1.toString();
             jTextArea2 = new JTextArea(100,100);
             jTextArea2.setText(str);
     
             addPropertyChangeListener(
                   new java.beans.PropertyChangeListener() {
                      public void propertyChange(java.beans.PropertyChangeEvent evt) {
                         formPropertyChange(evt);
                      }
                   });
     
             jList1.setModel(
                   new javax.swing.AbstractListModel() {
                      String[] strings = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50" };
                      public int getSize() { 
                         return strings.length; }
                      public Object getElementAt(int i) { 
                         return strings[i]; }
                   });
             jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
             jScrollPane1.setViewportView(jList1);
     
             jTextArea2.setColumns(20);
             jTextArea2.setRows(5);
             jScrollPane3.setViewportView(jTextArea2);
     
             javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
             getContentPane().setLayout(layout);
             layout.setHorizontalGroup(
                        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap(88, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(56, 56, 56)
                                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(113, 113, 113)
                                    .addComponent(jLabel1)))
                            .addGap(57, 57, 57))
                    );
             layout.setVerticalGroup(
                        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(119, 119, 119)
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel1)
                                    .addGap(100, 100, 100)))
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    );
          }// </editor-fold>
          @SuppressWarnings("FieldNameHidesFieldInSuperclass")
            double On = 1 ;
          private void formPropertyChange(java.beans.PropertyChangeEvent evt) {                                    
                    // TODO add your handling code here:
          }                                   
     
                // Variables declaration - do not modify
     
                // End of variables declaration
     
     
     
     
     
     
     
     
          class GCTask extends TimerTask {
             public void run() {
                ++gamelength
                          ;
                System.gc();
             }
          }
     
     
     
     
          class timer {
             public  void main(String[] args) {
                Timer timer = new Timer();
                GCTask task = new GCTask();
                timer.schedule(task, 1000, 1000);
                int counter = 1;
                while (true) {
                   try {
                      Thread.sleep(500);
                   } 
                      catch (InterruptedException e) {
                      }
                }
             }
          }                
       }

  25. #25
    Member
    Join Date
    Jun 2011
    Posts
    44
    My Mood
    Mad
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: just one more error that i cannot figure out please help me.

    what does that do?

Page 1 of 2 12 LastLast

Similar Threads

  1. [SOLVED] can't figure out..
    By darego in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 10th, 2010, 02:26 PM
  2. Easy help but can't figure it out.
    By weezer562 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: October 19th, 2010, 09:50 PM
  3. Simple error can't figure out.
    By n00bprogrammer in forum What's Wrong With My Code?
    Replies: 14
    Last Post: September 30th, 2010, 12:19 PM
  4. I'm new at this and can't figure it out
    By jaheh06 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 22nd, 2010, 08:44 AM
  5. Can not figure out my programs error!
    By mparkerj in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 16th, 2010, 10:48 AM

Tags for this Thread