java.awt.Window.repaint()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中java.awt.Window.repaint()方法的一些代码示例,展示了Window.repaint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.repaint()方法的具体详情如下:
包路径:java.awt.Window
类名称:Window
方法名:repaint

Window.repaint介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

/** Tries to resize wizard wisely if needed. Keeps "display inertia" so that
 * wizard is only enlarged, not shrinked, and location is changed only when
 * wizard window exceeds screen bounds after resize.
 */
private void resizeWizard(Window parentWindow, Dimension prevSize) {
  assert SwingUtilities.isEventDispatchThread () : "getComponent() must be called in EQ only.";
  Dimension curSize = data.getIterator(this).current().getComponent().getPreferredSize();
  // only enlarge if needed, don't shrink
  if ((curSize.width > prevSize.width) || (curSize.height > prevSize.height)) {
    Rectangle origBounds = parentWindow.getBounds();
    int newWidth = Math.max(origBounds.width + (curSize.width - prevSize.width), origBounds.width);
    int newHeight = Math.max(origBounds.height + (curSize.height - prevSize.height), origBounds.height);
    Rectangle screenBounds = Utilities.getUsableScreenBounds();
    Rectangle newBounds;
    // don't allow to exceed screen size, center if needed
    if (((origBounds.x + newWidth) > screenBounds.width) || ((origBounds.y + newHeight) > screenBounds.height)) {
      newWidth = Math.min(screenBounds.width, newWidth);
      newHeight = Math.min(screenBounds.height, newHeight);
      newBounds = Utilities.findCenterBounds(new Dimension(newWidth, newHeight));
    } else {
      newBounds = new Rectangle(origBounds.x, origBounds.y, newWidth, newHeight);
    }
    parentWindow.setBounds(newBounds);
    parentWindow.invalidate();
    parentWindow.validate();
    parentWindow.repaint();
  }
}

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

public void run() {
    w.repaint();
  }
});

代码示例来源:origin: stackoverflow.com

for (Window window: Window.getWindows())
{
  if (window.isVisible())
  {
    injectResources(window);
    window.repaint();
    if (window instanceof RootPaneContainer)
    {
      ((RootPaneContainer) window).getRootPane().revalidate();
    }
  }
}

代码示例来源:origin: khuxtable/seaglass

public void windowLostFocus(WindowEvent e) {
    e.getWindow().repaint();
  }
};

代码示例来源:origin: khuxtable/seaglass

public void windowGainedFocus(WindowEvent e) {
  e.getWindow().repaint();
}

代码示例来源:origin: net.java.truecommons/truecommons-key-hurlfb

@Override
  public void actionPerformed(ActionEvent e) {
    final long elapsed = System.currentTimeMillis() - start;
    if (elapsed < duration && window.isShowing()) {
      final double angle = TWO_PI * elapsed / cycle;
      final double offset
          = Math.sin(PI * elapsed / duration) * amplitude;
      final int x = (int) (Math.cos(angle) * offset + origin.x);
      final int y = (int) (Math.sin(angle) * offset + origin.y);
      window.setLocation(x, y);
      window.repaint();
    } else {
      ((Timer) e.getSource()).stop();
      window.setLocation(origin);
      window.repaint();
    }
  }
});

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@Override
  public void actionPerformed(ActionEvent e) {
    final long elapsed = System.currentTimeMillis() - start;
    if (elapsed < duration && window.isShowing()) {
      final double angle = TWO_PI * elapsed / cycle;
      final double offset
          = Math.sin(PI * elapsed / duration) * amplitude;
      final int x = (int) (Math.cos(angle) * offset + origin.x);
      final int y = (int) (Math.sin(angle) * offset + origin.y);
      window.setLocation(x, y);
      window.repaint();
    } else {
      ((Timer) e.getSource()).stop();
      window.setLocation(origin);
      window.repaint();
    }
  }
});

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

protected void cleanupGhostImage() {
  GlassPanel glassPane = manager.getGlassPanel();
  glassPane.setDraggingImage(null);
  glassPane.setVisible(false);
  ghostImage = null;
  SwingUtilities.getWindowAncestor(manager).repaint();
}

代码示例来源:origin: igniterealtime/Spark

public void stopShake() {
  shakeTimer.stop();
  window.setLocation(naturalLocation);
  window.repaint();
  SparkManager.getNativeManager().stopFlashing(window);
}

代码示例来源:origin: net.sourceforge.jadex/jadex-rules-tools

