Hello, I have just started learning AWT and Swing so I've done my first application. It works fine except one part. Application draws shapes which user choose by clicking button. The problem is that paint method is covering all the rest. Moreover at the start of the application there is a transparent background and nothing is visible until I move mouse cursor above one of the hidden buttons and click it. Also neither labels nor panels are visible. If you cut this method from code menu is visible and looks like it should:
This is strange because it shouldn't even work at start of the application because flags are set on false. Please take a look at this and give me a hint
I don't see a print() method. What print() method?
Your program seems to work fine. How about adding a Clear button?
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Michael Carol
Greenhorn
Posts: 3
posted 6 years ago
I'm sorry it was a typo. I was talking about paint method above.
So when I open my app it looks like this (everything is transparent):
And I must move my mouse cursor above each button to show them.
No labels and panels are available either. However on my other PC with WinXP labels and panels are shown after moving cursor above the button. I really have no idea why this happens :/
Without paint method menu looks fine and app starts ok but when I add paint method it start to be messed up :/
Greg Brannon
Bartender
Posts: 563
posted 6 years ago
1
Try starting your paint() method with:
super.paint( g );
You should find that the accepted/recommended approach in your study material.
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Michael Carol
Greenhorn
Posts: 3
posted 6 years ago
Thank you very much for your help - it works perfect now
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database