List of utility methods to do JButton Settings
JButton | getButton(Container c, String text) get Button if (c.isShowing()) { if (c.getComponents().length == 0) { if (c instanceof JButton) { JButton b = (JButton) c; String btxt = b.getText(); if (btxt != null && btxt.equalsIgnoreCase(text)) { return b; } else { for (Component sub : c.getComponents()) { if (sub instanceof Container) { JButton b = getButton((Container) sub, text); if (b != null) { return b; return null; |
JButton | getButton(Container container, String text) get Button JButton btn = null; List<Container> children = new ArrayList<>(25); for (Component child : container.getComponents()) { if (child instanceof JButton) { JButton button = (JButton) child; if (text.equals(button.getText())) { btn = button; break; ... |
JButton | getButton(String displayText, ActionListener actionListener) get Button return getButton(displayText, actionListener, null);
|
JButton | getButtonAsLink(String text) get Button As Link JButton button = new JButton(); button.setText(text); button.setHorizontalAlignment(SwingConstants.RIGHT); button.setBorderPainted(false); button.setOpaque(true); button.setForeground(Color.BLUE); return button; |
Color | getButtonBorderColor(Color color) get Button Border Color if ((DARK_GREEN.equals(color)) || (DARK_MAGENTA.equals(color))) { return new ColorUIResource(Color.WHITE); return color; |
Color | getButtonColor() Get the color for the custom editor button if specified by the theme or look and feel, or null if the defaults should simply be used return UIManager.getColor("netbeans.ps.buttonColor"); |
JPanel | getButtonPane() get Button Pane final JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); buttonPane.add(Box.createHorizontalGlue()); buttonPane.setAlignmentX(Component.LEFT_ALIGNMENT); return buttonPane; |
Color | getButtonSelectColor() get Button Select Color return UIManager.getColor("Button.select"); |
int | getButtonSelectedInt(ButtonGroup buttonGroup) get Button Selected Int try { return Integer.parseInt(getButtonSelectedString(buttonGroup)); } catch (NumberFormatException e) { return -1; |
String | getButtonSelectedString(ButtonGroup buttonGroup) get Button Selected String return buttonGroup.getSelection().getActionCommand();
|