2
* Copyright (c) 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.
2
* Copyright (c) 2002-2009 JGoodies Karsten Lentzsch. All Rights Reserved.
4
4
* Redistribution and use in source and binary forms, with or without
5
5
* modification, are permitted provided that the following conditions are met:
31
31
package com.jgoodies.forms.tutorial.building;
33
import javax.swing.JComponent;
34
import javax.swing.JFrame;
35
import javax.swing.JTextField;
35
37
import com.jgoodies.forms.builder.DefaultFormBuilder;
36
38
import com.jgoodies.forms.debug.FormDebugPanel;
37
39
import com.jgoodies.forms.debug.FormDebugUtils;
38
40
import com.jgoodies.forms.layout.FormLayout;
41
import com.jgoodies.forms.tutorial.util.TutorialApplication;
41
44
* Demonstrates how to find bugs in the layout using
46
49
* to use a leading indent column.
48
51
* @author Karsten Lentzsch
49
* @version $Revision: 1.19 $
52
* @version $Revision: 1.23 $
52
public final class FormDebugExample {
54
public final class FormDebugExample extends TutorialApplication {
54
56
private JTextField fileNumberField;
55
57
private JTextField rfqNumberField;
70
72
private JTextField deliveryDateField;
75
// Launching **************************************************************
73
77
public static void main(String[] args) {
75
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
76
} catch (Exception e) {
77
// Likely PlasticXP is not in the class path; ignore.
79
JFrame frame = new JFrame();
80
frame.setTitle("Forms Tutorial :: Debug a Form");
81
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
82
JComponent panel = new FormDebugExample().buildPanel();
83
frame.getContentPane().add(panel);
85
frame.setVisible(true);
78
TutorialApplication.launch(FormDebugExample.class, args);
82
protected void startup(String[] args) {
83
JFrame frame = createFrame("Forms Tutorial :: Debug a Form");
84
frame.getContentPane().add(buildPanel());
85
packAndShowOnScreenCenter(frame);
89
89
// Component Creation and Initialization **********************************
92
* Creates and intializes the UI components.
92
* Creates and initializes the UI components.
94
94
private void initComponents() {
95
95
fileNumberField = new JTextField();
136
136
builder.setLeadingColumnOffset(1);
138
138
builder.appendSeparator("General");
139
builder.append("File Number", fileNumberField, 7);
140
builder.append("RFQ Number", rfqNumberField, 7);
141
builder.append("BL/MBL", blNumberField, mblNumberField); builder.nextLine();
139
builder.append("File Number:", fileNumberField, 7);
140
builder.append("RFQ Number:", rfqNumberField, 7);
141
builder.append("BL/MBL:", blNumberField, mblNumberField); builder.nextLine();
143
143
builder.appendSeparator("Addresses");
144
builder.append("Customer", customerKeyField, customerAddressField, 5);
145
builder.append("Shipper", shipperKeyField, shipperAddressField, 5);
146
builder.append("Consignee", consigneeKeyField, consigneeAddressField, 5);
144
builder.append("Customer:", customerKeyField, customerAddressField, 5);
145
builder.append("Shipper:", shipperKeyField, shipperAddressField, 5);
146
builder.append("Consignee:", consigneeKeyField, consigneeAddressField, 5);
148
148
builder.appendSeparator("Transport");
149
builder.append("Departure", departureCodeField, departurePortField, 5);
150
builder.append("Destination", destinationCodeField, destinationPortField, 5);
151
builder.append("Delivery Date", deliveryDateField); builder.nextLine();
149
builder.append("Departure:", departureCodeField, departurePortField, 5);
150
builder.append("Destination:", destinationCodeField, destinationPortField, 5);
151
builder.append("Delivery date:", deliveryDateField); builder.nextLine();
153
153
FormDebugUtils.dumpAll(builder.getPanel());