1 22 package org.objectweb.joram.client.tools.admin; 23 24 import javax.swing.*; 25 import java.awt.*; 26 27 28 public class InputFormPanel extends JPanel { 29 public InputFormPanel(JLabel[] labels, JTextField[] textFields) { 30 GridBagLayout gridbag = new GridBagLayout(); 31 32 setLayout(gridbag); 33 34 GridBagConstraints c = new GridBagConstraints(); 35 c.anchor = GridBagConstraints.EAST; 36 int numLabels = labels.length; 37 38 for (int i = 0; i < numLabels; i++) { 39 c.gridwidth = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; gridbag.setConstraints(labels[i], c); 43 add(labels[i]); 44 45 c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; 47 c.weightx = 1.0; 48 gridbag.setConstraints(textFields[i], c); 49 add(textFields[i]); 50 } 51 } 52 } 53 | Popular Tags |