javrr-ui / SimonDice

Juego de simon dice programado en el lenguaje Java
0 stars 0 forks source link

Cosas raras al cambiar el color de fondo #57

Open javrr-ui opened 3 years ago

javrr-ui commented 3 years ago

Al querer cambiar de color de fondo, si entras a la opción de CMYK y la opción de Alpha la pones en 0, pasan errores en el fondo

image

image

Fondo con cosas raras image

Al expandir o disminuir la pantalla se arregla.

javatlacati commented 3 years ago

Una solución rápida al cuadrito indicador de color sería:

SwingUtilities.invokeLater(() -> {
            nextColor.setBackground(c);
            nextColor.paintImmediately(nextColor.getVisibleRect());
            dormir(dificultad);
            final int alpha = backgroundColor.getAlpha();
            System.out.println("Alpha:" + alpha);
            if (alpha < 255) {
                nextColor.setBackground(new Color(backgroundColor.getRed(), backgroundColor.getGreen(), backgroundColor.getBlue(), 255));
            } else {
                nextColor.setBackground(backgroundColor);
            }
            nextColor.paintImmediately(nextColor.getVisibleRect());
            dormir(dificultad);
            System.out.print(color + " ");
        });