مراحب
تحياتي للجميع
من فترة وانا اتصفح الموقع و استفيد من المشاركات
وهذه المرة لدي مشكلة في برنامج لعمل قوائم اساسية
لم استطع ان اعرف المشكلة فيها
ارجو ان تسعدوني في التوصل للسبب
import javax.swing.*;
import java.awt.event.*;
class mainP extends JFrame implements ActionListener
{
JMenuBar mb;
JMenu m1,m2,m3;
JMenuItem i_1,i_2,i_3,i_4,i_5,i_6;
JTextField t_1,t_2;
JLabel l;
mainP()
{
mb= new JMenuBar();
m1= new JMenu ("Customer");
m2= new JMenu ("Product");
m3= new JMenu ("Account");
mb.add (m1);
mb.add (m2);
mb.add (m3);
i_1= new JMenuItem ("New Customer");
i_2= new JMenuItem ("Regular Customer");
i_3= new JMenuItem ("Add");
i_4= new JMenuItem ("Delete");
i_5= new JMenuItem ("Modify");
i_6= new JMenuItem ("Account");
i_1.addActionListener(this);
i_2.addActionListener(this);
i_3.addActionListener(this);
i_4.addActionListener(this);
i_5.addActionListener(this);
i_6.addActionListener(this);
m1.add(i_1);
m1.add(i_2);
m2.add(i_3);
m2.add(i_4);
m2.add(i_5);
m3.add(i_6);
t_1=new JTextField (5);
t_2=new JTextField (5);
l=new JLabel ();
add(t_1);
add(t_2);
add(l);
SetMenuBar (mb);
}
/**
public void actionPerformed(ActionEvent ae)
{
int tp,fp,quantity;
tp=Integer.parseInt(t_1.getText);
quantity=Integer.parseInt(t_2.getText);
if(ae.getsource)==(i_1);
tp = 100;
quantity=2;
{
if (tp ="" || tp=" ")
{
System.out.print ("Entre a number : ");
}
else if (tp <= 500)
{
fp = (10*tp) / 100;
System.out.print("you get a 10% Discount");
}
else if(tp>500 || tp<=1000)
{
fp = (20*tp) / 100;
System.out.print("you get a 20% Discount");
}
else if(tp>1000)
{
fp = (30*tp) / 100;
System.out.print("you get a 30% Discount");
}
else
return 0;
}
}
l.setText (string == valueof(fp));**/
}
public static void main (String arg[ ])
{
mainP t=new mainP();
t.setSize (500,500);
t.SetVisible (true);
}
}
}