title: How to put Hover effect on jbutton?
body: <p>I am trying to create a Java Desktop application where I am using two buttons. I want to add hover effect in those buttons. I want: When I click any button it should change its background color.</p>
  
  <p>How can I achieve it?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class Party1Party2 extends JFrame
  {
      JButton b1;
      JButton b2;
      Container pane;
  
      public Party1Party2()
      {
          getContentPane().setBackground(new java.awt.Color(255, 255, 255));
  
      b2.addActionListener(new ActionListener()
      {
          public void actionPerformed(ActionEvent ae)
          {
              JOptionPane.showMessageDialog(frame, "Welcome to allhabad High Court");
          }
      });
  
      b1.addActionListener(new ActionListener()
      {
          public void actionPerformed(ActionEvent ae)
          {
              JOptionPane.showMessageDialog(frame, "Welcome to allhabad High Court");
  
          }
      });
    }
  }
  </code></pre>