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

📄 banca.java

📁 atm interface simulation
💻 JAVA
字号:
import java.awt.*;
//import jawa.io.*;
import java.util.Vector;
import java.util.Collections;
public class Banca extends Frame {
    Autentificare m1;
	Suplimentar m2;
	Optiuni t1;


	public Banca(){
		super("Fizica");
		setBackground(Color.gray);
		pack();
		resize(400,300);
	    adaugare();
		show();
	}
	
	void adaugare(){
		MenuBar meniu=new MenuBar();
		Menu autentificare=new Menu("Autentificare");
		Menu optiuni=new Menu("Optiuni");
		Menu suplimentar=new Menu("Suplimentar");
		Menu despre=new Menu("Contact ");
		Menu iesire=new Menu("Iesire");
	    autentificare.add("Autentificare");
		optiuni.add("Retragere numerar");
		optiuni.add("Consultare cont");
		optiuni.add("Schimbare PIN");
		suplimentar.add("Ajutor");
		despre.add("Despre autor");
		iesire.add("Iesire");
		meniu.add(autentificare);
		meniu.add(optiuni);
		meniu.add(suplimentar);
		meniu.add(despre);
		meniu.add(iesire);
		setMenuBar(meniu);	
	}
	
	public boolean handleEvent(Event ev){
		if (ev.id==Event.WINDOW_DESTROY)	System.exit(0);
		else if (ev.id==Event.ACTION_EVENT && ev.target instanceof MenuItem){ 	
	        if (ev.arg=="Iesire")   System.exit(0);   	
			if (ev.arg=="Autentificare") {
		    	m1=new Autentificare();	
		    	hide();
		    	}	
	
			if (ev.arg=="Retragere numerar"){
				t1=new Optiuni("Retragere numerar");	
		    	hide();
			}
			if (ev.arg=="Consultare cont"){
				t1=new Optiuni("Consultare cont");	
		    	hide();
			}
			if (ev.arg=="Schimbare PIN"){
			    t1=new Optiuni("Schimbare PIN");	
		    	hide();
			}
			if (ev.arg=="Ajutor"){
				m2=new Suplimentar ("Ajutor");
				hide();	
			}
		
		}
		 return true;
	}
	
	public static void main(String arg[]){
		Banca g=new Banca();	
	}	 
}
 

	
	
	

 class Autentificare extends Frame {
	Button b1,b2;
	Font f;
	Label l1,l2,l3;
	TextField t1,t2,t3;
	Double m,a,f1;
	Banca fr;
    String v;

	
	public Autentificare(){
		super("Autentificare");
		setBackground(Color.gray);
		pack();
		resize(400,300);
		f=new Font("Verdana",Font.ITALIC,16);
	    adaugare();
		show();
	}
	
	void adaugare(){
		
	//  String utilizator1[];
//	  utilizator1 = new String[100];
	//  utilizator1.addElement(2);
	  
	String utilizator1[]={"eu","tu","cine mai vrea"};
	  //v=utilizator1.get(1);
//	  System.out.println(utilizator1.get(0));
	  
		l1=new Label("Nume utilizator");
	    l2=new Label("Parola");

		t1=new TextField("",10);
	    t2=new TextField("",10);

		l1.setFont(f);
		l1.setBackground(Color.gray);
		l2.setFont(f);
		l2.setBackground(Color.gray);
	    t1.setFont(f);
		t1.setBackground(Color.white);
		t2.setFont(f);
		t2.setBackground(Color.white);
		b1=new Button("Validare");
		b2=new Button("Iesire");
		b1.setFont(f);
		b1.setBackground(Color.gray);
		b2.setFont(f);
		b2.setBackground(Color.gray);
		setLayout(new GridLayout(3,2));
		add(l1);add(t1);
	    add(l2);add(t2);
		add(b1);
		add(b2);
	}
	public boolean action(Event ev, Object ob) {
     if(ev.id==Event.ACTION_EVENT && ev.target instanceof Button){
      if("Iesire".equals(ev.arg)) { hide();
                                    fr=new Banca();
                                  }   
       else { 
      
         // aici se vine partea cu autentificarea
            
            }
      }
    return true;
   }
}	

 

