本文整理汇总了Java中javax.swing.event.ListSelectionListener类的典型用法代码示例。如果您正苦于以下问题:Java ListSelectionListener类的具体用法?Java ListSelectionListener怎么用?Java ListSelectionListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListSelectionListener类属于javax.swing.event包,在下文中一共展示了ListSelectionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/** Constructs rest of dialog.
*/
private void draw () {
list = new JList(listModel);
list.setBorder(new EmptyBorder(2, 2, 2, 2));
list.addListSelectionListener (new ListSelectionListener () {
@Override
public void valueChanged (ListSelectionEvent evt) {
updateSaveButton ();
}
}
);
// bugfix 37941, select first item in list
if (!listModel.isEmpty ()) {
list.setSelectedIndex (0);
} else {
updateSaveButton ();
}
JScrollPane scroll = new JScrollPane (list);
scroll.setBorder (new CompoundBorder (new EmptyBorder (12, 12, 11, 0), scroll.getBorder ()));
add(scroll, BorderLayout.CENTER);
list.setCellRenderer(new ExitDlgListCellRenderer());
list.getAccessibleContext().setAccessibleName((NbBundle.getBundle(ExitDialog.class)).getString("ACSN_ListOfChangedFiles"));
list.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ListOfChangedFiles"));
this.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ExitDialog"));
}
示例2: createListPanel
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
private Component createListPanel() {
model = new DefaultListModel();
list = new JList(model);
list.setCellRenderer(new FilterRenderer());
list.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
enableAppropriately();
}
}
});
return new JScrollPane(list);
}
示例3: PersistenceClientEntitySelectionVisual
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
public PersistenceClientEntitySelectionVisual(String name,
WizardDescriptor wizard , boolean requireReferencedClasses )
{
setName(name);
initComponents();
ListSelectionListener selectionListener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
updateButtons();
}
};
listAvailable.getSelectionModel().addListSelectionListener(selectionListener);
listSelected.getSelectionModel().addListSelectionListener(selectionListener);
disableNoIdSelection = wizard.getProperty(PersistenceClientEntitySelection.DISABLENOIDSELECTION) == Boolean.TRUE;
if ( requireReferencedClasses ){
cbAddRelated.setSelected( true );
cbAddRelated.setVisible( false );
}
}
示例4: SuiteCustomizerSources
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/**
* Creates new form SuiteCustomizerSources
*/
SuiteCustomizerSources(final SuiteProperties suiteProps, ProjectCustomizer.Category cat) {
super(suiteProps, SuiteCustomizerSources.class, cat);
initComponents();
initAccesibility();
prjFolderValue.setText(suiteProps.getProjectDirectory());
refresh();
moduleList.setCellRenderer(CustomizerComponentFactory.getModuleCellRenderer());
moduleList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
updateEnabled();
}
}
});
}
示例5: GlobalOptionsPanel
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/** Creates new form GlobalOptionsPanel */
public GlobalOptionsPanel() {
initComponents();
DefaultListModel dlm = new DefaultListModel();
descMap = new HashMap<String, String>();
int i = 0;
String[] desc = SettingsPanel.getAvailableOptionsDescriptions();
for (String s : SettingsPanel.AVAILABLE_OPTIONS) {
dlm.addElement(s);
descMap.put(s, desc[i]);
i = i + 1;
}
jList1.setModel(dlm);
jList1.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
String val = (String) jList1.getSelectedValue();
if (val != null) {
jTextArea1.setText(descMap.get(val));
} else {
jTextArea1.setText("");
}
}
});
}
示例6: DiffColorsPanel
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
public DiffColorsPanel() {
initComponents ();
setName(loc("LBL_DiffOptions_Tab")); //NOI18N
lCategories.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
lCategories.setVisibleRowCount (6);
lCategories.addListSelectionListener (new ListSelectionListener() {
public void valueChanged (ListSelectionEvent e) {
if (!listen) return;
refreshUI ();
}
});
lCategories.setCellRenderer (new CategoryRenderer());
cbBackground.addActionListener (this);
btnResetToDefaults.addActionListener(this);
}
示例7: ListParameter
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
public ListParameter(JList list, String parameter, String encoding) {
super(parameter, encoding);
this.list = list;
list.setModel(new DefaultListModel());
list.addListSelectionListener(new ListSelectionListener(){
@Override
public void valueChanged(ListSelectionEvent e) {
int[] s = ListParameter.this.list.getSelectedIndices();
if(e.getValueIsAdjusting()) {
return;
}
fireStateChanged();
};
});
original = list.getSelectedIndices();
fireStateChanged();
}
示例8: ToDoCustomizer
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/** Creates new form ToDoCustomizer */
public ToDoCustomizer() {
initComponents();
lblError.setVisible(false);
table.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
table.getSelectionModel().addListSelectionListener( new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
enableButtons();
}
});
table.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("tableCellEditor".equals(evt.getPropertyName())) { //NOI18N
if (!table.isEditing()) { // A cell has stopped editing
fireChanged();
firePropertyChange(OptionsPanelController.PROP_CHANGED, new Boolean(changed), Boolean.TRUE);
firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}
}
}
});
jScrollPane1.getViewport().setOpaque( false );
enableButtons();
}
示例9: registriereVerleihkartenAnzeigenAktion
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/**
* Registriert die Aktion die ausgeführt wird, wenn Verleihkarten selektiert
* werden.
*/
private void registriereVerleihkartenAnzeigenAktion()
{
_rueckgabeUI.getVerleihkartenAuflisterTable()
.getSelectionModel()
.addListSelectionListener(new ListSelectionListener()
{
@Override
public void valueChanged(ListSelectionEvent e)
{
zeigeAusgewaehlteVerleihkarten();
aktualisiereRuecknahmeButton();
}
});
}
示例10: setTable
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
private void setTable(JTable table) {
this.table = table;
tableModel = new DefaultTableModel() {
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
if (columnIndex == 2) {
return intervalValueExternalAction == null;
} else {
return true;
}
}
};
intervalValues = convertStringValueToIntervals(value);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public synchronized void valueChanged(ListSelectionEvent e) {
onUpdateValue();
}
});
}
示例11: ParamsPanel
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/** Creates new form ParamsPanel */
public ParamsPanel() {
bundle = org.openide.util.NbBundle.getBundle(ParamsPanel.class);
initComponents ();
initAccessibility();
paramsList.setModel(getListModel());
paramsList.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (paramsList.getSelectedIndex() != -1)
updateEditor(paramsList.getSelectedIndex());
removeParamButton.setEnabled(paramsList.getSelectedIndex() != -1);
}
}
);
removeParamButton.setEnabled(paramsList.getSelectedIndex() != -1);
HelpCtx.setHelpIDString(this, I18nUtil.HELP_ID_ADDPARAMS);
}
示例12: getJListComponentTypes
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
/**
* This method initializes componentTypesList
* @return javax.swing.JList
*/
private JList<ComponentTypeListElement> getJListComponentTypes() {
if (jListComponentTypes == null) {
jListComponentTypes = new JList<ComponentTypeListElement>(this.getListModelComponentTypes());
jListComponentTypes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jListComponentTypes.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent lse) {
if (!lse.getValueIsAdjusting()) {
// --- Set the current list element ---------
setComponentTypeListElement();
}
}
});
}
return jListComponentTypes;
}
示例13: DatabaseSelectionView
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
DatabaseSelectionView(Window owner) {
this.manageConnectionsdialog = new ManageDatabaseConnectionsDialog(owner);
this.setLayout(new BorderLayout());
JList connectionList = this.manageConnectionsdialog.getConnectionListCopy();
ExtendedJScrollPane connectionsPanel = new ExtendedJScrollPane(connectionList);
connectionsPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 250, 10, 250), BorderFactory.createLineBorder(Color.LIGHT_GRAY)));
this.add(connectionsPanel, "Center");
this.testLabel = new FixedWidthLabel(370, "", (Icon)null);
this.testLabel.setIconTextGap(10);
connectionList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
DatabaseSelectionView.this.resetTestStatus();
DatabaseSelectionView.this.testButton.setEnabled(DatabaseSelectionView.this.getSelectedConnection() != null);
DatabaseSelectionView.this.editButton.setEnabled(DatabaseSelectionView.this.getSelectedConnection() != null);
DatabaseSelectionView.this.fireStateChanged();
}
});
this.createButtonPanel();
}
示例14: addListener
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
public void addListener() {
WebAppListener listener = new WebAppListener();
bAdd.addActionListener(listener);
bEdit.addActionListener(listener);
bDelete.addActionListener(listener);
bStart.addActionListener(listener);
bStop.addActionListener(listener);
bRestart.addActionListener(listener);
t.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
WebAppPanel.instance.syncStatus();
}
});
}
示例15: StackTraceList
import javax.swing.event.ListSelectionListener; //导入依赖的package包/类
public StackTraceList(Throwable t) {
super(new DefaultListModel());
setFont(getFont().deriveFont(Font.PLAIN));
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
appendAllStackTraces(t);
addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (getSelectedIndex() >= 0) {
if (!(getSelectedValue() instanceof FormattedStackTraceElement)) {
editButton.setEnabled(false);
} else {
editButton.setEnabled(true);
}
} else {
editButton.setEnabled(true);
}
}
});
}