本文整理匯總了Java中javax.swing.event.ListSelectionEvent類的典型用法代碼示例。如果您正苦於以下問題:Java ListSelectionEvent類的具體用法?Java ListSelectionEvent怎麽用?Java ListSelectionEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ListSelectionEvent類屬於javax.swing.event包,在下文中一共展示了ListSelectionEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(ListSelectionEvent event) {
if (event != null && event.getValueIsAdjusting()) {
return;
}
if (event == null) {
return;
}
int returnValue = synsetList.getSelectedIndex();
Sense unit = senseListModel.getObjectAt(returnValue);
synsetList.setEnabled(false);
listeners.notifyAllListeners(synsetList.getSelectedIndices().length == 1 ? unit : null);
synsetList.setEnabled(true);
SwingUtilities.invokeLater(() -> {
synsetList.grabFocus();
});
}
示例2: PersistenceClientEntitySelectionVisual
import javax.swing.event.ListSelectionEvent; //導入依賴的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 );
}
}
示例3: initSubTable
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
/**
* initialize the submissions tables
*/
public void initSubTable() {
subTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
if (subTable.getSelectedRow() > -1) {
// print first column value from selected row
// System.out.println(subTable.getValueAt(subTable.getSelectedRow(), 0).toString());
downSubBtn.setEnabled(true);
gradeField.setEditable(true);
sendGradeBtn.setEnabled(true);
}
else {
downSubBtn.setEnabled(false);
gradeField.setEditable(false);
sendGradeBtn.setEnabled(false);
}
}
});
}
示例4: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) {
if (listSelectionEvent.getValueIsAdjusting()) {
return ;
}
int selectedRows[] = outline.getSelectedRows();
//System.err.println("TableSelectionListener.valueChanged(): selected rows = "+Arrays.toString(selectedRows));
ArrayList<Node> selectedNodes = new ArrayList<Node> (selectedRows.length);
for (int i = 0; i < selectedRows.length;i++) {
Node n = getNodeFromRow(selectedRows[i]);
if (n != null) {
selectedNodes.add(n);
}
}
//System.err.println(" => selectedNodes = "+selectedNodes);
callSelectionChanged(selectedNodes.toArray (new Node[selectedNodes.size ()]));
}
示例5: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(ListSelectionEvent e)
{
if( e.getSource() == list )
{
ListSelectionListener[] lsl = listeners.getListeners(ListSelectionListener.class);
if( lsl.length > 0 )
{
ListSelectionEvent e2 = new ListSelectionEvent(this, e.getFirstIndex(), e.getLastIndex(),
e.getValueIsAdjusting());
for( ListSelectionListener l : lsl )
{
l.valueChanged(e2);
}
}
}
}
示例6: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
/**
* @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
*/
public void valueChanged(ListSelectionEvent e)
{
JList jl = (JList) e.getSource();
if (jl.getSelectionModel().getValueIsAdjusting())
return;
KPartiteGraph bpg2 = (KPartiteGraph)kpg.copy();
// BipartiteGraph bpg2 = (BipartiteGraph) kpg.copy();
Object[] selected = jl.getSelectedValues();
// System.out.println("Value Changed " + Arrays.asList(selected));
for (int i = 0; i < selected.length; i++)
{
Vertex v2 = dates.getVertex((String) selected[i]);
if (v2 == null)
{
System.out.println(
"No original vertex with label " + selected[i]);
}
bpg2.removeVertex((Vertex) v2.getEqualVertex(bpg2));
}
wellKnownRenderer.setHiddenList(Arrays.asList(selected));
foldAndDisplay(bpg2);
}
示例7: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) return;
super.valueChanged(e);
for (WWIcon icon : icons) {
if (icon == null) continue;
icon.setHighlighted( false );
}
int[] selRows = table.getSelectedRows();
for (int row : selRows) {
int index = model.current[ row ];
icons[index].setHighlighted(true);
}
layer.firePropertyChange(AVKey.LAYER, null, layer);
}
示例8: DiffColorsPanel
import javax.swing.event.ListSelectionEvent; //導入依賴的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);
}
示例9: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
public void valueChanged(ListSelectionEvent e)
{
if (e.getValueIsAdjusting() == false)
{
JList list = (JList) e.getSource();
String selectedValue = (String) list.getSelectedValue();
String oldValue = textComponent.getText();
textComponent.setText(selectedValue);
if (!oldValue.equalsIgnoreCase(selectedValue))
{
textComponent.selectAll();
textComponent.requestFocus();
}
updateSampleFont();
}
}
示例10: styleListValueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
private void styleListValueChanged(ListSelectionEvent e) {
int style = -1;
String selectedStyle = (String) styleList.getSelectedValue();
if (selectedStyle == PLAIN) {
style = Font.PLAIN;
}
if (selectedStyle == BOLD) {
style = Font.BOLD;
}
if (selectedStyle == ITALIC) {
style = Font.ITALIC;
}
if (selectedStyle == BOLD_ITALIC) {
style = Font.BOLD + Font.ITALIC;
}
font = new Font(font.getFamily(), style, font.getSize());
previewLabel.setFont(font);
}
示例11: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
switch (clustList.getSelectedIndex()) {
case 0:
optClustering.removeAll();
optClustering.add(new KMeansOptPanel(ClusterPanel.this, new loadListener(), model), BorderLayout.CENTER);
optClustering.revalidate();
optClustering.repaint();
if (session.getListOfClustering().size() == 0) {
canGoOn = false;
}
break;
case 1:
optClustering.removeAll();
optClustering.add(new FuzzyOptPanel(ClusterPanel.this, new loadListener(), model), BorderLayout.CENTER);
optClustering.revalidate();
optClustering.repaint();
if (session.getListOfClustering().size() == 0) {
canGoOn = false;
}
break;
default:
clustList.setSelectedIndex(0);
}
}
}
示例12: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting() == false) {
@SuppressWarnings("unchecked")
JList<String> list = (JList<String>) e.getSource();
String selectedValue = (String) list.getSelectedValue();
String oldValue = textComponent.getText();
textComponent.setText(selectedValue);
if (!oldValue.equalsIgnoreCase(selectedValue)) {
textComponent.selectAll();
textComponent.requestFocus();
}
updateSampleFont();
}
}
示例13: DatabaseSelectionView
import javax.swing.event.ListSelectionEvent; //導入依賴的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: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
public void valueChanged(ListSelectionEvent e) {
JButton removeButton = buttons.get(Button.remove);
JButton upButton = buttons.get(Button.up);
JButton downButton = buttons.get(Button.down);
int index = viewersList.getSelectedIndex();
if (index == -1) {
removeButton.setEnabled(false);
upButton.setEnabled(false);
downButton.setEnabled(false);
} else {
removeButton.setEnabled(true);
if (index == 0) {
upButton.setEnabled(false);
} else {
upButton.setEnabled(true);
}
if (index == ((DefaultListModel) viewersList.getModel()).getSize()) {
downButton.setEnabled(false);
} else {
downButton.setEnabled(true);
}
}
}
開發者ID:didichuxing2,項目名稱:https-github.com-apache-zookeeper,代碼行數:25,代碼來源:ZooInspectorNodeViewersDialog.java
示例15: valueChanged
import javax.swing.event.ListSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
final TopComponent tc = (TopComponent) SwingUtilities.getAncestorOfClass(TopComponent.class, table);
if (tc == null) return; // table is no longer in component hierarchy
// this method may be called outside of AWT if a node fires change events from some other thread, see #79174
final Node [] nodeArray = getSelectedNodes();
if (SwingUtilities.isEventDispatchThread()) {
tc.setActivatedNodes(nodeArray);
} else {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
tc.setActivatedNodes(nodeArray);
}
});
}
}