JGoodies

From Informatics

Jump to: navigation, search

It is important to know what the dialog box units, or dlus represent. This would be much easier if these dlu specs were represented as classes, but instead they are strings so you cannot rely on your IDE to figure this out for you at compile time. These are not pixels, and need to be specified properly or you will get a runtime error. In the example below, right:20dlu says, "move everything to the right by 20dlus". The lines:

indexServicePanelBuilder.appendColumn("5dlu");
indexServicePanelBuilder.appendColumn("45dlu");

say, "on our form, let's create 2 columns, the first that is 5 dlus, and the second a column that is 45 dlus." That is, when you next add the line:

indexServicePanelBuilder.append("host", hostField);

5 dlus are reserved for the text name host, and 45dlus for the hostField.

DefaultFormBuilder indexServicePanelBuilder = new DefaultFormBuilder(new FormLayout("right:20dlu"));
 final JTextField hostField = new JTextField(host);
 final JTextField portField = new JTextField("" + port);
 final JTextField filterField = new JTextField("" + filter);	
 indexServicePanelBuilder.appendColumn("5dlu");
 indexServicePanelBuilder.appendColumn("45dlu");
 indexServicePanelBuilder.append("host", hostField);
 indexServicePanelBuilder.append("port", portField);
 indexServicePanelBuilder.append("filter", filterField);
Personal tools