1 /******************************************************************** 2 * 3 * This library is free software; you can redistribute it and/or 4 * modify it under the terms of the GNU Library General Public 5 * License as published by the Free Software Foundation; either 6 * version 2 of the License, or (at your option) any later version. 7 * 8 * This library is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * Library General Public License for more details. 12 * 13 * You should have received a copy of the GNU Library General Public 14 * License along with this library; if not, write to the 15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 * Boston, MA 02111-1307, USA. 17 * 18 * @author: Copyright (C) Tim Carver 19 * 20 ********************************************************************/ 21 package org.emboss.jemboss.gui.form; 22 23 import java.awt.Dimension; 24 25 import javax.swing.Box; 26 import javax.swing.BoxLayout; 27 import javax.swing.JTextField; 28 29 class MultiTextField 30 { 31 /** text fields */ 32 private JTextField textField[]; 33 private LabelTextBox labs[]; 34 private int num; 35 MultiTextField(final int num, final LabelTextBox labs[])36 public MultiTextField(final int num, final LabelTextBox labs[]) 37 { 38 this.num = num; 39 this.textField = new JTextField[num]; 40 this.labs = labs; 41 } 42 getBoxOfTextFields()43 public Box getBoxOfTextFields() 44 { 45 Box ybox = new Box(BoxLayout.Y_AXIS); 46 Dimension d = new Dimension(150, 30); 47 for(int i=0; i<num; i++) 48 { 49 Box xbox = new Box(BoxLayout.X_AXIS); 50 textField[i] = new JTextField(); 51 52 textField[i].setPreferredSize(d); 53 textField[i].setMinimumSize(d); 54 textField[i].setMaximumSize(d); 55 56 xbox.add(textField[i]); 57 xbox.add(labs[i]); 58 xbox.add(Box.createHorizontalGlue()); 59 ybox.add(xbox); 60 ybox.add(Box.createVerticalStrut(10)); 61 } 62 63 return ybox; 64 } 65 getJTextField()66 public JTextField[] getJTextField() 67 { 68 return textField; 69 } 70 }