import javax.swing.JOptionPane;
public class ch0304{
  public static void main(String[] args) {
	   //打印表头
    String output= "        Multiplication Table\n";
    output+="------------------------------------------\n";
  
          //打印数据头
    output += "    |  ";
    for (int j=1; j<=9;j++)
      output+= "   "+j;
    output += "\n";

          //打印表体
    for(int i=1;i<=9;i++) {  
      output+=i+"  |  ";
      for(int j=1;j<=9;j++){
        if(i*j<10)
          output+="   "+i*j;
        else
          output+=" "+i*j;
      }
    output +="\n";
   }

  //输出结果
  JOptionPane.showMessageDialog(null,output,"Example 3.4 Output",JOptionPane.INFORMATION_MESSAGE);
  }
}
