List of usage examples for java.awt Component repaint
public void repaint()
From source file:Main.java
public static void forceRepaint(Component component) { component.revalidate(); component.repaint(); }
From source file:Main.java
public static void forceRevalidate(Component comp) { comp.invalidate(); comp.validate(); comp.repaint(); }
From source file:Main.java
public static void repaint(final Component comp) { SwingUtilities.invokeLater(new Runnable() { public void run() { comp.repaint(); }//from w w w. j ava2 s .c o m }); }
From source file:Main.java
/** * A simple minded look and feel change: ask each node in the tree * to <code>updateUI()</code> -- that is, to initialize its UI property * with the current look and feel.//from w w w . j a v a 2s. c om * * @param c UI component. */ public static void updateComponentTreeUI(Component c) { updateComponentTreeUI0(c); c.invalidate(); c.validate(); c.repaint(); }
From source file:Main.java
public static void repaint(final Component component) { SwingUtilities.invokeLater(new Runnable() { @Override// ww w.ja v a2 s .c o m public void run() { component.repaint(); } }); }
From source file:Main.java
/** * Use this static method if you want to center a component over another * component.//from w w w .ja v a 2 s . com * * @param parent * the component you want to use to place it on * @param toBeCentered * the component you want to center */ public static void centerComponentInComponent(Component parent, Component toBeCentered) { toBeCentered.setLocation(parent.getX() + (parent.getWidth() - toBeCentered.getWidth()) / 2, parent.getY() + (parent.getHeight() - toBeCentered.getHeight()) / 2); toBeCentered.validate(); toBeCentered.repaint(); }
From source file:Main.java
/** * Use this static method if you want to center a component in Window. * * @param component//from ww w .ja v a 2s . c o m * the component you want to center in window */ public static void centerComponentInWindow(Component component) { Dimension dimension = component.getToolkit().getScreenSize(); component.setLocation((int) ((dimension.getWidth() - component.getWidth()) / 2), (int) ((dimension.getHeight() - component.getHeight()) / 2)); component.validate(); 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 w w w . j a v a 2s. c om*/ if (visible) { container.getLayout().addLayoutComponent(BorderLayout.CENTER, child); } else { container.getLayout().removeLayoutComponent(child); } child.repaint(); } container.revalidate(); container.repaint(); }
From source file:edu.ku.brc.af.core.NavBox.java
/** * Refreshes - meaning it makes sure it is resized (layed out) and drawn. * @param nbi the box to refresh/*from ww w .j a v a 2 s . co m*/ */ public static void refresh(final NavBoxItemIFace nbi) { if (nbi != null) { Component comp = nbi.getUIComponent(); comp.invalidate(); comp.doLayout(); comp.setSize(comp.getPreferredSize()); comp.repaint(); log.debug("comp " + comp.getPreferredSize() + " " + comp.getSize()); //$NON-NLS-1$ //$NON-NLS-2$ Container parentComp = nbi.getUIComponent().getParent(); if (parentComp instanceof NavBox) { refresh((NavBox) parentComp); } else if (parentComp instanceof JScrollPane) { // this must be a scrollable NavBox; // let's get the actual NavBox // container heirarchy is NavBox -> JScrollPane -> NavBoxItem parentComp = parentComp.getParent().getParent(); refresh((NavBox) parentComp); } } }
From source file:cool.pandora.modeller.ui.BagInfoInputPane.java
/** * updateForms.// w ww . j ava 2 s . co m * * @param bag DefaultBag */ public void updateForms(final DefaultBag bag) { verifyForms(bag); createTabbedUiComponentsWithForms(); final java.awt.Component[] components = bagInfoForm.getControl().getComponents(); for (final Component c : components) { c.invalidate(); c.repaint(); } bagInfoForm.getControl().invalidate(); profileForm.getControl().invalidate(); invalidate(); repaint(); }