⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paintjbutton.java

📁 java相关的j2me,j2se的一些相关资料
💻 JAVA
字号:
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class PaintJButton extends JButton {
    public PaintJButton(String name) {
        super(name);
        this.setContentAreaFilled(false);
    }    
    protected  void paintComponent(Graphics g){
        g.setColor(Color.LIGHT_GRAY);
        g.fillOval(0,0,200,35);
    }
    
    public static void main(String args[]){
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (IllegalAccessException ex) {}
          catch (ClassNotFoundException ex)  {} 
          catch (UnsupportedLookAndFeelException ex) {} 
          catch (InstantiationException ex) {}
        
        JFrame frame = new JFrame();
        frame.setLayout(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setBounds(100,100,500,500);
        frame.setVisible(true);
        
        PaintJButton button = new PaintJButton("dddddddd");
        button.setVisible(true);
        button.setBounds(200,200,350,350);
        
        frame.add(button);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -