List of utility methods to do JComponent Properties
boolean | isVisible(JComponent c, Rectangle r) is Visible return c.getVisibleRect().contains(r);
|
boolean | isVisible(JComponent comp) Returns true if the JComponent is visible on the monitor (e.g.
if (comp == null) { return false; Container parent = comp.getParent(); if (parent == null || !(parent instanceof JTabbedPane)) { return true; JTabbedPane tabbedPane = (JTabbedPane) parent; ... |
boolean | isVisibleOnScreen(final JComponent component) Checks if is visible on screen. final Window window = getWindow(component); if (window != null) { return window.isVisible(); return false; |
void | registerComponent(JComponent c) register Component InputMap imap = c.getInputMap(); ActionMap amap = c.getActionMap(); boolean removeKeyStroke = false; KeyStroke[] ks = imap.keys(); if (ks == null || ks.length == 0) { imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0), "backSlash"); removeKeyStroke = true; ToolTipManager.sharedInstance().registerComponent(c); if (removeKeyStroke) { imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0)); |
void | registerDataFlavors(JComponent component, DataFlavor... dataFlavors) register Data Flavors component.putClientProperty(FLAVORS_CLIENT_PROPERTY, dataFlavors); |
void | resetDisplayComponent(JComponent mainComp, JComponent nonDispComp, JComponent newDispComp) reset Display Component JComponent[] nonDispComps = { nonDispComp }; resetDisplayComponent(mainComp, nonDispComps, newDispComp); |
void | setComponentEnabled(JComponent component, Boolean isEnabled) set Component Enabled if (component == null) return; component.setEnabled(isEnabled); Component[] components = component.getComponents(); for (Component component1 : components) { if (component1 instanceof JComponent) { setComponentEnabled((JComponent) component1, isEnabled); |
void | setDirty(JComponent comp, boolean isDirty) set Dirty if (comp != null) comp.putClientProperty("windowModified", Boolean.valueOf(isDirty)); |
void | setGlassPane(JComponent comp, Component glass, boolean visible) set Glass Pane Container container = comp.getTopLevelAncestor(); if (container instanceof JFrame) { JFrame frame = (JFrame) container; frame.setGlassPane(glass); } else if (container instanceof JDialog) { JDialog dialog = (JDialog) container; dialog.setGlassPane(glass); } else { ... |
void | setLegendVisible(JComponent chartUI, boolean visible) set Legend Visible JPanel legendPanel = (JPanel) chartUI.getClientProperty("legendPanel");
legendPanel.setVisible(visible);
chartUI.doLayout();
chartUI.repaint();
|