//************************************************************* //           タブ切り替え動作確認 //           「TabbedPaneTest」 // //          作 成 者:ルート高菜    //          作成開始月:2007/4 //          最終更新月:2007/11 [TN113/J103] //************************************************************* import java.awt.Container; import java.awt.GridLayout; import javax.swing.ImageIcon; import javax.swing.SwingConstants; import javax.swing.JApplet; import javax.swing.JTabbedPane; public class TabbedPaneTest extends JApplet { //Eclipseの場合、シリアライズ可能クラスでこれがないと警告が出る private static final long serialVersionUID=0; // public void init(){ // JTabbedPane tab01=new JTabbedPane(); tab01.add(new TabbedPaneTestPanel("JTabbedPane.add() 1"),"1"); tab01.add(new TabbedPaneTestPanel("JTabbedPane.add() 2"),"2"); tab01.add(new TabbedPaneTestPanel("JTabbedPane.add() 3"),"3"); // JTabbedPane tab02=new JTabbedPane(SwingConstants.TOP); tab02.addTab("1",new ImageIcon(getImage(getCodeBase(),"image/01.gif")),new TabbedPaneTestPanel("JTabbedPane.addTab() image+text"),"JTabbedPane.addTab() image+text"); tab02.addTab("2",null,new TabbedPaneTestPanel("JTabbedPane.addTab() text"),"JTabbedPane.addTab() text"); tab02.addTab("",new ImageIcon(getImage(getCodeBase(),"image/02.gif")),new TabbedPaneTestPanel("JTabbedPane.addTab() image"),"JTabbedPane.addTab() image"); // JTabbedPane tab11=new JTabbedPane(SwingConstants.TOP,JTabbedPane.WRAP_TAB_LAYOUT); for(int t=0;t<20;t++){ tab11.add(new TabbedPaneTestPanel("JTabbedPane.WRAP_TAB_LAYOUT "+t),""+t); } // JTabbedPane tab12=new JTabbedPane(SwingConstants.TOP,JTabbedPane.SCROLL_TAB_LAYOUT); for(int t=0;t<20;t++){ tab12.add(new TabbedPaneTestPanel("JTabbedPane.SCROLL_TAB_LAYOUT "+t),""+t); } // JTabbedPane tab21=new JTabbedPane(SwingConstants.LEFT); tab21.add(new TabbedPaneTestPanel("SwingConstants.LEFT 1"),"1"); tab21.add(new TabbedPaneTestPanel("SwingConstants.LEFT 2"),"2"); tab21.add(new TabbedPaneTestPanel("SwingConstants.LEFT 3"),"3"); // JTabbedPane tab22=new JTabbedPane(SwingConstants.RIGHT); tab22.add(new TabbedPaneTestPanel("SwingConstants.RIGHT 1"),"1"); tab22.add(new TabbedPaneTestPanel("SwingConstants.RIGHT 2"),"2"); tab22.add(new TabbedPaneTestPanel("SwingConstants.RIGHT 3"),"3"); // JTabbedPane tab23=new JTabbedPane(SwingConstants.BOTTOM); tab23.add(new TabbedPaneTestPanel("SwingConstants.BOTTOM 1"),"1"); tab23.add(new TabbedPaneTestPanel("SwingConstants.BOTTOM 2"),"2"); tab23.add(new TabbedPaneTestPanel("SwingConstants.BOTTOM 3"),"3"); // JTabbedPane tab24=new JTabbedPane(SwingConstants.TOP); tab24.add(new TabbedPaneTestPanel("SwingConstants.TOP 1"),"1"); tab24.add(new TabbedPaneTestPanel("SwingConstants.TOP 2"),"2"); tab24.add(new TabbedPaneTestPanel("SwingConstants.TOP 3"),"3"); // //コンテナ枠 Container cp=getContentPane(); cp.setLayout(new GridLayout(4,2)); cp.add(tab01); cp.add(tab02); cp.add(tab11); cp.add(tab12); cp.add(tab21); cp.add(tab22); cp.add(tab23); cp.add(tab24); } }