Java Code Examples for javax.swing.JComponent#invalidate()

The following examples show how to use javax.swing.JComponent#invalidate() . 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: PluggableTreeTableView.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private static void checkVisibility(JComponent comp) {
    if (comp == null) return;

    comp.invalidate();
    comp.revalidate();
    comp.doLayout();
    comp.repaint();

    for (Component c : comp.getComponents())
        if (c.isVisible()) {
            comp.setVisible(true);

            return;
        }

    comp.setVisible(false);
}
 
Example 2
Source File: SplayedLayout.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
	synchronized (container.getTreeLock()) {
		long elapsedTime = System.currentTimeMillis() - startTime;
		float f = ((float) elapsedTime) / ANIMATION_DURATION;
		if (f >= 1)
			f = 1;
		boolean containerDirty = false;
		for (Entry<JComponent, Rectangle> entry : endingPositions
				.entrySet()) {
			Rectangle oldBounds = startingPositions.get(entry.getKey());
			Rectangle tweenBounds = tween(oldBounds, entry.getValue(),
					f);
			JComponent jc = entry.getKey();
			if (!jc.getBounds().equals(tweenBounds)) {
				jc.setBounds(tweenBounds);
				if (f == 1) {
					jc.invalidate();
					jc.revalidate();
				}
				containerDirty = true;
			}
		}
		if (containerDirty)
			container.repaint();
		if (f == 1 && e != null) {
			((Timer) e.getSource()).stop();
			container.putClientProperty(PROPERTY_TIMER, null);
			container.putClientProperty(PROPERTY_TIMER_LISTENER, null);
		}
	}
}
 
Example 3
Source File: DefaultSwingBundleDisplayer.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void repaintComponents()
{
  synchronized (components) {
    for (final JComponent comp : components) {
      comp.invalidate();
      comp.repaint();
    }
  }
}
 
Example 4
Source File: DefaultSwingBundleDisplayer.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void repaintComponents()
{
  synchronized (components) {
    for (final JComponent comp : components) {
      comp.invalidate();
      comp.repaint();
    }
  }
}
 
Example 5
Source File: DefaultSwingBundleDisplayer.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void repaintComponents()
{
  for (final JComponent comp : components) {
    comp.invalidate();
    comp.repaint();
  }
}
 
Example 6
Source File: TabLayoutManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
final void resizeContainer() {
    JComponent c = ( JComponent ) container.getParent();
    c.invalidate();
    c.revalidate();
    c.doLayout();
}