📄 huilvpanel.java~21~
字号:
package bankmanager;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import java.awt.*;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JComboBox;
import javax.swing.JTextArea;
import java.awt.Font;
import javax.swing.*;
import javax.swing.DebugGraphics;
import javax.swing.BorderFactory;
import java.awt.Color;
import javax.swing.border.TitledBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
public class HuiLvPanel extends JPanel {
public HuiLvPanel() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
URL pic = this.getClass().getResource("/hl.jpg");
jLabel1.setIcon(new ImageIcon(pic));
jPanel1.setBackground(new Color(255, 255, 164));
jPanel1.setBounds(new Rectangle( -1, 0, 701, 451));
jPanel1.setLayout(null);
return2.setBackground(SystemColor.activeCaption);
return2.setBounds(new Rectangle(507, 274, 90, 49));
return2.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
return2.setForeground(Color.white);
return2.setText("返 回");
return2.addActionListener(new HuiLvPanel_jButton2_actionAdapter(this));
jLabel1.setBounds(new Rectangle(11, 8, 385, 365));
choice.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
choice.setBounds(new Rectangle(453, 60, 181, 26));
choice.addActionListener(new HuiLvPanel_choice_actionAdapter(this));
jLabel2.setFont(new java.awt.Font("方正姚体", Font.BOLD, 20));
jLabel2.setForeground(Color.red);
jLabel2.setText("汇率表查询:");
jLabel2.setBounds(new Rectangle(455, 15, 189, 40));
text.setBackground(new Color(255, 255, 164));
text.setFont(new java.awt.Font("方正姚体", Font.BOLD, 15));
text.setBorder(BorderFactory.createEtchedBorder());
text.setToolTipText("");
text.setCaretColor(Color.black);
text.setDisabledTextColor(Color.gray);
text.setBounds(new Rectangle(424, 94, 243, 169));
display.setBackground(new Color(255, 255, 164));
display.setBounds(new Rectangle(404, 335, 291, 108));
display.addAncestorListener(new HuiLvPanel_display_ancestorAdapter(this));
jPanel1.add(choice);
jPanel1.add(jLabel2);
jPanel1.add(return2);
jPanel1.add(text);
jPanel1.add(jLabel1);
jPanel1.add(display);
this.add(jPanel1);
choice.addItem("美元");
choice.addItem("欧元");
choice.addItem("英镑");
choice.addItem("日元");
choice.addItem("澳元");
choice.addItem("港元");
choice.addItem("台币");
choice.addItem("韩元");
}
JPanel jPanel1 = new JPanel();
JButton return2 = new JButton();
JLabel jLabel1 = new JLabel();
JComboBox choice = new JComboBox();
JLabel jLabel2 = new JLabel();
TitledBorder titledBorder1 = new TitledBorder("");
JTextArea text = new JTextArea();
JTextArea display = new JTextArea();
//返回到 MenuPanel 界面
public void jButton2_actionPerformed(ActionEvent e) {
this.setVisible(false);
MainAppBank.frame.setContentPane(new MenuPanel());
MainAppBank.frame.setVisible(true);
}
public void return2_actionPerformed(ActionEvent e) {
disable();
MainAppBank.frame.setContentPane(new MenuPanel());
MainAppBank.frame.setVisible(true);
}
public void choice_actionPerformed(ActionEvent e) {
String strUS = "\n买入价:"
+ "\n\n7.3660人民币"
+ "\n\n卖出价:"
+ "\n\n7.3797人民币";
String strEurope = "\n买入价:"
+ "\n\n10.5810人民币"
+ "\n\n卖出价:"
+ "\n\n10.6347人民币";
String strpound = "\n买入价:"
+ "\n\n14.625人民币"
+ "\n\n卖出价:"
+ "\n\n14.671人民币";
String strJapan = "\n买入价:"
+ "\n\n0.065人民币"
+ "\n\n卖出价:"
+ "\n\n0.064人民币";
String strAustralia = "\n买入价:"
+ "\n\n6.3710人民币"
+ "\n\n卖出价:"
+ "\n\n6.41人民币";
String strHK = "\n买入价:"
+ "\n\n0.944人民币"
+ "\n\n卖出价:"
+ "\n\n0.946人民币";
String strTaiwan = "\n买入价:"
+ "\n\n0.227人民币"
+ "\n\n卖出价:"
+ "\n\n......人民币";
String strKorea = "\n买入价:"
+ "\n\n0.008人民币"
+ "\n\n卖出价:"
+ "\n\n0.008人民币";
if (choice.getSelectedItem().equals("美元")) {
text.setText(strUS);
}
if (choice.getSelectedItem().equals("欧元")) {
text.setText(strEurope);
}
if (choice.getSelectedItem().equals("英镑")) {
text.setText(strpound);
}
if (choice.getSelectedItem().equals("日元")) {
text.setText(strJapan);
}
if (choice.getSelectedItem().equals("澳元")) {
text.setText(strAustralia);
}
if (choice.getSelectedItem().equals("港元")) {
text.setText(strHK);
}
if (choice.getSelectedItem().equals("台币")) {
text.setText(strTaiwan);
}
if (choice.getSelectedItem().equals("韩元")) {
text.setText(strKorea);
}
}
public void display_ancestorAdded(AncestorEvent event) {
display.setText("dfasdfsfsdf");
}
class HuiLvPanel_choice_actionAdapter implements ActionListener {
private HuiLvPanel adaptee;
HuiLvPanel_choice_actionAdapter(HuiLvPanel adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.choice_actionPerformed(e);
}
}
class HuiLvPanel_jButton2_actionAdapter implements ActionListener {
private HuiLvPanel adaptee;
HuiLvPanel_jButton2_actionAdapter(HuiLvPanel adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.return2_actionPerformed(e);
}
}
}
class HuiLvPanel_display_ancestorAdapter implements AncestorListener {
private HuiLvPanel adaptee;
HuiLvPanel_display_ancestorAdapter(HuiLvPanel adaptee) {
this.adaptee = adaptee;
}
public void ancestorAdded(AncestorEvent event) {
adaptee.display_ancestorAdded(event);
}
public void ancestorRemoved(AncestorEvent event) {
}
public void ancestorMoved(AncestorEvent event) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -