Hallo Leute,
hört sich vielleicht lustig an, versuche aber schon den halben Tag, eine Scrollbar in einen meiner Tabs zu integrieren. Ich bekomm's einfach nicht hin(Java Anfänger).
Also hier mal der Code:
[HIGHLIGHT="Java"]public class Test extends JFrame {
private static JTabbedPane tabPane = new JTabbedPane();
private static JPanel tab1 = new JPanel();
private static JPanel tab2 = new JPanel();
private static JPanel tab3 = new JPanel();
private static JPanel tab4 = new JPanel();
public Test() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationByPlatform(true);
this.setSize(800, 600);
this.setTitle("Akte");
tabPane.addTab("Auflisten", tab1);
tabPane.addTab("Durchblättern", tab2);
tabPane.addTab("Hinzufügen", tab3);
tabPane.addTab("Verändern", tab4);
tab1.setLayout(new BoxLayout(tab1, BoxLayout.Y_AXIS));
this.add(tabPane, BorderLayout.CENTER);
this.setVisible(true);
}[/HIGHLIGHT]
Der Platz im ersten Tab reicht für den Inhalt nicht, deswegen brauche ich eine Scrollbar. Ich habe schon alles mögliche versucht, mit JScrollPane usw.. Habe ich schon in meinem Code was falsch gemacht?
Ich hoffe auf eure Hilfe :rtfm:
Beste Grüße
hört sich vielleicht lustig an, versuche aber schon den halben Tag, eine Scrollbar in einen meiner Tabs zu integrieren. Ich bekomm's einfach nicht hin(Java Anfänger).
Also hier mal der Code:
[HIGHLIGHT="Java"]public class Test extends JFrame {
private static JTabbedPane tabPane = new JTabbedPane();
private static JPanel tab1 = new JPanel();
private static JPanel tab2 = new JPanel();
private static JPanel tab3 = new JPanel();
private static JPanel tab4 = new JPanel();
public Test() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationByPlatform(true);
this.setSize(800, 600);
this.setTitle("Akte");
tabPane.addTab("Auflisten", tab1);
tabPane.addTab("Durchblättern", tab2);
tabPane.addTab("Hinzufügen", tab3);
tabPane.addTab("Verändern", tab4);
tab1.setLayout(new BoxLayout(tab1, BoxLayout.Y_AXIS));
this.add(tabPane, BorderLayout.CENTER);
this.setVisible(true);
}[/HIGHLIGHT]
Der Platz im ersten Tab reicht für den Inhalt nicht, deswegen brauche ich eine Scrollbar. Ich habe schon alles mögliche versucht, mit JScrollPane usw.. Habe ich schon in meinem Code was falsch gemacht?
Ich hoffe auf eure Hilfe :rtfm:
Beste Grüße
Zuletzt bearbeitet von einem Moderator: