use of org.jdesktop.swingx.painter.MattePainter 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());
}
}
use of org.jdesktop.swingx.painter.MattePainter in project MtgDesktopCompanion by nicho92.
the class CardsPicPanel method initGUI.
private void initGUI() {
renderer = new ReflectionRenderer();
setBackgroundPainter(new MattePainter(PaintUtils.NIGHT_GRAY, true));
GestionnaireEvenements interactionManager = new GestionnaireEvenements(this);
this.addMouseListener(interactionManager);
this.addMouseMotionListener(interactionManager);
this.addMouseWheelListener(interactionManager);
timer = new Timer(30, e -> {
repaint();
xScale += xDelta;
if (xScale > 1 || xScale < -1) {
xDelta *= -1;
}
if (loop > 0 && ((int) xScale == 1 || (int) xScale == -1)) {
timer.stop();
launched = false;
}
loop++;
});
}
Aggregations