Results 1 to 12 of 12
  1. #1
    Dark Knight is offline Member
    Join Date
    Feb 2014
    Posts
    20
    Rep Power
    0

    Default Code duplication - must be a better way?

    Hi guys,

    I have created a jframe which displays 6 labels. When my program starts it calles a method which sets these buttons invisible as such:

    Java Code:
    private void initComponents2(){
           JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
            for (JLabel label: labelArray){
                label.setVisible(false);
            }
        }
    I then Have a button on my screen which makes these labels visible as such:
    Java Code:
     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            
            JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
            BufferedImage img;
            try {
               img = ImageIO.read(new File("resources/images/numbers/1.png"));
           } catch (IOException e) {
           }
           
            
            for (JLabel label: labelArray){
                label.setVisible(true);
            }
         
             numberOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/1.png"))); 
    
           /* numberOne.setVisible(true);
            numberTwo.setVisible(true);
            numberThree.setVisible(true);
            numberFour.setVisible(true);
            numberFive.setVisible(true);
            numberSix.setVisible(true);*/
            
            
        }
    As you have noticed I am duplicating code which im sure is not good practice. I suspect I shouldnt have to create the labelArray twice and populate it twice so I thought I should maybe create and populate it outside of any method but I just get errors cannot find symbol: symbol class labelArray and some extra stuff I can paste if required. My overall code is as follows(note that some has been automatically generated via the IDE:

    Java Code:
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    
    package lottonumberdraw;
    
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.concurrent.TimeUnit;
    import javax.imageio.ImageIO;
    import javax.swing.JLabel;
    
    /**
     *
     * @author Caitlyn
     */
    public class LottoGUI2 extends javax.swing.JFrame {
           
        /**
         * Creates new form LottoGUI2
         */
        public LottoGUI2() {
         try{
            initComponents();
            initComponents2();
         }
         catch (Exception e){
            System.out.println("exception is " + e);
        }
            
            
        }
        
        private void initComponents2(){
           JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
            for (JLabel label: labelArray){
                label.setVisible(false);
            }
        }
        /**
         * This method is called from within the constructor to initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is always
         * regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
    
            jButton1 = new javax.swing.JButton();
            numberOne = new javax.swing.JLabel();
            numberTwo = new javax.swing.JLabel();
            numberThree = new javax.swing.JLabel();
            numberFour = new javax.swing.JLabel();
            numberFive = new javax.swing.JLabel();
            numberSix = new javax.swing.JLabel();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });
    
            numberOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberTwo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberThree.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberFour.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberFive.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberSix.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addGap(40, 40, 40)
                    .addComponent(numberOne)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(numberTwo)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(numberThree)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(numberFive)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton1)
                            .addGap(53, 53, 53))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(6, 6, 6)
                            .addComponent(numberFour)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(numberSix)
                            .addContainerGap(82, Short.MAX_VALUE))))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(109, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(numberOne, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberTwo, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberThree, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberFive, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberFour, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberSix, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addGap(77, 77, 77)
                    .addComponent(jButton1)
                    .addGap(32, 32, 32))
            );
    
            pack();
        }// </editor-fold>                        
    
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            
            JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
            BufferedImage img;
            try {
               img = ImageIO.read(new File("resources/images/numbers/1.png"));
           } catch (IOException e) {
           }
           
            
            for (JLabel label: labelArray){
                label.setVisible(true);
            }
         
             numberOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/1.png"))); 
    
           /* numberOne.setVisible(true);
            numberTwo.setVisible(true);
            numberThree.setVisible(true);
            numberFour.setVisible(true);
            numberFive.setVisible(true);
            numberSix.setVisible(true);*/
            
            
        }                                        
    
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
             * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
             */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
    
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new LottoGUI2().setVisible(true);
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel numberFive;
        private javax.swing.JLabel numberFour;
        private javax.swing.JLabel numberOne;
        private javax.swing.JLabel numberSix;
        private javax.swing.JLabel numberThree;
        private javax.swing.JLabel numberTwo;
        // End of variables declaration                   
    
    }
    I was thinking If I slotted the code for the labelArray like below just below the button declaration that I would be able to create and populate the label array once and refer to it anywhere in my program but instead im getting errors such ascannot find symbol: symbol class labelArray and some extra stuff I can paste if required.

    Java Code:
      JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
    I would be thankful for any help with this.
    Last edited by Dark Knight; 03-25-2014 at 12:04 PM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default Re: Code duplication - must be a better way?

    im getting errors
    Please copy the full text of the error message and paste it here. It has important info about the error.

    Does the code define the same variable in several places so that the local version shadows the class level one?
    A good IDE should give a warning about that.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Dark Knight is offline Member
    Join Date
    Feb 2014
    Posts
    20
    Rep Power
    0

    Default Re: Code duplication - must be a better way?

    Hey Norm, thanks for responding I suppose its the ide warning message I am talking about and not an actual error message when I run the program:Code duplication - must be a better way?-warning.jpg
    I have attached the image, hopefully it works. Though I have just had a thought. It is possibly due to the fact that the buttons havent been initialised yet. They dont get initialised until initComponents() hence why I am probably getting these errors? To resolve this I would need to initialise the buttons at class level and create the array at class level also. I guess that makes sense but I could still be wrong. Feel free to correct me.

    Thanks again for your input.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,949
    Rep Power
    4

    Default Re: Code duplication - must be a better way?

    Why do you need a label array at all? It doesn't appear you are doing anything with the labels once they are created. Perhaps I missed something.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  5. #5
    Dark Knight is offline Member
    Join Date
    Feb 2014
    Posts
    20
    Rep Power
    0

    Default Re: Code duplication - must be a better way?

    Hey Jim, basically I am just learning at the min so trying to test out a few things with java to ensure I understand them I do however intend to add more code which will make use of the label array. Basically I intend to make a small lotto draw game in which the user presses a single button and 6 random number between 1-49 will be displayed. These numbers are going to be displayed in the form of a label displaying an image. The way I envisage doing this is by perhaps having another array with a length of 49 (1 for each number) and using the random() class to select a number randomly I will then set the image of a label to the corresponding number and then subtract that number from the array so it will not appear twice. As I said im quite new to this but am just trying to do something along those lines, ultimately I may not be able to accomplish this or the way I am going about it may be wrong but im just wanting to give it a try. I hope to get there eventually :)

    Thanks

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default Re: Code duplication - must be a better way?

    The line numbers in the posted code end at 212.
    The error message is for code at line 214.

    Looks like there is more than one version of the code.
    Can you post the code and the error messages that go with the code that was posted?
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,949
    Rep Power
    4

    Default Re: Code duplication - must be a better way?

    Since your subject talks about code duplication you may want to create a label factory. Create a static method like the following:

    Java Code:
    public static JLabel createLabel() {
        // create and intialize your
        // label here.
        return label;
    }
    
    // Then you can do something like:
    
    JLabel[] labels = new JLabel[6];
    for (int i = 0; i < labels.length; i++) {
        labels[i] = createLabel();
    }
    I recommend you investigate Lists and other aspects of the Collection API. Lists in particular are more flexible than arrays.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  8. #8
    Dark Knight is offline Member
    Join Date
    Feb 2014
    Posts
    20
    Rep Power
    0

    Default Re: Code duplication - must be a better way?

    Hey,, The full code is this, the same only with the label array at the bottom which is giving the warnings shown in the screenshot.

    Cheers

    Java Code:
    
    package lottonumberdraw;
    
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.concurrent.TimeUnit;
    import javax.imageio.ImageIO;
    import javax.swing.JLabel;
    
    
    public class LottoGUI2 extends javax.swing.JFrame {
           
    
        public LottoGUI2() {
         try{
             initComponents2();
            initComponents();
           
         }
         catch (Exception e){
            System.out.println("exception is " + e);
        }
            
            
        }
        
        private void initComponents2(){
           JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
            for (JLabel label: labelArray){
                label.setVisible(false);
            }
        }
    
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
    
            jButton1 = new javax.swing.JButton();
            numberOne = new javax.swing.JLabel();
            numberTwo = new javax.swing.JLabel();
            numberThree = new javax.swing.JLabel();
            numberFour = new javax.swing.JLabel();
            numberFive = new javax.swing.JLabel();
            numberSix = new javax.swing.JLabel();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });
    
            numberOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberTwo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberThree.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberFour.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberFive.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            numberSix.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/default.png"))); // NOI18N
    
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addGap(40, 40, 40)
                    .addComponent(numberOne)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(numberTwo)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(numberThree)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(numberFive)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton1)
                            .addGap(53, 53, 53))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(6, 6, 6)
                            .addComponent(numberFour)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(numberSix)
                            .addContainerGap(82, Short.MAX_VALUE))))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(109, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(numberOne, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberTwo, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberThree, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberFive, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberFour, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(numberSix, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addGap(77, 77, 77)
                    .addComponent(jButton1)
                    .addGap(32, 32, 32))
            );
    
            pack();
        }// </editor-fold>                        
    
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            
            JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
            BufferedImage img;
            try {
               img = ImageIO.read(new File("resources/images/numbers/1.png"));
           } catch (IOException e) {
           }
           
            
            for (JLabel label: labelArray){
                label.setVisible(true);
            }
         
             numberOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/numbers/1.png"))); 
    
         
        public static void main(String args[]) {
       
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(LottoGUI2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
    
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new LottoGUI2().setVisible(true);
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel numberFive;
        private javax.swing.JLabel numberFour;
        private javax.swing.JLabel numberOne;
        private javax.swing.JLabel numberSix;
        private javax.swing.JLabel numberThree;
        private javax.swing.JLabel numberTwo;
        // End of variables declaration                   
    
        JLabel[] labelArray = new JLabel[6];
     
            labelArray[0] = numberOne;
            labelArray[1] = numberTwo;
            labelArray[2] = numberThree;
            labelArray[3] = numberFour;
            labelArray[4] = numberFive;
            labelArray[5] = numberSix;
            
    }
    Last edited by Dark Knight; 03-25-2014 at 02:14 PM.

  9. #9
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,107
    Rep Power
    4

    Default Re: Code duplication - must be a better way?

    can you please remove the comment blocks, as you can see the forum formatter doesn't like them.

    EDIT: thank you!
    Last edited by gimbal2; 03-25-2014 at 03:15 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default Re: Code duplication - must be a better way?

    Please post the full text of the error messages that go with the code in post#8.
    The screen shot shows code from a source that has 223 lines. The code in post#8 has 193. That looks different.
    If you don't understand my response, don't ignore it, ask a question.

  11. #11
    Dark Knight is offline Member
    Join Date
    Feb 2014
    Posts
    20
    Rep Power
    0

    Default Re: Code duplication - must be a better way?

    It only has less lines due to the fact that I removed the comments as gimbal2 requested.

    Thanks.

  12. #12
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default Re: Code duplication - must be a better way?

    Please post the full text of the error messages that go with the posted code.

    One problem I see is the lines of code that are assignment statements at the end of the class are outside of a method.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. JComboBox false duplication
    By rookiecoder in forum AWT / Swing
    Replies: 8
    Last Post: 09-26-2012, 11:08 AM
  2. Compare two Arrays, checking for duplication
    By Redefine12 in forum New To Java
    Replies: 4
    Last Post: 02-03-2012, 09:57 PM
  3. Replies: 16
    Last Post: 01-31-2012, 08:36 PM
  4. Replies: 0
    Last Post: 08-07-2011, 08:32 PM
  5. Replies: 1
    Last Post: 04-26-2007, 03:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •