Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


neo
Mr
0 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners


Hi friends i have this code below, it does not want to run.pls help me i'm stuck. Thank you.

/********************/ /* UsingBoxLayout */ /* */ /********************/ import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Summary description for UsingBoxLayout * */ public class Ceeda3 extends JFrame { // Variables declaration private JLabel labH1; private JLabel labH2; private JLabel labH3; private JLabel labH4; private JLabel labH5; private JLabel labV1; private JPanel contentPane; //----- private JPanel pnlCenterBoxLayout; //----- private JButton btnOK; private JButton btnCancel; private JButton btnApply; private JPanel pnlBottomFlowLayout; //----- private JLabel jLabel1; private JTextField txfID; private JPanel pnlID; //----- private JLabel jLabel2; private JTextField txfSurname; private JPanel pnlSurname; //----- private JLabel jLabel3; private JTextField txfFirstname; private JPanel pnlFirstname; //----- private JLabel jLabel4; private JTextField txfEmail; private JPanel pnlEmail; //----- //----- private JLabel jLabel5; private JTextField txfCellphone; private JPanel pnlCellphone; //-----
//----- private JLabel jLabel6; private JRadioButton rbtnMale; private JRadioButton rbtnFemale; private JPanel pnlSex; //----- private JLabel jLabel7; private JComboBox cmbRaceGroup; private JPanel pnlRace; //----- private JLabel jLabel8; private JTextField txfPermanentAddress; private JPanel pnlPermanentAddress; //----- private JLabel jLabel9; private JTextField txfCurrentAddress; private JPanel pnlCurrentAddress; //----- private ButtonGroup btnGroup_Sex; // End of variables declaration

public Ceeda3() 
{ 
    super(); 
    initializeComponent(); 
    // 
    // TODO: Add any constructor code after initializeComponent call 
    // 

    this.setVisible(true); 
} 

/** 
 * This method is called from within the constructor to initialize the form. 
 * WARNING: Do NOT modify this code. The content of this method is always regenerated 
 * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
 * to retrieve your design properly in future, before revising this method. 
 */ 
private void initializeComponent() 
{ 
    labH1 = new JLabel(); 
    labH2 = new JLabel();
    labH3 = new JLabel(); 
    labH4 = new JLabel(); 
    labH5 = new JLabel();  
    labV1 = new JLabel(); 
    contentPane = (JPanel)this.getContentPane(); 
    //----- 
    pnlCenterBoxLayout = new JPanel(); 
    //----- 
    btnOK = new JButton(); 
    btnCancel = new JButton(); 
    btnApply = new JButton(); 
    pnlBottomFlowLayout = new JPanel();
    //-----  
    jLabel1 = new JLabel(); 
    txfID = new JTextField(); 
    pnlID = new JPanel(); 
    //----- 
    //----- 
    jLabel2 = new JLabel(); 
    txfSurname = new JTextField(); 
    pnlSurname = new JPanel(); 
    //----- 
    jLabel3 = new JLabel(); 
    txfFirstname = new JTextField(); 
    pnlFirstname = new JPanel(); 
    //----- 
    jLabel4 = new JLabel(); 
    txfEmail = new JTextField(); 
    pnlEmail = new JPanel(); 
    //----- 
    jLabel5 = new JLabel(); 
    txfCellphone = new JTextField(); 
    pnlCellphone= new JPanel(); 
    //----- 
    jLabel6 = new JLabel(); 
    rbtnMale = new JRadioButton(); 
    rbtnFemale = new JRadioButton(); 
    pnlSex = new JPanel(); 
    //----- 
    jLabel7 = new JLabel(); 
    cmbRaceGroup = new JComboBox(); 
    pnlRace = new JPanel(); 
    //----- 
    jLabel8 = new JLabel(); 
    txfPermanentAddress = new JTextField(); 
    pnlPermanentAddress = new JPanel(); 
    //----- 
    jLabel9 = new JLabel(); 
    txfCurrentAddress = new JTextField(); 
    pnlCurrentAddress = new JPanel(); 
    //----- 
    btnGroup_Sex = new ButtonGroup(); 

    // 
    // labH1 
    // 
    labH1.setToolTipText("This empty label is used for Horizontal Gap Setting of BorderLayout to be effective, if necessarily."); 
    // 
    // labH2 
    // 
    labH1.setToolTipText("This empty label is used for Horizontal Gap Setting of BorderLayout to be effective, if necessarily."); 
    // 
    // labH3 
    // 
    labH1.setToolTipText("This empty label is used for Horizontal Gap Setting of BorderLayout to be effective, if necessarily."); 
    // 
    // labH4
    // 
    labH1.setToolTipText("This empty label is used for Horizontal Gap Setting of BorderLayout to be effective, if necessarily."); 
    // 
    // labH5 
    // 
    labH2.setToolTipText("This empty label is used for Horizontal Gap Setting of BorderLayout to be effective, if necessarily."); 
    // 
    // labV1 
    // 
    labV1.setToolTipText("This empty label is used for Vertical Gap Setting of BorderLayout to be effective, if necessarily."); 
    // 
    // contentPane 
    // 
    contentPane.setLayout(new BorderLayout(10, 10)); 
    contentPane.add(pnlCenterBoxLayout, BorderLayout.CENTER); 
    contentPane.add(pnlBottomFlowLayout, BorderLayout.SOUTH); 
    contentPane.add(labH1, BorderLayout.WEST);
    contentPane.add(labH2, BorderLayout.EAST);
    contentPane.add(labH3, BorderLayout.WEST);
    contentPane.add(labH4, BorderLayout.SOUTH); 
    contentPane.add(labH5, BorderLayout.EAST); 
    contentPane.add(labV1, BorderLayout.NORTH); 
    // 
    // pnlCenterBoxLayout 
    // 
    pnlCenterBoxLayout.setLayout(new BoxLayout(pnlCenterBoxLayout, BoxLayout.Y_AXIS));
    pnlCenterBoxLayout.add(pnlID, 1); 
    pnlCenterBoxLayout.add(pnlSurname, 2); 
    pnlCenterBoxLayout.add(pnlFirstname, 3); 
    pnlCenterBoxLayout.add(pnlEmail, 4); 
    pnlCenterBoxLayout.add(pnlCellphone, 5); 
    pnlCenterBoxLayout.add(pnlSex, 6); 
    pnlCenterBoxLayout.add(pnlRace, 7);
    pnlCenterBoxLayout.add(pnlPermanentAddress, 8); 
    pnlCenterBoxLayout.add(pnlCurrentAddress, 9);  
    pnlCenterBoxLayout.setBorder(BorderFactory.createEtchedBorder()); 
    pnlCenterBoxLayout.setToolTipText("This JPanel is using BoxLayout manager."); 
    // 
    // btnOK 
    // 
    btnOK.setText("    OK    "); 
    btnOK.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            btnOK_actionPerformed(e); 
        } 

    }); 
    // 
    // btnCancel 
    // 
    btnCancel.setText(" Cancel "); 
    btnCancel.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            btnCancel_actionPerformed(e); 
        } 

    }); 
    // 
    // btnApply 
    // 
    btnApply.setText("  Apply  "); 
    btnApply.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            btnApply_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlBottomFlowLayout 
    // 
    pnlBottomFlowLayout.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 5)); 
    pnlBottomFlowLayout.add(btnOK, 0); 
    pnlBottomFlowLayout.add(btnCancel, 1); 
    pnlBottomFlowLayout.add(btnApply, 2); 
    pnlBottomFlowLayout.setToolTipText("This JPanel is using FlowLayout manager."); 
    //
    // jLabel1 
    // 
    jLabel1.setText("ID no.:"); 
    jLabel1.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfID
    // 
    txfID.setColumns(20); 
    txfID.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfID_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlID 
    // 
    pnlID.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlID.add(jLabel1, 0); 
    pnlID.add(txfID, 1); 
    //  
    // jLabel2 
    // 
    jLabel2.setText("Surname:"); 
    jLabel2.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfSurname 
    // 
    txfSurname.setColumns(20); 
    txfSurname.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfSurname_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlSurname 
    // 
    pnlSurname.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlSurname.add(jLabel2, 0); 
    pnlSurname.add(txfSurname, 1); 
    // 
    // jLabel3 
    // 
    jLabel3.setText("Firstname:"); 
    jLabel3.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfFirstname 
    // 
    txfFirstname.setColumns(20); 
    txfFirstname.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfFirstname_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlFirstname 
    // 
    pnlFirstname.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlFirstname.add(jLabel3, 0); 
    pnlFirstname.add(txfFirstname, 1); 
    //
    // jLabel4 
    // 
    jLabel4.setText("Email Address:"); 
    jLabel4.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfEmail 
    // 
    txfEmail.setColumns(20); 
    txfEmail.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfEmail_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlEmail 
    // 
    pnlEmail.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlEmail.add(jLabel4, 0); 
    pnlEmail.add(txfEmail, 1); 
    // 
    // jLabel5 
    // 
    jLabel5.setText("Cellphone:"); 
    jLabel5.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfCellphone 
    // 
    txfCellphone.setColumns(20); 
    txfCellphone.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfCellphone_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlCellphone 
    // 
    pnlCellphone.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlCellphone.add(jLabel5, 0); 
    pnlCellphone.add(txfCellphone, 1); 
    //  
    // jLabel6
    // 
    jLabel6.setText("Sex:"); 
    jLabel6.setPreferredSize(new Dimension(106, 22)); 
    // 
    // rbtnMale 
    // 
    rbtnMale.setText("Male"); 
    rbtnMale.setSelected(true); 
    rbtnMale.addItemListener(new ItemListener() { 
        public void itemStateChanged(ItemEvent e) 
        { 
            rbtnMale_itemStateChanged(e); 
        } 

    }); 
    // 
    // rbtnFemale 
    // 
    rbtnFemale.setText("Female"); 
    rbtnFemale.addItemListener(new ItemListener() { 
        public void itemStateChanged(ItemEvent e) 
        { 
            rbtnFemale_itemStateChanged(e); 
        } 

    }); 
    // 
    // pnlSex 
    // 
    pnlSex.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlSex.add(jLabel6, 0); 
    pnlSex.add(rbtnMale, 1); 
    pnlSex.add(rbtnFemale, 2); 
    // 
    // jLabel7 
    // 
    jLabel7.setText("Age:"); 
    jLabel7.setPreferredSize(new Dimension(106, 22)); 
    // 
    // cmbAgeGroup 
    // 
    cmbRaceGroup.addItem("Select race"); 
    cmbRaceGroup.addItem("Black"); 
    cmbRaceGroup.addItem("Coloured"); 
    cmbRaceGroup.addItem("White"); 
    cmbRaceGroup.addItem("Asian"); 
    cmbRaceGroup.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            cmbAgeGroup_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlAge 
    // 
    pnlRace.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlRace.add(jLabel7, 0); 
    pnlRace.add(cmbRaceGroup, 1); 
    // 
    // jLabel8 
    // 
    jLabel8.setText("Permanent Address:"); 
    jLabel8.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfPermanentAddress 
    // 
    txfPermanentAddress.setColumns(20); 
    txfPermanentAddress.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfPermanentAddress_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlPermanentAddress 
    // 
    pnlPermanentAddress.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlPermanentAddress.add(jLabel8, 0); 
    pnlPermanentAddress.add(txfPermanentAddress, 1); 
    // 
    // jLabel9 
    // 
    jLabel9.setText("Current Address:"); 
    jLabel9.setPreferredSize(new Dimension(106, 22)); 
    // 
    // txfCurentAddress 
    // 
    txfCurrentAddress.setColumns(20); 
    txfCurrentAddress.addActionListener(new ActionListener() { 
        public void actionPerformed(ActionEvent e) 
        { 
            txfCurrentAddress_actionPerformed(e); 
        } 

    }); 
    // 
    // pnlCurrentAddress
    // 
    pnlCurrentAddress.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); 
    pnlCurrentAddress.add(jLabel9, 0); 
    pnlCurrentAddress.add(txfCurrentAddress, 1); 
    // 
    // btnGroup_Sex 
    // 
    btnGroup_Sex.add(rbtnFemale); 
    btnGroup_Sex.add(rbtnMale); 
    // 
    // UsingBoxLayout 
    // 
    this.setTitle("Application Form"); 
    this.setLocation(new Point(0, 0)); 
    this.setSize(new Dimension(815, 543)); 
    this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 
} 

