Java Code Examples for javax.swing.event.ListSelectionEvent

The following are top voted examples for showing how to use javax.swing.event.ListSelectionEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: WordnetLoom   File: SynsetViewUI.java   View source code 6 votes vote down vote up
@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();
    });
}
 
Example 2
Project: incubator-netbeans   File: PersistenceClientEntitySelectionVisual.java   View source code 6 votes vote down vote up
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 );
    }
}
 
Example 3
Project: call-IDE   File: InsMain.java   View source code 6 votes vote down vote up
/**
 * 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); 
        }
    }
    });
}
 
Example 4
Project: incubator-netbeans   File: OutlineView.java   View source code 6 votes vote down vote up
@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 ()]));
}
 
Example 5
Project: Equella   File: FilterList.java   View source code 6 votes vote down vote up
@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);
			}
		}
	}
}
 
Example 6
Project: cuttlefish   File: TestSouthernWomenBipartite.java   View source code 6 votes vote down vote up
/**
		 * @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);
		}
 
Example 7
Project: geomapapp   File: WWPDB.java   View source code 6 votes vote down vote up
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);
}
 
Example 8
Project: incubator-netbeans   File: DiffColorsPanel.java   View source code 6 votes vote down vote up
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);
}
 
Example 9
Project: brModelo   File: JFontChooser.java   View source code 6 votes vote down vote up
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();
    }
}
 
Example 10
Project: rapidminer   File: FontDialog.java   View source code 6 votes vote down vote up
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);
	}
 
Example 11
Project: QN-ACTR-Release   File: ClusterPanel.java   View source code 6 votes vote down vote up
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);
		}
	}
}
 
Example 12
Project: smile_1.5.0_java7   File: FontChooser.java   View source code 6 votes vote down vote up
@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();
    }
}
 
Example 13
Project: rapidminer   File: DatabaseSelectionView.java   View source code 6 votes vote down vote up
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();
}
 
Example 14
Project: https-github.com-apache-zookeeper   File: ZooInspectorNodeViewersDialog.java   View source code 6 votes vote down vote up
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);
        }
    }
}
 
Example 15
Project: incubator-netbeans   File: SyncTable.java   View source code 6 votes vote down vote up
@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);
            }
        });
    }
}
 
Example 16
Project: incubator-netbeans   File: TagManager.java   View source code 6 votes vote down vote up
@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());
        }
    }
}
 
Example 17
Project: lazycat   File: WebAppPanel.java   View source code 6 votes vote down vote up
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();

		}
	});

}
 
Example 18
Project: incubator-netbeans   File: DataViewTableUI.java   View source code 6 votes vote down vote up
@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);
        }
    }
}
 
Example 19
Project: alevin-svn2   File: MultiAlgoScenarioWizard.java   View source code 5 votes vote down vote up
@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));
}
 
Example 20
Project: NBANDROID-V2   File: AndroidPlatformCustomizer.java   View source code 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        AndroidPlatformInfo.PathRecord selectedValue = (AndroidPlatformInfo.PathRecord) classPathList.getSelectedValue();
        removeClasspath.setEnabled(selectedValue == null ? false : selectedValue.isUserRecord());
    }
}
 
Example 21
Project: incubator-netbeans   File: JFXApplicationMultiPropertyPanel.java   View source code 5 votes vote down vote up
void registerListeners() {
    tableModel.addTableModelListener(this);
    tableMultiProperties.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent lse) {
            if (!lse.getValueIsAdjusting()) {
                updateRemoveButton();
            }
        }
    });
    cellEditor.registerCellEditorListener();
}
 
Example 22
Project: Equella   File: StepDialog.java   View source code 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e)
{
	if( e.getSource() == list )
	{
		updateButtons();
	}
}
 
Example 23
Project: incubator-netbeans   File: TableCustomizer.java   View source code 5 votes vote down vote up
@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();
}
 
Example 24
Project: incubator-netbeans   File: TableCustomizer.java   View source code 5 votes vote down vote up
@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));
}
 
Example 25
Project: NBANDROID-V2   File: AndroidPlatformCustomizer.java   View source code 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        AndroidPlatformInfo.PathRecord selectedValue1 = (AndroidPlatformInfo.PathRecord) sourcesList.getSelectedValue();
        removeSources.setEnabled(selectedValue1 == null ? false : selectedValue1.isUserRecord());
    }
}
 
Example 26
Project: incubator-netbeans   File: CategoryPanelStepFilters.java   View source code 5 votes vote down vote up
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);
}
 
Example 27
Project: HBaseClient   File: SelectTableInfoListener.java   View source code 5 votes vote down vote up
@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);
        }
    }
}
 
Example 28
Project: WordnetLoom   File: SynsetStructureViewUI.java   View source code 5 votes vote down vote up
@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);
}
 
Example 29
Project: incubator-netbeans   File: StatusLineComponent.java   View source code 5 votes vote down vote up
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());
        }
    });
}
 
Example 30
Project: jmt   File: InGateWaySectionPanel.java   View source code 5 votes vote down vote up
@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();
		}
	}
}
 
Example 31
Project: Maxine-VM   File: JTableMachineCodeViewer.java   View source code 5 votes vote down vote up
@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));
        }
    }
}
 
Example 32
Project: sumo   File: GeometricInteractiveVDSLayerPanel.java   View source code 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e){
    super.valueChanged(e);
    if(getSelectedRow()>=0){
    	if(dataModel instanceof GeometricInteractiveVDSLayerModel)
    		((GeometricInteractiveVDSLayerModel)dataModel).changeSelection(getSelectedRow(), display);
    }	
}
 
Example 33
Project: incubator-netbeans   File: ItemSelector.java   View source code 5 votes vote down vote up
@Override
public void valueChanged (ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        if (e.getSource() == panel.list.getSelectionModel()) {
            changeSupport.fireChange();
        }
    }
}
 
Example 34
Project: incubator-netbeans   File: DockerHubSearchPanel.java   View source code 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
        return;
    }

    resultTextField.setText(getImage());
}
 
Example 35
Project: incubator-netbeans   File: ConfigurationsPanel.java   View source code 5 votes vote down vote up
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();
    }
 
Example 36
Project: powertext   File: CopyListBoard.java   View source code 5 votes vote down vote up
@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);
    }
}
 
Example 37
Project: openjdk-jdk10   File: JTableOperator.java   View source code 5 votes vote down vote up
/**
 * 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);
        }
    });
}
 
Example 38
Project: SE2Project   File: AusleiheMedienauflisterWerkzeug.java   View source code 5 votes vote down vote up
/**
 * 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();
            }
        });
}
 
Example 39
Project: VASSAL-src   File: TranslateWindow.java   View source code 5 votes vote down vote up
/**
 * 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$
  }
}
 
Example 40
Project: geomapapp   File: MGG.java   View source code 5 votes vote down vote up
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;
}