user3196130
user3196130

Reputation: 31

Nested tabs in Java

i'm trying to make nested tabs in java . It works but how can i resize my nested tabs ? ( addStudent, addTeacher ) because when it runs, they are very narrow. Thx for help

    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);

Upvotes: 0

Views: 499

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347334

Change the layout manager of addPanel to a BorderLayout

This will allow tp2 to occupy the entire available space provided by addPanel and tp

I'd also be careful with nested tabs, it becomes very messy and confusing to user very quickly

Upvotes: 2

Related Questions