Möchte das mein Panel das viele JButtons bekommt scrollbar wird... ohne den Scroller klappt das auch, also alle JButtons werden schön untereinander angezeigt. Doch weiß ich nicht wie ich das panel halt scrollbar machen kann...
ich hoffe einer weiß rat, nun folgt ein kleiner Code-Auszug:
Würde mich über hilfe wirklich sehr freuen.
//edit: hoffe ich hab alles drin was wichtig ist,
// Edit2: achja das problem:"das JScrollPane bleibt winzig klein, wenn ich aber draufdrück aktiviert sich trotzdem der Actionlistener des JButtons

Code:
GridBagLayout aufLay = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
GridLayout kleineB = new GridLayout(0,1);
JPanel gesammt = new JPanel();
JPanel panelLinks = new JPanel();
JPanel panelRechts = new JPanel();
panelLinks.setLayout(kleineB);
JButton butt[] = new JButton[länge];
for(int i=0; i<länge ;i++){
if(name.equals((String)"TWINS & AMS")){
butt[i] = new JButton(""+i);
butt[i].addActionListener(k);
panelLinks.add(butt[i]);
}
gesammt.setLayout(aufLay);
JScrollPane scroller = new JScrollPane(panelLinks);
gesammt.add(scroller);
gesammt.add(panelRechts,constraints);
this.add(gesammt);
this.setVisible(true);}
Würde mich über hilfe wirklich sehr freuen.

//edit: hoffe ich hab alles drin was wichtig ist,
// Edit2: achja das problem:"das JScrollPane bleibt winzig klein, wenn ich aber draufdrück aktiviert sich trotzdem der Actionlistener des JButtons
Zuletzt bearbeitet: