ZT文萃

          本博不原創,轉帖自己感興趣那些事人物,什么入眼貼什么,隨心所欲。
          posts - 93, comments - 5, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          java swing 圖片按鈕的使用

          Posted on 2014-04-27 11:12 ZT文萃 閱讀(514) 評論(0)  編輯  收藏 所屬分類: 前臺
          轉載自:

          1 JButton 圖片和文字按鈕的實現



          JButton btn1 = new JButton("打開", new ImageIcon(ImageView.class.getResource("10.png"))) ;

          btn1.setHorizontalTextPosition(SwingConstants.CENTER);

          btn1.setVerticalTextPosition(SwingConstants.BOTTOM);

           

          效果圖 :

          clip_image003

          2 JButton 圖片透明按鈕的實現



          setLayout(new FlowLayout(FlowLayout.RIGHT, 30, 0));

          btn1.setIcon(UIConfig.getImgUrl("常用交易字.png"));

          btn1.setRolloverIcon(UIConfig.getImgUrl("常用交易.png"));

          btn1.setBorderPainted(false);

          btn1.setFocusPainted(false);

          btn1.setContentAreaFilled(false);

          btn1.setFocusable(true);

          btn1.setMargin(new Insets(0, 0, 0, 0));

          btn1.setText("常用交易");

           

          clip_image006

          3JRadioButton 圖片透明按鈕的實現

          JRadioButton radio = new JRadioButton(UIConfig.getImgUrl("常用交易字.png") );

          radio.setContentAreaFilled(false);

          radio.setRolloverIcon(UIConfig.getImgUrl("常用交易.png"));

          radio.setSelectedIcon(UIConfig.getImgUrl("常用交易.png"));

          clip_image006[1]

          主站蜘蛛池模板: 诸城市| 太仆寺旗| 松溪县| 和平县| 连云港市| 信丰县| 西青区| 福鼎市| 中宁县| 五河县| 莲花县| 万载县| 富平县| 屏山县| 汤原县| 灵寿县| 类乌齐县| 广河县| 永兴县| 高邮市| 桓台县| 滦平县| 贺州市| 永康市| 武功县| 禹城市| 外汇| 年辖:市辖区| 尉犁县| 湖北省| 巴里| 青阳县| 雅安市| 兴海县| 宜章县| 遵义县| 青神县| 水城县| 扶绥县| 洛隆县| 黄平县|