Available Methods
- getParent ( )
- getPreferredSize ( )
- isVisible ( )
- isEnabled ( )
- setEnabled ( )
- setFont ( )
- getHeight ( )
- getName ( )
- setBackground ( )
- getPeer ( )
- getLocationOnScreen ( )
- getWidth ( )
- getBounds ( )
- setForeground ( )
- getFont ( )
- BaselineResizeBehavior ( )
- isShowing ( )
- setBounds ( )
- getMinimumSize ( )
- setVisible ( )
- getSize ( )
- repaint ( )
- setSize ( )
- setPreferredSize ( )
- setLocation ( )
- getTreeLock ( )
- getDropTarget ( )
- dispatchEvent ( )
- addComponentListener ( )
- getInputMethodRequests ( )
- getX ( )
- getY ( )
- isOpaque ( )
- addMouseListener ( )
- requestFocus ( )
- getBackground ( )
- getAccessibleContext ( )
- setDropTarget ( )
- paint ( )
- getForeground ( )
- isFocusCycleRoot ( )
- getGraphics ( )
- getLocation ( )
- setMinimumSize ( )
- hasFocus ( )
- getGraphicsConfiguration ( )
- setMaximumSize ( )
- addHierarchyListener ( )
- isFocusable ( )
- requestFocusInWindow ( )
- isDisplayable ( )
- removeComponentListener ( )
- addKeyListener ( )
- addFocusListener ( )
- validate ( )
- getToolkit ( )
- getClass ( )
- setCursor ( )
- add ( )
- getLocale ( )
- getCursor ( )
- equals ( )
- getFontMetrics ( )
- size ( )
- getMaximumSize ( )
- invalidate ( )
- CENTER_ALIGNMENT
- move ( )
- removeMouseMotionListener ( )
- update ( )
- setFocusable ( )
- removeFocusListener ( )
- contains ( )
- addPropertyChangeListener ( )
- removeMouseListener ( )
- createImage ( )
- isValid ( )
- addMouseMotionListener ( )
- setName ( )
- getFocusCycleRootAncestor ( )
- getInputContext ( )
Related Classes
- java.io.File
- java.awt.Color
- java.awt.event.ActionEvent
- java.awt.event.ActionListener
- javax.swing.JPanel
- java.awt.Dimension
- java.awt.Font
- java.awt.event.MouseEvent
- javax.swing.JLabel
- java.awt.Graphics2D
- java.awt.Graphics
- javax.swing.JButton
- java.awt.event.KeyEvent
- java.awt.BorderLayout
- javax.swing.JOptionPane
- javax.swing.JScrollPane
- java.awt.Rectangle
- javax.swing.JTextField
- javax.swing.SwingUtilities
- java.awt.event.MouseAdapter
- javax.swing.ImageIcon
- javax.swing.JFileChooser
- java.awt.Point
- javax.swing.JComponent
- javax.swing.JCheckBox
Java Code Examples for java.awt.Component#isValid()
The following examples show how to use
java.awt.Component#isValid() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewTooltips.java From netbeans with Apache License 2.0 | 6 votes |
/** * Set the cell renderer we will proxy. */ public void setComponent (Component jc, JComponent owner) { Dimension dd = jc.getPreferredSize(); Rectangle currentScreenBounds = Utilities.getUsableScreenBounds(); // get some reasonable limit for the width int width = Math.min(dd.width, 2 * currentScreenBounds.width); int height = Math.min(dd.height + 2, 2 * currentScreenBounds.height); Image nue = !Utilities.isMac() ? owner.createVolatileImage(width, height) : new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics g = nue.getGraphics(); g.setColor (bg); g.fillRect (0, 0, width, dd.height + 2); if( jc instanceof Container && !jc.isValid() ) { //#214739 jc.setSize( width, dd.height ); jc.doLayout(); } SwingUtilities.paintComponent(g, jc, this, 0, 0, width, dd.height + 2); g.dispose(); setImage (nue); }
Example 2
Source File: PaddingInfo.java From pumpernickel with MIT License | 5 votes |
/** * This makes some visual changes to the component and its children. Shortly * after calling this method, the <code>restore()</code> method needs to be * called. */ private static void prep(Component c) { if (c instanceof JComponent) { JComponent jc = (JComponent) c; if (jc.isOpaque()) { jc.setOpaque(false); jc.putClientProperty(USED_TO_BE_OPAQUE, Boolean.TRUE); } Dimension preferredSize = c.getPreferredSize(); if (greaterThanOrEqualTo(jc.getSize(), preferredSize) == false) { jc.putClientProperty(SIZE, c.getSize()); jc.setSize(preferredSize); } } if (c instanceof JSlider) { JSlider s = (JSlider) c; ChangeListener[] listeners = s.getChangeListeners(); int mid = (s.getMinimum() + s.getMaximum()) / 2; if (mid != s.getValue()) { s.putClientProperty(CHANGE_LISTENERS, listeners); for (int a = 0; a < listeners.length; a++) { s.removeChangeListener(listeners[a]); } s.putClientProperty(SLIDER_VALUE, new Integer(s.getValue())); s.setValue(mid); } } if (c instanceof Container) { Container c2 = (Container) c; for (int a = 0; a < c2.getComponentCount(); a++) { prep(c2.getComponent(a)); } } if (c.isValid() == false) c.validate(); }
Example 3
Source File: ComponentApprovalWriter.java From ApprovalTests.Java with Apache License 2.0 | 5 votes |
private static void validateComponent(Component c) { if (!c.isValid()) { JFrame frame = new JFrame(); frame.getContentPane().add(c); frame.pack(); } }