Java Swing Education
[Previous] [Main] [Next]

Java Swing Education


I am going to expand this soon, but here a some links into a class that JGuiGen generated. These links show you the various major parts of the application.

As a work in progress JGuiGen is being refactored so that for each type of Visual Componpent (JTextField, JFormattedTextField, Telephone, SSN, BoundedTextField, etc. ) the actual code used by JGuiGen is in a folder. The code snippets will look something like the following:

JxTextField_1_Declaration.java
JxTextField_2_Instantiation.java
JxTextField_3_Initialization.java
JxTextFeild_4_Database_to_OrigDataBean.java
JxTextField_5_OrigDataBean_to_Visual_Comp.java
JxTextField_7_Visual_Comp_Validation.java
JxTextField_8_Visual_Comp_to_RevisedDataBean.java
JxTextField_9_Test_RevisedDataBean_4_Errors.java
JxTextField_10_Test_RevisedDataBean_4_Changes.java
JxTextField_11_RevisedDataBean_to_Database.java
JxTextField_12_Text_RevisedDataBean_to_JTable.java
and more.
BoundedTextField_1_Declaration.java
BoundedTextField_2_Instantiation.java
BoundedTextField_3_Initialization.java
JxTextFeild_4_Database_to_OrigDataBean.java
BoundedTextField_5_OrigDataBean_to_Visual_Comp.java
BoundedTextField_7_Visual_Comp_Validation.java
BoundedTextField_8_Visual_Comp_to_RevisedDataBean.java
BoundedTextField_9_Test_RevisedDataBean_4_Errors.java
BoundedTextField_10_Test_RevisedDataBean_4_Changes.java
BoundedTextField_11_RevisedDataBean_to_Database.java
BoundedTextField_12_Text_RevisedDataBean_to_JTable.java

JGuigen will loop through all the columns needed to generate an application an grab a copy of the appropriate snippet, merge in the column name, class name, etc. and add it to the generated applicaiton. This repository of snippets will make a great "How do I..." repository and make it easy to test new validation schemes or add new Visual Componants. This system also lets us use the error testing of the major IDE's when creating the snippets.




JxFrame Example - Includes for borders    

SECTION 1- SETUP CONSTANTS and DECLARE VISUAL COMPONANTS

JxFrame Example - JxFrame Declration & Setting Title

JxFrame Example - Declaration of border variables

JxFrame Example - JxFrame Declaration for inside class

Bounded Text Field Example - declare the field

JxFrame Example - Pass JxFrame into class

/** SECTION 2 - START APPLICATION - ADD ATTRIBUTES TO INSTANTIAED VARIABLE & VISUAL COMPONANTS*/

#JxFrame Example - Set Passed in JxFrame to a local field in class #

JxFrame Example - Replace coffee cup icon on frame

#JxFrame Example - setting the JxFrame border #

JxFrame Example - Let user close the frame

#/** SECTION XXI - HANDLE CLOSING THE WINDOW (Calling program then sets to NULL) */ #

JxFrame Example - JxFrame Windows Listener in Class - check if leaving class is okay

/** SECTION 3 - MORE SETUP OF COLUMN VARS - INCLUDING BUTTONS and LISTENERS */

Bounded Text Field Example - set ToolTips and Assistive Technology

Telephone mask - set JFormattedTextField Mask

JxFrame Example - Example of passing frame into a JDialog

/** SECTION 4 - SETUP POPUP MENU */

/** SECTION 7 - LIST Columns to call BuildLayout */

/** SECTION 8 - Commented Column for BuildLayout */

/* SECTION 9- ROWLAYOUT MANAGER - Build Rows */

Bounded Text Field Example - add to layout manager

/** SECTION 5- MAIN DRIVER SECTION - DO THE WORK */

/** SECTION 6 - CHECKS ALL FIELDS FOR ERRORS */

/** SECTION 10- CHECK FOR CHANGED FIELDS - SETUP UPDATE and INSERT STRINGS */

/** SECTION 11- GET CHANGED DATA FROM VISUAL COMPONANTS & BUILD NEWROWOBJ */

Bounded Text Field Example - Test if data changed, set up update & insert strings

#Telephone mask - get data from component- set default to blank #

/** SECTION 12- GETS DATA FROM DATABASE TABLE, FILLS VISUAL COMPONANTS and SETS UP JTABLE */

/** SECTION 13-GET RESULT SET FROM DATABASE and SETUP JTABLE RENDERERS, SORTER, ETC */

/** SECTION 14- GET DATA IN RESULTSET AND PUTS DATA INTO ROWOBJ */

/** SECTION 15- TAKE DATA FROM ROWOBJ AND PLACE IN VISUAL COMOPNANTS */

Bounded Text Field Example - Fill component from resultSet

Telephone mask - get data from component- get data from SQL ResultSet

/** SECTION 16- UPDATE ONE ROW IN TABLE WITH SAVED EDIT CHANGES */

Bounded Text Field Example - Reset hld value to value in component after save

/** SECTION 17- CLEAR VISUAL COMPONANTS - PREPARE FOR ADD NEW ROW TO TABLE */

/** SECTION 18- MISCELLANEOUS METHOS & SAVE BUTTON EG JTABLE MODEL & RENDERS, SCROLL SETTINS, SAVE SETTINS, PAINT VIUALS COMPONANTS TO PRINTER */

/** SECTION 19- BTNSAVE - DO INSERT or CHECK THAT ROW HASN'T CHANGED DURING EDIT AND IF OKAY DO UPDATE */

/** SECTION 20- MAIN METHOD - USED TO RUN CLASS STANDALONE - RESTORES SCREEN SIZE & PLAF TO USER PREFERENCE */

#JxFrame Example - JxFrame Setup - size and location on screen #

#JxFrame Example - JxFrame Window Listener in main (set to null when done) #