Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 136,424 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,351 people online right now. Registration is fast and FREE... Join Now!




student record form

 
Reply to this topicStart new topic

student record form, storing student data to an array...tooltip here..i dunno how to use

imjuzaround
15 Oct, 2008 - 04:41 AM
Post #1

New D.I.C Head
*

Joined: 8 Mar, 2008
Posts: 16


My Contributions
hello there...i have this homework to be pass tommorow....


i had finally made the gui....but i have problems implementing the events and i dont know how to use tooltip...


here is the program specification:

>enabloing/disabling of jbutton and Jtextfield components

details:

A. save and cancel are disabled at first run as well as Jtextfield for name,age gender and address are also disabled. Enable the navigation buttons, add/edit, delete and search buttons

B. if Add/Edit button is clicked, disable all buttons except for save and cancel buttons. Jtextfield for name,age.gender and address are enabled while jtextfield for search is disabled

C. if save is clicked. do A

> tooltip text for JButton and Jtextfield components
provide brief description for each component when hovered by the mouse. Ude the settooltip method to do this

> more importantly, make this program fully functional/operational





wheeeew....


here is my code...i do not have events for this...im still working on it...please help me rolleyes.gif



CODE



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



public class bebe extends JFrame{
        
    public JButton search,addEdit,delete,save,cancel,next,prev,last,first;
    public JLabel name,gender,age,mailadd;
    public JTextField searching=null,fullname=null,edad=null,sex=null,mailaddress=null,scroll=null;
    public JComboBox kinatawo;
    public JPanel panelnorth,panelcenter,panelsouth,paneleast,panelwest,north1,north2,north3,south
1,south2,south3,center;
    String str[]={"male","female","uncertain"};
        
        
        public  void oink(){
            
            setTitle("Student Record Form");
            setLayout(new BorderLayout());
/*        my panels        */

     panelnorth=new JPanel(new FlowLayout());
     panelsouth=new JPanel(new FlowLayout());    
     panelcenter=new JPanel(new BorderLayout());
     panelwest=new JPanel(new BorderLayout());
     paneleast=new JPanel(new BorderLayout());        
     north1=new JPanel(new GridLayout(2,1));        
     north2=new JPanel(new GridLayout(2,1));
     north3=new JPanel(new GridLayout(2,2));
     south1=new JPanel(new GridLayout(2,1));
     south2=new JPanel(new GridLayout(2,2));    
     south3=new JPanel(new GridLayout(2,1));    
     center=new JPanel(new BorderLayout());    
         
         
         
/*        north panel        */    
        searching=new JTextField(20);
        search=new JButton("Search");
        
        panelnorth.add(searching);
        panelnorth.add(search);

/*        center panel        */

        addEdit=new JButton("Add/Edit");
        delete=new JButton("Delete");
        north1.add(addEdit);
        north1.add(delete);
        panelwest.add(north1,BorderLayout.NORTH);
        
        save=new JButton("Save");
        cancel=new JButton("Cancel");
        south1.add(save);
        south1.add(cancel);
        
        panelwest.add(south1,BorderLayout.SOUTH);        
        
        panelcenter.add(panelwest,BorderLayout.WEST);
        
        name=new JLabel("name");
        age=new JLabel("age");
        gender=new JLabel("Gender");
        mailadd=new JLabel("Mailing address");
        
       fullname=new JTextField(10);
       edad=new JTextField(10);
       kinatawo=new JComboBox(str);
       mailaddress=new JTextField(10);
      
      
      

        north2.add(name);
        north2.add(fullname);
        north2.add(age);
        north2.add(edad);
        south2.add(gender);
        south2.add(kinatawo);
        south2.add(mailadd);
        south2.add(mailaddress);
        
        center.add(north2,BorderLayout.NORTH);
        center.add(south2,BorderLayout.SOUTH);
        
        panelcenter.add(center,BorderLayout.EAST);
        
/*        south panel            */


next=new JButton(">");
prev=new JButton("<");
last=new JButton(">|");
first=new JButton("|<");
scroll=new JTextField(2);

panelsouth.add(first);
panelsouth.add(prev);
panelsouth.add(scroll);
panelsouth.add(next);
panelsouth.add(last);


        
        add(panelcenter,BorderLayout.CENTER);

        add(panelnorth,BorderLayout.NORTH);
        
        add(panelsouth,BorderLayout.SOUTH);
        
    pack();
    setVisible(true);
        }
        public static void main (String[] args) {
            
            
        
        bebe boink=new bebe();
        
        boink.oink();
        
        
        }
    
    
}




User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: Student Record Form
15 Oct, 2008 - 06:46 AM
Post #2

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,404