class Optiuni extends Frame {
	Button b1,b2,b3;
	Font f;
	Label l1,l2,l3,l4,l5;
	TextField t1,t2,t3,t4;
	Panel p1,p2,p3;
	Double pr1,pr2,v1,v2,te1,te2;
	Banca fr;
	String tip,n;
	
	public Optiuni(String s){
		super("Optiuni");
	    tip=s;
		setBackground(Color.gray);
		pack();
		resize(400,300);
		f=new Font("Verdana",Font.ITALIC,16);
	    adaugare();
		show();
	}
	
	void adaugare(){
		
		
		// Retragerea de numerar din c0ntul curent
		
		
		if (tip=="Retragere numerar") {
			l1=new Label("                          Introduceti suma dorita");
			
			l5=new Label(tip);
		t1=new TextField("",10);
		l1.setFont(f);
		l1.setBackground(Color.gray);
		l5.setFont(f);
		l5.setBackground(Color.gray);
	    t1.setFont(f);
		t1.setBackground(Color.white);
		p1=new Panel();
		p1.add(l5);
		p2=new Panel();
				p2.setLayout(new GridLayout(2,4));
		p2.add(l1);p2.add(t1);
		p3=new Panel();
		b1=new Button("Validare");
		b3=new Button("Stergere");
		b2=new Button("Iesire");
		b1.setFont(f);
		b1.setBackground(Color.gray);
		b3.setFont(f);
		b3.setBackground(Color.gray);
		b2.setFont(f);
		b2.setBackground(Color.gray);
		p3.setLayout(new GridLayout(1,3));
		p3.add(b1);
		p3.add(b3);
		p3.add(b2);
		setLayout(new GridLayout(3,2));
		add(p1);
		add(p2);
		add(p3);
		} else
			
			//Afisarea situatiei curente a contului
			
			
		if (tip=="Consultare cont") {
			l1=new Label("Nume utilizator");
			l4=new Label("Valoarea contului");
			
			l5=new Label(tip);
		t1=new TextField("",10);
		n="4";
	    t4=new TextField(n,10);
		l1.setFont(f);
		l1.setBackground(Color.gray);
		l4.setFont(f);
		l4.setBackground(Color.gray);
		l5.setFont(f);
		l5.setBackground(Color.gray);
	    t1.setFont(f);
		t1.setBackground(Color.white);
		t4.setFont(f);
		t4.setBackground(Color.white);
		p1=new Panel();
		p1.add(l5);
		p2=new Panel();
		p2.setLayout(new GridLayout(2,4));
		p2.add(l1);p2.add(t1);
	    p2.add(l4); p2.add(t4);
		p3=new Panel();
		b1=new Button("Tiparire");
		b2=new Button("Iesire");
		b1.setFont(f);
		b1.setBackground(Color.gray);
		b2.setFont(f);
		b2.setBackground(Color.gray);
		p3.setLayout(new GridLayout(1,3));
		p3.add(b1);
		p3.add(b2);
		setLayout(new GridLayout(3,1));
		add(p1);
		add(p2);
		add(p3);
		} else
			
			
			
			//Schimbarea pinului curent 
			
			
		{
			l1=new Label("Introduceti PIN vechi");
			l2=new Label("Introduceti PIN nou");
			l3=new Label("Reconfirmati PIN nou");		
			l5=new Label(tip);
		t1=new TextField("1",10);
	    t2=new TextField("2",10);
	    t3=new TextField("3",10);
		l1.setFont(f);
		l1.setBackground(Color.gray);
		l2.setFont(f);
		l2.setBackground(Color.gray);
		l3.setFont(f);
		l3.setBackground(Color.gray);
		l5.setFont(f);
		l5.setBackground(Color.gray);
	    t1.setFont(f);
		t1.setBackground(Color.white);
		t2.setFont(f);
		t2.setBackground(Color.white);
		t3.setFont(f);
		t3.setBackground(Color.white);
		p1=new Panel();
		p1.add(l5);
		p2=new Panel();
		p2.setLayout (new GridLayout(3,3));
		p2.add(l1);	p2.add(t1);	
	    p2.add(l2); p2.add(t2);	    	
	    p2.add(l3);p2.add(t3);	    
		p3=new Panel();
		b1=new Button("Validare");
		b2=new Button("Iesire");
		b1.setFont(f);
		b1.setBackground(Color.gray);
		b2.setFont(f);
		b2.setBackground(Color.gray);
		p3.setLayout(new GridLayout(1,2));
		p3.add(b1);
		p3.add(b2);
		setLayout(new GridLayout(3,1));
		add(p1);
		add(p2);
		add(p3);
		}
		
	}
	public boolean action(Event ev, Object ob) {
     if(ev.id==Event.ACTION_EVENT && ev.target instanceof Button){
      if("Iesire".equals(ev.arg)) { hide();
                                    fr=new Banca();
                                  } 
       else if("Stergere".equals(ev.arg)) {
       	t1.setText(" ");
       	t2.setText(" ");
       	t3.setText(" ");
       	t4.setText(" ");
       }
       else{ if (tip=="Retragere numerar") {
       	      v1=Double.valueOf(t1.getText());
       	      v2=Double.valueOf(t2.getText());
       	      pr1=Double.valueOf(t3.getText());
       	      pr2=pr1*v1/v2;
       	      t4.setText(Double.toString(pr2)); 
       	      }
              else if (tip=="Consultare cont") {
       	      v1=Double.valueOf(t1.getText());
       	      v2=Double.valueOf(t2.getText());
       	      te1=Double.valueOf(t3.getText());
       	      te2=te1*v2/v1;
       	      t4.setText(Double.toString(te2)); 
       	      }
       	      else { 
       	      pr1=Double.valueOf(t1.getText());
       	      pr2=Double.valueOf(t2.getText());
       	      te1=Double.valueOf(t3.getText());
       	      te2=te1*pr2/pr1;
       	      t4.setText(Double.toString(te2)); 
       	      }
            }
      }
    return true;
   }
}
class Suplimentar extends Frame {
	Button b2;
	Font f;
	Label l5;
	TextArea t1;
	Panel p1,p2,p3;
	Banca fr;
	String tip;
	
