~ubuntu-branches/ubuntu/trusty/libjgoodies-forms-java/trusty

« back to all changes in this revision

Viewing changes to src/tutorial/com/jgoodies/forms/tutorial/building/FormDebugExample.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2010-02-11 16:00:46 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100211160046-e96n4h9fqbffl79b
Tags: 1.3.0-1
* New upstream release
* Bump Standards-Version to 3.8.4
* (Build)-Depends on default-jdk-doc (Closes: #567281)
* Switch to source format 3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.
 
2
 * Copyright (c) 2002-2009 JGoodies Karsten Lentzsch. All Rights Reserved.
3
3
 *
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:
30
30
 
31
31
package com.jgoodies.forms.tutorial.building;
32
32
 
33
 
import javax.swing.*;
 
33
import javax.swing.JComponent;
 
34
import javax.swing.JFrame;
 
35
import javax.swing.JTextField;
34
36
 
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;
39
42
 
40
43
/**
41
44
 * Demonstrates how to find bugs in the layout using
46
49
 * to use a leading indent column.
47
50
 *
48
51
 * @author Karsten Lentzsch
49
 
 * @version $Revision: 1.19 $
 
52
 * @version $Revision: 1.23 $
50
53
 */
51
 
 
52
 
public final class FormDebugExample {
 
54
public final class FormDebugExample extends TutorialApplication {
53
55
 
54
56
    private JTextField fileNumberField;
55
57
    private JTextField rfqNumberField;
70
72
    private JTextField deliveryDateField;
71
73
 
72
74
 
 
75
    // Launching **************************************************************
 
76
 
73
77
    public static void main(String[] args) {
74
 
        try {
75
 
            UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
76
 
        } catch (Exception e) {
77
 
            // Likely PlasticXP is not in the class path; ignore.
78
 
        }
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);
84
 
        frame.pack();
85
 
        frame.setVisible(true);
 
78
        TutorialApplication.launch(FormDebugExample.class, args);
 
79
    }
 
80
 
 
81
 
 
82
    protected void startup(String[] args) {
 
83
        JFrame frame = createFrame("Forms Tutorial :: Debug a Form");
 
84
        frame.getContentPane().add(buildPanel());
 
85
        packAndShowOnScreenCenter(frame);
86
86
    }
87
87
 
88
88
 
89
89
    // Component Creation and Initialization **********************************
90
90
 
91
91
    /**
92
 
     *  Creates and intializes the UI components.
 
92
     *  Creates and initializes the UI components.
93
93
     */
94
94
    private void initComponents() {
95
95
        fileNumberField       = new JTextField();
136
136
        builder.setLeadingColumnOffset(1);
137
137
 
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();
142
142
 
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);
147
147
 
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();
152
152
 
153
153
        FormDebugUtils.dumpAll(builder.getPanel());
154
154