ZT文萃

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

          java swing 圖片按鈕的使用

          Posted on 2014-04-27 11:12 ZT文萃 閱讀(507) 評論(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]

          主站蜘蛛池模板: 延川县| 玛多县| 房产| 富蕴县| 开江县| 百色市| 天长市| 达日县| 泰安市| 皋兰县| 连城县| 景德镇市| 拉孜县| 靖西县| 田林县| 江达县| 江源县| 老河口市| 繁峙县| 呼玛县| 武邑县| 大港区| 太保市| 秦皇岛市| 柞水县| 茂名市| 安图县| 互助| 汝南县| 乌兰浩特市| 离岛区| 克什克腾旗| 乌海市| 通化市| 宁强县| 肇东市| 应城市| 镇远县| 逊克县| 密山市| 遂平县|