Changing PLAF when a JComboBox is open?

I am trying to write a simple way of changing the look and feel that I can easily connect to most of the possible ways that someone might want to change the plaf (for example combo box, list, radio buttons, menus & popups etc)
The best way of doing this I have found so far is implementing ItemListener. I can just get the contents of the event when it is ItemEvent.SELECTED and change the PLAF withUIManager.setLookAndFeel(lookAndFeel);
SwingUtilities.updateComponentTreeUI(c);where "c" was the root component to change from, given to my class.
This works fine in most cases but when using the keyboard to navigate a JComboBox, the item can be selected while the drop down list is still open. This causes the updateComponentTreeUI to error:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at javax.swing.plaf.basic.BasicComboBoxUI.selectNextPossibleValue(BasicComboBoxUI.java:1072)
     at javax.swing.plaf.basic.BasicComboBoxUI$Actions.actionPerformed(BasicComboBoxUI.java:1432)
     at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
     at javax.swing.JComponent.processKeyBinding(JComponent.java:2844)
     at javax.swing.JComponent.processKeyBindings(JComponent.java:2890)
     at javax.swing.JComponent.processKeyEvent(JComponent.java:2807)
     at javax.swing.JComboBox.processKeyEvent(JComboBox.java:1399)
     at java.awt.Component.processEvent(Component.java:5815)
     at java.awt.Container.processEvent(Container.java:2058)
     at java.awt.Component.dispatchEventImpl(Component.java:4410)
     at java.awt.Container.dispatchEventImpl(Container.java:2116)
     at java.awt.Component.dispatchEvent(Component.java:4240)
     at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
     at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:693)
     at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:958)
     at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:830)
     at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:657)
     at java.awt.Component.dispatchEventImpl(Component.java:4282)
     at java.awt.Container.dispatchEventImpl(Container.java:2116)
     at java.awt.Window.dispatchEventImpl(Window.java:2429)
     at java.awt.Component.dispatchEvent(Component.java:4240)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Is there a safe way of doing this or a way of avoiding the errors? Would somehow using SwingUtilities.invokeLater(Runnable) help? Is there a better way of doing what I want without using ItemListener etc?

