Changing L&F for the JFileChooser

Hi,
take a look at Sun's bug #4711700. Using the Windows L&F, sometimes the JFileChooser throws a NullPointerException when the constructor is called.
Apparently, the bug is related to retrieving Windows system icons to be shown in the dialog, so it's probably not there when using a non Windows L&F.
As my app needs to use the L&F of the host OS, I was thinking about using a workaround like this:
JFileChooser jfc;
try {
  jfc = new JFileChooser(...);
} catch(NullPointerException ex) {
  /* change L&F for file chooser here */
  jfc = new JFileChooser();
}This may not be very appealing, but it's definitely better than the exception!
The question is: it possible to selectively change the L&F for the file chooser, without affecting the rest of the components, and how do I do it?

JFileChooser fileChooser=new JFileChooser();// to choose the file ExampleFileFilter filter = new ExampleFileFilter();// to make file settings
     filter.addExtension("jpeg");
     filter.addExtension("jpg");
     filter.setDescription("Image Format");
     fileChooser.setFileFilter(filter);//new File(".")
     fileChooser.setCurrentDirectory(new File("."));
     int result = fileChooser.showOpenDialog(printFrame);//to open dialog box
     if(result==JFileChooser.CANCEL_OPTION)
               file=null;
try this u can solve ur problem and , write example filter class
//ExampleFilter.java
import java.io.File;
import java.util.Hashtable;
import java.util.Enumeration;
import javax.swing.filechooser.*;
public class ExampleFileFilter extends FileFilter {
private static String TYPE_UNKNOWN = "Type Unknown";
private static String HIDDEN_FILE = "Hidden File";
private Hashtable filters = null;
private String description = null;
private String fullDescription = null;
private boolean useExtensionsInDescription = true;
public ExampleFileFilter() {
          this.filters = new Hashtable();
public ExampleFileFilter(String extension) {
     this(extension,null);
public ExampleFileFilter(String extension, String description) {
     this();
     if(extension!=null) addExtension(extension);
     if(description!=null) setDescription(description);
public ExampleFileFilter(String[] filters) {
     this(filters, null);
public ExampleFileFilter(String[] filters, String description) {
     this();
     for (int i = 0; i < filters.length; i++) {
     addExtension(filters);
     if(description!=null) setDescription(description);
public boolean accept(File f) {
     if(f != null) {
     if(f.isDirectory()) {
          return true;
     String extension = getExtension(f);
     if(extension != null && filters.get(getExtension(f)) != null) {
          return true;
     return false;
public String getExtension(File f) {
     if(f != null) {
     String filename = f.getName();
     int i = filename.lastIndexOf('.');
     if(i>0 && i<filename.length()-1) {
          return filename.substring(i+1).toLowerCase();
     return null;
public void addExtension(String extension) {
     if(filters == null) {
     filters = new Hashtable(5);
     filters.put(extension.toLowerCase(), this);
     fullDescription = null;
public String getDescription() {
     if(fullDescription == null) {
     if(description == null || isExtensionListInDescription()) {
          fullDescription = description==null ? "(" : description + " (";
          // build the description from the extension list
          Enumeration extensions = filters.keys();
          if(extensions != null) {
          fullDescription += "." + (String) extensions.nextElement();
          while (extensions.hasMoreElements()) {
               fullDescription += ", ." + (String) extensions.nextElement();
          fullDescription += ")";
     } else {
          fullDescription = description;
     return fullDescription;
public void setDescription(String description) {
     this.description = description;
     fullDescription = null;
public void setExtensionListInDescription(boolean b) {
     useExtensionsInDescription = b;
     fullDescription = null;
public boolean isExtensionListInDescription() {
     return useExtensionsInDescription;
try this u can solve ur problem and , write example filter class
cheers
nr konjeti

Similar Messages

  • Change Primary UOM for The item

    Dear
    How can I change Primary UOM for the specific item to other Primary UOM, example from Piece to Unit?
    Ahmad,

    Hi,
    Review the folloing MOS Doc.
    APP-INV-43141 Error Displayed When Trying To Change The PRIMARY_UNIT_OF_MEASURE (Doc ID 1078914.1)
    Also, Check out the following MOS link.
    https://support.oracle.com/epmos/faces/CommunityDisplay?resultUrl=https%3A%2F%2Fcommunity.oracle.com%2Fthread%2F3535958&resultTitle=How+to+change+primary+UOM+of+newly+created+item+code.&commId=3535958&displayIndex=1&_adf.ctrl-state=vnwgftksh_126&_afrLoop=116529168856235
    https://support.oracle.com/epmos/faces/CommunityDisplay?resultUrl=https%3A%2F%2Fcommunity.oracle.com%2Fthread%2F3526698&_afrLoop=116688597198923&resultTitle=Need+to+change+the+UOM+for+Item&commId=3526698&displayIndex=8&_afrWindowMode=0&_adf.ctrl-state=vnwgftksh_177

  • HT4059 I downloaded iBooks Author in Italy so the interface is in Italian.  I want to change to English for the entire interface?

    I downloaded iBooks Author in Italy so the interface is in Italian.  I want to change to English for the entire interface?

    You would have to re download iBooks Author from the U.S. App Store. Launch the App Store then click the round flag icon bottom right side of the window. Select United States
    The issue with this is that your billing credentials (regardless of whether or not it's a free or paid app) must be associated with the same country where you reside. So you may not be able to re download iBooks Author in English.
    Post your topic in the iBooks Author community here.
    More iBooks Author users can offer feedback that way and may know of a work around.
    This is the, "iTunes Store" community for help with iOS devices.

  • HT204053 how can i change my account for the messages app o my mac? I have my school email and I do not know how that got there i just want to use my apple or iCloud account.

    im having trouble changing my account for the messages app on my mac. im not a mac wiz

    From the menu bar, select
    Messages ▹ Preferences ▹  Accounts
    Sign out of the account. Add another one and sign in.

  • Where do I change my username for the support group?

    where do I change my username for the support group? Thanks

    If you are talking about these forums, then no, you cannot change your name - the hosts will only make an exception if there is a security issue. But, since you've not accumulated any points, simply stop using this one and create another one.

  • How to maintain open change request control for the transaction MM02 & CS02

    hi all...
    can any one please let me know that, is there any BADI or Enhancement spot
    where i can code for my desired functionality...
    how to maintain open change request control for the transaction MM02 and CS02.
    Desired Functionality:
    • The user wants to maintain a material, bill of material or a document.
    • On the initial screen of the respective transaction (MM02, CS02)
      user enters a change request number.
    • The system checks whether the object record that the user wants to maintain
      is already assigned to other change request numbers.
    • If this is the case, the system displays a warning, stating that there are
      other open change requests for this master data record.
    • In addition, the system lists the relevant change request numbers.
    • The user can continue the maintenance or leave the transaction and first check
      the mentioned change requests.

    hi satish thanks for reverting back
    but sorry yaar given enhancement is not triggering...
    but my requirement is:
    - after executing the transaction MM02 & CS02.
    - user inputs the data for Material Number and then he enters the Change Number.
    - if the given Change Number is not maintained with the Material (i dont no
      where/how this two fields are maintained internally), then it has to raise a
      warning and it should list the existing Change Numbers for that perticular
      Material.

  • I can't access my iCloud account because my primary email is dead. I want to change my ID for the one associated with my current email address.

    I can't verify my icloud account because the email associated with it got deleted in a messup by the email provider. I made a new ID with another email address, but I don't seem to know how to set it as my iCloud account. Apple insist on asking me a password for my old account, I enter it, but it says it is incorrect. I have tried to fix it, and apple knows it is there as it appear on the list of apple ID's, but doesn't recognice the password and when I try to reset the password it gets me to my new account, which needs no resetting.
    All I want is to get rid of that old account and replace it with my new one in order to use the cloud, but it seems I am stuck with a non funtioning user ID. I have tried everything there is on this pages, but nothing works.
    Please, tell me, step by step, how can I remove the old user ID from the icloud account for good and replace it with my new ID on all my devices.
    Thank you.

    Welcome to the Apple community Yao.
    If you mean that Find My Phone is asking for a password to a different Apple ID to your current Apple ID.
    This feature has been introduced to make stolen phones useless to those that have stolen them.
    However it can also arise when the user has changed their Apple ID details with Apple and not made the same changes to their iCloud account/Find My Phone on their device before upgrading to iOS 7, or if you restore from a previous back up made before you changed your details.
    The only solution is to change your Apple ID back to its previous state with Apple at My Apple ID using your current password, you don’t need access to this address if it’s previously been used with your Apple ID, once you have saved these details enter the password as requested on your device and then turn off "find my phone" and delete the account from your device.
    You should then change your Apple ID back to its current state, save it once again and then log back in using your current Apple ID. Finally, turn "find my phone" back on once again.
    This article provides more information about Activation Lock.

  • How to get the change mode option for the line items in SC

    Hi Everybody,
    1. when the SC has 2 line items and in that if both the line item are rejected by the approver and the requester is receiving it for accept changes and when he click on the change button and wants to change the line items of both the rejected one, the change is enable and the requester can do the changes in the line items of the shopping cart which is working fine. but in the other case
    2. when the SC has 2 line items and in that if any one of the line item is rejected and other one is approved by the approver and the requester is receiving it for accept changes and when he click on the change button and wants to change the line item of the rejected one, the change is getting disabled but for the approved line item the requester can able to do the changes.
    so can anyone help me out how to solve this issue that if any one line item is rejected in the shopping cart also it should get the editable mode when the requester wants to do any changes.
    thanks in advance.

    Hi Everybody,
    1. when the SC has 2 line items and in that if both the line item are rejected by the approver and the requester is receiving it for accept changes and when he click on the change button and wants to change the line items of both the rejected one, the change is enable and the requester can do the changes in the line items of the shopping cart which is working fine. but in the other case
    2. when the SC has 2 line items and in that if any one of the line item is rejected and other one is approved by the approver and the requester is receiving it for accept changes and when he click on the change button and wants to change the line item of the rejected one, the change is getting disabled but for the approved line item the requester can able to do the changes.
    so can anyone help me out how to solve this issue that if any one line item is rejected in the shopping cart also it should get the editable mode when the requester wants to do any changes.
    thanks in advance.

  • Changed Ulimits values for the Oracle user and getting error -bash: ulimit: max user processes: cannot modify limit: Operation not permitted when logging in.

    I'm trying to increate the ulimits for max user processes and open files for the oracle user.  I've set the values in limits.conf, /etc/profile and in oracle's environment scripts. Now when I log in as oracle I get the below errors. If I change the ulimits back to the original values errors go away but ulimits aren't changed.
    login as: oracle
    [email protected]'s password:
    Last login: Fri Mar  6 09:56:02 2015 from mtkadmin12
    You are logging onto an Oracle system.
    Kickstarted on: 2014-06-05
    -bash: ulimit: max user processes: cannot modify limit: Operation not permitted
    -bash: ulimit: max user processes: cannot modify limit: Operation not permitted
    [oracle@servername ~]$

    Thanks for the update.
    I modified the /etc/security/limits.d/90-nproc.conf and added a line for oracle and also modifed the oracle.sh file.  The ulimits are setting correctly when I su - oracle but they are still wrong when sshing in as oracle.
    [root@mtkdevorap11d-1 ~]# su - oracle
    [oracle@mtkdevorap11d-1 ~]$ ulimit -Ha
    core file size          (blocks, -c) unlimited
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 1030982
    max locked memory       (kbytes, -l) 94371840
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 65536
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) unlimited
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 16384
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    [oracle@mtkdevorap11d-1 ~]$
    [oracle@mtkdevorap11d-2 ~]$ ssh mtkdevorap11d-1
    Last login: Mon Mar 16 13:04:16 2015 from mtkdevorap11d-2.conveydev.com
    You are logging onto an Oracle system.
    Kickstarted on: 2014-06-05
    [oracle@mtkdevorap11d-1 ~]$ ulimit -Ha
    core file size          (blocks, -c) unlimited
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 1030982
    max locked memory       (kbytes, -l) 64
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 4096
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) unlimited
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 16384
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    [oracle@mtkdevorap11d-1 ~]$

  • Changing hyperlink colors for the navigation bar

    hello all i am trying to figure out how to change the color of the links that are the top of my page in the navigation bar. i know how to do it with the ones in my text- but i cannot figure out how to do so for the ones at the top of each page in the navigation bar.
    any help would be much appreciated!

    Welcome to the Apple Discussions. Here's a link to a post by Cyclosaurus, the resident java script expert, about changing the font, etc. in the navbar with java script and a HTML snippet.. Don't know if includes color also.
    http://discussions.apple.com/thread.jspa?messageID=8600361#8600361
    OT

  • Call library function will not retain change of directory for the library.

    I have created a call to a dll made in Visual C++. Everything works fine. I then configure the vi to call the a newer version of the library that is in another directory. The Call Library Function dialog box updates with the new path. I click the OK button. Then configure the vi again to very my change took and it is back to the original path to the library.
    Why can I not change where to find the library? I am sure that I can make a new vi an input all the parameters again, but I have many parameters and calls to the same dll. Making new ones each time the location of the dll changes is not an option.
    Thanks for your help.
    Attachments:
    code.zip ‏106 KB

    If you have more than one VI accessing the same DLL, then you can't
    change the DLL location without unloading all the other VIs first. This
    is because Windows will always look first for the DLL in memory, before
    even attempting to load it from disk. And if another VI makes use of
    that DLL it will be still kept in memory.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Changing a color for the whole Application

    Hi,
    Is there a way to change the color, default purple of swing to some other color(say green) for the whole application without using themes? Is it possible through UIManager.put()?
    Regards
    Sridhar

    Thanks Michael,
    I just modified your code to fit my needs.
    import java.awt.*;
    import javax.swing.*;
    import java.util.Enumeration;
    class ApplicationColor
      public ApplicationColor()
        setApplicationColor(new Color(88, 140, 165));
        JFrame frame = new JFrame();
        frame.setLocation(400,300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel jp = new JPanel(new BorderLayout());
        String[] temp = {"abc","123"};
        JComboBox cbo = new JComboBox(temp);
        JButton btn = new JButton("I'm a button");
        jp.add(new JLabel("I'm a label"),BorderLayout.NORTH);
        jp.add(cbo,BorderLayout.CENTER);
        jp.add(btn,BorderLayout.SOUTH);
        frame.getContentPane().add(jp);
        frame.pack();
        frame.setVisible(true);
      public void setApplicationColor(Color color)
        Enumeration enum = UIManager.getDefaults().keys();
        while(enum.hasMoreElements())
          Object key = enum.nextElement();
          Object value = UIManager.get(key);
          Color jfcBlue = new Color(204, 204, 255);
          Color jfcBlue1 = new Color(153, 153, 204);
          if (value instanceof Color)
               if(value.equals(jfcBlue) || value.equals(jfcBlue1)){     
                    UIManager.put(key, color);
      public static void main(String[] args){new ApplicationColor();}
    }Sridhar

  • Changing print format for the Shop papers -External service operations

    Hi Friends ,
    We want print outs for the external service operations in our PM orders .
    The standard format available with shop papers is displayed with some extra info .
    We want to remove those info and add some extra info .
    Can we change the printing format for these and how much effort it rquires .
    Regards
    AM

    Hi,
    In OIDF, define the Shop Paper specially designed for External Service Operations.
    In Order, in Print option, go to Operation Selection, select the required operation & select the print layout which is designed for External Service, so that, you can get the print out according to additional fields requirements.
    regards,
    Maheswaran.

  • Change of domain for the cluster nodes

    Hi,
    We need to change our existing domain i.e. NT domain to windows 2003 domain for the SAP production server cluster nodes.
    There are 2 nodes. They are in active active mode.
    Windows 2000 advanced server is installed in the nodes.
    Can anybody tell us that during the change of the domain what else we need to take care or what should be correct procedure for this so that database & application does not have any impact
    Eagerly waiting for the reply
    With best regards
    Joydeep

    I would NOT do that.
    What immediately comes to my mind is:
    - users need to be recreated in the new domain
    - filesystem owners and permissions of all SAP and database directories must be changed
    - permissions on registry keys must be changed
    - owner/permissions of the files in the cluster filesystem must be changed
    There is no easy way of doing this. Depending on the database that is used more things are necessary. If you don't exactly know, where which application has files, it will certainly be troublesome.
    The safest way would be to use a different hardware and do a homogeneous system copy by reinstalling the cluster in the new domain.
    Markus

  • Cannot change multiple colors for the life of me

    Hi there-
    I am VERY new to photoshop and have been trying to change just two colors in this stupid picture now for about five days. I realize this is rudimentary probably for most users.
    I have searched extensively online and experimented using the color replacement tool and the "replace color" adjustment under image.  I will attempt to attach the before image and the after image I have been able to come up with.
    Essentially, I just want to replace the red and green with orange and black.  The orange I have is a very specific pantone (I have both RGB and CMYK numbers that I'd like to use).  If possible, I'd like to keep the shading....I think this is the biggest problem.  Colors are not uniform.
    Anyways, if this is going to take me a long time that is fine, I just don't know how to do it and have all the edges and shading look correct.  I cannot find a tutorial anywhere online that even shows how to clean up an image after you have changed its color so it looks professional.  I am going nuts.  This is for a job application and if you know how to do this and can help me - please!  Help!

    The orange I have is a very specific pantone (I have both RGB and CMYK numbers that I'd like to use).
    Doesn't mean anything in relation to spot colors. That's the part you  seriously must understand - either you  want to print it prodfessionally and a spot color is mandatory or it isn't. Process color CMYK is also used in professional print, but requires to work with color management. RGB is just for on-screen, web or printing on your home printer. Each of the methods will require a different way of shifting/ remapping the colors. For RGB and process CMYK, a gradient map adjustment layer might work, including of course converting to CMYK for the latter and dealing with color management. If it's just for home printing on unmanged printers like your personal inkjet, anything from hue shifting to selectiove color corrections will do. For spot colors you can forget these "dumb" methods and will have to learn how to create selections, manage channels and work with Dutone/ tritone/ multichannel modes.
    Mylenium

Maybe you are looking for

  • ALV REPORT BY USING TOP_OF_PAGE

    HI, firends i  want the code for  the top_of_page procedure in ALV REPORT, SO i can display data on top of my report . REGARDS SHAFEEQ AHMED

  • Firefox plugin breaks after Bluetooth audio switching

    Tracked down a bug to the FF flash plugin: On XP sp2 using FF 2.0.0.12 and Flash 9.0.47.0 (rolled back from the 9.0.115.0 disaster) after starting then stopping a Bluetooth audio session (a2dp), Flash no longer plays audio/video. All the usual sites

  • Changing my lumia 920 ringtone

    When I try to change my ringtone  nothing changes, I go to settings,select ringtone + sounds,press the ringtone box, select nostalgia it turns blue,check the ringtone box it says nostalgia,ringer on vibrate on,but when I ring my phone the ringtone th

  • Skip Blank Values in Import-CSV

    I am attempting to do a mass import of user attributes (phone number, address, city, state, zip code, title, company). All goes well until I hit a blank value in the CSV. Here is the Powershell script I am trying to use. Import-Csv IA-Test2.csv | For

  • SQL Developer Hangs when connecting for Remote Debug

    Hello, I've been trying to use the Remote Debug feature of SQL Developer. We are writing a Web Application that connects to Oracle and I would like to debug a package function on the database server (which is not the same machine as my SQL Developer