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

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

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

JButton.setAlignmentY介绍

暂无

代码示例

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

  1. tb.add(newButton);
  2. newButton.setAlignmentY(0.5f);
  3. newButton.setAlignmentX(0.5f);

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

  1. btnFindMain.setToolTipText("Connect to xmage.de (Europe, most popular, registration needs)");
  2. btnFindMain.setActionCommand("connectXmageDe");
  3. btnFindMain.setAlignmentY(0.0F);
  4. btnFindMain.setMargin(new java.awt.Insets(2, 2, 2, 2));
  5. btnFindMain.setMaximumSize(new java.awt.Dimension(42, 23));
  6. btnFindLocal.setToolTipText("Connect to localhost (local server)");
  7. btnFindLocal.setActionCommand("connectLocalhost");
  8. btnFindLocal.setAlignmentY(0.0F);
  9. btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  10. btnFindLocal.setMargin(new java.awt.Insets(2, 2, 2, 2));
  11. btnFindBeta.setAlignmentY(0.0F);
  12. btnFindBeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  13. btnFindBeta.setMargin(new java.awt.Insets(2, 2, 2, 2));
  14. btnFindUs.setToolTipText("Connect to mtg.powersofwar.com (USA, use any username without registration)");
  15. btnFindUs.setActionCommand("connectXmageus");
  16. btnFindUs.setAlignmentY(0.0F);
  17. btnFindUs.setMargin(new java.awt.Insets(2, 2, 2, 2));
  18. btnFindUs.setName("connectXmageusBtn"); // NOI18N
  19. btnCheckStatus.setText("Check online status");
  20. btnCheckStatus.setToolTipText("Go to servers online statuses page");
  21. btnCheckStatus.setAlignmentY(0.0F);
  22. btnCheckStatus.setMargin(new java.awt.Insets(2, 2, 2, 2));
  23. btnCheckStatus.setPreferredSize(new java.awt.Dimension(23, 23));

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

  1. JPanel contentPane = new JPanel();
  2. contentPane.setLayout( new OverlayLayout(ContentPane) );
  3. frame.setContentPane( panel );
  4. JButton button = new JButton(...);
  5. button.setAlignmentX(0.0f);
  6. button.setAlignmentY(1.0f);
  7. contentPane.add( button );
  8. ForumMainPage panel = new ForumMainPage(frame);
  9. contentPane.add( panel );

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

  1. private JButton getWebpageButton() {
  2. if (webpageButton == null) {
  3. webpageButton = new JButton("Webpage");
  4. webpageButton.setMnemonic('W');
  5. webpageButton.setVisible(false);
  6. webpageButton.setAlignmentY(Component.CENTER_ALIGNMENT);
  7. webpageButton.addActionListener(eventHandler);
  8. }
  9. return webpageButton;
  10. }

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

  1. downButton = new JButton();
  2. downButton.setIcon(ARROW_DOWN);
  3. downButton.setAlignmentY(CENTER_ALIGNMENT);
  4. upButton = new JButton();
  5. upButton.setIcon(ARROW_UP);
  6. upButton.setAlignmentY(CENTER_ALIGNMENT);
  7. buttons.setLayout(new BoxLayout(buttons,BoxLayout.Y_AXIS));
  8. buttons.add(downButton);

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

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

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

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

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

  1. public static void main(String[] args) {
  2. final JPanel panel = new JPanel();
  3. JFrame frame = new JFrame("test swing");
  4. frame.setAlwaysOnTop(true);
  5. frame.setSize(400, 200);
  6. frame.add(panel);
  7. frame.setVisible(true);
  8. panel.addMouseListener(new MouseAdapter() {
  9. @Override
  10. public void mousePressed(MouseEvent e){
  11. JButton button = new JButton();
  12. button.setVisible(true);
  13. button.setAlignmentX(e.getXOnScreen());
  14. button.setAlignmentY(e.getYOnScreen());
  15. panel.add(button);
  16. panel.revalidate();
  17. panel.repaint();
  18. }
  19. });
  20. }

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

  1. launch.setAlignmentY(0.0F);

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

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

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

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

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

  1. public IdentityPanel(ComboBoxModel model) {
  2. setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  3. identityButton = new JButton();
  4. facePanel = new MinecraftFacePanel();
  5. identityButton.setAlignmentY(BOTTOM_ALIGNMENT);
  6. facePanel.setAlignmentY(BOTTOM_ALIGNMENT);
  7. add(identityButton);
  8. add(Box.createHorizontalStrut(5));
  9. add(facePanel);
  10. updateSelected();
  11. setModel(model);
  12. }

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

  1. l_Menu.setAlignmentY(0.0F);

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

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

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

  1. browseCollectionsButton.setAlignmentY(0.0F);
  2. add(browseCollectionsButton);
  3. selectDomainButton.setAlignmentY(0.0F);
  4. add(selectDomainButton);

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

  1. protected void initLayout() {
  2. setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  3. objectiveModel = new ObjectiveTableModel();
  4. final JTable table = new JTable(objectiveModel);
  5. table.getTableHeader().setReorderingAllowed(false);
  6. final TableColumn column0 = table.getColumnModel().getColumn(0);
  7. column0.setPreferredWidth(34);
  8. column0.setWidth(34);
  9. column0.setMaxWidth(34);
  10. column0.setCellRenderer(new ColorTableCellRenderer());
  11. final TableColumn column1 = table.getColumnModel().getColumn(1);
  12. column1.setCellEditor(new EditorPaneCellEditor());
  13. column1.setCellRenderer(new EditorPaneTableCellRenderer());
  14. final JScrollPane scroll = new JScrollPane(table);
  15. final JButton refresh = new JButton("Refresh Objectives");
  16. refresh.setAlignmentY(Component.CENTER_ALIGNMENT);
  17. refresh.addActionListener(SwingAction.of("Refresh Objectives", e -> {
  18. objectiveModel.loadData();
  19. SwingUtilities.invokeLater(table::repaint);
  20. }));
  21. add(Box.createVerticalStrut(6));
  22. add(refresh);
  23. add(Box.createVerticalStrut(6));
  24. add(scroll);
  25. }

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

  1. JButton component = new JButton(text);
  2. FontMetrics fontMetrics = component.getFontMetrics(component.getFont());
  3. LineMetrics metrics = fontMetrics.getLineMetrics(text, component.getGraphics());
  4. float ascent = metrics.getAscent(), descent = metrics.getDescent();
  5. component.setAlignmentY(ascent / (ascent + descent));

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

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

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

  1. JTextPane textPane = new JTextPane();
  2. JButton button = new JButton("Button");
  3. button.setAlignmentY(0.85f);
  4. HTMLEditorKit kit = new HTMLEditorKit();
  5. HTMLDocument doc = new HTMLDocument();
  6. textPane.setEditorKit(kit);
  7. textPane.setDocument(doc);
  8. try {
  9. kit.insertHTML(doc, doc.getLength(), "<p color='#FF0000'>Cool!", 0, 0, HTML.Tag.P);
  10. kit.insertHTML(doc, doc.getLength(), "<p></p>", 0, 0, null);
  11. } catch (BadLocationException ex) {
  12. } catch (IOException ex) {
  13. }

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

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

相关文章

JButton类方法