📄 gridbaglayoutdemo.java
字号:
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button43.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[27]=new seat("aisle","4C");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label29.setText(information2);
button43.setBackground(Color.yellow);
label29.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[27].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label29.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button43.setBackground( Color.green);
label29.setForeground(Color.red);
label29.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
}});
button44.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[28]=new seat("middle","4D");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label30.setText(information2);
button44.setBackground(Color.yellow);
label30.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[28].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label30.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button44.setBackground( Color.green);
label30.setForeground(Color.red);
label30.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
}});
button45.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[29]=new seat("aisle","4E");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label31.setText(information2);
button45.setBackground(Color.yellow);
label31.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[29].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label31.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button45.setBackground( Color.green);
label31.setForeground(Color.red);
label31.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button46.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[30]=new seat("aisle","4F");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label32.setText(information2);
button46.setBackground(Color.yellow);
label32.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[30].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label33.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button46.setBackground( Color.green);
label33.setForeground(Color.red);
label33.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button47.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[31]=new seat("window","4G");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label33.setText(information2);
button47.setBackground(Color.yellow);
label33.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[31].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label33.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button47.setBackground( Color.green);
label33.setForeground(Color.red);
label33.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button48.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[32]=new seat("window","5A");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label34.setText(information2);
button48.setBackground(Color.yellow);
label34.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[32].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label34.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button48.setBackground( Color.green);
label34.setForeground(Color.red);
label34.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button49.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[33]=new seat("aisle","5B");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label35.setText(information2);
button49.setBackground(Color.yellow);
label35.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[33].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label35.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button49.setBackground( Color.green);
label35.setForeground(Color.red);
label35.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button50.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[34]=new seat("aisle","5C");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label36.setText(information2);
button50.setBackground(Color.yellow);
label36.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[34].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label36.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button50.setBackground( Color.green);
label36.setForeground(Color.red);
label36.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button51.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[35]=new seat("middle","5D");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label37.setText(information2);
button51.setBackground(Color.yellow);
label37.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[35].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label37.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button51.setBackground( Color.green);
label37.setForeground(Color.red);
label37.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button52.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[36]=new seat("aisle","5E");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label38.setText(information2);
button52.setBackground(Color.yellow);
label38.setForeground(Color.red);
tempid1=JOptionPane.showInputDialog("please input ur ID");
temp_name1=JOptionPane.showInputDialog("please input ur name");
onepassager1=new person(tempid1,temp_name1);
jt5.setText("the owner information: "+onepassager1.toString() );
jt1.setText("seat infomation: "+oneseat[36].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label38.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button52.setBackground( Color.green);
label38.setForeground(Color.red);
label38.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button53.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -