当前位置: 首页>>代码示例>>Java>>正文


Java SingleSelectionModel类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AbstractViewTabDisplayerUI.java

示例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 );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:NBTabbedPaneController.java

示例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();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JTabbedPaneOperator.java

示例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);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JTabbedPaneOperator.java

示例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();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JMenuBarOperator.java

示例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);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JMenuBarOperator.java

示例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();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JPopupMenuOperator.java

示例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);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JPopupMenuOperator.java

示例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;
}
   }
 
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:13,代码来源:ButtonDemo.java

示例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);
	} 
}
 
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:13,代码来源:SwingSet2.java

示例11: getSelectionModel

import javax.swing.SingleSelectionModel; //导入依赖的package包/类
public SingleSelectionModel getSelectionModel() {
    return tabDisplayer.getSelectionModel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:DefaultTabbedContainerUI.java

示例12: getSelectionModel

import javax.swing.SingleSelectionModel; //导入依赖的package包/类
protected final SingleSelectionModel getSelectionModel() {
    return selectionModel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:AbstractViewTabDisplayerUI.java

示例13: getSelectionModel

import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@Override
protected SingleSelectionModel getSelectionModel() {
    return JTabbedPaneAdapter.this.getModel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:JTabbedPaneAdapter.java

示例14: getSelectionModel

import javax.swing.SingleSelectionModel; //导入依赖的package包/类
SingleSelectionModel getSelectionModel() {
    return selectionModel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:Controller.java

示例15: getSelectionModel

import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@Override
protected final SingleSelectionModel getSelectionModel() {
    return controller.getSelectionModel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:TabbedImpl.java


注:本文中的javax.swing.SingleSelectionModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。