use of org.jdesktop.swingx.painter.PainterGlasspane in project CodenameOne by codenameone.
the class BaseForm method setOverrideMode.
public synchronized void setOverrideMode(boolean overrideMode, java.awt.Component c) {
RootPaneContainer r = (RootPaneContainer) SwingUtilities.windowForComponent(c);
if (overrideMode) {
if (overrideImage == null) {
overrideImage = new ImageIcon(getClass().getResource("/override_stamp.png"));
}
PainterGlasspane pg = new PainterGlasspane();
MattePainter matte = new MattePainter(new Color(0xcc, 0xcc, 0xcc, 120)) {
protected void doPaint(java.awt.Graphics2D g, java.lang.Object component, int width, int height) {
super.doPaint(g, component, width, height);
overrideImage.paintIcon(BaseForm.this, g, 0, 0);
// g.drawImage(overrideImage.getImage(), width / 2 - overrideImage.getIconWidth() / 2, 0, BaseForm.this);
}
};
pg.setPainter(matte);
pg.addTarget(this);
r.setGlassPane(pg);
pg.setBounds(0, 0, r.getContentPane().getWidth(), r.getContentPane().getHeight());
pg.setVisible(true);
} else {
r.setGlassPane(new JLabel());
}
}
Aggregations