List of usage examples for javax.swing ListSelectionModel SINGLE_SELECTION
int SINGLE_SELECTION
To view the source code for javax.swing ListSelectionModel SINGLE_SELECTION.
Click Source Link
From source file:org.fhcrc.cpl.viewer.gui.MRMDialog.java
private void transitionListInitializations() { listTransition = new JList(); listTransition.setCellRenderer(new coloredMRMListRenderer()); listTransition.setModel(new DefaultListModel()); listTransition.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); _tlsl = new transitionListSelectionListener(); listTransition.addListSelectionListener(_tlsl); listTransition.addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent event) { int move = event.getWheelRotation(); int curIndex = listTransition.getSelectedIndex(); int newIndex = curIndex; if (move > 0) { newIndex = Math.min(curIndex + move, listTransition.getModel().getSize()); listTransition.setSelectedIndex(newIndex); }//from w w w.j a v a 2 s . co m if (move < 0) { newIndex = Math.max(curIndex + move, 0); listTransition.setSelectedIndex(newIndex); } listTransition.ensureIndexIsVisible(newIndex); } }); for (MRMTransition curTran : _mrmTransitions) ((DefaultListModel) listTransition.getModel()).addElement(curTran); listTransition.setVisible(true); listScrollPane.getViewport().setView(listTransition); listScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); listScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent ae) { if (!ae.getValueIsAdjusting()) { listTransition.repaint(); } } }); }
From source file:app.RunApp.java
/** * Initializes Chi and Phi tables//from w w w. ja va2 s .c om */ private void initChiPhiJTable() { fixedTableChiPhi.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTableChiPhi.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fixedTableChiPhi.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableChiPhi.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fixedTableCoocurrences.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTableCoocurrences.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fixedTableCoocurrences.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableCoocurrences.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fixedTableHeatmap.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTableHeatmap.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); fixedTableHeatmap.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableHeatmap.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); chiLabel = new JLabel("Chi coefficients", SwingConstants.CENTER); chiLabel.setBounds(25, 420, 120, 20); chiLabel.setBackground(Color.white); chiLabel.setForeground(Color.black); chiLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); chiLabel.setOpaque(true); chiLabel.setToolTipText("White cells corresponds to chi coefficients"); panelChiPhi.add(chiLabel); phiLabel = new JLabel("Phi coefficients", SwingConstants.CENTER); phiLabel.setBounds(165, 420, 120, 20); phiLabel.setBackground(Color.lightGray); phiLabel.setForeground(Color.black); phiLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); phiLabel.setOpaque(true); phiLabel.setToolTipText("Light gray cells corresponds to phi coefficients"); panelChiPhi.add(phiLabel); jLabelChiFiText.setVisible(false); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTldPickerJPanel.java
public CFAccSwingTldPickerJPanel(ICFAccSwingSchema argSchema, ICFAccTldObj argFocus, ICFAccTenantObj argContainer, Collection<ICFAccTldObj> argDataCollection, ICFAccSwingTldChosen whenChosen) { super();//from www . j a v a 2s .c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedTld(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsTld(argFocus); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingTldPickerJPanel.java
public CFAstSwingTldPickerJPanel(ICFAstSwingSchema argSchema, ICFAstTldObj argFocus, ICFAstTenantObj argContainer, Collection<ICFAstTldObj> argDataCollection, ICFAstSwingTldChosen whenChosen) { super();//from w w w . j a v a 2s . c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedTld(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsTld(argFocus); }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_0.CFFswSwing.CFFswSwingTldPickerJPanel.java
public CFFswSwingTldPickerJPanel(ICFFswSwingSchema argSchema, ICFFswTldObj argFocus, ICFFswTenantObj argContainer, Collection<ICFFswTldObj> argDataCollection, ICFFswSwingTldChosen whenChosen) { super();/*from www .ja v a 2 s . c om*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedTld(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsTld(argFocus); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_2.CFAstSwing.CFAstSwingSysClusterPickerJPanel.java
public CFAstSwingSysClusterPickerJPanel(ICFAstSwingSchema argSchema, ICFAstSysClusterObj argFocus, ICFAstClusterObj argContainer, Collection<ICFAstSysClusterObj> argDataCollection, ICFAstSwingSysClusterChosen whenChosen) { super();//from ww w . j a va 2 s . co m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedSysCluster(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsSysCluster(argFocus); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTenantPickerJPanel.java
public CFAccSwingTenantPickerJPanel(ICFAccSwingSchema argSchema, ICFAccTenantObj argFocus, ICFAccClusterObj argContainer, Collection<ICFAccTenantObj> argDataCollection, ICFAccSwingTenantChosen whenChosen) { super();//from w ww . ja v a 2 s. c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedTenant(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsTenant(argFocus); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingTenantPickerJPanel.java
public CFAstSwingTenantPickerJPanel(ICFAstSwingSchema argSchema, ICFAstTenantObj argFocus, ICFAstClusterObj argContainer, Collection<ICFAstTenantObj> argDataCollection, ICFAstSwingTenantChosen whenChosen) { super();/*from www. j a va2s. c o m*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedTenant(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsTenant(argFocus); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSwing.CFAstSwingVersionPickerJPanel.java
public CFAstSwingVersionPickerJPanel(ICFAstSwingSchema argSchema, ICFAstVersionObj argFocus, ICFLibAnyObj argContainer, Collection<ICFAstVersionObj> argDataCollection, ICFAstSwingVersionChosen whenChosen) { super();/*from w w w. j av a 2s .c o m*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedVersion(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsVersion(argFocus); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingVersionPickerJPanel.java
public CFAccSwingVersionPickerJPanel(ICFAccSwingSchema argSchema, ICFAccVersionObj argFocus, ICFLibAnyObj2 argContainer, Collection<ICFAccVersionObj> argDataCollection, ICFAccSwingVersionChosen whenChosen) { super();/*from w w w .j a va2s . c o m*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedVersion(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsVersion(argFocus); }