hapciu
asked on
changing L&F for popup
I have a popup menu that I show when the user presses a button on my UI.
The problem is when the L&F gets changed and I do
UIManager.setLookAndFeel(. .);
SwingUtilities.updateCompo nentTreeUI (mainFrame );
all my components get updated to the new L&F except for the popup. Is there a way to fix this ?
The problem is when the L&F gets changed and I do
UIManager.setLookAndFeel(.
SwingUtilities.updateCompo
all my components get updated to the new L&F except for the popup. Is there a way to fix this ?
ASKER
it's not supposed to stay open - so it isn't shown while the LF changes. but the next time I show it - it still has the old LF
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To be more clear, even if you use your code "SwingUtilities.updateComp onentTreeU I(mainFram e);" instead of my version with "this", as long as you include the following line of code,
your jPopup will retain the changed LookAndFeel, no matter how many times you subsequently open/close it:
SwingUtilities.updateCompo nentTreeUI (jPopupMen u1);
Just substitute "jPopupMenu1" with the name of your jPopupMenu:)
your jPopup will retain the changed LookAndFeel, no matter how many times you subsequently open/close it:
SwingUtilities.updateCompo
Just substitute "jPopupMenu1" with the name of your jPopupMenu:)
BTW, the reason for that is:
SwingUtilities.updateCompo nentTreeUI (component ) will call updateUI on this component and each one of its children.
JPopupMenu is not a child of your frame (you never add it to your frame nor to its children).
SwingUtilities.updateCompo
JPopupMenu is not a child of your frame (you never add it to your frame nor to its children).
You should probably change the L&F before showing the pop-up.
ASKER
sorry for the delay
thanks
thanks
Thank you;)
If the pop-up is supposed to stay up after the user changes the LookAndFeel, would it be an option for you to close/re-open the popup so the new LookAndFeel can take effect (on the pop-up)?