我想要我的按钮"插入",点击打开新的小程序/窗口并关闭现有小程序。请尝试给我一些不使用JFrame
和JButton
等概念的方法。这只是前端。我将在后端使用MONGODB。
public class testd extends Applet implements ActionListener,ItemListener
{
Button insert,update,delete,view,report,search;
TextField na,am,sts,nr;
TextArea t;
Label head;
Choice down;
Checkbox si,sr;
CheckboxGroup g;
Button submit,cancel;
public void init()
{
setBackground(Color.white);
setForeground(Color.black);
this.setSize(new Dimension(500,500));
setLayout(new FlowLayout());
/////creating panel//////////////////
Panel p1=new Panel(new GridLayout(3,5,7,4));
head=new Label(" WELCOME ");
head.setFont(new Font("Courier",Font.BOLD,48));
p1.add(head);
add(head,"North");
/////////////////////creating menu///////////////////////
insert=new Button("INSERT");
update=new Button("UPDATE");
delete=new Button("DELETE");
view=new Button("VIEW");
report=new Button("REPORT");
search=new Button("SEARCH");
Font myFont = new Font("Arial", Font.ITALIC,30);
insert.setFont(myFont);
update.setFont(myFont);
delete.setFont(myFont);
view.setFont(myFont);
report.setFont(myFont);
search.setFont(myFont);
down=new Choice();
down.add("Machine Records");
down.add("Machine Worksheet ");
down.add("Machine Maintaince Record");
down.add("Employee Record");
down.add("Empoyee Worsheet");
down.add("Raw Materail Record");
down.add("Production Record");
down.add("Account");
down.setFont(myFont);
//submit=new Button("SUBMIT");
cancel=new Button("EXIT");
add(insert);
insert.addActionListener(this);
add(update);
add(view);
add(search);
add(delete);
add(report);
add(down);
//add(submit);
add(cancel);
down.addItemListener((ItemListener) this);
}
@Override
public void actionPerformed(ActionEvent ae) {
if(down.getSelectedItem().equals("Machine Records"))
{
if( ae.getSource()==insert)
{
/*WHAT TO ADD HERE TO OPEN NEW APPLET/WINDOW/*
}
}
}