How-to's are frequently updated

How-to get a JEasy Object

// oht is the hashtable were all JEasy objects are stored by their id.
// Get the JEObject by his name and cast it.
JEPanel jep = (JEPanel)oht.get("PA_MyPanel");

How-to get a Swing component from an JEasy JEObject

// First get the JEObject by his name and cast it.
JEPanel jep = (JEPanel)oht.get("PA_MyPanel");
// now get the JPanel by a method of JEPanel
JPanel swingpanel = jep.getPanel();

How-to bring a dialog on top

// First get the JEObject by his name and cast it.
JEDialog jo = (JEDialog) oht.get("DL_AddBoxwithOne");
jo.show();
// and remove it by
jo.remove();

How-to work with InputVerification

// when the user navigates out of a textfield this event is used to check the entry
public boolean callBackInputVerifier(String ID, String ID_Parent, String text, int error) {
// ID is DF_MyTextfield
// text is the entry in this field
// JEasy checks each field and gives an error
if (error != JEObject.NO_INPUT_ERROR) {
        JEOptionPane op; 
        switch (error) {
                case JEObject.INPUT_ERROR_LENGTH:
                        op = (JEOptionPane) oht.get("OP_INPUT_ERROR_LENGTH");
                        op.showOptionPane();
                        return false;
                        ...
                default:
                        return true;
        }
}
// Do your own check
if (ID.equals("DF_MyTextfield")) {
        if (!text.equals("All right")) {
                // something wrong
        }
}
}

How-to work with TabbedPane events

// TabbedPanes fire ChangeEvents
/**
* Gets all ChangeEvents from TabbedPanes
* @param e                      ChangeEvent
* @param ID             JEObject
* @param ID_Parent      Parent JEObject
*/
public void callBack(ChangeEvent e, String ID, String ID_Parent) {
        // you want to do something if a panel of a tabbedpane was activated
        // your JETabbedPane may be TP_MyTabbedPane
        // your  JEPanel now activated may be PA_MyPanel
        // first look which tabbedPane has thrown the event
        if (ID.equals("TB_MyTabbedPane") {
                // get the selected JEObject
                JEObject tp = ((JETabbedPane)oht.get(ID)).getSelectedObject();
                String tpid = tp.getId();
                // do something (like backup all entries) when activating this panel
                if (tpid.equals("PA_MyPanel")) {
                        ...
                }
        }
}

How-to work with TableModel events

//To get changes of data in rows or cells get the TableModelEvent
/**
 * All events from the TableModel of the JETable are 
 * send to this callBack.
 * @param       TableModelEvent the event send by the TableModel
 * @param       ID              the id of the JEObject
 * @param       ID_parent       the id of the JEObject where the component was added
 */
public void callBack(TableModelEvent e, String ID, String ID_Parent){
        // get the JETable object from the ID
        JETable tl = (JETable)oht.get(ID);
        // get some informations out if the event
        int             iCol            = e.getColumn();
        int             iFirstRow       = e.getFirstRow();
        int             iLastRow        = e.getLastRow();       
        if (ID.equals("TL_MyTable")) {
                // get all entrys of the first changed row as an XML-message
                tl.getMessage(iFirstRow);
        }
        if (ID.equals("TL_MyTable")) {
                // or get the TableModel and read one cell
                String cellentry = tl.getTableModel().getValueAt(iFirstRow, iCol).toString();
        }                       
}

How-to get Mouse events in tables

//Example: right mouse click will popup a menu
/**
 * All Mouse events from the JETable are 
 * send to this callBack.
 * @param       AWTEvent the event send by the Table
 * @param       ID              the id of the JEObject
 * @param       ID_parent       the id of the JEObject where the component was added
 * @param       row             the row of the tableModel 
 * @param       column  the column of the tableModel  
 */     
public void callBack(AWTEvent e, String ID, String ID_Parent, int row, int column) {
        JETable jt = (JETable)oht.get(ID);              
        AbstractTableModel tm = jt.getTableModel();
        popupRow = row;
        // Some useful informations
        String cellentry = tm.getValueAt(row,column);
        String colJEasyId = jt.getColumnJEID(column));
        String colName = tm.getColumnName(column);              
        String calClass = tm.getColumnClass(column));                           
        int eid = e.getID();
        // if you need
        int cc = ((MouseEvent)e).getClickCount();
        switch (eid) {
                case MouseEvent.MOUSE_PRESSED:  
                        // right mouse button was pressed
                        if (SwingUtilities.isRightMouseButton((MouseEvent)e)) {
                                // PopUp Menu in my table
                                if (ID.equals("TL_MyTable")) {
                                        JEMenu pop = (JEMenu) oht.get("ME_MyPopUpMenu");
                                        pop.start();
                                        JPopupMenu pme = pop.getPopupMenu();
                                        pme.show((Component)e.getSource(), ((MouseEvent)e).getX(), ((MouseEvent)e).getY());
                                        }
                        }
        }
}

How-to use a message as the presentation of a business object

A message is the way to serialize the entrys of GUI-Objects like JEDatafields, 
JERadioButtons, JEListboxes, JETables, JEPanels and other JEObjects.
These JEObjects are defined as elements of the message.
The method getMessage() reads the entries of JEObjects and builds an XML string.
The method putMessage() fills the JEObjects out of an XML string.
Example:
        // get the message object
        JEMessage om = (JEMessage)oht.get("MS_MyMessage");
        // get only JEObjects with entries
        String s = om.getMessage(JEMessage.ONLY_FILLED);
The XML-String may looks like
<MS_MyMessage>
<DF_Name>Paul</DF_Name>
<DF_LastName>lastname</DF_LastName>
<DF_FirstName>firstname</DF_FirstName>
<DF_Company>company</DF_Company>
<DF_Address1>address1</DF_Address1>
</MS_MyMessage>