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
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();
}
}