本文整理汇总了Java中javax.swing.SingleSelectionModel类的典型用法代码示例。如果您正苦于以下问题:Java SingleSelectionModel类的具体用法?Java SingleSelectionModel怎么用?Java SingleSelectionModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleSelectionModel类属于javax.swing包,在下文中一共展示了SingleSelectionModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mousePressed
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@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);
}
}
示例2: mousePressed
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@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 );
}
}
示例3: getModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* Maps {@code JTabbedPane.getModel()} through queue
*/
public SingleSelectionModel getModel() {
return (runMapping(new MapAction<SingleSelectionModel>("getModel") {
@Override
public SingleSelectionModel map() {
return ((JTabbedPane) getSource()).getModel();
}
}));
}
示例4: setModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* 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);
}
});
}
示例5: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* Maps {@code JMenuBar.getSelectionModel()} through queue
*/
public SingleSelectionModel getSelectionModel() {
return (runMapping(new MapAction<SingleSelectionModel>("getSelectionModel") {
@Override
public SingleSelectionModel map() {
return ((JMenuBar) getSource()).getSelectionModel();
}
}));
}
示例6: setSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* 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);
}
});
}
示例7: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* Maps {@code JPopupMenu.getSelectionModel()} through queue
*/
public SingleSelectionModel getSelectionModel() {
return (runMapping(new MapAction<SingleSelectionModel>("getSelectionModel") {
@Override
public SingleSelectionModel map() {
return ((JPopupMenu) getSource()).getSelectionModel();
}
}));
}
示例8: setSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* 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);
}
});
}
示例9: stateChanged
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
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;
}
}
示例10: stateChanged
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
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);
}
}
示例11: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
public SingleSelectionModel getSelectionModel() {
return tabDisplayer.getSelectionModel();
}
示例12: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
protected final SingleSelectionModel getSelectionModel() {
return selectionModel;
}
示例13: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@Override
protected SingleSelectionModel getSelectionModel() {
return JTabbedPaneAdapter.this.getModel();
}
示例14: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
SingleSelectionModel getSelectionModel() {
return selectionModel;
}
示例15: getSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@Override
protected final SingleSelectionModel getSelectionModel() {
return controller.getSelectionModel();
}