📄 applicationdeniedpanel.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 java.util.*;
import java.applet.*;
import javax.swing.*;
/**
* ApplicationDeniedPanel displays a reason to the applicant for
* not being approved.
*/
public class ApplicationDeniedPanel extends JPanel {
GridBagLayout gridBagLayout1 = new GridBagLayout();
GridBagLayout gridBagLayout2 = new GridBagLayout();
BorderLayout borderLayout1 = new BorderLayout();
BorderLayout borderLayout2 = new BorderLayout();
JLabel denialLabel = new JLabel();
JPanel buttonPanel = new JPanel();
JButton okButton = new JButton();
JPanel imagePanel = new JPanel();
JLabel imageLabel = new JLabel();
BorderLayout borderLayout3 = new BorderLayout();
JPanel denialMessagePanel = new JPanel();
JTextArea denialMessageArea = 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 ApplicationDeniedPanel() {
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 Reason Text
* @param reason String
*/
public void setReason(String reason) {
denialMessageArea.setText(res.getString("You_have_been_denied") + "\n\n" + reason);
}
/**
* Initialize the Panel
* @throws Exception exception
*
*/
private void jbInit() throws Exception{
this.setSize(new Dimension(448, 347));
this.setLayout(borderLayout6);
denialLabel.setFont(new java.awt.Font("Dialog", 3, 18));
denialLabel.setForeground(Color.red);
denialLabel.setHorizontalAlignment(SwingConstants.CENTER);
denialLabel.setText(res.getString("Sorry!"));
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")));
denialMessagePanel.setLayout(borderLayout4);
denialMessageArea.setLineWrap(true);
denialMessageArea.setWrapStyleWord(true);
denialMessageArea.setEditable(false);
mainPanel.setLayout(gridBagLayout3);
this.add(denialLabel, BorderLayout.NORTH);
this.add(buttonPanel, BorderLayout.SOUTH);
buttonPanel.add(okButton, null);
this.add(mainPanel, BorderLayout.CENTER);
mainPanel.add(imagePanel, new GridBagConstraints(2, 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(denialMessagePanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));
denialMessagePanel.add(jScrollPane2, BorderLayout.CENTER);
jScrollPane2.getViewport().add(denialMessageArea, null);
}
void okButton_actionPerformed(ActionEvent e) {
if (creditApprovalApplet != null) {
creditApprovalApplet.destroyApplet();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -