This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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 Head First Android this week in the Android 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
Sheriff

Joined: Oct 14, 2005
Posts: 19691
    
  10

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
Sheriff

Joined: Oct 14, 2005
Posts: 19691
    
  10

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
 
jQuery in Action, 3rd edition