JavaSwing JButton

JButton btn01 =new JButton("btn01");
        // 设置按钮图标
        //btn01.setIcon(new ImageIcon(HelloWorld.class.getResource("/images/book.png")));
        // 设置按钮被按下后图标
        //btn01.setPressedIcon(new ImageIcon(HelloWorld.class.getResource("/images/book.png")));
        // 设置按钮不可用下图标
        //btn01.setDisabledIcon(new ImageIcon(HelloWorld.class.getResource("/images/book.png")));
        //设置文本
        //btn01.setText("按钮");
        //设置字体
        //btn01.setFont(new Font("微软雅黑",Font.BOLD,10));
        // 设置字体颜色
        //btn01.setForeground(new Color(0XFFFFF));
        // 设置按钮是否可用
        //btn01.setEnabled(false);
        //设置是否绘制边框
        //btn01.setBorderPainted(false);

 

posted @ 2024-12-03 21:49  leungqingyun  阅读(21)  评论(0)    收藏  举报