Love Pisces

          It's not your aptitude but your attitude that determines your altitude!
          posts - 2, comments - 43, trackbacks - 0, articles - 9

          JBuilder使用小結(jié)(一)

          Posted on 2007-07-13 21:42 筱筱 閱讀(345) 評論(0)  編輯  收藏 所屬分類: Java
          1.讓Frame框顯示在屏幕中間的代碼:
              
           1     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
           2     Dimension frameSize = myFrame.getSize();
           3     if (frameSize.height > screenSize.height) {
           4            frameSize.height = screenSize.height;
           5         }

           6     if (frameSize.width > screenSize.width) {
           7            frameSize.width = screenSize.width;
           8         }

           9     myFrame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
          10   myFrame.setVisible(true);

                其中,myFrame是要顯示在屏幕中間的窗體,以上代碼寫在父窗體中。

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 通许县| 紫阳县| 克山县| 桑日县| 洛扎县| 丹阳市| 喀喇| 育儿| 东至县| 万州区| 弥勒县| 宿松县| 海安县| 新兴县| 雷州市| 长垣县| 利辛县| 延寿县| 淮北市| 东辽县| 绩溪县| 新河县| 德江县| 丹棱县| 许昌市| 门源| 新田县| 乌拉特前旗| 长子县| 汾阳市| 岑溪市| 安国市| 平和县| 江川县| 梅河口市| 奉新县| 阳江市| 永寿县| 克拉玛依市| 乌兰浩特市| 井冈山市|