Java 类javax.swing.event.ListSelectionEvent 实例源码
项目:WordnetLoom
文件:SynsetViewUI.java
@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();
});
}
项目:incubator-netbeans
文件:PersistenceClientEntitySelectionVisual.java
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 );
}
}
项目:call-IDE
文件:InsMain.java
/**
* 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);
}
}
});
}
项目:incubator-netbeans
文件:OutlineView.java
@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 ()]));
}
项目:Equella
文件:FilterList.java
@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);
}
}
}
}
项目:cuttlefish
文件:TestSouthernWomenBipartite.java
/**
* @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);
}
项目:geomapapp
文件:WWPDB.java
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);
}
项目:incubator-netbeans
文件:DiffColorsPanel.java
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);
}
项目:brModelo
文件:JFontChooser.java
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();
}
}
项目:rapidminer
文件:FontDialog.java
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);
}
项目:QN-ACTR-Release
文件:ClusterPanel.java
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);
}
}
}
项目:smile_1.5.0_java7
文件:FontChooser.java
@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();
}
}
项目:rapidminer
文件:DatabaseSelectionView.java
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();
}
项目:https-github.com-apache-zookeeper
文件:ZooInspectorNodeViewersDialog.java
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);
}
}
}
项目:incubator-netbeans
文件:SyncTable.java
@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);
}
});
}
}
项目:incubator-netbeans
文件:TagManager.java
@Override
public void valueChanged (ListSelectionEvent evt) {
if (!evt.getValueIsAdjusting()) {
HgTag tag = null;
if (panel.tagList.getSelectedValue() instanceof HgTag) {
tag = (HgTag) panel.tagList.getSelectedValue();
}
if (tag == null) {
panel.btnRemove.setEnabled(false);
panel.btnUpdate.setEnabled(false);
} else {
panel.btnRemove.setEnabled(tag.canRemove());
panel.btnUpdate.setEnabled(true);
panel.changesetPanel1.setInfo(tag.getRevisionInfo());
panel.txtTagName.setText(tag.getName());
panel.txtTagName.setCaretPosition(0);
panel.txtTaggedRevision.setText(annotateRevision(tag.getRevisionInfo()));
panel.txtTaggedRevision.setCaretPosition(0);
panel.lblLocal.setVisible(tag.isLocal());
}
}
}
项目:lazycat
文件:WebAppPanel.java
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();
}
});
}
项目:incubator-netbeans
文件:DataViewTableUI.java
@Override
public void valueChanged(ListSelectionEvent e) {
if (dataviewUI == null) {
return;
}
if (e.getSource() == table.getSelectionModel()
&& table.getRowSelectionAllowed()) {
boolean rowSelected = table.getSelectedRows().length > 0;
if (rowSelected && getModel().isEditable()) {
dataviewUI.enableDeleteBtn(!dataviewUI.isDirty());
} else {
dataviewUI.enableDeleteBtn(false);
}
}
}
项目:alevin-svn2
文件:MultiAlgoScenarioWizard.java
@Override
public void valueChanged(ListSelectionEvent e) {
int row = networkTable.getSelectedRow();
moveDown.setEnabled(model.canMoveGeneratorDown(row));
moveUp.setEnabled(model.canMoveGeneratorUp(row));
remove.setEnabled(model.canRemoveGenerator(row));
add.setEnabled(model.canAddGenerator(row));
}
项目:NBANDROID-V2
文件:AndroidPlatformCustomizer.java
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
AndroidPlatformInfo.PathRecord selectedValue = (AndroidPlatformInfo.PathRecord) classPathList.getSelectedValue();
removeClasspath.setEnabled(selectedValue == null ? false : selectedValue.isUserRecord());
}
}
项目:incubator-netbeans
文件:JFXApplicationMultiPropertyPanel.java
void registerListeners() {
tableModel.addTableModelListener(this);
tableMultiProperties.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent lse) {
if (!lse.getValueIsAdjusting()) {
updateRemoveButton();
}
}
});
cellEditor.registerCellEditorListener();
}
项目:Equella
文件:StepDialog.java
@Override
public void valueChanged(ListSelectionEvent e)
{
if( e.getSource() == list )
{
updateButtons();
}
}
项目:incubator-netbeans
文件:TableCustomizer.java
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
int[] index = columnsTable.getSelectedRows();
boolean empty = (index.length == 0);
boolean multi = (index.length > 1);
deleteColumnButton.setEnabled(!empty);
moveUpColumnButton.setEnabled(!empty && !multi && (index[0] > 0));
moveDownColumnButton.setEnabled(!empty && !multi && (index[0] < columns.size()-1));
updateColumnSection();
}
项目:incubator-netbeans
文件:TableCustomizer.java
@Override
public void valueChanged(ListSelectionEvent e) {
int[] index = rowsTable.getSelectedRows();
boolean empty = (index.length == 0);
boolean multi = (index.length > 1);
deleteRowButton.setEnabled(!empty);
moveUpRowButton.setEnabled(!empty && !multi && (index[0] > 0));
moveDownRowButton.setEnabled(!empty && !multi && (index[0] < rowTableModel.getRowCount()-1));
}
项目:NBANDROID-V2
文件:AndroidPlatformCustomizer.java
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
AndroidPlatformInfo.PathRecord selectedValue1 = (AndroidPlatformInfo.PathRecord) sourcesList.getSelectedValue();
removeSources.setEnabled(selectedValue1 == null ? false : selectedValue1.isUserRecord());
}
}
项目:incubator-netbeans
文件:CategoryPanelStepFilters.java
private void initFilterClassesList() {
filterClassesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
filterRemoveButton.setEnabled(filterClassesTable.getSelectedRow() >= 0);
}
});
filterRemoveButton.setEnabled(filterClassesTable.getSelectedRow() >= 0);
filterClassesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
filterClassesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
}
项目:HBaseClient
文件:SelectTableInfoListener.java
@SuppressWarnings("unchecked")
@Override
public void valueChanged(ListSelectionEvent e)
{
JList<String> v_Tables = (JList<String>)e.getSource();
String v_TableName = v_Tables.getSelectedValue();
if ( !JavaHelp.isNull(v_TableName) )
{
if ( !v_TableName.equals(this.getTableName()) )
{
this.getAppFrame().setTableName(v_TableName);
}
}
}
项目:WordnetLoom
文件:SynsetStructureViewUI.java
@Override
public void valueChanged(ListSelectionEvent arg0) {
if (arg0 != null && arg0.getValueIsAdjusting()) {
return;
}
int index = unitsList.getSelectedIndex(); // odczytanie indeksu
boolean singleSelection = unitsList.getSelectedIndices() == null
|| unitsList.getSelectedIndices().length < 2;
buttonUp.setEnabled(singleSelection && index > 0
&& (listModel.getSplitPosition() != index || index > 1));
buttonDown.setEnabled(singleSelection && index != -1
&& index + 1 < listModel.getSize()
&& (index > 0 || index + 1 != listModel.getSplitPosition()));
buttonToNew.setEnabled(null != lastSynset
&& listModel.getCollection().size() > 1);
int selectionSize = unitsList.getSelectedIndices().length;
// nie można usunąć linii podziału
buttonDelete.setEnabled(selectionSize > 0
&& selectionSize < listModel.getSize());
buttonSwitchToLexicalPerspective.setEnabled(singleSelection
&& index != -1 && index != listModel.getSplitPosition());
// powiadomienie zainteresowanych
listeners.notifyAllListeners(listModel.getObjectAt(index), LIST_SELECTION_CHANGED);
}
项目:incubator-netbeans
文件:StatusLineComponent.java
public @Override void setModel(TaskModel mod) {
model = mod;
model.addListDataListener(new Listener());
model.addListSelectionListener(new ListSelectionListener() {
public @Override void valueChanged(ListSelectionEvent e) {
pane.updateBoldFont(model.getSelectedHandle());
}
});
}
项目:jmt
文件:InGateWaySectionPanel.java
@Override
public void valueChanged(ListSelectionEvent e) {
super.valueChanged(e);
int row = getSelectedRow();
if (!e.getValueIsAdjusting() && row > -1) {
if (forkProbEditor != null) {
forkProbEditor.stopEditing();
forkProbEditor.setData(sd, cd, stationKey, cd.getClassKeys().get(row));
descrTextPane.setText(((ForkStrategy) sd.getForkStrategy(stationKey, cd.getClassKeys().get(row))).getDescription());
InGateWaySectionPanel.this.doLayout();
InGateWaySectionPanel.this.repaint();
}
}
}
项目:Maxine-VM
文件:JTableMachineCodeViewer.java
@Override
public void valueChanged(ListSelectionEvent e) {
// The selection in the table has changed; might have happened via user action (click, arrow) or
// as a side effect of a focus change.
super.valueChanged(e);
if (!e.getValueIsAdjusting()) {
final int selectedRow = getSelectedRow();
final MachineCodeTableModel machineCodeTableModel = (MachineCodeTableModel) getModel();
if (selectedRow >= 0 && selectedRow < machineCodeTableModel.getRowCount()) {
focus().setCodeLocation(machineCodeTableModel.rowToLocation(selectedRow));
}
}
}
项目:sumo
文件:GeometricInteractiveVDSLayerPanel.java
@Override
public void valueChanged(ListSelectionEvent e){
super.valueChanged(e);
if(getSelectedRow()>=0){
if(dataModel instanceof GeometricInteractiveVDSLayerModel)
((GeometricInteractiveVDSLayerModel)dataModel).changeSelection(getSelectedRow(), display);
}
}
项目:incubator-netbeans
文件:ItemSelector.java
@Override
public void valueChanged (ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
if (e.getSource() == panel.list.getSelectionModel()) {
changeSupport.fireChange();
}
}
}
项目:incubator-netbeans
文件:DockerHubSearchPanel.java
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
resultTextField.setText(getImage());
}
项目:incubator-netbeans
文件:ConfigurationsPanel.java
ConfigurationsPanel(ModelHandle2 handle, NbMavenProjectImpl project) {
this();
this.handle = handle;
this.project = project;
// btnAdd.setVisible(false);
// btnEdit.setVisible(false);
// btnRemove.setVisible(false);
// addProfileConfigurations();
initListUI();
checkButtonEnablement();
lstConfigurations.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component supers = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
ModelHandle2.Configuration conf = (ModelHandle2.Configuration)value;
if (conf == ConfigurationsPanel.this.handle.getActiveConfiguration()) {
supers.setFont(supers.getFont().deriveFont(Font.BOLD));
}
return supers;
}
});
lstConfigurations.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
checkButtonEnablement();
}
});
createListModel();
}
项目:powertext
文件:CopyListBoard.java
@Override
public void valueChanged(ListSelectionEvent evt)
{
if(jList3.getSelectedValue()!=null)
{
//System.out.println("it not copying oo ");
String list_item =jList3.getSelectedValue().trim();
StringSelection ss = new StringSelection(list_item);
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents(ss, ss);
}
}
项目:openjdk-jdk10
文件:JTableOperator.java
/**
* Maps {@code JTable.valueChanged(ListSelectionEvent)} through queue
*/
public void valueChanged(final ListSelectionEvent listSelectionEvent) {
runMapping(new MapVoidAction("valueChanged") {
@Override
public void map() {
((JTable) getSource()).valueChanged(listSelectionEvent);
}
});
}
项目:SE2Project
文件:AusleiheMedienauflisterWerkzeug.java
/**
* Registiert die Aktion, die ausgeführt wird, wenn ein Medium ausgewählt
* wird.
*/
private void registriereMedienAnzeigenAktion()
{
_ui.getMedienAuflisterTable()
.getSelectionModel()
.addListSelectionListener(new ListSelectionListener()
{
@Override
public void valueChanged(ListSelectionEvent e)
{
informiereUeberAenderung();
}
});
}
项目:VASSAL-src
文件:TranslateWindow.java
/**
* When a key is selected in the table, display the source and translated
* texts in the right hand panels
*/
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
if (lsm.isSelectionEmpty()) {
return;
}
else {
String key = keys[lsm.getMinSelectionIndex()];
currentKey = keyTarget.getI18nData().getFullPrefix() + key; //$NON-NLS-1$
}
}
项目:geomapapp
文件:MGG.java
public void valueChanged(ListSelectionEvent e) {
int i = list.getSelectedIndex();
if(i!=-1) {
i = model.indexOf( i );
}
drawSelectedTrack(Color.black);
selectedIndex = i;
drawSelectedTrack(Color.white);
return;
}