1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| class FormGenerator extends JFrame{
private static final long serialVersionUID = 1L;
private String space=" ";
public void test(Object o){
System.out.println(o);
}
XYSTagModelGroup tmg;
ArrayList mgSimpleList,attributeList,simpleList,nSimpleList,tagElementList,tagModelGroupList;
XYSTagElement tagElem, tagParentElem;
XSDSimpleTypeDefinition simType;
XSDFeature com;
public FormGenerator()
{
create(tmg,mgSimpleList);
create(attributeList,simpleList,nSimpleList,tagElementList,tagModelGroupList,tagElem,tagParentElem);
traverseList(attributeList,simpleList,nSimpleList,tagElementList,tagModelGroupList,tagElem);
createSimpleType(simType, com);
test(attributeList,simpleList,nSimpleList,tagElementList,tagModelGroupList);
setTitle("Form Generator");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
JButton button1 = new JButton("Ok");
JButton button2 = new JButton("Cancel");
Box hbox3 = Box.createHorizontalBox();
hbox3.add(button1);
use "glue" to push the two buttons apart
hbox3.add(Box.createGlue());
hbox3.add(button2);
add the three horizontal boxes inside a vertical box
Box vbox = Box.createVerticalBox();
vbox.add(Box.createGlue());
vbox.add(hbox3);
contentPane.add(vbox, BorderLayout.CENTER);
}
static int layer=1;
String[][] sysTableData;
Box vbox = Box.createVerticalBox();
public void addBox(Box hbox,String labelText, final JTextField field)
{
field.setMaximumSize(field.getPreferredSize());
hbox.add(new JLabel(labelText));
// separate with a 10-pixel strut
hbox.add(Box.createHorizontalStrut(10));
hbox.add(field);
vbox.add(Box.createGlue());
vbox.add(hbox);
}
protected void create(XYSTagModelGroup tmg, ArrayList mgSimpleList){
if(tmg.getTag()!=null){
if(tmg.getTag().equals("NOBJ")){
JTextField tf = new JTextField("",10);
Box hbox = Box.createHorizontalBox();
contentPane.add(vbox,BorderLayout.CENTER);
addBox(hbox,space+tmg.getModelGroup().getName(), tf); |
Partager