0

When I changing the dark mode check box, it's shadow goes behind the dateLabel. How can I avoid this? with shadow

if (isDarker) {
        dateLabel.setForeground(new java.awt.Color(255, 0, 51));
        wallpaper.setIcon(new ImageIcon(getClass().getResource("light.jpg")));
        isDarker = false;
    } else {
        isDarker = true;
        dateLabel.setForeground(new java.awt.Color(255, 255, 255));
        wallpaper.setIcon(new ImageIcon(getClass().getResource("wa.jpg")));
    }
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Some One
  • 103
  • 1
  • 1
  • 5
  • Your doing custom painting, maybe, overriding `paint` or `paintComponent` or some such, but, you're not honouring the paint chain (all the work which is done by the super implementation). Painting is actually a complex process and you must either call the super paint method before doing any custom painting or be willing to take over ALL the responsibilities of the the method you are overriding – MadProgrammer Jun 22 '21 at 22:52
  • 1
    Take a look at [Performing Custom Painting](https://docs.oracle.com/javase/tutorial/uiswing/painting/index.html) and [Painting in AWT and Swing](https://www.oracle.com/java/technologies/painting.html) for more details. – MadProgrammer Jun 22 '21 at 22:53
  • 2
    Also, a problem like this really needs a [mcve] – MadProgrammer Jun 22 '21 at 22:54

0 Answers0