做一个变量存储之前的背景色。
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JRadioButton;public class MyFrame extends JFrame{

public void service(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = getContentPane();

final JRadioButton button1 = new JRadioButton("A");
final Color colorBefore = button1.getBackground();
button1.setBackground(Color.ORANGE);

JButton button2 = new JButton("改变背景色");
button2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
button1.setBackground(colorBefore);
}
});

add(button1,BorderLayout.NORTH);
add(button2,BorderLayout.WEST);

pack();
setLocationRelativeTo(null);
setVisible(true);
}


public static void main(String[] args) {
MyFrame frame = new MyFrame();
frame.service();
}

}