tb.add(newButton); newButton.setAlignmentY(0.5f); newButton.setAlignmentX(0.5f);
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));
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 );
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; }
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);
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; }
/** * 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
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(); } }); }
launch.setAlignmentY(0.0F);
/** * 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
panelDate.add(buttonDate); buttonDate.setAlignmentX(LEFT_ALIGNMENT); buttonDate.setAlignmentY(TOP_ALIGNMENT); buttonDate.addActionListener(this); // To display popup
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); }
l_Menu.setAlignmentY(0.0F);
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) {
browseCollectionsButton.setAlignmentY(0.0F); add(browseCollectionsButton); selectDomainButton.setAlignmentY(0.0F); add(selectDomainButton);
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); }
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));
panelLocation.add(buttonLocation); buttonLocation.setAlignmentX(LEFT_ALIGNMENT); buttonLocation.setAlignmentY(TOP_ALIGNMENT); buttonLocation.addActionListener(this); // Requery catalog on change
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) { }
this.repaint(); }); expandButton.setAlignmentY(SwingConstants.CENTER); root.add(expandButton, BorderLayout.CENTER); return this.componentsFactory.wrapToSlide(root, AppThemeColor.TRANSPARENT, 1, 1, 1, 1);