public void run()
      {
        invalidate();
        Window    root    = SGUI.getWindowParent(NodePanel.this);
        if(root!=null)
        {
          root.doLayout();
          root.repaint();
        }
//                paintComponents(getGraphics());
      }
    });

代码示例来源:origin: com.jtattoo/JTattoo

public void windowDeactivated(WindowEvent e) {
    e.getWindow().invalidate();
    e.getWindow().repaint();
  }
} // end class MyWindowHandler

代码示例来源:origin: com.jtattoo/JTattoo

public void windowActivated(WindowEvent e) {
  e.getWindow().invalidate();
  e.getWindow().repaint();
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

public void actionPerformed(ActionEvent ae) {
    Dimension contentSize = null;
    if (w instanceof JDialog) {
      contentSize = ((JDialog)w).getContentPane().getSize();
    } else {
      contentSize = ((JFrame)w).getContentPane().getSize();
    }
    Dimension dialogSize = w.getSize();
    int ydiff = dialogSize.height - contentSize.height;
    Dimension paneSize = pane.getSize();
    w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff));
    w.validate();
    w.repaint();
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

@Override
  public void actionPerformed(ActionEvent ae) {
    Dimension contentSize = null;
    if (w instanceof JDialog) {
      contentSize = ((JDialog)w).getContentPane().getSize();
    } else {
      contentSize = ((JFrame)w).getContentPane().getSize();
    }
    Dimension dialogSize = w.getSize();
    int ydiff = dialogSize.height - contentSize.height;
    Dimension paneSize = pane.getSize();
    w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff));
    w.validate();
    w.repaint();
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

@Override
  public void actionPerformed(ActionEvent ae) {
    Dimension contentSize = null;
    if (w instanceof JDialog) {
      contentSize = ((JDialog)w).getContentPane().getSize();
    } else {
      contentSize = ((JFrame)w).getContentPane().getSize();
    }
    Dimension dialogSize = w.getSize();
    int ydiff = dialogSize.height - contentSize.height;
    Dimension paneSize = pane.getSize();
    w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff));
    w.validate();
    w.repaint();
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

@Override
  public void actionPerformed(ActionEvent ae) {
    Dimension contentSize = null;
    if (w instanceof JDialog) {
      contentSize = ((JDialog)w).getContentPane().getSize();
    } else {
      contentSize = ((JFrame)w).getContentPane().getSize();
    }
    Dimension dialogSize = w.getSize();
    int ydiff = dialogSize.height - contentSize.height;
    Dimension paneSize = pane.getSize();
    w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff));
    w.validate();
    w.repaint();
  }
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

@Override
  public void actionPerformed(ActionEvent ae) {
    Dimension contentSize = null;
    if (w instanceof JDialog) {
      contentSize = ((JDialog)w).getContentPane().getSize();
    } else {
      contentSize = ((JFrame)w).getContentPane().getSize();
    }
    Dimension dialogSize = w.getSize();
    int ydiff = dialogSize.height - contentSize.height;
    Dimension paneSize = pane.getSize();
    w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff));
    w.validate();
    w.repaint();
  }
}

代码示例来源:origin: net.imagej/imagej-legacy

@Override
  protected void hidePanel(final Container p) {
    getParent().remove(p);
    getParent().revalidate();
    getParent().repaint();
    final Window w = SwingUtilities.getWindowAncestor(this);
    w.revalidate();
    w.pack();
    w.repaint();
  }
};

代码示例来源:origin: com.github.insubstantial/flamingo

private void repaintWindows() {
  for (Window window : Window.getWindows()) {
    window.repaint();
  }
  List<PopupInfo> popups = PopupPanelManager.defaultManager()
      .getShownPath();
  for (PopupPanelManager.PopupInfo popup : popups) {
    JPopupPanel popupPanel = popup.getPopupPanel();
    popupPanel.paintImmediately(new Rectangle(0, 0, popupPanel
        .getWidth(), popupPanel.getHeight()));
  }
}

代码示例来源:origin: stackoverflow.com

public class Start implements ActionListener {
 Window theWindow = new Window();
 CustomPanel mainMenu = new CustomPanel();
 CustomPanel optionsMenu = new CustomPanel();
 Button myButton = new Button();
 public static void main(String[] args) {
   theWindow.add(mainMenu);
   mainMenu.add(myButton);
   myButton.addActionListener(this);
   theWindow.setVisible(true);
   theWindow.repaint();
 }
 public void actionPerformed(Event e) {
   theWindow.remove(mainMenu);
   theWindow.add(optionsMenu);
   theWindow.repaint();
 }

相关文章

Window类方法