Solved

Is this correct to add the wave files to this loop

Posted on 2004-04-25
4
147 Views
Last Modified: 2010-03-31
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
Comment
Question by:Drop_of_Rain
  • 2
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 10914681
           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
 

Author Comment

by:Drop_of_Rain
ID: 10914699
What would you advise for could programing practices.
0
 
LVL 92

Expert Comment

by:objects
ID: 10914705
as is seems fine, and store all your wav's in a single dir
0
 

Author Comment

by:Drop_of_Rain
ID: 10914715
OK thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now