Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Should UIManager fire propertyChangeEvents here?

843807Jan 27 2010 — edited Feb 11 2010
I have a java desktop application that behaves badly after the user changes the display properties under MS-Windows.
The situation is this:
Start the application.
Right-click on the Windows desktop, bring up the Display Properties dialog, and change the theme, color scheme, font size, etc. Click apply. A tree in my app that extends JTree now paints incorrectly. There are probably other issues as well, but this is an obvious starting point.

After some investigating, I came to the conclusion that I need to call:
SwingUtilities.updateComponentTreeUI(component);
when things like this change, and the way to know that things like this have changed is to register a PropertyChangeListener on the UIManager.

So to start out, I created a simple test app, with this code in the constructor:

UIManager.addPropertyChangeListener(new PropertyChangeListener()
{
public void propertyChange( PropertyChangeEvent e )
{
System.out.println( "UIManager propertyChange " + e.getPropertyName());
}
});

I then ran the app (in NetBeans), changed display properties in Windows, and got nothing printed out.
However, if in response to a button push, I change the LookAndFeel programmatically:

if (!flipFlop_)
{
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
flipFlop_ = true;
}
else
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
flipFlop_ = false;
}

When I do that, I see this printed out:

UIManager propertyChange lookAndFeel

But I need to detect that UI settings have changed due to actions outside of my app, maybe outside of the JRE? Shouldn't the UIManager be firing something here? Or is there some other static object that I need to register with? I see that a PropertyChangeListener can be added to the Toolkit object, but it requires the name of the property, and there may be many properties and I don't know the names of them.

Comments

Christian Pitet

What means BIP ?

User_TYVZT

Hi Christian Pitet

Oracle Business Intelligence Publisher (BI Publisher) (BIP)

Christian Pitet

I guess you are using an Interactive report. Do you have a Submit page process on that page ?

InoL

While generating report in BIP, that data is saved as sample data.
What do you mean by that? Generating a report via BI Publisher and saving sample data? I don't see the connection.
How are you using BIP? As the print server for Intercative Reports? Or a custom report template?

User_TYVZT

Hi InoL
So for creating report, I have xdm(data model) and xdo. In xdm, after providing the sql query, I can see the data when I click view data. There I can do "save as sample data". Then after link my data model with xdo which has template in it, I can view my report in various formats. There even though there is data I'm not able to see the data in xls and pdf format. Only CSV format report shows data.

InoL

I have xdm(data model) and xdo
I have no idea what that is, not APEX anyway. Is this something from BI Publisher? Maybe you can ask this in that forum then.

User_TYVZT

Hi InoL
Yes it is from BI Publisher(BIP). Could you share forum link?

Christian Pitet

Here is a forum link :
bi publisher (0 Bytes)Regards.

1 - 8
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 11 2010
Added on Jan 27 2010
5 comments
373 views