Also ich möchte 9 Komponenten in einem Panel anordnen nur läuft das noch nicht so ganz wie ich es mir vorstelle:
es Soll so aussehen
------------------------------------------------
| Label | TextField.................... | button|
| Label | TextField.................... | button|
| Label | TextField.................... | button|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
------------------------------------------------
und so wird es angezeigt:
------------------------------------------------
| |
| |
| Label | TextField | button|
| |
| ________________________________ |
| |
| |
| Label | TextField | button|
| |
| ________________________________ |
| |
| |
| Label | TextField | button|
| |
| |
------------------------------------------------
Habe es versucht mit einem SpringLayout zu lösen und etwas besseres fällt mir nicht ein
es Soll so aussehen
------------------------------------------------
| Label | TextField.................... | button|
| Label | TextField.................... | button|
| Label | TextField.................... | button|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
------------------------------------------------
und so wird es angezeigt:
------------------------------------------------
| |
| |
| Label | TextField | button|
| |
| ________________________________ |
| |
| |
| Label | TextField | button|
| |
| ________________________________ |
| |
| |
| Label | TextField | button|
| |
| |
------------------------------------------------
Habe es versucht mit einem SpringLayout zu lösen und etwas besseres fällt mir nicht ein
Code:
filepathCard.setSize(400,100);
filepathCard.setMaximumSize(new Dimension(400,100));
configPanel.add(filepathCard,"FilePath");
filepathCard.setLayout(new javax.swing.SpringLayout());
//Online Pfad
onlinepfadLabel.setText("Online Pfad");
onlinepfadButton.setIcon(new javax.swing.ImageIcon(cfg.getGifPath()+"\\toolbarButtonGraphics\\general\\open16.gif"));
filepathCard.add(onlinepfadLabel);
filepathCard.add(onlinepfadTextfield);
filepathCard.add(onlinepfadButton);
//Lokaler Pfad
lokalpfadLabel.setText("Lokaler Pfad");
lokalpfadButton.setIcon(new javax.swing.ImageIcon(cfg.getGifPath()+"\\toolbarButtonGraphics\\general\\open16.gif"));
filepathCard.add(lokalpfadLabel);
filepathCard.add(lokalpfadTextfield);
filepathCard.add(lokalpfadButton);
//Gif Pfad
gifpfadLabel.setText("Gif Pfad");
gifpfadButton.setIcon(new javax.swing.ImageIcon(cfg.getGifPath()+"\\toolbarButtonGraphics\\general\\open16.gif"));
filepathCard.add(gifpfadLabel);
filepathCard.add(gifpfadTextfield);
filepathCard.add(gifpfadButton);
//Layout
SpringUtilities.makeCompactGrid(filepathCard,
3, 3, //rows, cols
6, 6, //initX, initY
6, 6); //xPad, yPad