javax.swing.JButton.setAlignmentY()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中javax.swing.JButton.setAlignmentY()方法的一些代码示例,展示了JButton.setAlignmentY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setAlignmentY()方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setAlignmentY

JButton.setAlignmentY介绍

暂无

代码示例

代码示例来源:origin: log4j/log4j

tb.add(newButton);
newButton.setAlignmentY(0.5f);
newButton.setAlignmentX(0.5f);

代码示例来源:origin: magefree/mage

btnFindMain.setToolTipText("Connect to xmage.de (Europe, most popular, registration needs)");
btnFindMain.setActionCommand("connectXmageDe");
btnFindMain.setAlignmentY(0.0F);
btnFindMain.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindMain.setMaximumSize(new java.awt.Dimension(42, 23));
btnFindLocal.setToolTipText("Connect to localhost (local server)");
btnFindLocal.setActionCommand("connectLocalhost");
btnFindLocal.setAlignmentY(0.0F);
btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindLocal.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindBeta.setAlignmentY(0.0F);
btnFindBeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindBeta.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindUs.setToolTipText("Connect to mtg.powersofwar.com (USA, use any username without registration)");
btnFindUs.setActionCommand("connectXmageus");
btnFindUs.setAlignmentY(0.0F);
btnFindUs.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindUs.setName("connectXmageusBtn"); // NOI18N
btnCheckStatus.setText("Check online status");
btnCheckStatus.setToolTipText("Go to servers online statuses page");
btnCheckStatus.setAlignmentY(0.0F);
btnCheckStatus.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnCheckStatus.setPreferredSize(new java.awt.Dimension(23, 23));

代码示例来源:origin: stackoverflow.com

JPanel contentPane = new JPanel();
contentPane.setLayout( new OverlayLayout(ContentPane) );
frame.setContentPane( panel );

JButton button = new JButton(...);
button.setAlignmentX(0.0f);
button.setAlignmentY(1.0f);
contentPane.add( button );

ForumMainPage panel = new ForumMainPage(frame);
contentPane.add( panel );

代码示例来源:origin: robo-code/robocode

private JButton getWebpageButton() {
  if (webpageButton == null) {
    webpageButton = new JButton("Webpage");
    webpageButton.setMnemonic('W');
    webpageButton.setVisible(false);
    webpageButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    webpageButton.addActionListener(eventHandler);
  }
  return webpageButton;
}

代码示例来源:origin: sing-group/GC4S

downButton = new JButton();
downButton.setIcon(ARROW_DOWN);
downButton.setAlignmentY(CENTER_ALIGNMENT);
upButton = new JButton();
upButton.setIcon(ARROW_UP);
upButton.setAlignmentY(CENTER_ALIGNMENT);
buttons.setLayout(new BoxLayout(buttons,BoxLayout.Y_AXIS));
buttons.add(downButton);

代码示例来源:origin: net.sf.ingenias/editor

protected JButton createButton(int direction, int width, boolean small) {
  JButton button = new ScrollButton(direction, width, small);
  button.setAlignmentX(0.5f);
  button.setAlignmentY(0.5f);
  return button;
}

代码示例来源:origin: org.gephi/visualization

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
  buttonPanel = new javax.swing.JPanel();
  extendButton = new javax.swing.JButton();
  setOpaque(false);
  setLayout(new java.awt.BorderLayout());
  buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 3));
  extendButton.setText(org.openide.util.NbBundle.getMessage(CollapsePanel.class, "CollapsePanel.extendButton.text")); // NOI18N
  extendButton.setAlignmentY(0.0F);
  extendButton.setBorderPainted(false);
  extendButton.setContentAreaFilled(false);
  extendButton.setFocusable(false);
  buttonPanel.add(extendButton);
  add(buttonPanel, java.awt.BorderLayout.EAST);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
   final JPanel panel = new JPanel();
   JFrame frame = new JFrame("test swing");
   frame.setAlwaysOnTop(true);
   frame.setSize(400, 200);
   frame.add(panel);
   frame.setVisible(true);
   panel.addMouseListener(new MouseAdapter() {
     @Override
     public void mousePressed(MouseEvent e){
       JButton button = new JButton();
       button.setVisible(true);
       button.setAlignmentX(e.getXOnScreen());
       button.setAlignmentY(e.getYOnScreen());
       panel.add(button);
       panel.revalidate();
       panel.repaint();
     }
   });
 }

代码示例来源:origin: vasl-developers/vasl

launch.setAlignmentY(0.0F);

