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

📄 trantwo.java

📁 GUI银行管理系统,包括一系列的用户操作功能
💻 JAVA
字号:
package denglu;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class Trantwo extends JPanel {
		private JButton onehundred,twohundred,fivehundred,thousand,fivethousand,buttontrue;
		private JLabel trantwoone,trantwotwo;
		private JTextField trantext;
		private Image bg;
		private JFrame MyJFrame;
		Trantwo(){		
			MyPanel();
			initsize();
			initOther();
		}
		public void MyPanel()
		{
			this.setLayout(null);
			this.add(getOnehundred());
			this.add(getTwohundred());
			this.add(getFivehundred());
			this.add(getThousand());
			this.add(getFivethousand());
			this.add(getButtontrue());
			this.add(getTrantwoone());
			this.add(getTrantwotwo());
			this.add(getTrantext());
		     try{
		            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		            SwingUtilities.updateComponentTreeUI(this);
		        } catch(Exception exe){
		            exe.printStackTrace();
		        }
		}
		public void initsize()
		{
			MyJFrame = new JFrame();
			MyJFrame.setUndecorated(true);
			MyJFrame.setVisible(true);
			MyJFrame.validate();
			MyJFrame.getContentPane().add(this,null);
			MyJFrame.setBounds(200, 50, 700, 500);
		}
		private JButton getOnehundred() {
			onehundred = new JButton("100");
			onehundred.setBounds(50, 100, 70, 30);
			onehundred.addActionListener(new ActionListener(){
				public void actionPerformed(ActionEvent arg0) {
					int tenten=Integer.parseInt(onehundred.getText());
					String sql = "select (TotalCash,Banlance) from SaveCash where CustomalID =111111";
					LinkDataBast getcash = new LinkDataBast(sql);
					try{
						trantext.setText(getcash.rs.getString(1));
					}catch(SQLException ex)
					{
						System.out.println("this is SQL error!");
					}
				}			
			});
			return onehundred;
		}
		private JButton getTwohundred() {
			twohundred = new JButton("200");
			twohundred.setBounds(50, 200, 70, 30);
			return twohundred;
		}
		private JButton getFivehundred() {
			fivehundred = new JButton("500");
			fivehundred.setBounds(50, 300, 70, 30);
			return fivehundred;
		}
		private JButton getThousand() {
			thousand = new JButton("1000");
			thousand.setBounds(600, 100, 70, 30);
			return thousand;
		}
		private JButton getFivethousand() {
			fivethousand = new JButton("5000");
			fivethousand.setBounds(600, 200, 70, 30);
			return fivethousand;
		}
		private JButton getButtontrue() {
			buttontrue = new JButton("确定");
			buttontrue.setBounds(600, 400, 80, 30);
			return buttontrue;
		}
		private JLabel getTrantwoone() {
			trantwoone = new JLabel("其它金额:");
			trantwoone.setBounds(310,150, 80, 40);
			return trantwoone;
		}
		private JLabel getTrantwotwo() {
			trantwotwo = new JLabel("hjfgjhgf");
			trantwotwo.setBounds(310,250, 80, 40);
			return trantwotwo;
		}
		private JTextField getTrantext() {
			trantext = new JTextField(10);
			trantext.setBounds(290, 200, 80, 27);
			return trantext;
		}
	    private void initOther(){
	        bg = Toolkit.getDefaultToolkit().createImage(this.getClass().getResource("login/bj3.jpg"));      
	        MediaTracker mt=new MediaTracker(this);
	        mt.addImage(bg,0);
	        try{
	            mt.waitForAll();
	        } catch(Exception exe){
	            exe.printStackTrace();
	        }
	    }
	    protected void paintComponent(Graphics g){
	        super.paintComponent(g);
	        g.drawImage(bg,0,0,this);
	    }
		public static void main(String args[])
		{
			new Trantwo();
		}
}

⌨️ 快捷键说明

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