// 
// TODO: Add any appropriate code in the following Event Handling Methods 
// 
private void btnOK_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\nbtnOK_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

private void btnCancel_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\nbtnCancel_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

private void btnApply_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\nbtnApply_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

}
private void txfID_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfID_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

private void txfSurname_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfSurname_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

private void txfFirstname_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfFirstname_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

}
private void txfEmail_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfEmail_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

}
private void txfCellphone_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfCellphone_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

private void rbtnMale_itemStateChanged(ItemEvent e) 
{ 
    System.out.println("\nrbtnMale_itemStateChanged(ItemEvent e) called."); 
    System.out.println(">>" + ((e.getStateChange() == ItemEvent.SELECTED) ? "selected":"unselected")); 
    // TODO: Add any handling code here 

} 

private void rbtnFemale_itemStateChanged(ItemEvent e) 
{ 
    System.out.println("\nrbtnFemale_itemStateChanged(ItemEvent e) called."); 
    System.out.println(">>" + ((e.getStateChange() == ItemEvent.SELECTED) ? "selected":"unselected")); 
    // TODO: Add any handling code here 

} 

private void cmbAgeGroup_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ncmbAgeGroup_actionPerformed(ActionEvent e) called."); 

    Object o = cmbRaceGroup.getSelectedItem(); 
    System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected."); 
    // TODO: Add any handling code here for the particular object being selected 

} 

