Is this correct to add the wave files to this loop

Is this correct to add the wave files to this loop. Will there need to be a directory use here or anywhere?

b.setActionCommand("" + (i+1) "seconds" + ".wav");


for (int i=2; i<13; i++)
            {
               JButton b = new JColoredButton( Color.green, Color.black);
               b.setPreferredSize( new Dimension( 40, 20 ) );
               buttons.put("b"+(i+1), b);
               b.setText("" + (i+1) "seconds")
               b.addActionListener(this);
               gridPanel.add(b);
            }
Drop_of_RainAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
objectsConnect With a Mentor Commented:
           for (int i=2; i<13; i++)
            {
               JButton b = new JColoredButton((i+1)+"seconds", Color.green, Color.black);
               b.setActionCommand((i+1)+"seconds" + ".wav");
               b.setPreferredSize( new Dimension( 40, 20 ) );
               buttons.put("b"+(i+1), b);
               b.addActionListener(this);
               gridPanel.add(b);
            }

Are all the files in the same directory?  If not then no real need to store the directory in the action command
0
 
Drop_of_RainAuthor Commented:
What would you advise for could programing practices.
0
 
objectsCommented:
as is seems fine, and store all your wav's in a single dir
0
 
Drop_of_RainAuthor Commented:
OK thanks
0
All Courses

From novice to tech pro — start learning today.