aspose file tools*
The moose likes Applets and the fly likes Help with two buttons on applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Help with two buttons on applet" Watch "Help with two buttons on applet" New topic
Author

Help with two buttons on applet

kinzur manye
Greenhorn

Joined: Jun 19, 2003
Posts: 6
I have a program and i need a button that will show the lyrics to a song and the other button to clear those words from the text area and right now the way the program is set up is that when i click either of the buttons it shows the lyrics. How can i fix this?
Torsten Schippel
Ranch Hand

Joined: May 09, 2003
Posts: 62
Hi Kinzur,
sorry but don't understand why you are able to compile it.
The if(ActionEvent == "Clear") statement should not work. Try actionEvent.getActionCommand() in the if statement.
Additional you need an else part. Otherwise you will clear the text box and fill it with lyrics again.
Regards
Torsten
kinzur manye
Greenhorn

Joined: Jun 19, 2003
Posts: 6
ok let me try that
kinzur manye
Greenhorn

Joined: Jun 19, 2003
Posts: 6
ok it works now but the output looks very funny on the applet. Like the text area over runs it or something and my buttons disappear once i click them.
kinzur manye
Greenhorn

Joined: Jun 19, 2003
Posts: 6
ok i got everything working accept when i run the program my buttons are on teh right of my text area and i want them at the bottom. how do i do that?
Torsten Schippel
Ranch Hand

Joined: May 09, 2003
Posts: 62
Hi Kinzur,
if you would like to have the buttons on the bottom, I would use a Borderlayout and two additional JPanel.
For example:

Regards
Torsten
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with two buttons on applet
 
Similar Threads
How do i use monitors?
Can someone help me out with this code
how to store data in multi dimenstional arrays
Arivazhagan
Help with this code