Search code examples
user-interfaceintellij-ideacomponentspalette

how to add file chooser to swing GUI form Palette components IntelliJ IDEA


I already developed an application that train some text files in order to creat a data model which i will use in another class to identify the language of the document. For now i have written and finished writing two classes one for Training the data models and the other to identify any given document language. I wrote the code that i can get the file paths as arguments to my main method in order for the user to pass the file names as arguments to my main method. But now i decided to create a simple GUI form for the application and i need the file chooser But when i choose the GUI form i could not find the file chooser from all the Swing palette components available. How can i add it? Note: i am using IntelliJ IDEA 13.0 Ultimate.


Solution

  • File chooser is something that usually pops up based on some button click. So, what can you do is, inside button listener make an object JFileChooser and play with that.

    fc = new JFileChooser();
    fc.showOpenDialog(parentPanel);