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


Java JButton.setVerticalTextPosition方法代码示例

本文整理汇总了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;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:24,代码来源:JWatStartScreen.java

示例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;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:24,代码来源:JWatMainPanel.java

示例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;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:24,代码来源:JWatStartScreen.java

示例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;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:24,代码来源:JWatMainPanel.java

示例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;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:16,代码来源:GraphStartScreen.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:38,代码来源:ButtonDemo.java

示例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);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:8,代码来源:BrowserIntDlg.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:ButtonHtmlDemo.java

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


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