Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

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);
            }
0
Drop_of_Rain
Asked:
Drop_of_Rain
  • 2
  • 2
1 Solution
 
objectsCommented:
           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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now