It's not a secret anymore!*
The moose likes Applets and the fly likes Problem with buttons and there actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Problem with buttons and there actions" Watch "Problem with buttons and there actions" New topic
Author

Problem with buttons and there actions

Qriz Cruega
Greenhorn

Joined: Nov 01, 2012
Posts: 11

I need to have an applet, starting with only one Jbutton.
When that button is clicked , a JLabel prompts to enter an integer into
a JTextfield, and shows another button with the name "Double me".
If the button is clicked, the integer is doubled and displayed in the JTextField.

I tried to accomplish that with visibility flags, but it won't play nice in the applet.


here is my code so far.



I'm messing with this for a while now, so hopefully someone can't point
me into the right direction.
Every help is greatly appreciated.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I am baffled by this code:



You are comparing a JButton to a Dimension. The two are never going to be equal. I don't understand why you did that.
Qriz Cruega
Greenhorn

Joined: Nov 01, 2012
Posts: 11

Paul Clapham wrote:I am baffled by this code:



You are comparing a JButton to a Dimension. The two are never going to be equal. I don't understand why you did that.


thanks for helping,

I don't know either what I was trying to do there!

I have read up on objects and corrected to this:

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes, it sort of looked as if you typed "gets" into your code and then let your IDE choose the rest of the name of the method. And it chose getSize rather than getSource. But anyway now it looks like you have workable code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with buttons and there actions
 
Similar Threads
Getting sql error [Microsoft ][odbc microsoft access driver]numeric index out of range
Calculator Problem
why its not running or how to run it
getText() is not working?
JTabbedPane pblm.