import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class Case1 extends Frame implements ActionListener
{
Font myf1 = new Font("Times New Roam", Font.BOLD, 14);
TextField txtnmn,txtcode;
Label lbl1, lbl2,lbl;
Button btnEnter,btnNew;
public Case1()
{
super("MERC Grocery");
setLayout(new FlowLayout(70,20,20));
//event handler for closing the frame
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
setSize(600,150);
setLocation(100,50);
setBackground(Color.lightGray);
lbl1 = new Label("User Name ");
add(lbl1);
txtnmn = new TextField(10);
add(txtnmn);
lbl2 = new Label("Code ");
add(lbl2);
txtcode = new TextField(10);
add(txtcode);
lbl=new Label();
add(lbl);
btnEnter = new Button("Enter");
add(btnEnter);
btnEnter.addActionListener(this);
btnNew = new Button("New Entry");
add(btnNew);
btnNew.addActionListener(this);
setVisible(true);
txtnmn.setEditable(true);
txtcode.setEditable(true);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String a="Kristine";
String b="akosis";
if( e.getSource() == btnEnter){
if(a.equals(txtnmn.getText())&& b.equals(txtcode.getText()))
JOptionPane.showMessageDialog(null, "Go");
else
JOptionPane.showMessageDialog(null, "Invalid");
}
if(e.getSource()==btnNew)
{
txtnmn.setText("");
txtcode.setText("");
}
}
public static void main (String [] args) {
Case1 case1 = new Case1();
}
}
HI THIS IS MY PROGRAM....
I WILL ASK A QUESTION!
MY PROGRAM IS ABOUT A GROCERY CASE STUDY
I WILL ASK HOW CAN I CONNECT THE BUTTON ENTER AFTER I LOG IN THAT WILL APPEAR A NEW FRAME THAT HAVING A LIST OF A PRODUCT CODE??... TNX FOR THE HELP YOU MAY REPLY I REALLY APPRECIATE THE HELP YOU CAN GIVE..
This post has been edited by japanir: 05 March 2011 - 05:17 AM
Reason for edit:: Code tags added

New Topic/Question
Reply



MultiQuote






|