javax.swing.JComponent#invalidate ( )源码实例Demo

下面列出了javax.swing.JComponent#invalidate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: visualvm   文件: PluggableTreeTableView.java
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);
}
 
源代码2 项目: pumpernickel   文件: SplayedLayout.java
@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);
		}
	}
}
 
void repaintComponents()
{
  synchronized (components) {
    for (final JComponent comp : components) {
      comp.invalidate();
      comp.repaint();
    }
  }
}
 
void repaintComponents()
{
  synchronized (components) {
    for (final JComponent comp : components) {
      comp.invalidate();
      comp.repaint();
    }
  }
}
 
void repaintComponents()
{
  for (final JComponent comp : components) {
    comp.invalidate();
    comp.repaint();
  }
}
 
源代码6 项目: netbeans   文件: TabLayoutManager.java
final void resizeContainer() {
    JComponent c = ( JComponent ) container.getParent();
    c.invalidate();
    c.revalidate();
    c.doLayout();
}