> List of tutorials for developing a Fat-Client in Java

Index – Advanced Java-Fat-Client development

Code for Class JS_ProjAssist_Project

* For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

  • The owner of this web-site (www.javascout.biz) is not responsible for the content of web-sites linked within this document or linked within other documents of www.javascout.biz.

  • If this document or other documents of this web-site (www.javascout.biz) infringes your rights or you think that rights of others (third parties) are infringed, please inform the author.
    An e-mail can be sent by clicking onto the 'hungry mailbox' in the upper right corner.

Last revision of this document:
2006-09-05

This is document contains the code for Class JS_ProjAssist_CommandCenter.
This class contains variables and methods used for all StartFrames (CommandCenter) of application-programs.
For easy 'cut and paste' ;-)

package js_projassist.clientframes;

import java.awt.*;
import javax.swing.*;

import js_base.frame.*;

/**
 *
 * @author
kurt@javascout.biz
 * @date 2006-09-05
 *
 * @description
 * Class with the User-Interface to maintain the Business-Task 'Project'.
 * The Business-Task 'Project' comprises the definition of Projects and
 * Languages of the respective Project.
 * To the combination Project/Language are other data
 * (e.g. language dependent text for GUI-elements or error-messages) attached.
 
*
 * @change-log
 * when          who          why
 * --------------------------------------------------------
 *
 */

public class JS_ProjAssist_Project extends
JSBS_TaskFrame {
/*
 * -------------------------------
 * GUI-elements individual for this Task. */
   protected JLabel lbl_ProjectCode;
   protected JTextField txt_ProjectCode;

   protected JLabel lbl_LanguageCode;
   protected JTextField txt_LanguageCode;

   protected JLabel lbl_MainTargetDirectory;
   protected JTextField txt_MainTargetDirectory;

   protected JButton btn_MainTargetDirectorySelection;
/*
 * -------------------------------
 * Constructor of the class */
    public JS_ProjAssist_Project(JSBS_StartFrame parmCC){
      super(parmCC);
      initialize_before_frame();
      initialize_frame();
      initialize_after_frame();
    }

/*
 * -------------------------------
 * Create the GUI-elements specific for this class.
 * This also includes the overwriting of methods in the inherited class.
 * */
    protected JPanel get_pnl_DetailFields() {
/* Auto-create the GUI-element if it does not already exist. */
      if (pnl_DetailFields == null) {
        try {
          pnl_DetailFields = new JPanel();
          pnl_DetailFields.setName("pnl_DetailField");
          pnl_DetailFields.setLayout(new GridBagLayout());
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_lbl_ProjectCode = new GridBagConstraints();
          gbc_lbl_ProjectCode.gridx = 0;
          gbc_lbl_ProjectCode.gridy = 0;
          gbc_lbl_ProjectCode.fill = GridBagConstraints.HORIZONTAL;
          gbc_lbl_ProjectCode.weightx = 1;
          gbc_lbl_ProjectCode.anchor = GridBagConstraints.LINE_END;
          gbc_lbl_ProjectCode.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_lbl_ProjectCode(), gbc_lbl_ProjectCode);
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_txt_ProjectCode = new GridBagConstraints();
          gbc_txt_ProjectCode.gridx = 1;
          gbc_txt_ProjectCode.gridy = 0;
          gbc_txt_ProjectCode.fill = GridBagConstraints.HORIZONTAL;
          gbc_txt_ProjectCode.weightx = 1;
          gbc_txt_ProjectCode.anchor = GridBagConstraints.LINE_START;
          gbc_txt_ProjectCode.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_txt_ProjectCode(), gbc_txt_ProjectCode);
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_lbl_LanguageCode = new GridBagConstraints();
          gbc_lbl_LanguageCode.gridx = 0;
          gbc_lbl_LanguageCode.gridy = 1;
          gbc_lbl_LanguageCode.fill = GridBagConstraints.HORIZONTAL;
          gbc_lbl_LanguageCode.weightx = 1;
          gbc_lbl_LanguageCode.anchor = GridBagConstraints.LINE_END;
          gbc_lbl_LanguageCode.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_lbl_LanguageCode(), gbc_lbl_LanguageCode);
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_txt_LanguageCode = new GridBagConstraints();
          gbc_txt_LanguageCode.gridx = 1;
          gbc_txt_LanguageCode.gridy = 1;
          gbc_txt_LanguageCode.fill = GridBagConstraints.HORIZONTAL;
          gbc_txt_LanguageCode.weightx = 1;
          gbc_txt_LanguageCode.anchor = GridBagConstraints.LINE_START;
          gbc_txt_LanguageCode.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_txt_LanguageCode(), gbc_txt_LanguageCode);
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_lbl_MainTargetDirectory = new GridBagConstraints();
          gbc_lbl_MainTargetDirectory.gridx = 0;
          gbc_lbl_MainTargetDirectory.gridy = 2;
          gbc_lbl_MainTargetDirectory.fill = GridBagConstraints.HORIZONTAL;
          gbc_lbl_MainTargetDirectory.weightx = 1;
          gbc_lbl_MainTargetDirectory.anchor = GridBagConstraints.LINE_END;
          gbc_lbl_MainTargetDirectory.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_lbl_MainTargetDirectory(), gbc_lbl_MainTargetDirectory);
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_txt_MainTargetDirectory = new GridBagConstraints();
          gbc_txt_MainTargetDirectory.gridx = 0;
          gbc_txt_MainTargetDirectory.gridy = 3;
          gbc_txt_MainTargetDirectory.fill = GridBagConstraints.HORIZONTAL;
          gbc_txt_MainTargetDirectory.weightx = 1;
          gbc_txt_MainTargetDirectory .gridwidth = 2;
          gbc_txt_MainTargetDirectory.anchor = GridBagConstraints.LINE_START;
          gbc_txt_MainTargetDirectory.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_txt_MainTargetDirectory(), gbc_txt_MainTargetDirectory);
