Hey everyone,

I have been looking for video tutorials on SWING class and pretty much of GUI side in Java .. I found tutorials on Oracle site but they require lots and lots of reading..

if anyone knows a good site that has videos on GUI, please share it..

Time == issue then look for something easy to follow

Cheers,

Recommended Answers

All 9 Replies

acquiring a good knowledge of a technique requires time, whether it is Swing or any other framework.

if time is your main issue, I would (very much against my own advice) use NetBeans, it can generate the Swing parts for you.

but, mind this:
you will be able to 'present' a Swing application to your company, but that doesn't mean you'll be able to create one yourself. by using a wizzard, you won't learn nor understand it any better, so I would strongly recommend, that once you have more time, you do look up those tutorials Oracle offers.

Personally, I use Netbeans to create a master GUI with basic component needed because
it is so much quicker. Besides component placement and the adjusting name
and the "code" Variable Modifiers (public static ... etc) it turns into a mess.

So once there is a master template created then you could extend as many times as you want and have different components and objectives and start learning how to hand code adding listeners and storing values,buttons etc.
As you pin point what you need to fix there is ample examples for specific needs
good luck

I'm going to (respectfully) disagree with the previous 2 posts.
Using NetBeans or another IDE to generate Swing code when you don't understand Swing will just lead you into more and more confusion. You'll get hundreds of lines of code that almost but not quite work, and you'll have no idea what to do next. Reading machine-generated code is a terrible way to learn about a subject.
Swing is a big complicated topic, so it's not easy to learn. The Oracle tutorials are of the very highest quality, and you won't find anything better. If you don't have the time (or patience) for "lots and lots of reading" then maybe you should switch to an easier subject.
The best advice I can give you is to start with the first Oracle tutorial and take them one at a time. Within each topic you can often skip the last couple of pages before moving on - it's usually pretty clear which pages are necessary for what follows.

Using NetBeans or another IDE to generate Swing code when you don't understand Swing will just lead you into more and more confusion. You'll get hundreds of lines of code that almost but not quite work, and you'll have no idea what to do next. Reading machine-generated code is a terrible way to learn about a subject.

even though the advice I offered in my first reply here, I do completely agree with you. but, the OP stated that he didn't had the time to go through the Oracle tutorials, and that he needed a quick sollution.

obviously, relying on a WYSIWYG editor doesn't do the learning process any good, which is also why I told him to go through the Oracle tutorials when he does have the time.

If there is no time to go through the tutorials, I doubt he'll have enough time to learn enough about the Swing framework to create a solid GUI, just like I don't really believe he would go reading the by NetBeans generated code once it was there. And yes, it is as you say, if he were to take that code as an example, he would be worse of than he is now, because the generated code is .. yeah well, you know what kind of structure it has, it's liking reading Tolstoj as a bedtime story to a 5 year old, while you have a decent copy of Snow white in the room.

I have to agree to some degree. relying on generated code has no learning value at all. However, putting components on panel then that on a panel and on and on could take several hours to make a simple Panel of components.
Why not slap a dozen componets perfectly on a template in 4 minutes and then dig
in like you mentioned and learn how to use them. Swing is no trivial topic. That
is what aggravates me the most about my past College instructors whom assign Complicated logic programs like Calculating pi to 27 decimal places or figuring out
The square roots of all the prime numbers or dealing a deck of cards. Swing alone
Has a billion other concepts to learn before complicated logic or time consuming
Procedures. Creating a simple Container could be extremely time consuming. Everyone should definitely build a few by hand to learn the concept of putting panels on panels.
Personally, I taught myself by loading dozens of components To a container in 5 min. and the rest has to be done by hand : adding, propertyChaneEvents, fireEvents, add popups, menus, The list goes on and on of what is needed to learn.

Swing is no trivial topic.

I hope for your sake that your current/future employer shares this point of view with you, otherwise, you'll be royally scr****.

having code generated and just "digging in" to see how it works is a very bad idea, since it is generated in such a way that it 'll work, but also, as JamesCherrill pointed out, is in no way easy to read/maintain/change ... unless off course, you're using the same WYSIWYG functionality as the original creater.

