Hallo,
in einer Applikation möchte ich eine reihe von Komponenten automatisch erzeugen. mit einer "for" Schleiife erzeuge ich ohne Problem Panel (JPanel[] myPanel = new JPanel[10]), Buttons, Labels etc.... Das Ganze schaut ungefähr so aus:
Aber Boxen scheinen nicht mit Arrays arbeiten zu können. Was für Lösungen hätte ich? Ich hätte gern etwas, wie:
Aber so geht es leider nicht.
Danke.
in einer Applikation möchte ich eine reihe von Komponenten automatisch erzeugen. mit einer "for" Schleiife erzeuge ich ohne Problem Panel (JPanel[] myPanel = new JPanel[10]), Buttons, Labels etc.... Das Ganze schaut ungefähr so aus:
Code:
for (int i=0;i<aZeilen;i++) {
for (int j=0;j<aSpalten;j++) {
if (j==0) {
q[i] = new JLabel(myQuestions[i][j]);
bg[i] = new ButtonGroup();
p[i] = new JPanel();
p[i].setLayout(myLayout1);
p[i].add(q[i]);
add(p[i], myFlow);
Code:
Box[] myBox = Box.createVerticalBox();
Danke.