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 - Order.java

Order.java

Caricato da: Bonny
Scarica il programma completo

  1. package jcredito;
  2. import java.awt.*;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.util.*;
  6. import javax.swing.*;
  7.  
  8. public class Order extends JFrame{
  9.  
  10.     private Choice comboday = new Choice();
  11.     private Choice combomese = new Choice();
  12.     private Choice comboanno = new Choice();
  13.     private Choice comboday2 = new Choice();
  14.     private Choice combomese2 = new Choice();
  15.     private Choice comboanno2 = new Choice();
  16.     private JCheckBox cb = new JCheckBox("Visualizza tutto");
  17.     private String user;
  18.     private JTabella T ;
  19.  
  20.     public Order(String us) {
  21.         super("");
  22.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  23.         this.user = us;
  24.         JPanel p = new JPanel();
  25.         JPanel p2 = new JPanel();
  26.         p.setLayout(new GridLayout(2,4,5,5));
  27.         p.setBackground(new Color(0, 60, 120));
  28.         p2.setBackground(new Color(0, 60, 120));
  29.         JLabel l1 = new JLabel(" Da:");
  30.         l1.setFont(new Font("Arial", Font.BOLD, 14));
  31.         l1.setForeground(Color.ORANGE);
  32.         JLabel l2 = new JLabel(" A:");
  33.         l2.setFont(new Font("Arial", Font.BOLD, 14));
  34.         l2.setForeground(Color.ORANGE);
  35.         p.add(l1);
  36.         p.add(comboday);
  37.         p.add(combomese);
  38.         p.add(comboanno);
  39.         p.add(l2);
  40.         p.add(comboday2);
  41.         p.add(combomese2);
  42.         p.add(comboanno2);
  43.         initCombo();    
  44.         cb.setFont(new Font("Arial", Font.BOLD, 14));
  45.         cb.setForeground(Color.ORANGE);
  46.         cb.setBackground(new Color(0, 60, 120));
  47.         JButton view = new JButton("Vedi");
  48.         p2.add(cb);
  49.         p2.add(view);
  50.         JLabel l3 = new JLabel("Visualizza tutto o in data predefinita");
  51.         l3.setFont(new Font("Arial", Font.BOLD, 14));
  52.         l3.setForeground(Color.ORANGE);
  53.         JPanel p3 = new JPanel();
  54.         p3.setBackground(new Color(0, 60, 120));
  55.         p3.add(l3);
  56.         this.getContentPane().add(p3, "North");
  57.         this.getContentPane().add(p, "Center");
  58.         this.getContentPane().add(p2, "South");
  59.         this.setResizable(false);
  60.         this.setVisible(true);
  61.         this.setBounds(360, 200, 400, 200);
  62.         this.pack();
  63.  
  64.         view.addActionListener(
  65.                 new ActionListener() {
  66.  
  67.                     public void actionPerformed(ActionEvent event) {
  68.                         if (cb.isSelected()) {
  69.                             T = new JTabella(user);
  70.                         } else {
  71.                             T = new JTabella(user, comboday.getSelectedItem() + "/" + combomese.getSelectedItem() + "/" + comboanno.getSelectedItem(), comboday2.getSelectedItem() + "/" + combomese2.getSelectedItem() + "/" + comboanno2.getSelectedItem());
  72.                         }
  73.                     }
  74.                 });
  75.     }
  76.  
  77.     public void initCombo() {
  78.  
  79.         int i;
  80.         for (i = 1; i < 32; i++) {
  81.             comboday.addItem(String.valueOf(i));
  82.             comboday2.addItem(String.valueOf(i));
  83.         }
  84.         for (i = 1; i < 13; i++) {
  85.             combomese.addItem(String.valueOf(i));
  86.               combomese2.addItem(String.valueOf(i));
  87.         }
  88.  
  89.         for (i = 2010; i < 2051; i++) {
  90.             comboanno.addItem(String.valueOf(i));
  91.             comboanno2.addItem(String.valueOf(i));
  92.         }
  93.         GregorianCalendar gc = new GregorianCalendar();
  94.         comboday2.select(gc.get(Calendar.DATE) - 1);
  95.         combomese2.select(gc.get(Calendar.MONTH));
  96.         i = 2010;
  97.         int j = 0;
  98.         while (i < 2051) {
  99.             if (String.valueOf(i).equals(comboanno2.getItem(j))) {
  100.                 break;
  101.             }
  102.             j++;
  103.             i++;
  104.         }
  105.         comboanno2.select(j);
  106.     }
  107.  
  108. }