it is very hard to read, and surely not written in a way a decent Swing GUI would be written by a serious developer. yes, if your employer doesn't care how the code is built and whether or not you're able to do it on yourself, using this functionality of NetBeans might be an option, but if you actually want to learn how Swing works, or, if you want to prepare for, let's say an exam, or a job interview, where you want (have to?) prove that you actually know how to work with Swing, you would do better to prepare yourself, since the chances of you having access to NetBeans at that point would be very small.

to avoids any miss_understood, there any good Auto_Generated code, nor correct, all these Frameworks died on long time ago, we have to forgot about that

all frameworks that exists there are built on plain methods that came from ATW and Swing, From these Components is somethimes not possible to returns back to the AWT/Swing's method, is there something who's know how to change aplication icon for Java Desktop Aplication (JSR296), Components by Compoentns always is there something wrong (with compare to the plain AWT/Swing)

real alternative are richiest Custom Frameworks (since not works as I expected, but in all cases are as alternative how to build Most Compeded GUI)
and SWT and OracleForms, but again are based on plain AWT/Swing

thanks guys for all pieces of advice you've given me ...

I Just learned how to work with swing that way. I never use the GUI builder for any thing
but the basic component placement. I would never use it for anything else. I have an app with one master
panel for instance. It has components dropped on it. Then I have five classes
extending it all written by hand and each one of thoughs classes have at least
35 forms extending each one. On top of that I have more than 6 sets of the above
mentioned. I was just saying that I drag and drop one GUI and code the the rest.
so I created 5 pictures basically and coded at least 400 classes by hand.
I have taught myself a lot this way. I would like to share some code that is the root of
a form that when tables are added to a database the app will create a form
with just that meta data. This may be more advanced than the original question
posted by rotten69 but it could help someone with some automatic form creation written by hand.
I have added one form with one of the util classes used. Coding the GUI is almost
trival when compared to the other 400 classes. The technique works great. I could not add everything because the app has a database and 800 classes with properties and xml. But it all started by dragging and droppin one GUI. Just dig in and start making those component do something you will learn how to place component and panels along the way.
In my build() it is feed Strings of a tables Column name and it automatically creates
all the forms. 25 tables use this method.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EditForm.java
 *
 * Created on Jun 15, 2010, 3:43:25 PM
 */
package view.content.entities.instructor;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JFormattedTextField;
import model.dao.ConnectInstructorDAO;
import model.err.ConfirmUpdateException;

import model.err.DuplicateEmailException;
import model.err.DuplicateRegisterException;
import model.err.DuplicateUserException;
import model.err.EmptyFieldException;
import model.err.IncorrectEmailException;
import model.err.IncorrectPasswordException;
import model.err.LoginException;
import model.err.MappingException;
import model.err.NoGenderException;
import model.err.NoRecordDeleteException;
import model.err.NoStateException;
import model.err.NoTargetFoldersException;
import model.err.PasswordMismatchException;
import model.err.ProfileException;
import model.err.RegisterException;
import model.err.SubscribeException;
import model.err.UnknownUserNameException;
import model.utils.Password;
import view.ViewUtils;
import view.content.entities.masterForms.MasterRegisterForm;
import view.content.entities.masterOptionPanels.MasterRegisterOptionsPanel;
import view.messages.SendConfirmationEmailMessage;
import view.messages.SuccessfullLoginMessage;
import view.messages.SuccessfullRecordRemovalMessage;
import view.messages.SuccessfullRegistrationMessage;
import view.messages.SuccessfullTargetFoldersCreation;
import view.utils.UniqueField;
import view.messages.SuccessfullValidateMessage;
import view.utils.FillFormWithBlankPanels;
import view.utils.formattedFields.validationSetup.FormatFieldSetup;
import view.utils.formattedFields.validationSetup.FormatLabelSetup;

/**
 *
 * @author depot
 */
public class InstructorRegisterProfileForm extends MasterRegisterForm implements ActionListener {

   

    public boolean bUnique;
    public int[] emptyArray;
    public boolean bValid;
    public boolean bCorrect;
    public boolean fill;
    public int fillCount = 7;
    public float offSetX = 0;
    public float offSetY = 10;
    public int x = 0;
    public boolean bRevalidate = false;
  
