javax.swing.SingleSelectionModel Java Examples
The following examples show how to use
javax.swing.SingleSelectionModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractViewTabDisplayerUI.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void mousePressed(MouseEvent e) { Point p = e.getPoint(); int i = getLayoutModel().indexOfPoint(p.x, p.y); tabState.setPressed(i); SingleSelectionModel sel = getSelectionModel(); selectionChanged = i != sel.getSelectedIndex(); // invoke possible selection change if ((i != -1) || !selectionChanged) { boolean change = shouldPerformAction(TabDisplayer.COMMAND_SELECT, i, e); if (change) { getSelectionModel().setSelectedIndex(i); tabState.setSelected(i); Component tc = i >= 0 ? getDataModel().getTab(i).getComponent() : null; if( null != tc && tc instanceof TopComponent && !((TopComponent)tc).isAncestorOf( KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() ) ) { ((TopComponent)tc).requestActive(); } } } if (e.isPopupTrigger()) { //Post a popup menu show request shouldPerformAction(TabDisplayer.COMMAND_POPUP_REQUEST, i, e); } }
Example #2
Source File: JTabbedPaneOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JTabbedPane.getModel()} through queue */ public SingleSelectionModel getModel() { return (runMapping(new MapAction<SingleSelectionModel>("getModel") { @Override public SingleSelectionModel map() { return ((JTabbedPane) getSource()).getModel(); } })); }
Example #3
Source File: SharedTabPane.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
protected SharedTabPane() { final SingleSelectionModel selectionModel = getModel(); selectionModel.addChangeListener(e -> { int index = selectionModel.getSelectedIndex(); if (index != -1) { setSharedComponentParent(index); } }); }
Example #4
Source File: SharedTabPane.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
protected SharedTabPane() { final SingleSelectionModel selectionModel = getModel(); selectionModel.addChangeListener(e -> { int index = selectionModel.getSelectedIndex(); if (index != -1) { setSharedComponentParent(index); } }); }
Example #5
Source File: SwingSet2.java From beautyeye with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { SingleSelectionModel model = (SingleSelectionModel) e.getSource(); boolean srcSelected = model.getSelectedIndex() == 1; if(currentTabDemo != currentDemo && demoSrcPane != null && srcSelected) { demoSrcPane.setText(getString("SourceCode.loading")); repaint(); } if(currentTabDemo != currentDemo && srcSelected) { currentTabDemo = currentDemo; setSourceCode(currentDemo); } }
Example #6
Source File: ButtonDemo.java From beautyeye with Apache License 2.0 | 5 votes |
public void stateChanged(ChangeEvent e) { SingleSelectionModel model = (SingleSelectionModel) e.getSource(); if(model.getSelectedIndex() == 0) { currentControls = buttons; } else if(model.getSelectedIndex() == 1) { currentControls = radiobuttons; } else if(model.getSelectedIndex() == 2) { currentControls = checkboxes; } else { currentControls = togglebuttons; } }
Example #7
Source File: JPopupMenuOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JPopupMenu.setSelectionModel(SingleSelectionModel)} * through queue */ public void setSelectionModel(final SingleSelectionModel singleSelectionModel) { runMapping(new MapVoidAction("setSelectionModel") { @Override public void map() { ((JPopupMenu) getSource()).setSelectionModel(singleSelectionModel); } }); }
Example #8
Source File: JPopupMenuOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JPopupMenu.getSelectionModel()} through queue */ public SingleSelectionModel getSelectionModel() { return (runMapping(new MapAction<SingleSelectionModel>("getSelectionModel") { @Override public SingleSelectionModel map() { return ((JPopupMenu) getSource()).getSelectionModel(); } })); }
Example #9
Source File: JMenuBarOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JMenuBar.setSelectionModel(SingleSelectionModel)} * through queue */ public void setSelectionModel(final SingleSelectionModel singleSelectionModel) { runMapping(new MapVoidAction("setSelectionModel") { @Override public void map() { ((JMenuBar) getSource()).setSelectionModel(singleSelectionModel); } }); }
Example #10
Source File: JMenuBarOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JMenuBar.getSelectionModel()} through queue */ public SingleSelectionModel getSelectionModel() { return (runMapping(new MapAction<SingleSelectionModel>("getSelectionModel") { @Override public SingleSelectionModel map() { return ((JMenuBar) getSource()).getSelectionModel(); } })); }
Example #11
Source File: JTabbedPaneOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JTabbedPane.setModel(SingleSelectionModel)} through queue */ public void setModel(final SingleSelectionModel singleSelectionModel) { runMapping(new MapVoidAction("setModel") { @Override public void map() { ((JTabbedPane) getSource()).setModel(singleSelectionModel); } }); }
Example #12
Source File: NBTabbedPaneController.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void mousePressed( MouseEvent e ) { Point p = e.getPoint(); p = SwingUtilities.convertPoint( e.getComponent(), p, container ); int tabIndex = container.indexAtLocation( p.x, p.y ); SingleSelectionModel sel = container.getModel(); //invoke possible selection change if( tabIndex >= 0 && e.getComponent() != container ) { CloseableTabComponent tab = ( CloseableTabComponent ) container.getTabComponentAt( tabIndex ); if( tab.isInCloseButton( e ) ) { return; } tabIndex = container.indexOf( container.getComponentAt( tabIndex ) ); boolean change = shouldPerformAction( TabDisplayer.COMMAND_SELECT, tabIndex, e ); if( change ) { sel.setSelectedIndex( tabIndex ); Component tc = container.getDataModel().getTab( tabIndex ).getComponent(); if( null != tc && tc instanceof TopComponent && !(( TopComponent ) tc).isAncestorOf( KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() ) ) { (( TopComponent ) tc).requestActive(); } } } if( e.isPopupTrigger() ) { //Post a popup menu show request shouldPerformAction( TabDisplayer.COMMAND_POPUP_REQUEST, tabIndex, e ); } }
Example #13
Source File: TabbedImpl.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected final SingleSelectionModel getSelectionModel() { return controller.getSelectionModel(); }
Example #14
Source File: Controller.java From netbeans with Apache License 2.0 | 4 votes |
SingleSelectionModel getSelectionModel() { return selectionModel; }
Example #15
Source File: JTabbedPaneAdapter.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected SingleSelectionModel getSelectionModel() { return JTabbedPaneAdapter.this.getModel(); }
Example #16
Source File: AbstractViewTabDisplayerUI.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected final SingleSelectionModel createSelectionModel() { return new DefaultTabSelectionModel (displayer.getModel()); }
Example #17
Source File: AbstractViewTabDisplayerUI.java From netbeans with Apache License 2.0 | 4 votes |
protected final SingleSelectionModel getSelectionModel() { return selectionModel; }
Example #18
Source File: DefaultTabbedContainerUI.java From netbeans with Apache License 2.0 | 4 votes |
public SingleSelectionModel getSelectionModel() { return tabDisplayer.getSelectionModel(); }
Example #19
Source File: TabDisplayerUI.java From netbeans with Apache License 2.0 | 2 votes |
/** * Create the selection model which will handle selection for the * TabDisplayer. SPI method located here because TabDisplayer.setSelectionModel * is package private. */ protected abstract SingleSelectionModel createSelectionModel();