Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

re focusing

 
Hannah Maurphy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys at java ranch,
I'm currently studying java at RMIT, Victoria, Australia. And we are currently doing an in-class project which involves making a basic calculator with a menu bar, but every time i click on the menu bar and then try to use the calcultor buttons it wont work, my teacher says it has something to do with re focusing, or refreshing graphics, but nor i or my teacher can figure it out....could u please give me a hand?
Luv Han xoxoxox
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd put a "System.out.println()" trace statement in your button's event handler.

If you still don't see anything, I'd write a small "hello world" type of program that just has a "public static void main()", puts up a frame, adds a button, and gives the button an event handler, and get that working.

Good luck .. PSM

PS:
"Focus" isn't necessarily the first thing I'd look at, but you can always write an event handler for window events and put a "println()" in that, too.

PPS:
If you're REALLY lucky, maybe your teacher will let you use a tool like Eclipse, Netbeans or JBuilder with GUI debuggers that let you step through the code instead...
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Hannah!

Folks around here would likely be able to better offer advice if you were to post the code that you're working on.

When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.

If your issue surrounds a GUI concern, our Swing / JFC / AWT forum is the best place for it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic