Search in sources :

Example 1 with ReflectionRenderer

use of org.jdesktop.swingx.graphics.ReflectionRenderer 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++;
    });
}
Also used : MattePainter(org.jdesktop.swingx.painter.MattePainter) MTGControler(org.magic.services.MTGControler) Rectangle2D(java.awt.geom.Rectangle2D) Point(java.awt.Point) RenderingHints(java.awt.RenderingHints) AlphaComposite(java.awt.AlphaComposite) AffineTransformOp(java.awt.image.AffineTransformOp) Graphics2D(java.awt.Graphics2D) MouseWheelEvent(java.awt.event.MouseWheelEvent) MouseAdapter(java.awt.event.MouseAdapter) BorderLayout(java.awt.BorderLayout) Timer(javax.swing.Timer) Shape(java.awt.Shape) MattePainter(org.jdesktop.swingx.painter.MattePainter) MTGLogger(org.magic.services.MTGLogger) PaintUtils(org.jdesktop.swingx.util.PaintUtils) BufferedImage(java.awt.image.BufferedImage) ReflectionRenderer(org.jdesktop.swingx.graphics.ReflectionRenderer) AffineTransform(java.awt.geom.AffineTransform) MouseEvent(java.awt.event.MouseEvent) JXPanel(org.jdesktop.swingx.JXPanel) MagicEdition(org.magic.api.beans.MagicEdition) ThreadManager(org.magic.services.ThreadManager) Graphics(java.awt.Graphics) MagicCard(org.magic.api.beans.MagicCard) BasicStroke(java.awt.BasicStroke) Timer(javax.swing.Timer) ReflectionRenderer(org.jdesktop.swingx.graphics.ReflectionRenderer)

Aggregations

AlphaComposite (java.awt.AlphaComposite)1 BasicStroke (java.awt.BasicStroke)1 BorderLayout (java.awt.BorderLayout)1 Graphics (java.awt.Graphics)1 Graphics2D (java.awt.Graphics2D)1 Point (java.awt.Point)1 RenderingHints (java.awt.RenderingHints)1 Shape (java.awt.Shape)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 MouseWheelEvent (java.awt.event.MouseWheelEvent)1 AffineTransform (java.awt.geom.AffineTransform)1 Rectangle2D (java.awt.geom.Rectangle2D)1 AffineTransformOp (java.awt.image.AffineTransformOp)1 BufferedImage (java.awt.image.BufferedImage)1 Timer (javax.swing.Timer)1 JXPanel (org.jdesktop.swingx.JXPanel)1 ReflectionRenderer (org.jdesktop.swingx.graphics.ReflectionRenderer)1 MattePainter (org.jdesktop.swingx.painter.MattePainter)1 PaintUtils (org.jdesktop.swingx.util.PaintUtils)1