This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes refreshing JFrame? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "refreshing JFrame?" Watch "refreshing JFrame?" New topic
Author

refreshing JFrame?

jeff krystyan
Greenhorn

Joined: Apr 02, 2012
Posts: 9
Hey everybody,

I have a JFrame with a grid layout on it, each grid has a button. What I'm trying to do is remove all the buttons when a button is pushed. I believe I have it correct except that the JFrame won't refresh the revised panel. Advice?

Also, I noticed on some sites that people were able to paste their code in with lined numbers to make referencing it easier. Anyone know how i can do that to make it easier on you all to read? Thanks.

John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
jeff krystyan wrote:Also, I noticed on some sites that people were able to paste their code in with lined numbers to make referencing it easier. Anyone know how i can do that to make it easier on you all to read? Thanks.

You can use code tags to represent code in a better way. Please read UseCodeTags.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

Welcome to the Ranch.
Please check out the link John provide to UseCodeTags I have added them this time for you.
You will also be able to edit your post using the No need to repost

In your code, you have declared ButtonListener but never used it.
Also, after removing the buttons, call revalidate and repaint.

This question would be more suitable on the UI forums. I will move it over there for you


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
jeff krystyan
Greenhorn

Joined: Apr 02, 2012
Posts: 9
thank you Maneesh,

i made those changes and it works perfectly now
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

You are welcome!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: refreshing JFrame?
 
Similar Threads
Please need help with calculator program...
Adding JButton Array to a applet issue
problem with handling the states of the events
Mouse shift event coding - to trigger a predetermined sequence of images to a GUI
tictactoe help