Как добавить к этой круглой кнопке металлический фон в java?

Как сделать так, чтобы эта кнопка была как jbutton?

я хочу дать этой кнопке металлический цвет или гигантский цвет, как сделать это?

import java.awt.*;
import java.awt.event.*;

RoundButton - класс, который производит легкую кнопку.

Легкие компоненты могут иметьпрозрачный» области, что означает, что вы можете увидеть фон контейнера за этими областями.

@SuppressWarnings("serial")
public class RoundButton extends Component {

ActionListener actionListener;     // Post action events to listeners
String label;                      // The Button's text
protected boolean pressed = false; // true if the button is detented.


/**
* Constructs a RoundButton with no label.
*/
public RoundButton() {
  this("");
}

/**
* Constructs a RoundButton with the specified label.
* @param label the label of the button
*/
public RoundButton(String label) {
  this.label = label;
  enableEvents(AWTEvent.MOUSE_EVENT_MASK);
}

/**
* gets the label
* @see setLabel
*/
public String getLabel() {
  return label;
}

/**
* sets the label
* @see getLabel
*/
public void setLabel(String label) {
  this.label = label;
  invalidate();
  repaint();
}

/**
* paints the RoundButton
*/
public void paint(Graphics g) {
  int s = Math.min(getSize().width - 1, getSize().height - 1);

  // paint the interior of the button
  if(pressed) {
  g.setColor(getBackground().darker().darker());
  } else {
  g.setColor(getBackground());
  }
  g.fillArc(0, 0, s, s, 0, 360);

  // draw the perimeter of the button
  g.setColor(getBackground().darker().darker().darker());
  g.drawArc(0, 0, s, s, 0, 360);
  // draw the label centered in the button
  Font f = getFont();
  if(f != null) {
  FontMetrics fm = getFontMetrics(getFont());
  g.setColor(getForeground());
  g.drawString(label,
           s/2 - fm.stringWidth(label)/2,
           s/2 + fm.getMaxDescent());
  }
}

/**
* The preferred size of the button. 
*/
public Dimension getPreferredSize() {
  Font f = getFont();
  if(f != null) {
  FontMetrics fm = getFontMetrics(getFont());
  int max = Math.max(fm.stringWidth(label) + 40, fm.getHeight() + 40);
  return new Dimension(max, max);
  } else {
  return new Dimension(100, 100);
  }
}

/**
* The minimum size of the button. 
*/
public Dimension getMinimumSize() {
  return new Dimension(100, 100);
}

/**
* Adds the specified action listener to receive action events
* from this button.
* @param listener the action listener
*/
public void addActionListener(ActionListener listener) {
    actionListener = AWTEventMulticaster.add(actionListener, listener);
    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
 }

 /**
 * Removes the specified action listener so it no longer receives
 * action events from this button.
 * @param listener the action listener
 */
 public void removeActionListener(ActionListener listener) {
     actionListener = AWTEventMulticaster.remove(actionListener, listener);
 }

/**
* Determine if click was inside round button.
*/
 public boolean contains(int x, int y) {
   int mx = getSize().width/2;
   int my = getSize().height/2;
   return (((mx-x)*(mx-x) + (my-y)*(my-y)) 

Ответы на вопрос(1)

Ваш ответ на вопрос