How to create something similar to JFileChooser in Java?
-
14-11-2019 - |
質問
I am trying to make a frame similar to a JFileChooser. I have a scrollpane and 2 toggle buttons, one for list view, and other for icons view. I will be using CardLayout on the scrollpane. However, I don't know where to begin. I would like to know a good approach on this matter. How do I design the 2 panels that will be put over the scrollpane? Something similar is the GroupBox in C# forms.
解決
See File Browser GUI for some tips.
I need to know how to create custom views. For example, for the listView option, I will be able to create a Jlist(i think) that will be spread out horizontally on multiple columns. For iconsView i will have some thumbnails that will be displayed vretically on multiple rows, etc.
For the detail view I'd tend to use a JTable
. 'horizontally in multiple columns' can be done using a list and setLayoutOrientation(int)
.
他のヒント
If you want to create "something similar to JFileChooser" why not to take a look on code of JFileChooser
itself? You can find JDK source in file src.zip
under your JDK directory.