本文整理汇总了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;
}
示例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;
}
示例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");
}