📄 gridbaglayoutdemo.java
字号:
{
label18.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button32.setBackground( Color.green);
label18.setForeground(Color.red);
label18.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button33.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[17]=new seat("window","2G");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label19.setText(information2);
button33.setBackground(Color.yellow);
label19.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[17].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label19.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button33.setBackground( Color.green);
label19.setForeground(Color.red);
label19.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
// ////////////////////////////////////////////////
button34.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[18]=new seat("window","3A");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label20.setText(information2);
button34.setBackground(Color.yellow);
label20.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[18].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label20.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button34.setBackground( Color.green);
label20.setForeground(Color.red);
label20.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button35.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[19]=new seat("aisle","3B");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label21.setText(information2);
button35.setBackground(Color.yellow);
label21.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[19].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label21.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button35.setBackground( Color.green);
label21.setForeground(Color.red);
label21.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button36.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[20]=new seat("aisle","3C");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label22.setText(information2);
button36.setBackground(Color.yellow);
label22.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[20].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label1.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button16.setBackground( Color.green);
label1.setForeground(Color.red);
label1.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button37.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[21]=new seat("middle","3D");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label23.setText(information2);
button37.setBackground(Color.yellow);
label23.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[21].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label23.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button37.setBackground( Color.green);
label23.setForeground(Color.red);
label23.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button38.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[22]=new seat("aisle","3E");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label24.setText(information2);
button38.setBackground(Color.yellow);
label24.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[22].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label25.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button39.setBackground( Color.green);
label25.setForeground(Color.red);
label25.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button39.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[23]=new seat("aisle","3F");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label25.setText(information2);
button39.setBackground(Color.yellow);
label25.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[23].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label25.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button39.setBackground( Color.green);
label25.setForeground(Color.red);
label25.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button40.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[24]=new seat("window","3G");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label26.setText(information2);
button40.setBackground(Color.yellow);
label26.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[24].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label26.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button40.setBackground( Color.green);
label26.setForeground(Color.red);
label26.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
// //////////////////////////////////////////////////
button41.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[25]=new seat("window","4A");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label27.setText(information2);
button41.setBackground(Color.yellow);
label27.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[25].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label27.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button41.setBackground( Color.green);
label27.setForeground(Color.red);
label27.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button42.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[26]=new seat("aisle","4B");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label28.setText(information2);
button42.setBackground(Color.yellow);
label28.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[26].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
// jt3.setText("flight infomation: "+oneflight.toString() );
}
else if(information2.compareTo("clear")==0)
{
label28.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button42.setBackground( Color.green);
label28.setForeground(Color.red);
label28.setText("book");
jt5.setText("" );
jt1.setText("" );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -