本文整理汇总了Java中javax.swing.SingleSelectionModel类的典型用法代码示例。如果您正苦于以下问题:Java SingleSelectionModel类的具体用法?Java SingleSelectionModel怎么用?Java SingleSelectionModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleSelectionModel类属于javax.swing包,在下文中一共展示了SingleSelectionModel类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: setSingleSelectionMode
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
public void setSingleSelectionMode(SingleSelectionModel sModel){
this.singleModel = sModel;
}
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:HCTabHost.java
示例17: TabbedPaneDemo
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* TabbedPaneDemo Constructor.
*
* @param swingset the swingset
*/
public TabbedPaneDemo(SwingSet2 swingset) {
// Set the title for this demo, and an icon used to represent this
// demo inside the SwingSet2 app.
super(swingset, "TabbedPaneDemo"
, "toolbar/JTabbedPane.gif");
// create tab position controls
JPanel tabControls = new JPanel();
tabControls.add(new JLabel(getString("TabbedPaneDemo.label")));
top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top")));
left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left")));
bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom")));
right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right")));
getDemoPanel().add(tabControls, BorderLayout.NORTH);
group = new ButtonGroup();
group.add(top);
group.add(bottom);
group.add(left);
group.add(right);
top.setSelected(true);
top.addActionListener(this);
bottom.addActionListener(this);
left.addActionListener(this);
right.addActionListener(this);
// create tab
tabbedpane = new JTabbedPane();
getDemoPanel().add(tabbedpane, BorderLayout.CENTER);
String name = getString("TabbedPaneDemo.laine");
JLabel pix = new JLabel(createImageIcon("tabbedpane/laine.jpg", name));
tabbedpane.add(name, pix);
name = getString("TabbedPaneDemo.ewan");
pix = new JLabel(createImageIcon("tabbedpane/ewan.jpg", name));
tabbedpane.add(name, pix);
name = getString("TabbedPaneDemo.hania");
pix = new JLabel(createImageIcon("tabbedpane/hania.jpg", name));
tabbedpane.add(name, pix);
name = getString("TabbedPaneDemo.bounce");
spin = new HeadSpin();
tabbedpane.add(name, spin);
tabbedpane.getModel().addChangeListener(
new ChangeListener() {
public void stateChanged(ChangeEvent e) {
SingleSelectionModel model = (SingleSelectionModel) e.getSource();
if(model.getSelectedIndex() == tabbedpane.getTabCount()-1) {
spin.go();
}
}
}
);
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:66,代码来源:TabbedPaneDemo.java
示例18: createSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
/**
* 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();
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:TabDisplayerUI.java
示例19: createSelectionModel
import javax.swing.SingleSelectionModel; //导入依赖的package包/类
@Override
protected final SingleSelectionModel createSelectionModel() {
return new DefaultTabSelectionModel (displayer.getModel());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:AbstractViewTabDisplayerUI.java
注:本文中的javax.swing.SingleSelectionModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论