This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with buttons and there actions

 
Qriz Cruega
Greenhorn
Posts: 11
Chrome Eclipse IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
Chrome Eclipse IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic