📄 gridbaglayoutdemo.java
字号:
if(information2.compareTo("buy")==0)
{ label7.setText(information2);
button22.setBackground(Color.yellow);
label7.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[6].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label7.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button22.setBackground( Color.green);
label7.setForeground(Color.red);
label7.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }
});
button23.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[7]=new seat("middle","1D");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label8.setText(information2);
button23.setBackground(Color.yellow);
label8.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[7].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);}
else if(information2.compareTo("clear")==0)
{
label8.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button23.setBackground( Color.green);
label8.setForeground(Color.red);
label8.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
}});
button24.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[8]=new seat("aisle","1E");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label9.setText(information2);
button24.setBackground(Color.yellow);
label9.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[8].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)
{
button24.setBackground( Color.green);
label19.setForeground(Color.red);
label19.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }
});
button25.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[9]=new seat("aisle","1F");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label10.setText(information2);
button25.setBackground(Color.yellow);
label10.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[9].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label10.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button25.setBackground( Color.green);
label10.setForeground(Color.red);
label10.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button26.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[10]=new seat("window","1G");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label11.setText(information2);
button26.setBackground(Color.yellow);
label11.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[10].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label11.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button26.setBackground( Color.green);
label11.setForeground(Color.red);
label11.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
// /////////////////////////////////////////
button27.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[11]=new seat("window","2A");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label12.setText(information2);
button27.setBackground(Color.yellow);
label12.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[11].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label12.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button27.setBackground( Color.green);
label12.setForeground(Color.red);
label12.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button28.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[12]=new seat("aisle","2B");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label13.setText(information2);
button28.setBackground(Color.yellow);
label13.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[12].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label13.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button28.setBackground( Color.green);
label13.setForeground(Color.red);
label13.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }
});
button29.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[13]=new seat("aisle","2C");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label14.setText(information2);
button29.setBackground(Color.yellow);
label14.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[13].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label14.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button29.setBackground( Color.green);
label14.setForeground(Color.red);
label14.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button30.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[14]=new seat("middle","2D");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label15.setText(information2);
button30.setBackground(Color.yellow);
label15.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[14].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label15.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button30.setBackground( Color.green);
label15.setForeground(Color.red);
label15.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button31.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[15]=new seat("aisle","2E");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label17.setText(information2);
button31.setBackground(Color.yellow);
label17.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[15].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
{
label17.setText("");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1++;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("book")==0)
{
button31.setBackground( Color.green);
label17.setForeground(Color.red);
label17.setText("book");
jt5.setText("" );
jt1.setText("" );
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
} }});
button32.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
oneseat[16]=new seat("aisle","2F");
String information2 =JOptionPane.showInputDialog("please decide do u want to buy or booked");
if(information2.compareTo("buy")==0)
{ label18.setText(information2);
button32.setBackground(Color.yellow);
label18.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[16].toString());
jt1.setEditable( true);
num1--;
jt2.setText("remain seats number: "+num1);
}
else if(information2.compareTo("clear")==0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -