List of utility methods to do JButton Create
JRadioButton | createRadioButton(String text, ButtonGroup buttonGroup, ActionListener... listeners) create Radio Button JRadioButton result = new JRadioButton(text); if (buttonGroup != null) { buttonGroup.add(result); for (ActionListener listener : listeners) { result.addActionListener(listener); return result; ... |
JRadioButton | createRadioButton(String text, int mnemonic, ActionListener listener, boolean selected) create Radio Button JRadioButton button = new JRadioButton(text); button.setMnemonic(mnemonic); button.setSelected(selected); button.setMinimumSize(labelPrefSize); if (listener != null) button.addActionListener(listener); if (text.length() == 0) button.setPreferredSize(labelPrefSize); ... |
Container | createRadioButtonGrouping(String elements[], String title) create Radio Button Grouping return createRadioButtonGrouping(elements, title, null, null, null);
|
JButton | createScreenCaptureButton() create Screen Capture Button return new JButton("Screen Capture"); |
JButton | createSimpleTextButton(String caption, Action action) Create simple JButton . JButton button = decoratedToSimpleButton(new JButton(caption)); button.addActionListener(action); return button; |
JButton | createSmallButton() create Small Button JButton button = new JButton(); button.setBorderPainted(false); button.setBorder(new EmptyBorder(0, 1, 0, 1)); button.setContentAreaFilled(false); button.setFocusPainted(false); button.setRolloverEnabled(true); button.setHorizontalAlignment(SwingConstants.CENTER); return button; ... |
JButton | createSmallButton(Icon icon, String tooltip, ActionListener listener) create Small Button final JButton btn = new JButton(icon); btn.setBorder(BorderFactory.createEmptyBorder()); final Dimension size = new Dimension(16, 16); btn.setMinimumSize(size); btn.setPreferredSize(size); btn.setMaximumSize(size); btn.setMargin(new Insets(0, 0, 0, 0)); if (listener != null) ... |
JButton | createSquareButton(String text, int size) Creates a new JButton that is perfectly square JButton button = new JButton(text); button.setPreferredSize(new Dimension(size, size)); button.setMargin(new Insets(0, 0, 0, 0)); return button; |
JButton | createStandartButton(String name) create Standart Button JButton bt = new JButton(name); FontMetrics fm = bt.getFontMetrics(bt.getFont()); return bt; |
JToggleButton | createToggleButton(ImageIcon icon, int dimension, String tooltipText, java.awt.event.ActionListener action) create Toggle Button JToggleButton btn = createToggleButton(icon, dimension, tooltipText); if (action != null) btn.addActionListener(action); return btn; |