Domanda

I want to customize my JFileChooser so that instead of saying "Folder Name" at the bottom I want to set it to say "Picture Name" and at the text field I don't want that to change based on where i'm clicking, i want it to just stay blank the whole time. Anyway I could do this. basically I just want to customize my JFileChooser:

enter image description here

È stato utile?

Soluzione

The file chooser wasn't designed to be customized in this way. The proper solution would be to customize the UI of the file chooser.

For a hack you can try using Darryl's Swing Utils class. The example shows you can access the text field. Once you have the text field you could add a DocumentFilter to prevent the document from being updated. Or you could change the font color to white so you don't see the text.

The code to access the label would be similar. Just find the label containing the text you want to change.

Altri suggerimenti

Add this code in main() method:

try{  
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e){}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top