Exemplo n.º 1
0
  /*
   **构造函数
   */
  public AboutDialog() {
    setTitle("蜘蛛牌");
    setSize(300, 200);
    setResizable(false);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    Container c = this.getContentPane();

    jt1.setSize(260, 200);
    jt2.setSize(260, 200);

    jt1.setEditable(false);
    jt2.setEditable(false);

    jt1.setLineWrap(true);
    jt2.setLineWrap(true);

    jt1.setFont(new Font("楷体_GB2312", java.awt.Font.BOLD, 13));
    jt1.setForeground(Color.blue);

    jt2.setFont(new Font("楷体_GB2312", java.awt.Font.BOLD, 13));
    jt2.setForeground(Color.black);

    jPanel1.add(jt1);
    jPanel2.add(jt2);

    jTabbedPane.setSize(300, 200);
    jTabbedPane.addTab("游戏规则", null, jPanel1, null);
    jTabbedPane.addTab("声明", null, jPanel2, null);

    jMainPane.add(jTabbedPane);
    c.add(jMainPane);

    pack();
    this.setVisible(true);
  }
  private void setUpMainPanel() {
    /////// SET UP TABBED PANE

    mainPanel.setSize(1000, 250);

    int space = 15;
    Border spaceBorder = BorderFactory.createEmptyBorder(space, space, space, space);
    Border titleBorder = BorderFactory.createLineBorder(new Color(184, 207, 229));

    mainPanel.setBorder(BorderFactory.createCompoundBorder(spaceBorder, titleBorder));

    mainPanel.setLayout(new BorderLayout());

    centrePanel.setLayout(new BoxLayout(centrePanel, BoxLayout.PAGE_AXIS));

    buttonPanel = new ButtonPanel();

    buttonPanel.setButtonListener(
        new StringListener() {
          @Override
          public void textOmitted(String text) {
            actionChoice(text);
          }
        });

    tabbedPane = new JTabbedPane();

    leasePanel = new LeasePanel("Leases");

    try {
      leasePanel.setData(landlord.getLeases());
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    leasePanel.setTableListener(
        new StringListener() {
          @Override
          public void textOmitted(String text) {
            actionChoice(text);
          }
        });

    notePanel = new NotePanel("Notes");

    try {
      notePanel.setData(landlord.getNotes());
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    notePanel.setTableListener(
        new StringListener() {
          @Override
          public void textOmitted(String text) {
            actionChoice(text);
          }
        });

    modPanel = new ModPanel("Modifications");

    try {
      modPanel.setData(landlord.getModifiedBy());
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    tabbedPane.setSize(800, 175);

    tabbedPane.add(leasePanel, "Leases");
    tabbedPane.add(notePanel, "Notes");
    tabbedPane.add(modPanel, "Modifications");

    centrePanel.add(tabbedPane);
    try {
      centrePanel.add(
          new DetailsPanel(
              landlord.getCreatedBy(),
              landlord.getCreatedDate(),
              landlord.getLastModifiedBy(),
              landlord.getLastModifiedDate()));
    } catch (RemoteException ex) {
      Logger.getLogger(LandlordDetails.class.getName()).log(Level.SEVERE, null, ex);
    }

    mainPanel.add(buttonPanel, BorderLayout.WEST);
    mainPanel.add(centrePanel, BorderLayout.CENTER);
  }