title: Why doesn't my text color change to white again?
body: <p><img src="https://i.stack.imgur.com/ov85Z.png" alt="text color"></p>
  
  <p>The picture's worth a thousand words.<br>
  I used a <code>JLabel</code> to create my GUI <strong>after</strong> adding the gradient background.<br>
  I used <code>setPaint(gr)</code> to change the color to the required gradient and then used <code>setPaint(Color.white)</code> again to change the color to white.<br>
  And then I use the <code>setupGUI()</code> to create the buttons n all you see.<br>
  However they are in gray and not white.<br>
  <strong>How do I make it white again</strong>  </p>
  
  <pre><code>public class ScreenRecorder extends JFrame{
      public ScreenRecorder(){
          setupGUI();
          this.getContentPane().add(b);
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          this.setVisible(true);
          this.setResizable(false);
          this.pack();
      }
  
      /*This method is used to add components into each other, setting layout, etc*/
      public void setupGUI(){
          play.setPreferredSize(new Dimension(24,24));
          Box controls = Box.createHorizontalBox();
          controls.add(play);
          controls.add(Box.createHorizontalStrut(10));
          controls.add(timerLabel);
          controls.add(Box.createHorizontalStrut(200));
          controls.add(locationLabel);
          b.add(controls);
      }
      /* Creating the gradient background */
      protected class Background extends JPanel{
          @Override
          protected void paintComponent(Graphics g){
              Graphics2D g2D = (Graphics2D) g;
              int w = this.getWidth();
              int h = this.getHeight();
              Color color1 = Color.black;
              Color color2 = Color.DARK_GRAY.brighter();
              GradientPaint gr = new GradientPaint(0,0,color1,0,w/2,color2);
              g2D.setPaint(gr); //Color changes to the gradient color
              g2D.fillRect(0, 0, w, h);
              g2D.setPaint(Color.white); //Color changes to white for JLabel, but doesn't actually change
          }
      }
      /*Creating the combined Play and Pause button using AbstractAction 
       * The displayed icon must change from that of play to pause on click and vice versa*/
      protected class PlayAction extends AbstractAction{
          public PlayAction(){
              this.putValue(AbstractAction.LARGE_ICON_KEY, playIcon);
              this.putValue(SHORT_DESCRIPTION, "Click to Record Video");
          }
          @Override
          public void actionPerformed(ActionEvent e){
              if(isPlay == true){
                  isPlay = false;
                  play.getAction().putValue(LARGE_ICON_KEY, pauseIcon);
                  play.getAction().putValue(SHORT_DESCRIPTION,"Click to Pause Recording");
                  ScreenRecorder.this.setState(JFrame.ICONIFIED);
                  play.repaint();
              }else{
                  isPlay = true;
                  play.getAction().putValue(LARGE_ICON_KEY, playIcon);
                  play.getAction().putValue(SHORT_DESCRIPTION,"Click to Start Recording");
                  play.repaint();
              }
          }
          boolean isPlay = true; //true represents recorder is ready, false means it is currently recording
          Icon playIcon = (Icon) new ImageIcon("src/images/play.png");
          Icon pauseIcon = (Icon) new ImageIcon("src/images/pause.png");
      }
      public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable(){
              @Override
              public void run(){
                  new ScreenRecorder();
              }
          });
      }
      Background b = new Background();
      JButton play = new JButton(new PlayAction());
      JLabel timerLabel = new JLabel("00:00",JLabel.CENTER);
      JLabel locationLabel = new JLabel("Into: ",JLabel.LEFT);
  }
  </code></pre>