📄 small_air_craft.java
字号:
pane.add(button57,c);
button60 =new JButton("a");
c.gridx=7;
c.gridy=15;
pane.add(button60,c);
button61 =new JButton("w");
c.gridx=8;
c.gridy=15;
pane.add(button61,c);
// $$$$$$$$$$$$$$$$$$$$$$$$
jt1=new JTextField();
c.gridwidth=30;
c.gridx=0;
c.gridy=16;
pane.add(jt1,c);
jt2=new JTextField();
c.gridwidth=30;
c.gridx=0;
c.gridy=17;
pane.add(jt2,c);
// jt3=new JTextField();
// c.gridwidth=30;
// c.gridx=0;
// c.gridy=18;
// pane.add(jt3,c);
// jt4=new JTextField();
// c.gridwidth=30;
// c.gridx=0;
// c.gridy=19;
// pane.add(jt4,c);
jt5=new JTextField();
c.gridwidth=30;
c.gridx=0;
c.gridy=18;
pane.add(jt5,c);
jt6=new JTextField();
c.gridwidth=5;
c.gridx=0;
c.gridy=1;
pane.add(jt6,c);
jt9=new JTextField();
//c.gridwidth=5;
c.gridx=6;
c.gridy=1;
pane.add(jt9,c);
jt7=new JTextField();
c.gridwidth=40;
c.gridx=0;
c.gridy=3;
pane.add(jt7,c);
// +String info =JOptionPane.showInputDialog("please insert ur destination");
check=new JButton("check destination & start city");
c.gridwidth=3;
c.gridx=0;
c.gridy=2;
pane.add(check,c);
// String info1 =JOptionPane.showInputDialog("please insert ur flight time");
final seat[]oneseat=new seat[46];
button16.add(label1);
button17.add(label2);
button18.add(label3);
button19.add(label4);
button20.add(label5);
button21.add(label6);
button22.add(label7);
//button23.add(label8);
//button24.add(label9);
button25.add(label10);
button26.add(label11);
button27.add(label12);
button28.add(label13);
button29.add(label14);
//button30.add(label15);
//button31.add(label17);
button32.add(label18);
button33.add(label19);
button34.add(label20);
button35.add(label21);
button36.add(label22);
//button37.add(label23);
//button38.add(label24);
button39.add(label25);
button40.add(label26);
button41.add(label27);
button42.add(label28);
button43.add(label29);
//button44.add(label30);
//button45.add(label31);
button46.add(label32);
button47.add(label33);
button48.add(label34);
button49.add(label35);
button50.add(label36);
//button51.add(label37);
//button52.add(label38);
button53.add(label39);
button54.add(label40);
button55.add(label41);
button56.add(label42);
button57.add(label43);
//button58.add(label44);
//button59.add(label45);
button60.add(label46);
button61.add(label47);
label16=new JLabel();
label16.setText("flightcheck");
c.gridx=5;
c.gridy=0;
// pane.add(label16,c);
// c.gridx=7;
// c.gridy=4;
// pane.add(show,c);
check.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
for(int i=0;i<6;i++){
if(jt6.getText().compareTo(air1.get_2st(i).get_dis())==0&&jt9.getText().compareTo(air1.get_2st(i).get_start())==0){
jt7.setText("infomation: "+air1.get_2st(i).toString() );
}
//input.set_info(jt6.getText());
}
}});
// /////////////////////////////////////
button16.addActionListener (
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[0]=new seat("window","f1A");
String information2 =JOptionPane.showInputDialog("please decide do " +
"u want to buy or booked or clear ");
if(information2.compareTo("buy")==0)
{ label1.setText(information2);
button16.setBackground(Color.yellow);
label1.setForeground(Color.red);
tempid=JOptionPane.showInputDialog("please input ur ID");
temp_name=JOptionPane.showInputDialog("please input ur name");
onepassager=new person(tempid,temp_name);
jt5.setText("the owner information: "+onepassager.toString() );
jt1.setText("seat infomation: "+oneseat[0].toString());
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("clear")==0)
{
label1.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num++;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("book")==0)
{
button16.setBackground( Color.green);
label1.setForeground(Color.red);
label1.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
}});
button17.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[1]=new seat("aisle","f1B");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label2.setText(information2);
button17.setBackground(Color.yellow);
label2.setForeground(Color.red);
tempid=JOptionPane.showInputDialog("please input ur ID");
temp_name=JOptionPane.showInputDialog("please input ur name");
onepassager=new person(tempid,temp_name);
jt5.setText("the owner information: "+onepassager.toString() );
jt1.setText("seat infomation: "+oneseat[1].toString());
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("clear")==0)
{
label2.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num++;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("book")==0)
{
button17.setBackground( Color.green);
label2.setForeground(Color.red);
label2.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
}});
button18.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[2]=new seat("aisle","f1C");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label3.setText(information2);
button18.setBackground(Color.yellow);
label3.setForeground(Color.red);
tempid=JOptionPane.showInputDialog("please input ur ID");
temp_name=JOptionPane.showInputDialog("please input ur name");
onepassager=new person(tempid,temp_name);
jt5.setText("the owner information: "+onepassager.toString() );
jt1.setText("seat infomation: "+oneseat[2].toString());
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("clear")==0)
{
label3.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num++;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("book")==0)
{
button18.setBackground( Color.green);
label3.setForeground(Color.red);
label3.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
} }});
button19.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[3]=new seat("window","f1D");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label4.setText(information2);
button19.setBackground(Color.yellow);
label4.setForeground(Color.red);
tempid=JOptionPane.showInputDialog("please input ur ID");
temp_name=JOptionPane.showInputDialog("please input ur name");
onepassager=new person(tempid,temp_name);
jt5.setText("the owner information: "+onepassager.toString() );
jt1.setText("seat infomation: "+oneseat[3].toString());
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("clear")==0)
{
label4.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num++;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("book")==0)
{
button19.setBackground( Color.green);
label4.setForeground(Color.red);
label4.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
}});
// /////////////////////////////////////////
button20.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[4]=new seat("window","1A");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label5.setText(information2);
button20.setBackground(Color.yellow);
label5.setForeground(Color.red);
tempid=JOptionPane.showInputDialog("please input ur ID");
temp_name=JOptionPane.showInputDialog("please input ur name");
onepassager=new person(tempid,temp_name);
jt5.setText("the owner information: "+onepassager.toString() );
jt1.setText("seat infomation: "+oneseat[4].toString());
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);}
else if(information2.compareTo("clear")==0)
{
label5.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num++;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("book")==0)
{
button20.setBackground( Color.green);
label5.setForeground(Color.red);
label5.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
} }
});
button21.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[5]=new seat("aisle","1B");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label6.setText(information2);
button21.setBackground(Color.yellow);
label6.setForeground(Color.red);
tempid=JOptionPane.showInputDialog("please input ur ID");
temp_name=JOptionPane.showInputDialog("please input ur name");
onepassager=new person(tempid,temp_name);
jt5.setText("the owner information: "+onepassager.toString() );
jt1.setText("seat infomation: "+oneseat[5].toString());
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("clear")==0)
{
label6.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num++;
jt2.setText("remain seats number: "+num);
}
else if(information2.compareTo("book")==0)
{
button21.setBackground( Color.green);
label6.setForeground(Color.red);
label6.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num--;
jt2.setText("remain seats number: "+num);
} }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -