List of usage examples for javax.swing JComponent repaint
public void repaint()
From source file:Main.java
public static void repaint(JComponent comp) { comp.validate(); comp.repaint(); }
From source file:Main.java
/** * Repaints UI tree recursively./* ww w. j av a 2 s. c o m*/ * * @param c UI component. */ private static void updateComponentTreeUI0(Component c) { if (c instanceof JComponent) { JComponent jc = (JComponent) c; jc.invalidate(); jc.validate(); jc.repaint(); JPopupMenu jpm = jc.getComponentPopupMenu(); if (jpm != null && jpm.isVisible() && jpm.getInvoker() == jc) { updateComponentTreeUI(jpm); } } Component[] children = null; if (c instanceof JMenu) { children = ((JMenu) c).getMenuComponents(); } else if (c instanceof java.awt.Container) { children = ((java.awt.Container) c).getComponents(); } if (children != null) { for (int i = 0; i < children.length; i++) updateComponentTreeUI0(children[i]); } }
From source file:Main.java
/** * Work around for JTable/viewport bug.//w w w.j a v a 2 s . c o m * @link http://developer.java.sun.com/developer/bugParade/bugs/4205145.html */ protected static void repaintLater(final JComponent component) { SwingUtilities.invokeLater(new Runnable() { public void run() { component.repaint(); } }); }
From source file:Main.java
/** * Repaints the parent of the given component. If the parent is null, the component itself is repainted. * /*w w w. jav a2 s.com*/ * @param component The component whose parent will be repainted. */ public static void repaintParent(JComponent component) { // Get the parent of the component. JComponent parentComponent = (JComponent) SwingUtilities.getAncestorOfClass(JComponent.class, component); // Could we find a parent? if (parentComponent != null) { // Repaint the parent. parentComponent.revalidate(); parentComponent.repaint(); } else { // Repaint the component itself. component.revalidate(); component.repaint(); } }
From source file:Main.java
public static void showAsOnlyVisibleChild(JComponent container, Component childToBeMadeVisible) { for (Component child : container.getComponents()) { boolean visible = child.equals(childToBeMadeVisible); child.setVisible(visible);//from ww w .j a v a2s .c o m if (visible) { container.getLayout().addLayoutComponent(BorderLayout.CENTER, child); } else { container.getLayout().removeLayoutComponent(child); } child.repaint(); } container.revalidate(); container.repaint(); }
From source file:MyCheckBoxUI.java
public void mouseExited(MouseEvent e) { JComponent c = (JComponent) e.getComponent(); c.setBackground(Color.red); c.repaint(); }
From source file:MyCheckBoxUI.java
public void mouseEntered(MouseEvent e) { JComponent c = (JComponent) e.getComponent(); c.setBackground(Color.blue); c.repaint(); }
From source file:MyButtonUI.java
public void mouseEntered(MouseEvent e) { JComponent c = (JComponent) e.getComponent(); c.setForeground(m_foregroundActive); c.repaint(); }
From source file:MyButtonUI.java
public void mouseExited(MouseEvent e) { JComponent c = (JComponent) e.getComponent(); c.setForeground(m_foregroundNormal); c.repaint(); }
From source file:net.sf.nmedit.patchmodifier.mutator.VariationTransferHandler.java
protected void exportDone(JComponent c, Transferable data, int action) { if ((action == MOVE)) { c.repaint(); }//from www . j a va 2 s .c o m }