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


Java ListSelectionEvent類代碼示例

本文整理匯總了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();
    });
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:20,代碼來源:SynsetViewUI.java

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

示例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); 
        }
    }
    });
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:24,代碼來源:InsMain.java

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

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

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

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

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

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

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

示例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);
		}
	}
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:27,代碼來源:ClusterPanel.java

示例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();
    }
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:18,代碼來源:FontChooser.java

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

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


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