Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
MyBancoCredito - Firstframe.java

Firstframe.java

Caricato da: Bonny
Scarica il programma completo

  1. package jcredito;
  2.  
  3. import java.awt.*;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. import javax.swing.*;
  7.  
  8. public class Firstframe extends JFrame {
  9.  
  10.     private Framereg frame;
  11.     private JButton click;
  12.     private JRadioButton reg, use;
  13.     private ButtonGroup bg;
  14.  
  15.     public Firstframe() {
  16.  
  17.         super("JCredito");
  18.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  19.         click = new JButton("Avanti >>");
  20.         bg = new ButtonGroup();
  21.         use = new JRadioButton("Accedi");
  22.         use.setBackground(new Color(0, 64, 128));
  23.         use.setForeground(Color.ORANGE);
  24.         use.setFont(new Font("Arial", Font.BOLD, 16));
  25.         use.setActionCommand("a");
  26.         reg = new JRadioButton("Registrati");
  27.         reg.setBackground(new Color(0, 64, 128));
  28.         reg.setForeground(Color.ORANGE);
  29.         reg.setFont(new Font("Arial", Font.BOLD, 16));
  30.         reg.setActionCommand("r");
  31.         JPanel p = new JPanel();
  32.         p.setLayout(new GridLayout(2,1,5,5));
  33.         p.setBackground(new Color(0, 60, 95));
  34.         p.add(use);
  35.         p.add(reg);
  36.         bg.add(use);//ascoltatori radiob
  37.         bg.add(reg);//
  38.         use.doClick();
  39.         JLabel l = new JLabel("Se non possiedi un accaunt registrati adesso.");
  40.         l.setFont(new Font("Arial", Font.BOLD, 14));
  41.         l.setForeground(Color.ORANGE);
  42.         JPanel pl = new JPanel();
  43.         pl.add(l);
  44.         pl.setBackground(new Color(0, 60, 95));
  45.         this.getContentPane().add(pl, "North");
  46.         this.getContentPane().add(p, "Center");
  47.         JPanel pb = new JPanel();
  48.         pb.add(click);
  49.         pb.setBackground(new Color(0, 60, 95));
  50.         this.getContentPane().add(pb, "South");
  51.         this.setResizable(false);
  52.         this.setVisible(true);
  53.         this.setBounds(340, 200, 400, 200);
  54.         this.pack();
  55.  
  56.         click.addActionListener(
  57.                 new ActionListener() {
  58.  
  59.                     public void actionPerformed(ActionEvent event) {
  60.  
  61.                         ButtonModel srb = bg.getSelection();
  62.  
  63.                         if ("a".equals(srb.getActionCommand())) {
  64.                             setVisible(false);
  65.                              frame = new Framereg(false);
  66.                         } else if ("r".equals(srb.getActionCommand())) {
  67.                             setVisible(false);
  68.                               frame = new Framereg(true);
  69.                         }
  70.                     }
  71.                 });
  72.     }
  73.  
  74.     public static void main(String[] args) {
  75.         Firstframe f = new Firstframe();  
  76.     }
  77. }