Thanks, this seems to have worked well enough, though I don't know if I am going about this the correct way.
I changed
SwingUtilities.updateComponentTreeUI(c);into
SwingUtilities.invokeLater(new Runnable() {
  public void run() {
    SwingUtilities.updateComponentTreeUI(c);
});Which stops the error but doesn't cause the code only to be executed after the drop down popup has been changed, when using the keyboard down cursor it lets you go down 1 item then closes the drop down and changes the plaf. Normally when I use the down cursor on JComboBoxes the box does not disappear when switching between things.
I can get it to stay open and change the look and feel but as soon as I add the update component tree UI even wrapped in an invokeLater, it closes the dropdown popup and changes it.

Similar Messages

  • All of a sudden, my settings have been changed, my homepage, and EVERYTHING. No matter how many times I go in and change them again, the SAME pages open up when I start FireFox and I am constantly being asked if I want Yahoo as my start page and default s

    I don't know what happened. All of a sudden, my settings have been changed, my homepage, and EVERYTHING. No matter how many times I go in and change them again, the SAME pages open up when I start FireFox and I am constantly being asked if I want Yahoo as my start page and default search engine. I click the box 'do not ask me again' and it comes up EVERY TIME. I change things like I don't want history remembered, and when I reload FireFox again, it's back to the way it was BEFORE. EVERY SINGLE TIME. I don't know why this is happening, or how to fix it. What do I do??

    I do not want to download another virus program.. I do not believe it is a virus. I am running the full version of Norton 360 and it is doing a daily scan. I have Windows 7, 64 bit OS.
    This is very irritating !! If I wanted Yahoo I would ask for it !

  • I have both Photoshop 4 and Photoshop 6 on my computer. When I am in Bridge and want to open an image by double clicking, it automatically opens in 6. I see, when I go to "open with" 6 is listed as "default" How can I change the "double click" defult to o

    I have both Photoshop 4 and Photoshop 6 on my computer. When I am in Bridge and want to open an image by double clicking, it automatically opens in 6. I see, when I go to "open with" 6 is listed as "default" How can I change the default to open an image with a double click in 4?

    You can associate files from the Bridge level and the Desktop level.
    In Bridge CS4, go to Preferences > File Type Associations and change it to Photoshop CS4 for the file types you want.
    If you want to open files from the Windows Desktop in CS4, these are the instructions:
    Do this from the Windows Desktop:
    If you want your image file to open in Photoshop and it doesn't, right click on it and choose
    Open with > Choose default program… select Photoshop CS4 or CS6 and checkmark "always use the selected program to open this type of file".

  • How can i change the tab bar from opening a new tab when single clicked to open one only when double clicked?

    Out of habbit, i double click the tab bar and it opens 1 tab. however in the new beta, it opens 2.
    Is there anyway to change this so single clicks dont open new tabs on the tab bar?

    I don't have multiple tab bars and haven't installed anything to try and get them.
    I re-read what I wrote earlier and realised it's not worded clearly when I said: If I have more than a single tab bar of tabs open
    I meant: When I have so many tabs open that they won't all fit into the tab bar at once

  • I recently purchased an external hard drive to back up my iMovies. When I try to open the movies on the backup I get a message "you may not have permission to modify that folder" How do I change permissions on the backup?

    I recently purchased an external hard drive to back up my iMovies. When I try to open the movies on the backup I get a message "you may not have permission to modify that folder" How do I change permissions on the backup?

    Hi
    One Must NEVER move or alter any folders named
    • iMovie Event's - or -
    • iMovie Projects - or - alike
    on DESKTOP/FINDER - Ever ! - ONLY Within the iMovie Program ! else all connections are broken and hard to impossibly to mend !
    but rather do as described here under
    Moving Event's and Project's
    Connection - Either connect one Mac in Target mode to the other via FireWire. Or use an external hard disk !
    (Target-Mode - Start one Mac e.g. laptop - BUT keep T-key down during full up-start - Now a FW-symbol is jumping around the screen and it will work as an external hard disk when connected to the other Mac)
    A. The External Hard Disk - MUST BE - Mac OS Extended (hfs) formatted to work for Video. UNIX/DOS/FAT32/Mac OS Exchange works for most other things but not for Video whatever program is used (iMovie or FinalCut)
    B. Should be a FireWire one as USB/USB2 performs badly to me and especially when filling up
    C. Do never Move or Alter any folder named
    • iMovie Event's - or -
    • iMovie Project's
    on DeskTop/Finder - as this will result in iMovie losing connections to them and repair can be anything from hard to impossibly
    D. Moving and Copying must be done within iMovie application and Events to Events - and - Project's to Project's.
    E. Moving Project's to Event's - Do not work for me - I have to export project as a QuickTime movie then Import this into Events.
    Event's window can show two faces
    Like this
    or like this
    from one hard disk Event - You can move it to the other hard disk
    You can not (at least not me) move Event to Project or other way around only
    Event to Event and Project to Project
    Yours Bengt W

  • When I choose to open a new tab from a website, such as facebook, it always opens it in a new window. How do I change this to just opening a new tab. I tried changing the tab settings but it did not work

    When I choose to open a new tab from a website, such as facebook, it always opens it in a new window. How do I change this to just opening a new tab. I tried changing the tab settings but it did not work. I did not have the problem until I started using firefox 4.

    It is probably a JavaScript link.
    You can probably force it where you want it with a keyboard shortcut
    either "Ctrl+click" or "Ctrl+Shift+click". see
    * Firefox and other Browser Keyboard Shortcuts (Comparison Table)<br>http://dmcritchie.mvps.org/firefox/keyboard.htm
    ''Did that work?''
    Some styles that provide a warning as to the type of link:
    * No Follow links, mouseover id of other links - userstyles.org<br>http://userstyles.org/styles/10987
    * Change cursor on some links with JS. - userstyles.org<br>http://userstyles.org/styles/233
    * Link Warning - Themes and Skins for Mozilla - userstyles.org<br>http://userstyles.org/styles/1301
    * Link warning (cursor hover) - various filetypes - userstyles.org<br>http://userstyles.org/styles/2538
    * Red hand cursor for .pdf links - userstyles.org<br>http://userstyles.org/styles/553

  • I set my passcode in arabic then I changed the language to English, when I wanted to open my ipad later there was no arabic letters to enter my arabic passcode..and I am not able to use my Ipad again please let me know what to do

    I set my passcode in Arabic then I changed the language to English, when I wanted to open my ipad later there was no Arabic letters to enter my Arabic passcode..and I am not able to use my Ipad again please advice me what to do

    Hello Shaholeh87,
    Do you see a Globe icon on left hand side of your Spacebar if yes try pressing that and see if you get an option of changing the keboard language (this will work if you have Multiple language set on your iPhone from Settings>General>Keyboard>International Keyboards and added a keyboard in Arabic Language before )
    Or you can get your iPhone in Recovery Mode and Restore it to Factory settings but you will lose all your current Data that you have on your iPhone.
    To Restore your iPhone by taking it in Recovery Mode you can follow the below steps :
    Follow the process mentioned below step by step to get your iPod Touch/iPhone/iPad working.
    Make sure you have Latest Version of iTunes (11.1.3) Downloaded and Installed on your Computer, if not then you can download the latest version of iTunes from the Link below.
    http://www.apple.com/itunes/download/
    Now once you have the Updated version of iTunes installed on your computer follow the below steps to get your iPod Touch/iPhone/iPad in Recovery Mode and Then restore it to factory settings
    Open iTunes Application on your computer and then start the process step by step
    1>Disconnect your device from the computer (if connected). The process won’t work if you start with the iPod Touch/iPhone/iPad connected to the computer. Leave the cable connected to the iPod Touch/iPhone/iPad, as you will be reconnecting the iPod Touch/iPhone/iPad to the Computer later in the process.
    2>Power down your device. Turn off your device by holding down the Power button ( On Top right corner of iPod). When the power slider appears, slide it to the right. Wait for your device to comepletely shut down before continuing.
    3>Press and hold the Home button (Home Button is located at bottom of your iPod Touch/iPhone/iPad screen/display). With the Home button held connect the device to your computer with the USB cable. When reconnected, your device should turn on.
    (If the low battery screen appears, charge your device for a few minutes and try the process again.)
    4>Continue holding the Home button. After a few moments, you will see the "Connect to iTunes" screen on your device. This screen is a picture of an arrow pointing from a USB cable to the iTunes logo. When you see the screen you can release the Home button.
    5>iTunes will display a message stating that a device in recovery mode has been connected. From there you can proceed to restore your iOS device. Once you see this message click on OK and then click on Restore
    Once you click on Restore iTunes will download the Latest available version of iPod Touch/iPhone/iPad software (ipsw file) in your computer and after the download is completed the same will be restored in your iPod Touch/iPhone/iPad. You will see the Download process and Restore process on top of your iTunes screen. Once the restore is completed your iPod Touch/iPhone/iPad will automatically restart and you will see a message that iPod Touch/iPhone/iPad has been Restored and will connect after restart.
    Now you will have to follow some steps on your iPod Touch/iPhone/iPad to Customize your Device for First Use.
    Hope this process will help you

  • TS3297 When I try to open iTunes i get that this message "This copy of iTunes is corrupted or is not installed correctly.  Please reinstall iTunes."  I have downloaded the lastest version and it has not changed the message.  What should I do next?

    When I try to open iTunes I get this message  " This copy of iTunes is corrupted or is not correctly installed.  Please reinstall iTunes." I have installed the latest version of iTunes and the message has not changed.  What should i do next?

    Let's try a repair install of iTunes first.
    Restart the PC. If you're using Vista or 7, now head into your Uninstall a program control panel, select "iTunes" and then click "Repair". If you're using XP, head into your Add or Remove Programs control panel, select "iTunes", click "Change" and then click "Repair".
    Can you launch your iTunes now?

  • PDF is changing all my pdf documents into a word document - My boss sent me a pdf email through outlook and when I try to open it changes to a word document

    PDF is changing all my pdf documents into a word document - My boss sent me a pdf email through outlook and when I try to open it changes to a word document Help this is so frustrating

    Hi tinam74565130,
    That does sound frustrating! It sounds as though the filename associations have become confused on your computer. You should be able to reset that easily. Here are some instructions:
    Change which programs Windows uses by default - Windows Help
    How to change the default application for a file type | Macworld
    Please let us know how it goes.
    Best,
    Sara

  • Why does the Right-click - "t" delete a bookmark on the bookmark toolbar, when Right-click - "t" opens a new tab elsewhere. The bookmark toolbar use Right-click - "w" to open in a new tab. Please change this to "t" to...

    Why does the Right-click -> "t" delete a bookmark on the bookmark toolbar, when Right-click -> "t" opens a new tab elsewhere in Firefox. The bookmark toolbar use Right-click -> "w" to open in a new tab. Please change this to "t" to... I keep deleting all my bookmark because you don't make the commands consistent!

    If you have accidentally removed bookmarks then use "Organize > Undo" in the bookmarks manager (Bookmarks > Organize Bookmarks) to get them back.<br />
    The Organize button is the first of the three buttons on the toolbar in the Library (Bookmarks Manager).<br />
    That only works if you haven't closed Firefox.
    [https://bugzilla.mozilla.org/show_bug.cgi?id=301888 Bug 301888] – Bookmarks cut instead of opened in new tab from Bookmarks Toolbar Folder
    (please do not comment in bug reports; you can vote instead)

  • Changing between buttons when a widget is open

    Hello everyone    I am wrestling with the HTML5 output and the glossary widget...I had posted this problem last week here: http://forums.adobe.com/message/5298569. Shekhar from Adobe helped solve the problem (thank you)but not 100% optimally. So, I will ask a question that may bring me to satisfaction and closure
    I want to open a glossary widget with an "open" button. When the widget is open, the open button will change to a "close" button. Basically, the controls will be in the same place, but the open widget will toggle the buttons. Is there a way to do this without too much programming savvy...? Again, I need HMTL5 output because about half of my students are running the courses on ipad or other handhelds...
    Thank you,
    Daniel

    I suggest you go immediately to scenario 4, because that is what you want really.
    For the moment blog is posted under blog.lilybiri.com. The main website is still not available (protected by password), have too much work for the moment and want to have at least some articles transferred. I'm very annoyed with Posthaven that doesn't allow any comments for the moment, nor analytics, nor subscribing. But it was the only way to convert so many articles (outdated or not) in a quick way and not to lose them.
    Lilybiri

  • I had a Microsoft tech access my computer remotely to resolve issues with my hotmail acct. There were files that needed to be deleted and he also changed some settings.   Later, when I tried to open InDesign I received the following error:  AMT Subsystem

    I had a Microsoft tech access my computer remotely to resolve issues with my hotmail acct. There were files that needed to be deleted and he also changed some settings.
    Later, when I tried to open InDesign I received the following error:
    AMT Subsystem Failure
    The licensing subsystem has failed catastrophically. You must reinstall or call customer support.
    I rebooted the computer and tried again:
    Licensing for this product has stopped working.
    You cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this product or contacting your IT administrator or Adobe customer support for help.
    I can access Acrobat and MS Office programs, it's just the CS3 programs that I can't access. Can I uninstall and then reinstall CS3 without an access (un-lock) code?

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • I'm using bridge cc2014 on my mac and when I go to open photos, it opens on PS6 even though I have PS CC.  How do I change the default?

    I'm using bridge cc2014 on my mac and when I go to open photos, it opens on PS6 even though I have PS CC.  How do I change the default?

    Change File Associations in Mac OS X

  • How do you transfer files from mac to word pc for school?  Paper keeps changing format when professor opens it on PC

    I have Word 2011 on Mac 10.6.8.  I write my papers and save them as .docx  I submit them to my school online but every time My professor opens them he says the margins are set wrong.  He said to save them as a Word-Pc format.  How do I do this? Do I save it as RTF or as PDF?  He has to be able to make comments on the paper after along the right side.  I can not ask him to download anything t make it easier for me. I should be the one doing it correctly. I just do not know how.  Can you please tell me how I should be saving my papers so that they do not change format when he opens them on his PC?
    And I do recheck and open and repen my paper to check and recheck my margins before I submit it and all is fine on my end.
    Thanks for your help.

    nnigel, Welcome to the discussion area!
    I've been reading thru the discussions and yet to find a clear answer on how to transfer files from my external HD to time capsule.
    If it is directly connected to your Mac via USB or FireWire, Time Machine will include it in the backup.
    ...but is it difficult to point the library to the music file on the Time Capsule?
    iTunes for Windows: Moving your iTunes Music folder

  • When I started to open firefox, windows pops "browser settings change"

    when I started to open firefox, windows pops "browser settings change" .. and the window can not be deleted or removed .. I want to ask how to remove it ..
    in the window that says "an unknown change was detected on your browser's search settings:
    keep my current settings
    i am aware of this change and approve it
    I've been picking and pressing yes but the window was still not working .. what should i do .. thank you

    Check that you do not run Firefox as Administrator.
    Right-click the Firefox desktop shortcut and choose "Properties".
    In the Compatibility tab, make sure that Privilege Level: "Run this program as Administrator" is not selected.
    You also need to check the Properties of the firefox.exe program in the Firefox program directory.
    If you can't make the changes then you need to start Windows Explorer as Administrator.

Maybe you are looking for

  • Not delivered message when trying to send a message

    I know the phone number is correct...Just won't deliver...using the "message" icon

  • EXTERNAL USER VERIFICATION PROCESS V2

    I posted this on the security forum w/ no response, hence trying here We have a large number of users from different companies. They need to login to access the information on the site, pertinent to their own company. Now, when a user leaves their ow

  • SAP Business One for Egypt

    Dear All, if we have to implement SAP Business One in Egypt or in other parts of Africa, which localization  can we use? Regards, Bharath S

  • JDBC Data Sources: Potential Issue with JDeveloper 10.1.3.4

    I think I found a bug or issue with the latest JDeveloper 10.1.3.4 release when using JDBC Data Sources on the Embedded OC4J container. To state the issule bluntly, If I use a JDBC Data Source in an ADF Faces application, I get the following error on

  • Styling af|PanelAccordian

    Hi, I am styling af|panelAccordian , but the classes like af|panelAccordian::header-start, af|panelAccordian::header-title, af|panelAccordian::header-toolbar, af|panelAccordian::header-end, af|panelAccordian::header-disclosure{background-image:url("t