企業架構師成長之路

          一些心得體會..

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            3 Posts :: 1 Stories :: 3 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(1)

          我參與的團隊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          2005年12月19日 #

          文章很長的話...顯示在列表上基本上會占整頁,如何只顯示幾句,點進去后才閱讀全文呢?
          posted @ 2005-12-19 09:45 風風 閱讀(505) | 評論 (2)編輯 收藏

          現象:

            JBuilder啟動時有一個啟動畫面,在Jbuilder所有的初始化工作都完成之后,啟動畫面消失,繼而JBuilder可以開始使用。

            解決方案:

            該方案基于我所做過的一個項目。

            1、新建一個啟動畫面Window類

            java.awt.Window windowSplash;

            2、調用prepareSplash()函數,初始化啟動界面

            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類(主界面)中調用startSplash(),顯示啟動界面,然后初試化JFrame的各個可視化組件,初始化后臺數據庫等(如數據
          庫的連接)

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

            4、在所有的初始化工作完成之后,調用stopSplash()函數,停止顯示啟動畫面

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

          import java.io.*;
          public class StringTest
          {
          public static void main(String[] args)
          {
          String aString = "這是一個測試串,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 風風 閱讀(360) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 古蔺县| 班戈县| 建水县| 长阳| 青浦区| 鄂伦春自治旗| 和平区| 比如县| 东至县| 沙田区| 临颍县| 安塞县| 房山区| 临沂市| 西林县| 河北省| 静海县| 安福县| 乐平市| 黄山市| 定南县| 铁岭市| 富裕县| 修水县| 辉南县| 镶黄旗| 曲阳县| 霸州市| 河源市| 博白县| 呼玛县| 中西区| 昭苏县| 祥云县| 宁远县| 新河县| 遂昌县| 华坪县| 无极县| 古交市| 荣成市|