OverSkillers

InterfaceGráfica

Nov 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.36 KB | None | 0 0
  1. package projetopoo;
  2. /*
  3.  * To change this license header, choose License Headers in Project Properties.
  4.  * To change this template file, choose Tools | Templates
  5.  * and open the template in the editor.
  6.  */
  7. import javax.swing.*;
  8. import java.awt.*;
  9. import java.awt.event.ActionEvent;
  10. import java.awt.event.ActionListener;
  11.  
  12.  
  13. class Inscriçao extends JFrame{
  14.     private final JCheckBox buttonInscrever;
  15.     private final JButton buttonSai;
  16.     private final JRadioButton Exposições;
  17.     private final JRadioButton Bares;
  18.     private final JRadioButton Jardins;
  19.     private final JRadioButton Desporto;
  20.     private final JComboBox combo;
  21.     //private final JComboBox combo_2;
  22.    
  23.     public Inscriçao(){
  24.         this.setPreferredSize(new Dimension(400,400));
  25.         this.setTitle("Inscrições");
  26.         this.setLocation(100,100);
  27.         this.setVisible(true);
  28.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29.         this.setLayout(new FlowLayout());
  30.        
  31.         buttonInscrever = new JCheckBox("Inscrever");this.add(buttonInscrever);
  32.         buttonInscrever.addActionListener(new ActionListener(){
  33.             @Override
  34.             public void actionPerformed(ActionEvent event){
  35.                 if(buttonInscrever.isSelected()){
  36.                     //increver
  37.                     buttonInscrever.setSelected(false);
  38.                     //combo_2.removeAllItems();
  39.                     //combo_2.addItem("a");
  40.                    
  41.                 }
  42.             }
  43.         });
  44.        
  45.         buttonSai = new JButton("Sai");this.add(buttonSai);
  46.         buttonSai.addActionListener(new ActionListener(){
  47.             @Override
  48.             public void actionPerformed(ActionEvent event){
  49.                 System.exit(0);
  50.             }
  51.     });
  52.         combo = new JComboBox(new String[]{"...","..."});
  53.                        
  54.         this.add(combo);
  55.        
  56.         //combo_2 = new JComboBox(new String[]{"..."});
  57.                        
  58.         //this.add(combo_2);
  59.        
  60.         ButtonGroup group = new ButtonGroup();
  61.         Exposições = new JRadioButton("Exposições",true);
  62.         Exposições.addActionListener(new ActionListener(){
  63.             @Override
  64.             public void actionPerformed(ActionEvent event){
  65.                 if (Exposições.isSelected()){
  66.                     combo.removeAllItems();
  67.                     combo.addItem("Exposição1");
  68.                     combo.addItem("Exposição2");
  69.                 }
  70.             }
  71.         });
  72.              
  73.            
  74.         group.add(Exposições);
  75.         this.add(Exposições);
  76.        
  77.         Bares = new JRadioButton("Bares",true);
  78.         Bares.addActionListener(new ActionListener(){
  79.             @Override
  80.             public void actionPerformed(ActionEvent event){
  81.                 if (Bares.isSelected()){
  82.                     combo.removeAllItems();
  83.                     combo.addItem("Bar1");
  84.                     combo.addItem("Bar2");
  85.                 }
  86.             }
  87.         });
  88.         group.add(Bares);
  89.         this.add(Bares);
  90.        
  91.        
  92.         Jardins = new JRadioButton("Jardins",true);
  93.         Jardins.addActionListener(new ActionListener(){
  94.             @Override
  95.             public void actionPerformed(ActionEvent event){
  96.                 if (Jardins.isSelected()){
  97.                     combo.removeAllItems();
  98.                     combo.addItem("Jardim1");
  99.                     combo.addItem("Jardim2");
  100.                 }
  101.             }
  102.         });
  103.         group.add(Jardins);
  104.         this.add(Jardins);
  105.        
  106.         Desporto = new JRadioButton("Parques Desportivos",true);
  107.         Desporto.addActionListener(new ActionListener(){
  108.             @Override
  109.             public void actionPerformed(ActionEvent event){
  110.                 if (Desporto.isSelected()){
  111.                     combo.removeAllItems();
  112.                     combo.addItem("Desporto1");
  113.                     combo.addItem("Desporto2");
  114.                 }
  115.             }
  116.         });
  117.         group.add(Desporto);
  118.         this.add(Desporto);
  119.        
  120.         this.pack();
  121.     }
  122. }
  123.    
  124. class Cria extends JFrame{
  125.     private final JTextField nome;
  126.     private final JTextField password;
  127.     private final JLabel label1;
  128.     private final JLabel label2;
  129.     private final JButton buttonCria;
  130.     private final JButton buttonLimpa;
  131.     private final JButton buttonSai;
  132.    
  133.     public Cria(){
  134.         this.setPreferredSize(new Dimension(200,200));
  135.         this.setTitle("Criar Conta");
  136.         this.setLocation(100,100);
  137.         this.setVisible(true);
  138.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  139.         this.setLayout(new FlowLayout());
  140.        
  141.         label1 = new JLabel("Nome"); this.add(label1);
  142.         nome = new JTextField(); this.add(nome);
  143.         nome.setPreferredSize(new Dimension(60,20));
  144.    
  145.        
  146.         label2 = new JLabel("Password"); this.add(label2);
  147.         password = new JTextField(); this.add(password);
  148.         password.setPreferredSize(new Dimension(80,20));
  149.        
  150.         buttonCria = new JButton("Cria");this.add(buttonCria);
  151.        
  152.         buttonLimpa = new JButton("Limpa");this.add(buttonLimpa);
  153.         buttonLimpa.addActionListener(new ActionListener(){
  154.         @Override
  155.             public void actionPerformed(ActionEvent event){
  156.                     nome.setText("");
  157.                     password.setText("");          
  158.             }
  159.         });
  160.         buttonSai = new JButton("Sai");this.add(buttonSai);
  161.         buttonSai.addActionListener(new ActionListener(){
  162.             @Override
  163.             public void actionPerformed(ActionEvent event){
  164.                 System.exit(0);
  165.             }
  166.     });
  167.        
  168.         this.pack();
  169.     }
  170. }
  171.  
  172. class Login extends JFrame{
  173.    
  174.     private final JTextField nome;
  175.     private final JTextField password;
  176.     private final JLabel label1;
  177.     private final JLabel label2;
  178.     private final JButton buttonLogin;
  179.     private final JButton buttonLimpa;
  180.     private final JButton buttonSai;
  181.    
  182.    
  183.    
  184.     public Login(){
  185.        
  186.         this.setPreferredSize(new Dimension(200,200));
  187.         this.setTitle("Login");
  188.         this.setLocation(100,100);
  189.         this.setVisible(true);
  190.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  191.         this.setLayout(new FlowLayout());
  192.        
  193.         label1 = new JLabel("Nome"); this.add(label1);
  194.         nome = new JTextField(); this.add(nome);
  195.         nome.setPreferredSize(new Dimension(60,20));
  196.    
  197.        
  198.         label2 = new JLabel("Password"); this.add(label2);
  199.         password = new JTextField(); this.add(password);
  200.         password.setPreferredSize(new Dimension(80,20));
  201.        
  202.         buttonLogin = new JButton("Login");this.add(buttonLogin);
  203.        
  204.         buttonLimpa = new JButton("Limpa");this.add(buttonLimpa);
  205.         buttonLimpa.addActionListener(new ActionListener(){
  206.         @Override
  207.             public void actionPerformed(ActionEvent event){
  208.                     nome.setText("");
  209.                     password.setText("");          
  210.             }
  211.         });
  212.         buttonSai = new JButton("Sai");this.add(buttonSai);
  213.         buttonSai.addActionListener(new ActionListener(){
  214.             @Override
  215.             public void actionPerformed(ActionEvent event){
  216.                 System.exit(0);
  217.             }
  218.     });
  219.        
  220.         this.pack();
  221.     }
  222. }
Add Comment
Please, Sign In to add comment