/* 
 * Define GridBagConstraints for the element to be added. */
          
GridBagConstraints gbc_btn_MainTargetDirectorySelection = new GridBagConstraints();
          gbc_btn_MainTargetDirectorySelection.gridx = 2;
          gbc_btn_MainTargetDirectorySelection.gridy = 2;
          gbc_btn_MainTargetDirectorySelection.fill = GridBagConstraints.BOTH;
          gbc_btn_MainTargetDirectorySelection.weightx = 1;
          gbc_btn_MainTargetDirectorySelection.gridheight = 2;
          gbc_btn_MainTargetDirectorySelection.anchor = GridBagConstraints.LINE_START;
          gbc_btn_MainTargetDirectorySelection.insets = new Insets(3,3,3,3);
/* Add the element to the panel; element-position is controlled by GridBagConstraints. */
          
get_pnl_DetailFields().add(get_btn_MainTargetDirectorySelection(),
                                     gbc_btn_MainTargetDirectorySelection);

        }
        catch (Throwable Exc) {
          System.out.println("Error while building pnl_DetailFields in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return pnl_DetailFields;
    }

/*
 * ------------------------------- */
    protected JLabel get_lbl_ProjectCode() {
/* Auto-create the GUI-element if it does not already exist. */
      if (lbl_ProjectCode == null) {
        try {
          lbl_ProjectCode = new JLabel();
          lbl_ProjectCode.setName("lbl_ProjectCode");
          lbl_ProjectCode.setText(". . . . .");
          lbl_ProjectCode.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        catch (Throwable Exc) {
          System.out.println("Error while building lbl_ProjectCode in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return lbl_ProjectCode;
    }

/*
 * ------------------------------- */
    public JTextField get_txt_ProjectCode() {
/* Auto-create the GUI-element if it does not already exist. */
      if (txt_ProjectCode == null) {
        try {
          txt_ProjectCode = new JTextField();
          txt_ProjectCode.setName("txt_ProjectCode");
        }
        catch (Throwable Exc) {
          System.out.println("Error while building txt_ProjectCode in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return txt_ProjectCode;
    }

/*
 * ------------------------------- */
    protected JLabel get_lbl_LanguageCode() {
/* Auto-create the GUI-element if it does not already exist. */
      if (lbl_LanguageCode == null) {
        try {
          lbl_LanguageCode = new JLabel();
          lbl_LanguageCode.setName("lbl_LanguageCode");
          lbl_LanguageCode.setText(". . . . .");
          lbl_LanguageCode.setHorizontalAlignment(SwingConstants.TRAILING);
        }
        catch (Throwable Exc) {
          System.out.println("Error while building lbl_LanguageCode in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return lbl_LanguageCode;
    }

/*
 * ------------------------------- */
    public JTextField get_txt_LanguageCode() {
/* Auto-create the GUI-element if it does not already exist. */
      if (txt_LanguageCode == null) {
        try {
          txt_LanguageCode = new JTextField();
          txt_LanguageCode.setName("txt_LanguageCode");
        }
        catch (Throwable Exc) {
          System.out.println("Error while building txt_LanguageCode in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return txt_LanguageCode;
    }

/*
 * ------------------------------- */
    protected JLabel get_lbl_MainTargetDirectory() {
/* Auto-create the GUI-element if it does not already exist. */
      if (lbl_MainTargetDirectory == null) {
        try {
          lbl_MainTargetDirectory = new JLabel();
          lbl_MainTargetDirectory.setName("lbl_MainTargetDirectory");
          lbl_MainTargetDirectory.setText(". . . . .");
        }
        catch (Throwable Exc) {
          System.out.println("Error while building lbl_MainTargetDirectory in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return lbl_MainTargetDirectory;
    }

/*
 * ------------------------------- */
    public JTextField get_txt_MainTargetDirectory() {
/* Auto-create the GUI-element if it does not already exist. */
      if (txt_MainTargetDirectory == null) {
        try {
          txt_MainTargetDirectory = new JTextField();
          txt_MainTargetDirectory.setName("txt_MainTargetDirectory");
        }
        catch (Throwable Exc) {
          System.out.println("Error while building txt_MainTargetDirectory in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return txt_MainTargetDirectory;
    }

/*
 * ------------------------------- */
    public JButton get_btn_MainTargetDirectorySelection() {
/* Auto-create the GUI-element if it does not already exist. */
      if (btn_MainTargetDirectorySelection == null) {
        try {
          btn_MainTargetDirectorySelection = new JButton();
          btn_MainTargetDirectorySelection.setName("btn_MainTargetDirectorySelection");
          btn_MainTargetDirectorySelection.setActionCommand("btn_MainTargetDirectorySelection");
          btn_MainTargetDirectorySelection.addActionListener(this);
        }
        catch (Throwable Exc) {
          System.out.println("Error while building btn_MainTargetDirectorySelection in class JS_ProjAssist_Project");
          Exc.printStackTrace();
        }
      }
      return btn_MainTargetDirectorySelection;
    }

/*
 * -------------------------------
 * Method with code to be executed before the GUI is build */
    private void initialize_before_frame() {
    }
 
/*
 * -------------------------------
 * Method with code to construct and display the GUI (Graphic User Interface) */
    private void initialize_frame() {
      setVisible(true);
      setSize(600, 400);
/* Use the standard GUI-layout (without currency-selection)
 * as defined in the inherited class (JSBS_StartFrame). */
      setContentPane(get_pnl_Main());
    }

 
/*
 * -------------------------------
 * Method with code to be executed after the GUI is build */
    private void initialize_after_frame() {
/* Assign the language dependent text to the GUI-elements.
 * The method used is defined in the imported library JSBS_Base. */
      JSBS_FrameServices.processLanguageDependantElements(this);
    
}

}