企業(yè)架構(gòu)師成長(zhǎng)之路

          一些心得體會(huì)..

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            3 Posts :: 1 Stories :: 3 Comments :: 0 Trackbacks

          2005年12月19日 #

          文章很長(zhǎng)的話(huà)...顯示在列表上基本上會(huì)占整頁(yè),如何只顯示幾句,點(diǎn)進(jìn)去后才閱讀全文呢?
          posted @ 2005-12-19 09:45 風(fēng)風(fēng) 閱讀(503) | 評(píng)論 (2)編輯 收藏

          現(xiàn)象:

            JBuilder啟動(dòng)時(shí)有一個(gè)啟動(dòng)畫(huà)面,在Jbuilder所有的初始化工作都完成之后,啟動(dòng)畫(huà)面消失,繼而JBuilder可以開(kāi)始使用。

            解決方案:

            該方案基于我所做過(guò)的一個(gè)項(xiàng)目。

            1、新建一個(gè)啟動(dòng)畫(huà)面Window類(lèi)

            java.awt.Window windowSplash;

            2、調(diào)用prepareSplash()函數(shù),初始化啟動(dòng)界面

            private void prepareSplash()
           {
              Toolkit toolkit = Toolkit.getDefaultToolkit();
              windowSplash = new Window( this );
              Image image = toolkit.getImage( "images" + File.separator + "splash.gif" );
              ImageCanvas canvas = new ImageCanvas( image );
              windowSplash.add( canvas, "Center" );
              Dimension scmSize = toolkit.getScreenSize();
              int imgWidth = image.getWidth( this );
              int imgHeight = image.getHeight( this );
              windowSplash.setLocation( scmSize.width/2 - (imgWidth/2), scmSize.height/2 - (imgHeight/2) );
             windowSplash.setSize( imgWidth, imgHeight );
            }

            3、在Application的JFrame類(lèi)(主界面)中調(diào)用startSplash(),顯示啟動(dòng)界面,然后初試化JFrame的各個(gè)可視化組件,初始化后臺(tái)數(shù)據(jù)庫(kù)等(如數(shù)據(jù)
          庫(kù)的連接)

            private void startSplash()
            {
              windowSplash.setVisible( true );
             windowSplash.toFront();
            }

            4、在所有的初始化工作完成之后,調(diào)用stopSplash()函數(shù),停止顯示啟動(dòng)畫(huà)面

            private void stopSplash()
          {
             windowSplash.dispose();
           }
          posted @ 2005-12-19 08:51 風(fēng)風(fēng) 閱讀(430) | 評(píng)論 (1)編輯 收藏

          import java.io.*;
          public class StringTest
          {
          public static void main(String[] args)
          {
          String aString = "這是一個(gè)測(cè)試串,This is a test string.";
          String anotherString = null;
          try {
          anotherString = new String(aString.getBytes("GBK"), "ISO8859_1");
          }
          catch (UnsupportedEncodingException ex) {
          }
          System.out.println(aString.length() + "," + anotherString.length());
          }
          }
          posted @ 2005-12-19 08:49 風(fēng)風(fēng) 閱讀(358) | 評(píng)論 (0)編輯 收藏

          主站蜘蛛池模板: 顺昌县| 湘西| 土默特左旗| 特克斯县| 上杭县| 合山市| 琼结县| 德庆县| 凤阳县| 昆山市| 抚州市| 张北县| 通化县| 元朗区| 务川| 偃师市| 莲花县| 论坛| 增城市| 通化市| 且末县| 宜城市| SHOW| 平阳县| 墨竹工卡县| 嘉善县| 平果县| 三江| 锦州市| 磴口县| 宜阳县| 桂平市| 瓮安县| 钟山县| 达州市| 大理市| 耿马| 井研县| 紫金县| 乐安县| 亳州市|