⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemerrorpanel.java

📁 java在线商店的源代码。编写十分规范的哦
💻 JAVA
字号:
/**
 * Copyright (c) 1996-2004 Borland Software Corporation.  All Rights Reserved.
 * 
 * This SOURCE CODE FILE, which has been provided by Borland Software as part
 * of a Borland Software product for use ONLY by licensed users of the product,
 * includes CONFIDENTIAL and PROPRIETARY information of Borland Software.  
 *
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
 * THE PRODUCT.
 *
 * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS
 * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
 * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
 * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
 * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
 * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
 * DERIVED FROM THIS SOURCE CODE FILE.
 */
//------------------------------------------------------------------------------
// Copyright (c) 1996-2004 Borland Software Corporation.  All Rights Reserved.
//------------------------------------------------------------------------------

package com.borland.samples.creditapproval.client;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.applet.*;

import com.borland.dbswing.*;

/**
 * SystemErrorPanel displays system errors to the applicant
 */
public class SystemErrorPanel extends JPanel {
  GridBagLayout gridBagLayout1 = new GridBagLayout();
  GridBagLayout gridBagLayout2 = new GridBagLayout();
  BorderLayout borderLayout1 = new BorderLayout();
  BorderLayout borderLayout2 = new BorderLayout();
  JLabel errorLabel = new JLabel();
  JPanel buttonPanel = new JPanel();
  JButton okButton = new JButton();
  JPanel imagePanel = new JPanel();
  JLabel imageLabel = new JLabel();
  BorderLayout borderLayout3 = new BorderLayout();
  JPanel errorMessagePanel = new JPanel();
  JTextArea errorMessageArea = new JTextArea();
  BorderLayout borderLayout4 = new BorderLayout();
  JScrollPane jScrollPane2 = new JScrollPane();
  JPanel mainPanel = new JPanel();
  BorderLayout borderLayout6 = new BorderLayout();
  GridBagLayout gridBagLayout3 = new GridBagLayout();
  ResourceBundle res = Res.getBundle("com.borland.samples.creditapproval.client.Res");

  private CreditApprovalApplet creditApprovalApplet;

  /**
   * Default constructor
   */
  public SystemErrorPanel() {
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  /**
   * Sets a reference to the CreditApprovalApplet using this panel.
   * @param creditApprovalApplet CreditApprovalApplet
   *
   */
  public void setCreditApprovalApplet(CreditApprovalApplet creditApprovalApplet) {
    this.creditApprovalApplet = creditApprovalApplet;
  }

  /**
   * Invoked by the applet to set the displayed error text.
   * @param error String
   */
  public void setError(String error) {
    errorMessageArea.setText(res.getString("Error_during_processing") + "\n\n" + error);
  }

  /**
   *  Initialize the Panel
   *  @throws Exception exception
   *
   */
  private void jbInit() throws Exception{
    this.setSize(new Dimension(534, 280));
    this.setLayout(borderLayout6);
    errorLabel.setFont(new java.awt.Font("Dialog", 3, 18));
    errorLabel.setForeground(Color.red);
    errorLabel.setHorizontalAlignment(SwingConstants.CENTER);
    errorLabel.setText(res.getString("System_Error"));
    okButton.setText(res.getString("OK"));
    okButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        okButton_actionPerformed(e);
      }
    });
    imagePanel.setLayout(borderLayout3);
    imageLabel.setIcon(new ImageIcon(this.getClass().getResource("images/logo.gif")));
    errorMessagePanel.setLayout(borderLayout4);
    errorMessageArea.setLineWrap(true);
    errorMessageArea.setWrapStyleWord(true);
    errorMessageArea.setEditable(false);
    mainPanel.setLayout(gridBagLayout3);
    this.add(errorLabel, BorderLayout.NORTH);
    this.add(buttonPanel, BorderLayout.SOUTH);
    buttonPanel.add(okButton, null);
    this.add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(imagePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0
            ,GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(10, 10, 10, 10), 0, 0));
    imagePanel.add(imageLabel, BorderLayout.CENTER);
    mainPanel.add(errorMessagePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));
    errorMessagePanel.add(jScrollPane2, BorderLayout.CENTER);
    jScrollPane2.getViewport().add(errorMessageArea, null);
  }

  /**
   * Re-display the application panel so that the user may submit
   * their application again.
   * @param e ActionEvent
   *
   */
  void okButton_actionPerformed(ActionEvent e) {
    if (creditApprovalApplet != null) {
      creditApprovalApplet.displayApplication();
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -