| Show all answer |
| Q: JListView component, how to get the component to redraw now the I have actually loaded the image and it is ready! |
A: Follow the instructions: 1.You can get the JList or JTable component: JList list = ((BasicListViewUI)listView.getUI()).getList(); 2.Find the index in JList model for the specified image: int index = 3; // for example 3.Refersh the specified bounds for the specified index. Rectangle bounds = list.getCellBounds(index, index); list.repaint(bounds); |
| Q: How to enable the color effect for print preview? |
A: JPrintPreview provides the following methods to enable color print preview: JPrintPreview.setColorType(JPrintPreview.COLOR); |
| Q: If i hide a header column (f.i. "Date") and the change the source folder for the listview, the prior hided column is shown again. Is there any way to _get/set_ the columns which should be shown, that the listview remembers these columns? |
A: Because every times, JTable always repopulate all columns when
set a new model, you can disable the auto column create after set
the first column by invoke the following code: table.setAutoCreateColumnsFromModel(false); |
| Q: How to set a Renderer for AComboBox that aligns the text on the left? |
A: You can use the "ObjectCellRenderer" in com.zfqjava.swing.cell
directly, it has method "setDefaultHorizontalAlignment" and "setDefaultVerticalAlignment". |
| Q: How do I set the format of the renderer to format the date in short form: MM/DD/YYYY? |
A: You can create "DateCellRenderer" instance, it's ObjectCellRenderer
subclass, and pass a new SimpleDateFormat("MM/dd/yyyy"); |
| Q: If there is a way to populate the tree in your JDirChooser with a specific JList of files.I mean not the files physically on the computer ...It could permit the user to select a directory which is not on his own machine but on another system which is not directly accessible. |
A: Create JDirChooser with a "javax.swing.filechooser.FileSystemView",
so which you need is write a class extends "FileSystemView" and provides
the files you what to create. |
| >>Old FAQ Documentation |