List of utility methods to do JButton Create
JButton | createButton(ImageIcon icon, String text) create Button JButton toret; if (icon != null) { toret = new JButton(icon); } else { toret = new JButton(text); toret.setToolTipText(text); return toret; ... |
JButton | createButton(String aText, String aTooltip, ActionListener aListener) Creates a new button with manageable width. JButton button = new JButton(aText); button.setToolTipText(aTooltip); button.addActionListener(aListener); button.setMaximumSize(new Dimension(Short.MAX_VALUE, button.getHeight())); return button; |
JButton | createButton(String name, ActionListener listener) create Button final JButton button = new JButton(name); button.addActionListener(listener); return button; |
JButton | createButton(String name, int x, int y, int width, int height, ImageIcon imageIcon) create Button JButton jButton = imageIcon == null ? new JButton(name) : new JButton(imageIcon); jButton.setBounds(x, y, width, height); return jButton; |
JButton | createButton(String text, boolean parse) Creates a new button with the given text. JButton button = new JButton(); if (parse) { setMenuText(button, text, true); } else { button.setText(text); return button; |
JButton | createButton(String text, String icon) Create a button with a pre-defined look-and-feel ImageIcon iconRefresh = new ImageIcon(icon); JButton jButton = new JButton(iconRefresh); jButton.setBorderPainted(false); jButton.setBackground(buttonGgColor); jButton.setForeground(buttonTextColor); jButton.setFont(buttonFont); jButton.setText(text); jButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); ... |
JButton | createButton16(final ImageIcon icon) create Button return createButton16(icon, null);
|
Container | createButtonFooter(JButton ok, JButton cancel) Creates a "footer" containing two buttons (typically OK and Cancel) for a dialog. return createButtonFooter(ok, cancel, -1);
|
javax.swing.ButtonGroup | createButtonGroup(javax.swing.AbstractButton... buttons) Creates and returns a button group from 'buttons'. javax.swing.ButtonGroup bg = new javax.swing.ButtonGroup(); for (int i = 0; i < buttons.length; ++i) bg.add(buttons[i]); return bg; |
JPanel | createButtonPanel() Create and return the button panel. JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setBorder(new EmptyBorder(0, 20, 20, 20)); buttonPanel.add(new JButton("Help")); buttonPanel.add(Box.createGlue()); buttonPanel.add(Box.createGlue()); buttonPanel.add(Box.createGlue()); return buttonPanel; ... |