除了用paintComponent外 还有别的方法能改变按钮的形状吗
这就需要你自己写一个继承自AbstractButton的类了
能不能举个实例出来` 我知道另一个方法 但是那是获得系统默认的 请看事例
import java.awt.*;
import javax.swing.*;
public class Button1 extends JFrame
{
private Panel panel;
private JButton jButton;
public Button1()
{
panel = new Panel();
jButton = new JButton("按钮");
panel.add(jButton);
Container contentPane = getContentPane();
contentPane.add(panel);
contentPane.setLayout(new FlowLayout());
setSize(300,300);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
setLocation((screenSize.width - frameSize.width)/2,(screenSize.height - frameSize.height)/2);
show();
}
public static void main(String args[])throws Exception
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
new Button1();
}
}