2014-02-07 138 views
0

我試圖在java中製作嵌套選項卡。它的作品,但我怎麼能調整我的嵌套選項卡? (addStudent,addTeacher),因爲它運行時,它們非常窄。 THX的幫助Java中的嵌套選項卡

JPanel students = new JPanel(); 
    JPanel teachers = new JPanel(); 
    JPanel lessons = new JPanel(); 
    JPanel courses = new JPanel(); 
    JPanel addPanel = new JPanel(); 
    JPanel translations = new JPanel(); 
    JPanel addStudent = new JPanel(); 
    JPanel addTeacher = new JPanel(); 

    JButton bAddStudent = new JButton(); 
    //addStudent.setBounds(x, y, width, height); 

    tp=new JTabbedPane(); 
    tp2 = new JTabbedPane(); 
    Container pane = this.getContentPane(); 
    pane.add(tp); 
    tp.addTab("Uczniowie",students); 
    tp.addTab("Nauczyciele",teachers); 
    tp.addTab("Harmonogram zajec",lessons); 
    tp.addTab("Kursy",courses); 
    tp.addTab("Tlumaczenia", translations); 
    tp.addTab("Panel administratora", addPanel); 

    tp2.add("Nowy uczen",addStudent); 
    tp2.add("Nowy nauczyciel",addTeacher); 
    addPanel.add(tp2); 
+0

重複? http://stackoverflow.com/questions/6994352/how-to-set-jtabbedpane-tab-height-width-background-foreground-color-both-select –

+0

我想調整我的nestet選項卡,所以我不認爲我在複製,對不起。有任何想法嗎 ? – user3196130

回答

2

變化addPanel佈局管理器到BorderLayout

這將使tp2佔據由addPaneltp

所提供的全部可用空間,我還小心嵌套標籤,它變得非常混亂和用戶非常迅速地混淆