	public Suplimentar(String s){
		super("Ajutor");
	    tip=s;
		setBackground(Color.gray);
		pack();
		resize(400,300);
		f=new Font("Verdana",Font.ITALIC,16);
	    adaugare();
		show();
	}
	
	void adaugare(){
		if (tip=="Ajutor") {			
			l5=new Label(tip);
		t1=new TextArea("Aici trebuie sa vina informatiile despre program si alte cele iar aste vora aparea nu");
		l5.setFont(f);
		l5.setBackground(Color.gray);
	    t1.setFont(f);
		t1.setBackground(Color.white);
		p1=new Panel();
		p1.add(l5);
		p2=new Panel();
		p2.setLayout(new GridLayout(1,1));
		p2.add(t1);
		p3=new Panel();
		b2=new Button("Iesire");		
		b2.setFont(f);
		b2.setBackground(Color.gray);
		p3.setLayout(new GridLayout(1,3));
		b2.setSize(10,10);
		b2.setLocation(0,0);
		p3.add((b2),BorderLayout.NORTH);
		setLayout(new GridLayout(3,1));
		add(p1);
		add(p2);
		add(p3);
		}
	}	
public boolean action(Event ev, Object ob) {
     if(ev.id==Event.ACTION_EVENT && ev.target instanceof Button){
      if("Iesire".equals(ev.arg)) { hide();
                                    fr=new Banca();
                                  } 
    
     }
    return true;
   }
}			

⌨️ 快捷键说明

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