private void txfPermanentAddress_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfPermanentAddress_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

private void txfCurrentAddress_actionPerformed(ActionEvent e) 
{ 
    System.out.println("\ntxfCurrentaddress_actionPerformed(ActionEvent e) called."); 
    // TODO: Add any handling code here 

} 

// 
// TODO: Add any method code to meet your needs in the following area 
//

//============================= Testing ================================// //= =// //= The following main method is just for testing this class you built.=// //= After testing,you may simply delete it. =// //======================================================================// public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception ex) { System.out.println("Failed loading L&F: "); System.out.println(ex); } new Ceeda3(); } //= End of Testing =

}


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Mr.
Mr.  how to install and load mysql?   Hi Friend, Please visit the following link: http://www.roseindia.net/mysql/mysql5/Installing-MySQL-on-Windows.shtml Thanks
Mr. Sonam
Mr. Sonam  Why does each primitive type give different range of number
Advertisements
Mr
Mr
Mr
Mr Vijaya Bhaskara
Mr Vijaya Bhaskara  how to increase jvm memory size through application
Mr Vijaya Bhaskara
Mr Vijaya Bhaskara  what are default implicit objects available when you jsp page   JSP Implicit Objects
Student database
Student database  Create a class Student with Name, Gender, and Date of Birth and Input Student and print as ?Dear Mr/Mrs Name, your Age is 99 Years?. Mr/Mrs - only one should be displayed based on their age and Gender
remopving errors incore java programming
"); MyRunnable mr = new MyRunnable(); Thread th = new Thread(mr); th.start
remopving errors incore java programming
"); MyRunnable mr = new MyRunnable(); Thread th = new Thread(mr); th.start
remopving errors incore java programming
"); MyRunnable mr = new MyRunnable(); Thread th = new Thread(mr); th.start
Regular Expression Help Help HELP!!!!
['07001'].CO = new Array("MR","","Harish Ram","Not Available","M.R Harish","hotmail.com"); so i need to extract"07001", "MR Harish Ram " and extract "M.RHarish... the quotes ""07001", "MR Harish Ram","M.RHarish @ hotmail.com"" Help is greatly
calculator in java with stack
button must run result Ac Mr M+ Mc ( ) 7 8 9 + 4 5 6
assertion
that the object is no longer used. i hope its clear to u Mr. lokendra yadav
my question is related to my project viz
my question is related to my project viz   Sir, my project is based on MR tracking system developed using struts framework, it has been developed in Net Beans the whole project is working except a jsp page named dayplan.jsp
JSP - JSP-Servlet
to do this... Pls... Help Me............  Hi Mr. vasu can u please
Dear Sir I need to join u
document file for all details please Al-Buainain Group Software Engineer Mr
JSP - JSP-Servlet
; Hi Mr. vasu I want to know whether u have already created your form
JSP - JSP-Servlet
.. If possible pls... send me with example........  Mr. vasu Can u
Drop down and radio button value on edit action
mr.,mrs.,miss for payment type there are to radio buttons as by cash &...;option value="Mr.">Mr.</option> <option value="Mrs
List in J2ME
;list.append("Miss. Neelam", null);   list.append("Mr. Sandeep", null);   list.append("Mr. Suman", null);   list.append("Mr. Saurabh", null
Java client posting to a servlet - Development process
Mr." + " " + name + " " + "for visiting roseindia" ); out.println("Now you
illegal start of type
) { System.out.println(e); MyReader mr = new MyReader(); mr.ReadFile("side1-60.java...) { System.out.println(e); /*MyReader mr = new MyReader
Java Project Training
, and Spring by Experienced Faculty. The interested candidate can contact to Mr... on: +91-9313063554 deepak38@gmail.com Contact Person: Mr. Deepak Kumar
Factory Pattern
is the administrator then it displays welcome message saying Hello Mr. <Name> You... saying Hello Mr <Name> you are not the administrator of the organization...) { System.out.println("Hello Mr. "+ fullName + "You are the administrator
Java Swing Scientific Calculator
, pow2, pow3, exp, fac, plus, min, div, log, rec, mul, eq, addSub, dot, mr, mc...)); boolean t = true; mr = new JButton("MR"); buttonpanel.add(mr...; tfield.setText(""); } if (s.equals("MR")) { tfield.setText
Creational Design Patterns
), it displays welcome message saying Hello Mr. <Name> and if the sex is Female (F...; System.out.println("Hello Mr. "+fullName);   } } //** End of class...: Hello Mr. Rajnish Again Running this Code: with two argument Name: Bhaskar
Example of Flow Control Tags of JSTL Core Tag Library
=="Mahendra" >    WELCOME........Mr. Mahendra   ...="${name=='mahendra'}" > WELCOME........Mr...'}" > WELCOME........Mr. Girish </c:if><
Gardens in Jaipur
Mr. Vidyadhar Bhattacharya, the brain behind designing the city. The garden
 

 

 

DMCA.com