Search in sources :

Example 6 with DefaultListCellRenderer

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);
            }
        }
    }
}
Also used : DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) Component(java.awt.Component) CharacterFacade(pcgen.facade.core.CharacterFacade) UIPropertyContext(pcgen.gui2.UIPropertyContext) JList(javax.swing.JList)

Aggregations

DefaultListCellRenderer (javax.swing.DefaultListCellRenderer)6 Component (java.awt.Component)5 JComponent (javax.swing.JComponent)3 JList (javax.swing.JList)2 CharacterFacade (pcgen.facade.core.CharacterFacade)2 FormBuilder (com.jgoodies.forms.builder.FormBuilder)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 FileFilter (java.io.FileFilter)1 NumberFormat (java.text.NumberFormat)1 Vector (java.util.Vector)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSpinner (javax.swing.JSpinner)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1