Java Code Examples for javax.swing.JButton#setVerticalAlignment()

The following examples show how to use javax.swing.JButton#setVerticalAlignment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Main.java    From btdex with GNU General Public License v3.0 6 votes vote down vote up
private JButton createResetPinButton() {
	resetPinButton = new JButton(i.get(Icons.RESET_PIN));
	resetPinButton.setToolTipText(tr("main_reset_pin"));
	resetPinButton.setVerticalAlignment(SwingConstants.CENTER);
	resetPinButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			Welcome welcome = new Welcome(Main.this, true);

			welcome.setLocationRelativeTo(Main.this);
			welcome.setVisible(true);
		}
	});
	resetPinButton.setVisible(!Globals.getInstance().usingLedger());
	return resetPinButton;
}
 
Example 2
Source File: MarqueeTicker.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public Component getUpdate() {
    JPanel panel = new JPanel();//new FlowLayout(FlowLayout.CENTER,0,0));
    panel.setBackground(Color.BLACK);
    JButton button = new JButton(new AbstractAction("Refresh") {
        private static final long serialVersionUID = 3433227364758002853L;

        public void actionPerformed(ActionEvent e) {
        	updateStyledlabel();
        }
    });
    Font myFont = new Font("Dialog", Font.BOLD,9);
    button.setFont(myFont);
    button.setVerticalAlignment(SwingConstants.BOTTOM);
    panel.add(button);
    return panel;
}
 
Example 3
Source File: Main.java    From btdex with GNU General Public License v3.0 5 votes vote down vote up
private JButton createVersionButton() {
	JButton versionButton = new JButton(version, i.get(Icons.VERSION));
	versionButton.setToolTipText(tr("main_check_new_release"));
	versionButton.setVerticalAlignment(SwingConstants.CENTER);
	versionButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			browse(Constants.RELEASES_LINK);
		}
	});
	return versionButton;
}
 
Example 4
Source File: Main.java    From btdex with GNU General Public License v3.0 5 votes vote down vote up
private JButton createDiscordButton() {
	JButton discordButton = new JButton(i.get(Icons.DISCORD));
	discordButton.setToolTipText(tr("main_chat_discord"));
	discordButton.setVerticalAlignment(SwingConstants.CENTER);
	discordButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			browse(Constants.DISCORD_LINK);
		}
	});
	return discordButton;
}
 
Example 5
Source File: Main.java    From btdex with GNU General Public License v3.0 5 votes vote down vote up
private JButton createGithubButton() {
	JButton githubButton = new JButton(i.get(Icons.GITHUB));
	githubButton.setToolTipText(tr("main_check_source"));
	githubButton.setVerticalAlignment(SwingConstants.CENTER);
	githubButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			browse(Constants.GITHUB_LINK);
		}
	});
	return githubButton;
}
 
Example 6
Source File: SettlementTransparentPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void buildLabelPane() {

        labelPane = new JPanel(new FlowLayout(FlowLayout.LEADING));
        labelPane.setBackground(new Color(0,0,0,128));
		labelPane.setOpaque(false);

		JButton labelsButton = new JButton(Msg.getString("SettlementTransparentPanel.button.labels")); //$NON-NLS-1$
		//labelsButton.setFont(new Font("Dialog", Font.BOLD, 16));
		//labelsButton.setBackground(new Color(139,69,19)); // (139,69,19) is brown
		//labelsButton.setBackground(new Color(139,69,19,40));
		//labelsButton.setBackground(new Color(51,25,0,5)); // dull gold color
//		labelsButton.setBackground(new Color(0,0,0));//,0));
		labelsButton.setPreferredSize(new Dimension(80, 20));
//		labelsButton.setForeground(Color.green);
		labelsButton.setOpaque(false);
		labelsButton.setVerticalAlignment(JLabel.CENTER);
		labelsButton.setHorizontalAlignment(JLabel.CENTER);
		//labelsButton.setContentAreaFilled(false); more artifact when enabled
//		labelsButton.setBorder(new LineBorder(Color.green, 1, true));
		labelsButton.setToolTipText(Msg.getString("SettlementTransparentPanel.tooltip.labels")); //$NON-NLS-1$
		labelsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				JButton button = (JButton) evt.getSource();
				if (labelsMenu == null) {
					labelsMenu = createLabelsMenu();
				}
				labelsMenu.show(button, 0, button.getHeight());
				//repaint();
			}
		});

		labelPane.add(labelsButton);


		labelPane.add(emptyLabel);
	}
 
Example 7
Source File: VistaSearchDialog.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private TitleBar(String title) {
    this.title = title;
    setName("vistaTitleBar");
    setFont(new Font("Dialog", Font.BOLD, 12));
    setLayout(new GridBagLayout());

    JButton button = new JButton();
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setBorder(null);
    button.setIconTextGap(0);
    button.setVerticalAlignment(SwingConstants.TOP);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setIcon(new ImageIcon(getClass().getResource("close-title-bar.png")));
    button.setRolloverIcon(new ImageIcon(getClass().getResource("close-title-bar-rollover.png")));
    button.setOpaque(false);
    button.setName("vistaCloseButton");
    add(Box.createVerticalStrut(24),
        new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
                               GridBagConstraints.LINE_START,
                               GridBagConstraints.HORIZONTAL,
                               new Insets(0, 0, 0, 0), 0, 0));
    add(button, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
                                       GridBagConstraints.FIRST_LINE_END,
                                       GridBagConstraints.VERTICAL,
                                       new Insets(0, 0, 0, 0), 0, 0));
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VistaSearchDialog.this.setVisible(false);
        }
    });

    Locator locator = new Locator();
    addMouseListener(locator);
    addMouseMotionListener(locator);
}