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 @   leungqingyun  阅读(9)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示