当前位置: 首页>>代码示例>>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;未经允许,请勿转载。