本文整理汇总了Java中javax.swing.JButton.setVerticalTextPosition方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setVerticalTextPosition方法的具体用法?Java JButton.setVerticalTextPosition怎么用?Java JButton.setVerticalTextPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setVerticalTextPosition方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Helper method used to create a button inside a JPanel
* @param action action associated to that button
* @return created component
*/
private JComponent createButton(AbstractAction action) {
JPanel panel = new JPanel(); // Use gridbag as centers by default
JButton button = new JButton(action);
button.setHorizontalTextPosition(SwingConstants.CENTER);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2)));
button.addMouseListener(rollover);
if (action == buttonAction[3]) {
button.setVisible(false);
}
if (action == buttonAction[0]) {
button.setEnabled(false);
}
//if (action == buttonAction[2]) button.setEnabled(false);
//if (action == buttonAction[4]) button.setEnabled(false);
panel.add(button);
return panel;
}
示例2: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Helper method used to create a button inside a JPanel
* @param action action associated to that button
* @return created component
*/
private JComponent createButton(AbstractAction action) {
JPanel panel = new JPanel(); // Use gridbag as centers by default
JButton button = new JButton(action);
button.setHorizontalTextPosition(SwingConstants.CENTER);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2)));
button.addMouseListener(rollover);
//if (action == buttonAction[4]) {
// button.setVisible(false);
//}
//if (action == buttonAction[0]) {
// button.setEnabled(false);
//}
//if (action == buttonAction[2]) button.setEnabled(false);
//if (action == buttonAction[4]) button.setEnabled(false);
panel.add(button);
return panel;
}
示例3: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Helper method used to create a button inside a JPanel
* @param action action associated to that button
* @return created component
*/
private JComponent createButton(AbstractAction action) {
JPanel panel = new JPanel(); // Use gridbag as centers by default
JButton button = new JButton(action);
button.setHorizontalTextPosition(SwingConstants.CENTER);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2)));
button.addMouseListener(rollover);
if (action == buttonAction[3]) {
button.setVisible(false);
}
if (action == buttonAction[0]) {
button.setEnabled(false);
}
//if(action == buttonAction[2]) button.setEnabled(false);
//if(action == buttonAction[4]) button.setEnabled(false);
panel.add(button);
return panel;
}
示例4: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Helper method used to create a button inside a JPanel
* @param action action associated to that button
* @return created component
*/
private JComponent createButton(AbstractAction action) {
JPanel panel = new JPanel(); // Use gridbag as centers by default
JButton button = new JButton(action);
button.setHorizontalTextPosition(SwingConstants.CENTER);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2)));
button.addMouseListener(rollover);
//if (action == buttonAction[4]) {
// button.setVisible(false);
//}
//if (action == buttonAction[0]) {
// button.setEnabled(false);
//}
//if(action == buttonAction[2]) button.setEnabled(false);
//if(action == buttonAction[4]) button.setEnabled(false);
panel.add(button);
return panel;
}
示例5: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Helper method used to create a button inside a JPanel
* @param action action associated to that button
* @return created component
*/
private JComponent createButton(AbstractAction action) {
JPanel panel = new JPanel(); // Use gridbag as centers by default
JButton button = new JButton(action);
button.setHorizontalTextPosition(SwingConstants.CENTER);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setPreferredSize(new Dimension((int) (BUTTONSIZE * 3.5), (BUTTONSIZE * 2)));
button.addMouseListener(rollover);
panel.add(button);
return panel;
}
示例6: ButtonDemo
import javax.swing.JButton; //导入方法依赖的package包/类
public ButtonDemo() {
ImageIcon leftButtonIcon = createImageIcon("images/right.gif");
ImageIcon middleButtonIcon = createImageIcon("images/middle.gif");
ImageIcon rightButtonIcon = createImageIcon("images/left.gif");
b1 = new JButton("Disable middle button", leftButtonIcon);
b1.setVerticalTextPosition(AbstractButton.CENTER);
b1.setHorizontalTextPosition(AbstractButton.LEADING); // aka LEFT, for
// left-to-right
// locales
b1.setMnemonic(KeyEvent.VK_D);
b1.setActionCommand("disable");
b2 = new JButton("Middle button", middleButtonIcon);
b2.setVerticalTextPosition(AbstractButton.BOTTOM);
b2.setHorizontalTextPosition(AbstractButton.CENTER);
b2.setMnemonic(KeyEvent.VK_M);
b3 = new JButton("Enable middle button", rightButtonIcon);
// Use the default text position of CENTER, TRAILING (RIGHT).
b3.setMnemonic(KeyEvent.VK_E);
b3.setActionCommand("enable");
b3.setEnabled(false);
// Listen for actions on buttons 1 and 3.
b1.addActionListener(this);
b3.addActionListener(this);
b1.setToolTipText("Click this button to disable the middle button.");
b2.setToolTipText("This middle button does nothing when you click it.");
b3.setToolTipText("Click this button to enable the middle button.");
// Add Components to this container, using the default FlowLayout.
add(b1);
add(b2);
add(b3);
}
示例7: prepareButton
import javax.swing.JButton; //导入方法依赖的package包/类
void prepareButton(JButton btn) {
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setHorizontalAlignment(JButton.CENTER);
btn.setHorizontalTextPosition(JButton.CENTER);
btn.setVerticalTextPosition(JButton.BOTTOM);
}
示例8: ButtonHtmlDemo
import javax.swing.JButton; //导入方法依赖的package包/类
public ButtonHtmlDemo() {
ImageIcon leftButtonIcon = createImageIcon("images/right.gif");
ImageIcon middleButtonIcon = createImageIcon("images/middle.gif");
ImageIcon rightButtonIcon = createImageIcon("images/left.gif");
b1 = new JButton("<html><center><b><u>D</u>isable</b><br>" + "<font color=#ffffdd>middle button</font>", leftButtonIcon);
Font font = b1.getFont().deriveFont(Font.PLAIN);
b1.setFont(font);
b1.setVerticalTextPosition(AbstractButton.CENTER);
b1.setHorizontalTextPosition(AbstractButton.LEADING); // aka LEFT, for
// left-to-right
// locales
b1.setMnemonic(KeyEvent.VK_D);
b1.setActionCommand("disable");
b2 = new JButton("middle button", middleButtonIcon);
b2.setFont(font);
b2.setForeground(new Color(0xffffdd));
b2.setVerticalTextPosition(AbstractButton.BOTTOM);
b2.setHorizontalTextPosition(AbstractButton.CENTER);
b2.setMnemonic(KeyEvent.VK_M);
b3 = new JButton("<html><center><b><u>E</u>nable</b><br>" + "<font color=#ffffdd>middle button</font>", rightButtonIcon);
b3.setFont(font);
// Use the default text position of CENTER, TRAILING (RIGHT).
b3.setMnemonic(KeyEvent.VK_E);
b3.setActionCommand("enable");
b3.setEnabled(false);
// Listen for actions on buttons 1 and 3.
b1.addActionListener(this);
b3.addActionListener(this);
b1.setToolTipText("Click this button to disable the middle button.");
b2.setToolTipText("This middle button does nothing when you click it.");
b3.setToolTipText("Click this button to enable the middle button.");
// Add Components to this container, using the default FlowLayout.
add(b1);
add(b2);
add(b3);
}
示例9: launch
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Launch SwingAppleCommander.
*/
public void launch() {
JMenuBar menuBar = createMenuBar();
JToolBar toolBar = new JToolBar();
JPanel topPanel = new JPanel(new BorderLayout());
tabPane = new JTabbedPane(JTabbedPane.TOP);
topPanel.add(menuBar,BorderLayout.NORTH);
topPanel.add(toolBar,BorderLayout.SOUTH);
JButton aButton = new JButton(textBundle.get("OpenButton"), new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/webcodepro/applecommander/ui/images/opendisk.gif")))); //$NON-NLS-1$
aButton.setToolTipText(textBundle.get("SwtAppleCommander.OpenDiskImageTooltip")); //$NON-NLS-1$
aButton.setHorizontalTextPosition(JLabel.CENTER);
aButton.setVerticalTextPosition(JLabel.BOTTOM);
aButton.addActionListener(this);
toolBar.add(aButton);
JButton aButton2 = new JButton(textBundle.get("CreateButton"), new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/webcodepro/applecommander/ui/images/newdisk.gif")))); //$NON-NLS-1$
aButton2.setToolTipText(textBundle.get("SwtAppleCommander.CreateDiskImageTooltip")); //$NON-NLS-1$
aButton2.setHorizontalTextPosition(JLabel.CENTER);
aButton2.setVerticalTextPosition(JLabel.BOTTOM);
aButton2.addActionListener(this);
toolBar.add(aButton2);
JButton aButton3 = new JButton(textBundle.get("CompareButton"), new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/webcodepro/applecommander/ui/images/comparedisks.gif")))); //$NON-NLS-1$
aButton3.setToolTipText(textBundle.get("SwtAppleCommander.CompareDiskImageTooltip")); //$NON-NLS-1$
aButton3.setHorizontalTextPosition(JLabel.CENTER);
aButton3.setVerticalTextPosition(JLabel.BOTTOM);
aButton3.addActionListener(this);
toolBar.add(aButton3);
JButton aButton4 = new JButton(textBundle.get("AboutButton"), new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/webcodepro/applecommander/ui/images/about.gif")))); //$NON-NLS-1$
aButton4.setToolTipText(textBundle.get("SwtAppleCommander.AboutTooltip")); //$NON-NLS-1$
aButton4.setHorizontalTextPosition(JLabel.CENTER);
aButton4.setVerticalTextPosition(JLabel.BOTTOM);
aButton4.addActionListener(this);
toolBar.add(aButton4);
SwingAppleCommander application = new SwingAppleCommander();
application.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/webcodepro/applecommander/ui/images/diskicon.gif"))); //$NON-NLS-1$
application.setTitle(textBundle.get("SwtAppleCommander.AppleCommander"));
titleLabel = new JLabel(new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/webcodepro/applecommander/ui/images/AppleCommanderLogo.gif"))));
addTitleTabPane();
application.getContentPane().add(topPanel, BorderLayout.NORTH);
application.getContentPane().add(tabPane, BorderLayout.CENTER);
application.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
application.pack();
application.setVisible(true);
}