• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Problem with buttons and there actions  RSS feed

 
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.
 
Sheriff
Posts: 23687
50
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
Posts: 23687
50
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!