代码示例来源:origin: omegat-org/omegat

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
  messageLabel = new javax.swing.JLabel();
  filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 5), new java.awt.Dimension(0, 5), new java.awt.Dimension(32767, 5));
  browsePluginsButton = new javax.swing.JButton();
  setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
  setMinimumSize(new java.awt.Dimension(250, 200));
  setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.PAGE_AXIS));
  org.openide.awt.Mnemonics.setLocalizedText(messageLabel, OStrings.getString("PREFS_PLUGINS_AVAILABLE_ONLINE")); // NOI18N
  messageLabel.setAlignmentY(0.0F);
  add(messageLabel);
  add(filler1);
  org.openide.awt.Mnemonics.setLocalizedText(browsePluginsButton, OStrings.getString("PREFS_PLUGINS_BROWSE_ONLINE")); // NOI18N
  browsePluginsButton.setAlignmentY(0.0F);
  add(browsePluginsButton);
}// </editor-fold>//GEN-END:initComponents

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

panelDate.add(buttonDate);
buttonDate.setAlignmentX(LEFT_ALIGNMENT);
buttonDate.setAlignmentY(TOP_ALIGNMENT);
buttonDate.addActionListener(this);     // To display popup

代码示例来源:origin: SKCraft/SKMCLauncher

public IdentityPanel(ComboBoxModel model) {
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  identityButton = new JButton();
  facePanel = new MinecraftFacePanel();
  identityButton.setAlignmentY(BOTTOM_ALIGNMENT);
  facePanel.setAlignmentY(BOTTOM_ALIGNMENT);
  add(identityButton);
  add(Box.createHorizontalStrut(5));
  add(facePanel);
  updateSelected();
  setModel(model);
}

代码示例来源:origin: vasl-developers/vasl

l_Menu.setAlignmentY(0.0F);

代码示例来源:origin: vasl-developers/vasl

public void addTo(Buildable b) {
 map = (Map) b;
 launch = new JButton("Change boards");
 launch.setAlignmentY(0.0F);
 launch.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {

代码示例来源:origin: omegat-org/omegat

browseCollectionsButton.setAlignmentY(0.0F);
add(browseCollectionsButton);
selectDomainButton.setAlignmentY(0.0F);
add(selectDomainButton);

代码示例来源:origin: triplea-game/triplea

protected void initLayout() {
 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
 objectiveModel = new ObjectiveTableModel();
 final JTable table = new JTable(objectiveModel);
 table.getTableHeader().setReorderingAllowed(false);
 final TableColumn column0 = table.getColumnModel().getColumn(0);
 column0.setPreferredWidth(34);
 column0.setWidth(34);
 column0.setMaxWidth(34);
 column0.setCellRenderer(new ColorTableCellRenderer());
 final TableColumn column1 = table.getColumnModel().getColumn(1);
 column1.setCellEditor(new EditorPaneCellEditor());
 column1.setCellRenderer(new EditorPaneTableCellRenderer());
 final JScrollPane scroll = new JScrollPane(table);
 final JButton refresh = new JButton("Refresh Objectives");
 refresh.setAlignmentY(Component.CENTER_ALIGNMENT);
 refresh.addActionListener(SwingAction.of("Refresh Objectives", e -> {
  objectiveModel.loadData();
  SwingUtilities.invokeLater(table::repaint);
 }));
 add(Box.createVerticalStrut(6));
 add(refresh);
 add(Box.createVerticalStrut(6));
 add(scroll);
}

代码示例来源:origin: stackoverflow.com

JButton component = new JButton(text);
FontMetrics fontMetrics = component.getFontMetrics(component.getFont());
LineMetrics metrics = fontMetrics.getLineMetrics(text, component.getGraphics());

float ascent = metrics.getAscent(), descent = metrics.getDescent();
component.setAlignmentY(ascent / (ascent + descent));

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

panelLocation.add(buttonLocation);
buttonLocation.setAlignmentX(LEFT_ALIGNMENT);
buttonLocation.setAlignmentY(TOP_ALIGNMENT);
buttonLocation.addActionListener(this);   // Requery catalog on change

代码示例来源:origin: stackoverflow.com

JTextPane textPane = new JTextPane();
 JButton button = new JButton("Button");     
 button.setAlignmentY(0.85f);
 HTMLEditorKit kit = new HTMLEditorKit();
 HTMLDocument doc = new HTMLDocument();
 textPane.setEditorKit(kit);
 textPane.setDocument(doc);
 try {
   kit.insertHTML(doc, doc.getLength(), "<p color='#FF0000'>Cool!", 0, 0, HTML.Tag.P);
   kit.insertHTML(doc, doc.getLength(), "<p></p>", 0, 0, null);
 } catch (BadLocationException ex) {
 } catch (IOException ex) {
 }

代码示例来源:origin: Exslims/MercuryTrade

this.repaint();
});
expandButton.setAlignmentY(SwingConstants.CENTER);
root.add(expandButton, BorderLayout.CENTER);
return this.componentsFactory.wrapToSlide(root, AppThemeColor.TRANSPARENT, 1, 1, 1, 1);

相关文章

JButton类方法