Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Refresh Entire UI

Reply
Thread Tools

Refresh Entire UI

 
 
Jason Cavett
Guest
Posts: n/a
 
      08-04-2008
Is there a way to tell a top-level Java Swing component to refresh and
have all of its subcomponents refresh along with it?

The reason I am asking is that I have a skinning/theme system in place
and when the user switches themes, I want it to update on the fly.
This works with some of the components (icons/text/etc), but I can't
seem to get the entire GUI to refresh (trying to do this via
updateUI()).

Any suggestions?
 
Reply With Quote
 
 
 
 
Daniele Futtorovic
Guest
Posts: n/a
 
      08-04-2008
On 04/08/2008 18:58, Jason Cavett allegedly wrote:
> Is there a way to tell a top-level Java Swing component to refresh and
> have all of its subcomponents refresh along with it?
>
> The reason I am asking is that I have a skinning/theme system in place
> and when the user switches themes, I want it to update on the fly.
> This works with some of the components (icons/text/etc), but I can't
> seem to get the entire GUI to refresh (trying to do this via
> updateUI()).
>
> Any suggestions?


Do you mean you changed the UI delegate of each, or at least some,
Component(s)?

Have you tried invalidate() + validate() on the root Container (e.g. a
JFrame)?

--
DF.
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      08-04-2008
Jason Cavett wrote:
> Is there a way to tell a top-level Java Swing component to refresh and
> have all of its subcomponents refresh along with it?
>
> The reason I am asking is that I have a skinning/theme system in place
> and when the user switches themes, I want it to update on the fly.
> This works with some of the components (icons/text/etc), but I can't
> seem to get the entire GUI to refresh (trying to do this via
> updateUI()).
>
> Any suggestions?


Have you tried any of the validate()/repaint() options?

--

Knute Johnson
email s/nospam/knute2008/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
Jason Cavett
Guest
Posts: n/a
 
      08-04-2008
On Aug 4, 1:17*pm, Daniele Futtorovic <(E-Mail Removed)>
wrote:
> On 04/08/2008 18:58, Jason Cavett allegedly wrote:
>
> > Is there a way to tell a top-level Java Swing component to refresh and
> > have all of its subcomponents refresh along with it?

>
> > The reason I am asking is that I have a skinning/theme system in place
> > and when the user switches themes, I want it to update on the fly.
> > This works with some of the components (icons/text/etc), but I can't
> > seem to get the entire GUI to refresh (trying to do this via
> > updateUI()).

>
> > Any suggestions?

>
> Do you mean you changed the UI delegate of each, or at least some,
> Component(s)?
>
> Have you tried invalidate() + validate() on the root Container (e.g. a
> JFrame)?
>
> --
> DF.


I did, and that refreshes some of the components (namely, the menus,
the JTree contained within the JFrame, etc). However, it does *not*
refresh the JInternalFrames that I have contained within the parent
JFrame.

It's a little bit confusing. Is there something different about the
JInternalFrames that I'm not understanding?

Thanks for your response.
 
Reply With Quote
 
Jason Cavett
Guest
Posts: n/a
 
      08-04-2008
On Aug 4, 1:30*pm, Knute Johnson <(E-Mail Removed)>
wrote:
> Jason Cavett wrote:
> > Is there a way to tell a top-level Java Swing component to refresh and
> > have all of its subcomponents refresh along with it?

>
> > The reason I am asking is that I have a skinning/theme system in place
> > and when the user switches themes, I want it to update on the fly.
> > This works with some of the components (icons/text/etc), but I can't
> > seem to get the entire GUI to refresh (trying to do this via
> > updateUI()).

>
> > Any suggestions?

>
> Have you tried any of the validate()/repaint() options?
>
> --
>
> Knute Johnson
> email s/nospam/knute2008/
>
> --
> Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
> * * * ------->>>>>>http://www.NewsDemon.com<<<<<<------
> Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


I have. See my response to Daniele.
 
Reply With Quote
 
Daniele Futtorovic
Guest
Posts: n/a
 
      08-05-2008
On 04/08/2008 19:39, Jason Cavett allegedly wrote:
> On Aug 4, 1:17 pm, Daniele Futtorovic <(E-Mail Removed)>
> wrote:
>> On 04/08/2008 18:58, Jason Cavett allegedly wrote:
>>
>>> Is there a way to tell a top-level Java Swing component to refresh and
>>> have all of its subcomponents refresh along with it?
>>> The reason I am asking is that I have a skinning/theme system in place
>>> and when the user switches themes, I want it to update on the fly.
>>> This works with some of the components (icons/text/etc), but I can't
>>> seem to get the entire GUI to refresh (trying to do this via
>>> updateUI()).
>>> Any suggestions?

>> Do you mean you changed the UI delegate of each, or at least some,
>> Component(s)?
>>
>> Have you tried invalidate() + validate() on the root Container (e.g. a
>> JFrame)?
>>

>
> I did, and that refreshes some of the components (namely, the menus,
> the JTree contained within the JFrame, etc). However, it does *not*
> refresh the JInternalFrames that I have contained within the parent
> JFrame.
>
> It's a little bit confusing. Is there something different about the
> JInternalFrames that I'm not understanding?


Sorry, I don't know for sure. Actually, I haven't ever used
JInternalFrames seriously. Knute might be able to tell you better than I.

Are you using a JDesktopPane for the JInternalFrames, as advised? Having
a quick glance at the source code, I don't see anything that might
intercept the invalidation -- the JInternalFrames are added as children
to the JDesktopPane, and consequently should be part of the same
hierarchy. So I don't really know why it doesn't work.

You might want to manually hide and show the JInternalFrames again, to
check whether it's merely a refresh problem.

Then, of course it should be possible to hack around the problem by
gathering, invalidating and validating the JInternalFrames manually. I'd
find that unsatisfying if it were my code, so I merely mention it as a
last resort.

--
DF.
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      08-05-2008
On Aug 5, 2:58*am, Jason Cavett <(E-Mail Removed)> wrote:
> Is there a way to tell a top-level Java Swing component to refresh and
> have all of its subcomponents refresh along with it?


The best way to achieve that seems to be along
the lines of..

...
UIManager.setLookAndFeel( plaf );
// called from JFrame sub-class, the
// 'root' component of the GUI
SwingUtilities.updateComponentTreeUI(this);
...

If that fails for you, I suggest you post an SSCCE
trimmed to just the JDesktopPane, the JInternalFrames
and a menu to select the various default PLAFs.

--
Andrew Thompson
http://pscode.org/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP: Session parameters vanish on refresh. How do I keep them on refresh? Per Magnus L?vold Java 1 10-08-2004 02:52 PM
How do i refresh a datagrid from a pop up window without having to refresh the whole page? Pkenty ASP .Net Web Controls 0 05-28-2004 07:06 AM
using refresh button on the menu bar to refresh two frames. Jawahar Rajan ASP General 1 10-01-2003 09:20 PM
Problem with refresh button breaking automatic refresh brian lanning ASP .Net 0 07-29-2003 07:57 PM



Advertisments