use of javax.swing.DefaultListCellRenderer in project pcgen by PCGen.
the class ExportDialog method initComponents.
private void initComponents() {
characterBox.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
CharacterFacade character = (CharacterFacade) value;
return super.getListCellRendererComponent(list, character.getNameRef().get(), index, isSelected, cellHasFocus);
}
});
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fileList.addListSelectionListener(this);
exportButton.setDefaultCapable(true);
getRootPane().setDefaultButton(exportButton);
partyBox.setActionCommand(PARTY_COMMAND);
exportBox.setActionCommand(EXPORT_TO_COMMAND);
exportButton.setActionCommand(EXPORT_COMMAND);
closeButton.setActionCommand(CLOSE_COMMAND);
exportBox.addActionListener(this);
partyBox.addActionListener(this);
exportButton.addActionListener(this);
closeButton.addActionListener(this);
exportButton.setEnabled(false);
progressBar.setStringPainted(true);
progressBar.setString("Loading Templates");
progressBar.setIndeterminate(true);
setTitle("Export a PC or Party");
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
UIPropertyContext context = UIPropertyContext.createContext("ExportDialog");
String defaultOSType = context.getProperty(UIPropertyContext.DEFAULT_OS_TYPE);
if (defaultOSType != null) {
for (SheetFilter filter : SheetFilter.values()) {
if (defaultOSType.equals(filter.toString())) {
exportBox.setSelectedItem(filter);
}
}
}
}
Aggregations