Thanked: 6 times
Dream Kudos: 125
Expert In: HTML, CSS, Database,

My Contributions
Please do not double post your questions.
User is offlineProfile CardPM
+Quote Post

imjuzaround
RE: Student Record Form
16 Oct, 2008 - 02:00 AM
Post #3

New D.I.C Head
*

Joined: 8 Mar, 2008
Posts: 16


My Contributions
QUOTE(jjsaw5 @ 15 Oct, 2008 - 07:46 AM) *

Please do not double post your questions.



oooops......sorry tongue.gif
User is offlineProfile CardPM
+Quote Post

pbl
RE: Student Record Form
16 Oct, 2008 - 02:20 PM
Post #4

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,110



Thanked: 202 times
Dream Kudos: 75
My Contributions
ToolTip are easy... I have put 2 in your code
ActionListener has been added for a few buttons in your code

java

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

//I guess you have an ActionListener missing

public class bebe extends JFrame implements ActionListener { // <---- actionListener

public JButton search,addEdit,delete,save,cancel,next,prev,last,first;
public JLabel name,gender,age,mailadd;
public JTextField searching=null,fullname=null,edad=null,sex=null,mailaddress=null,scroll=null;
public JComboBox kinatawo;
public JPanel panelnorth,panelcenter,panelsouth,paneleast,panelwest,north1,north2,north3,
south1,south2,south3,center;
String str[]={"male","female","uncertain"};


public void oink(){

setTitle("Student Record Form");
setLayout(new BorderLayout());
/* my panels */

panelnorth=new JPanel(new FlowLayout());
panelsouth=new JPanel(new FlowLayout());
panelcenter=new JPanel(new BorderLayout());
panelwest=new JPanel(new BorderLayout());
paneleast=new JPanel(new BorderLayout());
north1=new JPanel(new GridLayout(2,1));
north2=new JPanel(new GridLayout(2,1));
north3=new JPanel(new GridLayout(2,2));
south1=new JPanel(new GridLayout(2,1));
south2=new JPanel(new GridLayout(2,2));
south3=new JPanel(new GridLayout(2,1));
center=new JPanel(new BorderLayout());



/* north panel */
searching=new JTextField(20);
search=new JButton("Search");

panelnorth.add(searching);
panelnorth.add(search);

/* center panel */

addEdit=new JButton("Add/Edit");
addEdit.addActionListener(this); // add actionListener to the button
delete=new JButton("Delete");
delete.addActionListener(this); // add actionListener to the button
north1.add(addEdit);
north1.add(delete);
panelwest.add(north1,BorderLayout.NORTH);

save=new JButton("Save");
save.addActionListener(this); // add actionListener to the button

cancel=new JButton("Cancel");
cancel.addActionListener(this); // add actionListener to the button
south1.add(save);
south1.add(cancel);

panelwest.add(south1,BorderLayout.SOUTH);

panelcenter.add(panelwest,BorderLayout.WEST);

name=new JLabel("name");
age=new JLabel("age");
gender=new JLabel("Gender");
mailadd=new JLabel("Mailing address");

fullname=new JTextField(10);
edad=new JTextField(10);
kinatawo=new JComboBox(str);
mailaddress=new JTextField(10);




north2.add(name);
north2.add(fullname);
north2.add(age);
north2.add(edad);
south2.add(gender);
south2.add(kinatawo);
south2.add(mailadd);
south2.add(mailaddress);

center.add(north2,BorderLayout.NORTH);
center.add(south2,BorderLayout.SOUTH);

panelcenter.add(center,BorderLayout.EAST);

/* south panel */


next=new JButton(">");
next.addActionListener(this); // add actionListener to the button

// also addActionListener for the other buttons
prev=new JButton("<");
prev.setToolTipText("This the text that will be showed when the mouse"); // tooltip
last=new JButton(">|");
last.setToolTipText("will pass over this button"); // tooltip
first=new JButton("|<");
scroll=new JTextField(2);

panelsouth.add(first);
panelsouth.add(prev);
panelsouth.add(scroll);
panelsouth.add(next);
panelsouth.add(last);



add(panelcenter,BorderLayout.CENTER);

add(panelnorth,BorderLayout.NORTH);

add(panelsouth,BorderLayout.SOUTH);

pack();
setVisible(true);
}
public static void main (String[] args) {



bebe boink=new bebe();

boink.oink();


}
// action listener
public void actionPerformed(ActionEvent arg0) {
JButton b = (JButton) arg0.getSource();

// do what you have to do for the search button
if(b == search) {
return;
}
// to what you have to do for the addEdit button
if(b == addEdit) {
return;
}

// an so on for the other buttons

}


}

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 01:21PM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month