2010-06-11 28 views
1

我使用swing在java中創建了一個應用程序。在那裏我有一個String數組,我嘗試使用html選取框標記從上到下滾動所有字符串。但是,選取框標記不支持面板。我怎麼能實現它。任何人都可以建議我? 在此先感謝如何在java應用程序中設置垂直選取框?

回答

0

你可以通過使用線程編寫你自己的代碼。

類跑馬燈實現Runnable { Thread t;

Marquee() 
    { 
     t = new Thread(this, "Demo Thread"); 
     t.start(); 
    } 
    public void run() 
    { 
     try 
     { 
      for(int i = 820; i>0 ;i-=5) 
      { 
       marql.setBounds(i,10,130,40);// marql label moves 
       Thread.sleep(500); 
       p3.repaint(); //p3 is a panel with layout null 
            if(i<10) 
            { 
              i = 820; 
            } 

      } 
     } 
     catch(InterruptedException e) 
     { 
      System.out.println("Thread Interrupted "+e); 
     } 
    } 
} 
相關問題