當前位置: 首頁>>代碼示例>>Java>>正文


Java ListSelectionListener類代碼示例

本文整理匯總了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"));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:ExitDialog.java

示例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);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:AbstractFilterEditorPanel.java

示例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 );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:PersistenceClientEntitySelectionVisual.java

示例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();
            } 
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:SuiteCustomizerSources.java

示例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("");
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:GlobalOptionsPanel.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:DiffColorsPanel.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:QueryParameter.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:ToDoCustomizer.java

示例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();
            }
        });
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:20,代碼來源:RueckgabeWerkzeug.java

示例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();
        }
    });
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:21,代碼來源:IntervalsComponent.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:ParamsPanel.java

示例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;
  }
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:20,代碼來源:AddComponentDialog.java

示例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();
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:20,代碼來源:DatabaseSelectionView.java

示例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();

		}
	});

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:19,代碼來源:WebAppPanel.java

示例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);
			}
		}
	});
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:22,代碼來源:ExtendedErrorDialog.java


注:本文中的javax.swing.event.ListSelectionListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。