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


Java BasicOptionPaneUI类代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicOptionPaneUI的典型用法代码示例。如果您正苦于以下问题:Java BasicOptionPaneUI类的具体用法?Java BasicOptionPaneUI怎么用?Java BasicOptionPaneUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicOptionPaneUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicOptionPaneUI类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createButtonPanel

import javax.swing.plaf.basic.BasicOptionPaneUI; //导入依赖的package包/类
/**
 * create the dialog button controls.
 * 
 * 
 * @return panel containing button controls
 */
protected JComponent createButtonPanel() {
    // PENDING: this is a hack until we have a dedicated ButtonPanel!
    JPanel panel = new JPanel(new BasicOptionPaneUI.ButtonAreaLayout(true, 6))
    {
        @Override
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };

    panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0));
    Action executeAction = getAction(EXECUTE_ACTION_COMMAND);
    Action closeAction = getAction(CLOSE_ACTION_COMMAND);

    JButton defaultButton = new JButton(executeAction);
    panel.add(defaultButton);
    getRootPane().setDefaultButton(defaultButton);
    
    if (executeAction != closeAction) {
        JButton b = new JButton(closeAction);
        panel.add(b);
        getRootPane().setCancelButton(b);
    }
    
    return panel;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:33,代码来源:JXDialog.java

示例2: createButtonPanel

import javax.swing.plaf.basic.BasicOptionPaneUI; //导入依赖的package包/类
/**
 * create the dialog button controls.
 * 
 * 
 * @return panel containing button controls
 */
protected JComponent createButtonPanel() {
    // PENDING: this is a hack until we have a dedicated ButtonPanel!
    JPanel panel = new JPanel(new BasicOptionPaneUI.ButtonAreaLayout(true, 6))
    {
        @Override
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };

    panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0));
    Action executeAction = getAction(EXECUTE_ACTION_COMMAND);
    Action closeAction = getAction(CLOSE_ACTION_COMMAND);

    JButton findButton = new JButton(executeAction);
    panel.add(findButton);
    if (executeAction != closeAction) {
        panel.add(new JButton(closeAction));
    }


    KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
    KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);

    InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    inputMap.put(enterKey, EXECUTE_ACTION_COMMAND);
    inputMap.put(escapeKey, CLOSE_ACTION_COMMAND);

    getRootPane().setDefaultButton(findButton);
    return panel;
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:38,代码来源:JXDialog.java

示例3: restored

import javax.swing.plaf.basic.BasicOptionPaneUI; //导入依赖的package包/类
public @Override void restored() {
    // javax.swing.plaf.OptionPaneUI mentioned in method signature:
    new JOptionPane().setUI(new BasicOptionPaneUI());
    System.setProperty("my.bundle.worked", "true");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ActivatorTest.java


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