List of utility methods to do JButton Settings
boolean | hasText(AbstractButton button) Checks whether the specified button has associated text. String text = button.getText(); if ((text != null) && (text.length() > 0)) { return true; return false; |
void | hideApproveButton(JFileChooser fileChooser) hide Approve Button fileChooser.setApproveButtonText("approveButton"); JButton button = lookupButton(fileChooser, "approveButton"); fileChooser.setApproveButtonText(null); button.setVisible(false); |
void | hideJFileChooserButtons(JFileChooser sessionFileChooser) hide J File Chooser Buttons hideChildButtonsWithTooltip(sessionFileChooser, "Sessions at server"); hideChildButtonsWithTooltip(sessionFileChooser, "Up One Level"); hideChildButtonsWithTooltip(sessionFileChooser, "Remote sessions"); hideChildButtonsWithTooltip(sessionFileChooser, "Create New Folder"); hideChildButtonsWithTooltip(sessionFileChooser, "List"); hideChildButtonsWithTooltip(sessionFileChooser, "Details"); |
Component | interButtonSpace() A horizontal strut between buttons on the same line. return Box.createHorizontalStrut(STANDARD_SPACE);
|
boolean | isScrollBarButton(AbstractButton button) Checks and answers if the specified button is in a scroll bar. Container parent = button.getParent(); return (parent != null) && ((parent instanceof JScrollBar) || (parent.getParent() instanceof JScrollBar)); |
boolean | isSelected(AbstractButton... buttons) is Selected for (AbstractButton button : buttons) { if (button.isSelected()) { return true; return false; |
boolean | isSelected(final AbstractButton abstractButton) is Selected if (abstractButton != null) { if (SwingUtilities.isEventDispatchThread()) { return abstractButton.isSelected(); } else { final boolean[] isSelected = new boolean[1]; try { SwingUtilities.invokeAndWait(new Runnable() { @Override ... |
boolean | isSelected(final AbstractButton abstractButton) is Selected return abstractButton != null
&& runInEDT(() -> Boolean.valueOf(abstractButton.isSelected())).booleanValue();
|
JButton | lookupButton(Container c, String text) Find button by text JButton button = null; for (Component comp : c.getComponents()) { if (comp == null) { continue; if (comp instanceof JButton && (button = (JButton) comp).getText() != null && button.getText().equals(text)) { return button; ... |
JButton | newTabbedPaneButton(String text) Returns a button to add to a panel in a tabbed pane. JButton button = new JButton(text); if (getUseNonOpaqueTabbedPaneComponents()) button.setOpaque(false); return button; |