use of javax.swing.RepaintManager in project smile by haifengl.
the class PlotPanel method print.
@Override
public int print(java.awt.Graphics g, PageFormat pf, int page) throws PrinterException {
if (page > 0) {
// We have only one page, and 'page' is zero-based
return NO_SUCH_PAGE;
}
Graphics2D g2d = (Graphics2D) g;
// User (0,0) is typically outside the imageable area, so we must
// translate by the X and Y values in the PageFormat to avoid clipping
g2d.translate(pf.getImageableX(), pf.getImageableY());
// Scale plots to paper size.
double scaleX = pf.getImageableWidth() / contentPane.getWidth();
double scaleY = pf.getImageableHeight() / contentPane.getHeight();
g2d.scale(scaleX, scaleY);
// Disable double buffering
RepaintManager currentManager = RepaintManager.currentManager(this);
currentManager.setDoubleBufferingEnabled(false);
// Now we perform our rendering
contentPane.printAll(g);
// Enable double buffering
currentManager.setDoubleBufferingEnabled(true);
// tell the caller that this page is part of the printed document
return PAGE_EXISTS;
}
use of javax.swing.RepaintManager in project adempiere by adempiere.
the class Env method updateUI.
// sleep
/**
* Update all windows after look and feel changes.
* @since 2006-11-27
*/
public static Set<Window> updateUI() {
Set<Window> updated = new HashSet<Window>();
for (Container c : s_windows) {
Window w = getFrame(c);
if (w == null)
continue;
if (updated.contains(w))
continue;
SwingUtilities.updateComponentTreeUI(w);
w.validate();
RepaintManager mgr = RepaintManager.currentManager(w);
Component[] childs = w.getComponents();
for (Component child : childs) {
if (child instanceof JComponent)
mgr.markCompletelyDirty((JComponent) child);
}
w.repaint();
updated.add(w);
}
for (Window w : s_hiddenWindows) {
if (updated.contains(w))
continue;
SwingUtilities.updateComponentTreeUI(w);
w.validate();
RepaintManager mgr = RepaintManager.currentManager(w);
Component[] childs = w.getComponents();
for (Component child : childs) {
if (child instanceof JComponent)
mgr.markCompletelyDirty((JComponent) child);
}
w.repaint();
updated.add(w);
}
return updated;
}
use of javax.swing.RepaintManager in project adempiere by adempiere.
the class AEnv method updateUI.
// cacheReset
/**
* Update all windows after look and feel changes.
* @since 2006-11-27
*/
public static void updateUI() {
Set<Window> updated = Env.updateUI();
JFrame top = Env.getWindow(0);
if (top instanceof AMenu) {
CFrame[] frames = ((AMenu) top).getWindowManager().getWindows();
for (CFrame f : frames) {
if (updated.contains(f))
continue;
SwingUtilities.updateComponentTreeUI(f);
f.validate();
RepaintManager mgr = RepaintManager.currentManager(f);
Component[] childs = f.getComponents();
for (Component c : childs) {
if (c instanceof JComponent)
mgr.markCompletelyDirty((JComponent) c);
}
f.repaint();
updated.add(f);
}
}
}
use of javax.swing.RepaintManager in project jdk8u_jdk by JetBrains.
the class SwingUtilities3 method getDelegateRepaintManager.
/**
* Returns delegate {@code RepaintManager} for {@code component} hierarchy.
*/
public static RepaintManager getDelegateRepaintManager(Component component) {
RepaintManager delegate = null;
if (Boolean.TRUE == SunToolkit.targetToAppContext(component).get(DELEGATE_REPAINT_MANAGER_KEY)) {
while (delegate == null && component != null) {
while (component != null && !(component instanceof JComponent)) {
component = component.getParent();
}
if (component != null) {
delegate = (RepaintManager) ((JComponent) component).getClientProperty(DELEGATE_REPAINT_MANAGER_KEY);
component = component.getParent();
}
}
}
return delegate;
}
Aggregations