jList.setSelectionModel(new DisabledItemSelectionModel()); jList.setCellRenderer(new DisabledItemListCellRenderer()); jList.addListSelectionListener(new ListSelectionListener() {
searchResultList.setSelectionModel(searchResultSelectionModel);
/** * Create a new interactive list for interacting with the query. * @return a {@link javax.swing.JList} bound to this dynamic query. */ public JList createList() { JList list = new JList(m_model); list.setSelectionModel(m_model); return list; }
JFrame frame = new JFrame(); //Other frame "stuff" JList list = new JList(new Object[]{"121", "131", "141", "151" , "111", "181"}); list.setSelectionModel(new MySelectionModel(list, 5)); //<-- This is the magic line right here frame.setVisible(true);
/** * Convinient method to install a new {@link OneClicListSelectionModel} on * a given {@link JList}. * * @param list the list onwhcih install the selection model * @since 2.5.4 */ public static void installModel(JList list) { OneClicListSelectionModel newModel = new OneClicListSelectionModel(list); list.setSelectionModel(newModel); }
/** * Convinient method to install a new {@link OneClicListSelectionModel} on * a given {@link JList}. * * @param list the list onwhcih install the selection model * @since 2.5.4 */ public static void installModel(JList list) { OneClicListSelectionModel newModel = new OneClicListSelectionModel(list); list.setSelectionModel(newModel); }
@Override public final void setSelectionModel(ListSelectionModel selectionModel) { super.setSelectionModel(new DefaultListSelectionModel()); }
@Override public void processDataBinding() { if (listSimulParamsPopulations != null) { listSimulParamsPopulations.setSelectionModel(new jaxx.runtime.swing.OneClicListSelectionModel(listSimulParamsPopulations.getSelectionModel(), listSimulParamsPopulations.getModel())); } }
@Override public void processDataBinding() { if (listSimulParamsStrategies != null) { listSimulParamsStrategies.setSelectionModel(new jaxx.runtime.swing.OneClicListSelectionModel(listSimulParamsStrategies.getSelectionModel(), listSimulParamsStrategies.getModel())); } }
/** Sets the selection model that is used to maintain selection state. This provides the ability to programmatically select and deselect objects. @param selectionModel The selection model. **/ public void setSelectionModel (ListSelectionModel selectionModel) { if (selectionModel == null) throw new NullPointerException ("selectionModel"); // Do not dispatch events from the old selection model any more. ListSelectionModel oldSelectionModel = list_.getSelectionModel (); oldSelectionModel.removeListSelectionListener (listSelectionEventSupport_); list_.setSelectionModel (selectionModel); // Dispatch events from the new selection model. selectionModel.addListSelectionListener (listSelectionEventSupport_); }
@Override public void processDataBinding() { if (model != null) { to.setSelectionModel(getModel().getToModel()); } }
/** Sets the selection model that is used to maintain selection state. This provides the ability to programmatically select and deselect resources. @param selectionModel The selection model. **/ public void setSelectionModel (ListSelectionModel selectionModel) { if (selectionModel == null) throw new NullPointerException ("selectionModel"); // Do not dispatch events from the old selection model any more. ListSelectionModel oldSelectionModel = list_.getSelectionModel (); oldSelectionModel.removeListSelectionListener (listSelectionEventSupport_); list_.setSelectionModel (selectionModel); // Dispatch events from the new selection model. selectionModel.addListSelectionListener (listSelectionEventSupport_); }
@Override public void processDataBinding() { if (model != null) { to.setSelectionModel(getModel().getToModel()); } }
@Override public void processDataBinding() { if (model != null) { from.setSelectionModel(getModel().getFromModel()); } }
public void showHistory() { if (historyDialog == null) { JList<PixelitorEdit> historyList = new JList<>(this); historyList.setSelectionModel(selectionModel); historyDialog = new JDialog(PixelitorWindow.getInstance(), "History", false); JPanel p = new HistoryPanel(this, historyList); historyDialog.getContentPane().add(p); historyDialog.setSize(200, 300); } if (!historyDialog.isVisible()) { GUIUtils.showDialog(historyDialog); } }
/** * {@inheritDoc} <p> * * Overridden to update selectionMapper */ @Override public void setSelectionModel(ListSelectionModel newModel) { super.setSelectionModel(newModel); getSelectionMapper().setViewSelectionModel(getSelectionModel()); }
BattleStepsPanel() { setLayout(new BorderLayout()); add(list, BorderLayout.CENTER); list.setBackground(this.getBackground()); list.setSelectionModel(listSelectionModel); }
public final void setModel( @NotNull TagsComponentModel model ) { this.model = model; tagCombo.setModel( new TagComboBoxModel( getModel().getTagProvider(), false ) ); TagListModel tagListModel = new TagListModel( getModel().getSelectedTags(), false ); tagList.setModel( tagListModel ); tagList.setSelectionModel( new TagListSelectionMode( tagListModel ) ); tagList.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged( ListSelectionEvent e ) { if ( e.getValueIsAdjusting() ) { return; } updateRemoveButtonState(); } } ); }
public void setSelectionModel(final ListSelectionModel _selectionModel) { // ne pas mettre getSelectionModel dans une variable ! if (getSelectionModel() != null) { getSelectionModel().removeListSelectionListener(this); } super.setSelectionModel(_selectionModel); if (getSelectionModel() != null) { getSelectionModel().addListSelectionListener(this); } }
public static void createListSelectionModel(ActionContext actionContext){ Thing self = (Thing) actionContext.get("self"); JList parent = (JList) actionContext.get("parent"); for(Thing child : self.getChilds()){ ListSelectionModel l = (ListSelectionModel) child.doAction("create", actionContext); if(l != null){ parent.setSelectionModel(l); } } }