Example usage for javax.swing DefaultComboBoxModel addListDataListener

List of usage examples for javax.swing DefaultComboBoxModel addListDataListener

Introduction

In this page you can find the example usage for javax.swing DefaultComboBoxModel addListDataListener.

Prototype

void addListDataListener(ListDataListener l);

Source Link

Document

Adds a listener to the list that's notified each time a change to the data model occurs.

Usage

From source file:org.pentaho.reporting.ui.datasources.sequence.SequenceEditor.java

public SequenceEditor() {
    registry = new SequenceRegistry();
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    final DefaultComboBoxModel groupModel = new DefaultComboBoxModel(
            registry.getSequenceGroups(Locale.getDefault()));
    groupModel.addListDataListener(new SelectGroupAction());
    sequenceGroupBox = new JComboBox();
    sequenceGroupBox.setModel(groupModel);

    sequenceModel = new KeyedComboBoxModel<Sequence, String>();
    sequenceModel.addListDataListener(new SequenceSelectionHandler());
    sequenceNameBox = new JComboBox(sequenceModel);

    propertyTableModel = new SequencePropertyTableModel();
    propertyTable = new PropertyTable();
    propertyTable.setModel(propertyTableModel);

    final JPanel headerPanel = new JPanel();
    headerPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
    headerPanel.add(new JLabel(Messages.getString("SequenceEditor.Group")));
    headerPanel.add(sequenceGroupBox);//from www .ja  v  a2s. c om
    headerPanel.add(new JLabel(Messages.getString("SequenceEditor.Sequence")));
    headerPanel.add(sequenceNameBox);

    setLayout(new BorderLayout());
    add(new JScrollPane(propertyTable), BorderLayout.CENTER);
    add(headerPanel, BorderLayout.NORTH);

    setSequence(null);
}