    public boolean bValidPassword;
    public boolean bNewUser;
    public boolean bReset;
    public boolean bUserAndOwner;
    public static final String ACTION = "PROFILE";
    public static final String PROFILE = "instr_";
    public static final String FOREIGNKEY = "PAYEE_UID";
    public static final String CLASSTYPE = "INSTRUCTOR";
    public static final String PRIMARYKEY = "INSTR_UID";
    public static final int MODIFIER = 4;

    /** Creates new form EditForm */
    public InstructorRegisterProfileForm() throws FileNotFoundException, 
        super();

      
       //
        updateBtn.addActionListener(this);
        updateBtn.setActionCommand("Update");
        updateBtn.setEnabled(false);
        actionLbl.setText(ACTION);
        submitInsertBtn.addActionListener(this);
        cancelBtn.addActionListener(this);
        validateBtn.addActionListener(this);
        updateBtn.addActionListener(this);
        setAction(ACTION);
        setThisProfile(PROFILE);

        ConnectInstructorDAO cid = new ConnectInstructorDAO();

columnNameList=cid.countColumns(tableName);

        if (columnNameList.size() < fillCount) {
            fill = true;
        }

        buildForm();

    }

    public void buildForm() throws ProfileException, FileNotFoundException, IOException, 
        
        txtFieldArray = new JFormattedTextField[columnNameList.size() + MODIFIER];
      
        for (String s : columnNameList) {

            p = new JPanel();
            p.setBorder(BorderFactory.createEtchedBorder());
            p.setLayout(new GridLayout(1, 0, 1, 0));
            p.setAlignmentX(offSetX);
            p.setAlignmentY(offSetY);
            offSetY++;
            p.setPreferredSize(new Dimension(20, 500));
            //displayPanel.add(p);
            //_________________________________________________________lbl
            FormatLabelSetup fl = new FormatLabelSetup();
            JLabel lbl = new JLabel();
            lbl = fl.FormatColumnNameLabel(s);
            p.add(lbl);
            lbl = null;
            JLabel lbl2 = new JLabel();
            lbl2 = fl.FormatVerifierNameLabel(s);
            if (lbl2 != null) {
                p.add(lbl2);
                lbl2 = null;
            }

            if (!s.contains("_PASSWORD")) {
                if (s.contains("_GENDER")) {
                    txt = new JFormattedTextField();
                    setGenderIndex(x);
                    txt.setText("dummy");
                    txtFieldArray[x] = (JFormattedTextField) txt;
                    comboGender = ffs.comboSelect(comboGenderArray);
                    comboGender.addActionListener(this);
                    comboGender.setSelectedIndex(SEL);
                    comboGender.setEnabled(false);

                    setGender("GENDER");
                    p.add(comboGender);
                    displayPanel.add(p);
                    txt = null;

                    x++;
                } else if (s.contains("_STATE")) {
                    txt = new JFormattedTextField();
                    setStateIndex(x);
                    txtFieldArray[x] = (JFormattedTextField) txt;
                    txt.setText("dummy");
                    comboState = ffs.comboSelect(comboStateArray);
                    comboState.addActionListener(this);
                    comboState.setSelectedIndex(SEL);
                    comboState.setEnabled(false);

                    setState("STATE");
                    p.add(comboState);
                    displayPanel.add(p);
                    txt = null;

                    x++;
                } else if (s.contains("EMAIL")) {
                    ffs = new FormatFieldSetup();
                    txt = ffs.fieldSetup(s);
                    emailIndex = x;
                   
                    txtFieldArray[x] = (JFormattedTextField) txt;
                    txt.setEnabled(false);
                    p.add(txt);
                    displayPanel.add(p);
                    x++;
                    txt = null;
                } else if (s.contains(PRIMARYKEY)) {
                    ffs = new FormatFieldSetup();
                    txt = ffs.fieldSetup(s);
                    primaryKeyIndex = x;

                  
                    txtFieldArray[x] = (JFormattedTextField) txt;
                    // txt.setBackground(Color.YELLOW);
                    //txt.setEnabled(true);
                    //txt.setEditable(true);
                    p.add(txt);
                    displayPanel.add(p);
                    x++;
                    txt = null;

                } else if (s.contains(FOREIGNKEY)) {
                    ffs = new FormatFieldSetup();
                    txt = ffs.fieldSetup(s);
                    txt.setEnabled(false);
                    txtFieldArray[x] = (JFormattedTextField) txt;
                    p.add(txt);
                    displayPanel.add(p);
                    x++;
                    txt = null;
                } else if (!s.contains(PRIMARYKEY)) {
                    ffs = new FormatFieldSetup();
                    txt = ffs.fieldSetup(s);
                    txt.setEnabled(false);
                    txtFieldArray[x] = (JFormattedTextField) txt;
                    p.add(txt);
                    displayPanel.add(p);
                    x++;
                    txt = null;

                }
            }
            if (s.contains("_PASSWORD")) {
                passwordTxtFieldArray = new JPasswordField[2];

                txt = new JFormattedTextField("dummy");
                setPasswordIndex(x);
                txtFieldArray[x] = (JFormattedTextField) txt;
                txt.setText("dummy");
                x++;
                txtFieldArray[x] = (JFormattedTextField) txt;
                passTxt = ffs.setupPassField(s);
                passTxt.setEnabled(false);
                passwordTxtFieldArray[0] = passTxt;
                p.add(passTxt);
                displayPanel.add(p);
                JLabel confirmLbl = new JLabel("Confirm");
                p.add(confirmLbl);
                passTxt = ffs.setupPassField(s);
                setConfirmIndex(x);
                passTxt.setEnabled(false);
                passwordTxtFieldArray[1] = passTxt;
                p.add(passTxt);
                displayPanel.add(p);
                txt = null;

                passTxt = null;
                x++;
            }

        }
        if (fill == true) {
            for (int i = 0; i < fillCount; i++) {
                FillFormWithBlankPanels ffwbp = new FillFormWithBlankPanels();
                JPanel f = ffwbp.fill();
                displayPanel.add(f);
            }
        }

        validateBtn.setFocusable(true);
        validateBtn.isSelected();


        updateBtn.setEnabled(false);
        txtFieldArray[primaryKeyIndex].setBackground(Color.yellow);
        txtFieldArray[getPasswordIndex()].setText("dummy");
        txtFieldArray[getGenderIndex()].setText("dummy");
        txtFieldArray[getGenderIndex()].setText("dummy");
        for (int i = 0; i < passwordTxtFieldArray.length; i++) {
            passwordTxtFieldArray[i].setEnabled(false);
        }

        txtFieldArray[primaryKeyIndex].setEnabled(true);
        txtFieldArray[emailIndex].setEnabled(false);

        submitInsertBtn.setEnabled(false);
        setTxtFieldArray(txtFieldArray);
        setPasswordTxtFieldArray(passwordTxtFieldArray);
    }

    @Override
    public void actionPerformed(ActionEvent evt) {
        setTxtFieldArray(txtFieldArray);

         if (evt.getSource() == cancelBtn) {
             cancelAction();
         }
        if (evt.getSource() == submitInsertBtn) {
            validateBtn.setEnabled(false);
           
                try {
                    submitBtnAction();
                } catch (InterruptedException ex) {
                    Logger.getLogger(InstructorRegisterProfileForm.class.getName()).log(Level.SEVERE, null, ex);

            } catch (SuccessfullRecordRemovalMessage ex) {
                Logger.getLogger(InstructorRegisterProfileForm.class.getName()).log(Level.SEVERE, null, ex);
            } catch (MappingException ex) {
                Logger.getLogger(InstructorRegisterProfileForm.class.getName()).log(Level.SEVERE, null, ex);
            } 

        }
        if (evt.getSource() == validateBtn) {
           
                try {

                    validateBtnAction();
                } catch (DuplicateEmailException ex) {
                    Logger.getLogger(InstructorRegisterProfileForm.class.getName()).log(Level.SEVERE, null, ex);
                } catch (DuplicateRegisterException ex) {
                    Logger.getLogger(InstructorRegisterProfileForm.class.getName()).log(Level.SEVERE, null, ex);
                } 
        }
        if (evt.getActionCommand().equals("Update")) {
            if (evt.getSource() == updateBtn) {
                try {
                    txtFieldArray[0].setEnabled(false);

                    updateBtnAction();
                } catch (InterruptedException ex) {
                    Logger.getLogger(InstructorRegisterProfileForm.class.getName()).log(Level.SEVERE, null, ex);
                } 
            }
        }

        if (evt.getSource() == comboGender) {


            setGender((String) comboGender.getSelectedItem());


        }
        if (evt.getSource() == comboState) {

            setState((String) comboState.getSelectedItem());

        }
    }

    public boolean chkEmptyFields() throws ProfileException, LoginException, FileNotFoundException, IOException {

       
        bValid = true;

       

        if (txtFieldArray[primaryKeyIndex].getText().length() < 1) {
            bValid = false;
        }

        return bValid;
    }

    public boolean chkEmptyUpdateFields() throws ProfileException, LoginException, FileNotFoundException, IOException {

      
        bValid = true;
        int len = txtFieldArray.length - MODIFIER;
      
        for (int i = 0; i < len; i++) {
            if (txtFieldArray[i].getText().length() < 1) {
                bValid = false;

            }


        }
        for (int i = 0; i < passwordTxtFieldArray.length; i++) {
            String str = new String(passwordTxtFieldArray[i].getPassword());
            if (str.length() < 1) {
                bValid = false;
               
            }
        }
       
        return bValid;
    }

    public boolean authorizePassword() throws FileNotFoundException, IOException, SQLException, ProfileException, LoginException {

        bValid = true;
        String userField = new String(txtFieldArray[0].getText());
        String passwordField = new String(passwordTxtFieldArray[0].getPassword());
        ConnectInstructorDAO a = new ConnectInstructorDAO();
        bValid = a.isAuthorizeInstructor(userField, passwordField);

        return bValid;
    }

    public boolean isChkEmailUnique() throws ProfileException,  DuplicateRegisterException, MappingException, InterruptedException {

        String M = "isChkEmailUnique()";
        bUserAndOwner = true;

        for (int i = 0; i < txtFieldArray.length; i++) {


            if (i == emailIndex) {
                ConnectInstructorDAO cd = new ConnectInstructorDAO();
                bUserAndOwner = cd.isChkEmailUnique(txtFieldArray[emailIndex].getText());
               
                if (!bUserAndOwner) {
                    UniqueField un = new UniqueField();
                    bUserAndOwner = un.isEmailOwner(tableName, txtFieldArray, emailIndex);
                    
                    if (!bUserAndOwner) {
                        txtFieldArray[i].setText("");
                        txtFieldArray[i].setValue("");
                        bUserAndOwner = false;
                    }
                }
            }



        }

        return bUserAndOwner;
    }

    public void submitBtnAction() throws FileNotFoundException, InterruptedException {

        String M = "submitBtnAction()";

        try {
            submitInsertBtn.setEnabled(false);
            throw new ConfirmUpdateException();
        } catch (ConfirmUpdateException ex) {
            String z = ex.getMessage();
            ViewUtils vu = new ViewUtils();
            vu.addConfirmExceptionMessage(z);
        }
        try {

            if (ViewUtils.bConfirm == true) {

               
                MasterRegisterForm.formFactory(tableName);
                exitOptionsPanelAction();

            }
            if (ViewUtils.bConfirm == false) {

                submitInsertBtn.setEnabled(true);
                exitOptionsPanelAction();
                throw new NoRecordDeleteException();
            }

        } catch (NoRecordDeleteException ex) {
            String z = ex.getMessage();
            
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);
        }




    }

    public void validateBtnAction() throws IOException, LoginException, FileNotFoundException, SQLException, DuplicateRegisterException, MappingException {

        String M = "validateBtnAction()";
        setThisUid(txtFieldArray[primaryKeyIndex].getText());
        controlView();
        bValid = true;
        try {

            bValid = chkEmptyFields();
            if (!bValid) {

                throw new EmptyFieldException();

            }
            UniqueField uf = new UniqueField();
            //valid is if it is there to edit
            bUnique = uf.searchUniqueField(tableName, txtFieldArray);
            if (bUnique) {
                bValid = false;
            }
            if (!bValid) {
                txtFieldArray[primaryKeyIndex].setText("");

             

                throw new UnknownUserNameException();
            }
            for (int i = 0; i < passwordTxtFieldArray.length; i++) {
                passwordTxtFieldArray[i].setEnabled(true);
            }
            int len = txtFieldArray.length - MODIFIER;
            for (int i = 0; i < len; i++) {
                txtFieldArray[i].setEnabled(true);

            }
            txtFieldArray[primaryKeyIndex].setEnabled(false);
            validateBtn.setEnabled(false);
            submitInsertBtn.setEnabled(false);
            updateBtn.setEnabled(true);
            ConnectInstructorDAO cd = new ConnectInstructorDAO();
            cd.populateInstructorProfile(txtFieldArray[primaryKeyIndex].getText());

            throw new SuccessfullValidateMessage();



        } catch (EmptyFieldException ex) {

            String z = ex.getMessage();
           
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);


        } catch (UnknownUserNameException ex) {
            //Logger.getLogger(PayeeEditForm.class.getName()).log(Level.SEVERE, null, ex);
            String z = ex.getMessage();
            System.out.println("Error: " + z);
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);
        } catch (SuccessfullValidateMessage ex) {
            String z = ex.getMessage();
            System.out.println("message: " + z);
            ViewUtils vu = new ViewUtils();
            vu.addMessage(z);
        }
    }

    public void updateBtnAction() throws model.err.LoginException, FileNotFoundException{
       
        bValid = true;
        try {
              ////////////////////////////////add
            bValid=authorizePassword();
         if(!bValid){
             throw new model.err.IncorrectPasswordException();
         }
         //////////////////////add
            bValid = chkEmptyUpdateFields();
            if (!bValid) {
                validateBtn.setEnabled(false);
                submitInsertBtn.setEnabled(false);
                updateBtn.setEnabled(true);
                throw new EmptyFieldException();
            }

            if (gender.equals("GENDER")) {
                validateBtn.setEnabled(false);
                submitInsertBtn.setEnabled(false);
                updateBtn.setEnabled(true);
                throw new NoGenderException();
            }

            if (state.equals("STATE")) {
                validateBtn.setEnabled(false);
                submitInsertBtn.setEnabled(false);
                updateBtn.setEnabled(true);

                throw new NoStateException();

            }


            Password pa = new Password();

            bCorrect = pa.isConfirmPasswordCorrect(passwordTxtFieldArray[0].getPassword(), passwordTxtFieldArray[1].getPassword());
            if (bCorrect == false) {
                bValid = false;
                validateBtn.setEnabled(false);
                submitInsertBtn.setEnabled(false);
                updateBtn.setEnabled(true);

                throw new PasswordMismatchException();

            }

            bUserAndOwner = isChkEmailUnique();
            if (!bUserAndOwner) {
                bValid = false;
                validateBtn.setEnabled(false);
                submitInsertBtn.setEnabled(false);
                updateBtn.setEnabled(true);

                throw new DuplicateEmailException();
            }

            validateBtn.setEnabled(false);
            submitInsertBtn.setEnabled(true);
            updateBtn.setEnabled(false);

            throw new SuccessfullValidateMessage();
        } catch (IncorrectPasswordException ex) {
            //Logger.getLogger(PayeeProfileForm.class.getName()).log(Level.SEVERE, null, ex);
            String z = ex.getMessage();
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);
        } catch (EmptyFieldException ex) {

            String x = ex.getMessage();
           
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(x);

        } catch (PasswordMismatchException ex) {
            //Logger.getLogger(PayeeProfileForm.class.getName()).log(Level.SEVERE, null, ex);
            String z = ex.getMessage();
            
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);
        } catch (NoStateException e) {
            String z = e.getMessage();
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);
        } catch (NoGenderException e) {
            String z = e.getMessage();
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(z);
        } catch (SuccessfullValidateMessage ex) {
            String z = ex.getMessage();
            System.out.println("message: " + z);
            ViewUtils vu = new ViewUtils();
            vu.addMessage(z);
        }

    }
 private void cancelAction() {
        if(MasterRegisterOptionsPanel.displayPanel!=null){
            MasterRegisterOptionsPanel.displayScrollPane.setViewportView(null);

        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.