Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.EventQueue;
- import javax.swing.ImageIcon;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.Border;
- import javax.swing.border.EmptyBorder;
- import javax.swing.border.LineBorder;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import java.awt.event.KeyAdapter;
- import java.awt.event.KeyEvent;
- import javax.swing.JButton;
- import javax.swing.JLabel;
- import java.awt.Color;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import java.awt.Font;
- import javax.swing.ButtonGroup;
- import javax.swing.JOptionPane;
- import javax.swing.SwingConstants;
- import javax.swing.JComboBox;
- import javax.swing.DefaultComboBoxModel;
- import java.awt.Cursor;
- import java.awt.ComponentOrientation;
- import javax.swing.text.AttributeSet;
- import javax.swing.text.BadLocationException;
- import javax.swing.text.PlainDocument;
- import javax.swing.JTextField;
- import javax.swing.JRadioButton;
- import java.awt.GridLayout;
- /**Import das librarias necessárias para correr o programa**/
- public class festapp extends JFrame {
- private JPanel Painel_Contentor;
- private final JPanel Painel_Inicio = new JPanel();
- private final JPanel Painel_Bilhetes = new JPanel();
- private final JPanel Painel_Dados = new JPanel();
- private final JPanel Painel_Metodo_Pagamento = new JPanel();
- private final JPanel Painel_Fim = new JPanel();
- private JTextField textField_nome, textField_email, textField_dia, textField_mes, textField_ano, textField_identificacao;
- /** Inicia o programa **/
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- festapp frame = new festapp();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /** Classe que limita o número de caracteres dentro dos JTextField**/
- public class JTextFieldLimit extends PlainDocument {
- private int limit;
- JTextFieldLimit(int limit) {
- super();
- this.limit = limit;
- }
- public void insertString(int offset, String str, AttributeSet attr)
- throws BadLocationException {
- if (str == null)
- return;
- if ((getLength() + str.length()) <= limit) {
- super.insertString(offset, str, attr);
- }
- }
- }
- public festapp() {
- Color verde = new Color(51, 204, 153); /** Como as cores básicas do eclipse não serviam para o nosso design, tivemos de criar um novo verde **/
- Border thickBorder = new LineBorder(verde, 2); /** Criamos uma border costumizada para o nosso design **/
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /** Fechar default do programa **/
- setBounds(100, 100, 400, 600); /** Os dois primeiros valores (100, 100) são a posição do programa em relação ao ecrã, os valores (400,600) são respectivamente a largura e a altura do programa **/
- Painel_Contentor = new JPanel();
- Painel_Contentor.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(Painel_Contentor);
- Painel_Contentor.setLayout(null);
- Painel_Inicio.setBackground(new Color(255, 255, 255));
- Painel_Inicio.setForeground(Color.WHITE);
- Painel_Inicio.setBounds(0, 0, 400, 578);
- Painel_Contentor.add(Painel_Inicio);
- Painel_Inicio.setLayout(null);
- final ButtonGroup bG_pagamento = new ButtonGroup();
- JLabel lblBemVindoFestivaleiro = new JLabel("Bem Vindo Festivaleiro!");
- lblBemVindoFestivaleiro.setForeground(new Color(0, 51, 102));
- lblBemVindoFestivaleiro.setHorizontalAlignment(SwingConstants.CENTER);
- lblBemVindoFestivaleiro.setFont(new Font("Helvetica Neue", Font.PLAIN,20));
- lblBemVindoFestivaleiro.setBounds(70, 265, 259, 16);
- Painel_Inicio.add(lblBemVindoFestivaleiro);
- JLabel label_logo = new JLabel();
- label_logo.setBounds(159, 40, 86, 151);
- label_logo.setIcon(new ImageIcon("/Users/MarcioLopes/Documents/workspace/FEST_APP/src/img/logo.png"));
- Painel_Inicio.add(label_logo);
- JButton btnEntrar = new JButton("ENTRAR");
- btnEntrar.setForeground(new Color(0, 51, 102));
- btnEntrar.setBackground(new Color(51, 204, 153));
- btnEntrar.setBorder(thickBorder);
- btnEntrar.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- btnEntrar.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent arg0) {
- Painel_Inicio.setVisible(false);
- Painel_Bilhetes.setVisible(true);
- JOptionPane.showMessageDialog(null,"Bem Vindo FESTIVALEIRO!!!!!");
- }
- });
- btnEntrar.setBounds(97, 445, 218, 51);
- Painel_Inicio.add(btnEntrar);
- final ButtonGroup bGroup_CP = new ButtonGroup();
- final ButtonGroup bGroup_Identificacao = new ButtonGroup();
- final ButtonGroup bGroup_Sexo = new ButtonGroup();
- Painel_Bilhetes.setAutoscrolls(true);
- Painel_Bilhetes.setBorder(null);
- Painel_Bilhetes.setIgnoreRepaint(true);
- Painel_Bilhetes.setBackground(new Color(255, 255, 255));
- Painel_Bilhetes.setBounds(0, 0, 400, 578);
- Painel_Contentor.add(Painel_Bilhetes);
- Painel_Bilhetes.setLayout(null);
- Painel_Bilhetes.setVisible(false);
- JLabel label_logo_2 = new JLabel("");
- label_logo_2.setIcon(new ImageIcon("/Users/MarcioLopes/Documents/workspace/FEST_APP/src/img/logo.png"));
- label_logo_2.setBounds(152, 6, 94, 141);
- Painel_Bilhetes.add(label_logo_2);
- final String[] e_cbox_festival = { "Super Bock Super Rock",
- "Paredes de Coura", "Optimus Alive", "Sumol Summer Fest",
- "Primavera Sound", "Mar\u00E9s Vivas", "Musa Cascais" };
- final JComboBox cbox_festival = new JComboBox(e_cbox_festival);
- cbox_festival.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
- cbox_festival.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
- cbox_festival.setAlignmentX(CENTER_ALIGNMENT);
- cbox_festival.setBackground(new Color(51, 204, 153));
- cbox_festival.setMaximumRowCount(5);
- cbox_festival.setBorder(null);
- cbox_festival.setFont(new Font("Helvetica Neue", Font.PLAIN, 15));
- cbox_festival.setForeground(new Color(0, 51, 102));
- cbox_festival.setBounds(6, 215, 388, 55);
- cbox_festival.setSelectedItem(null);
- Painel_Bilhetes.add(cbox_festival);
- JLabel lblEscolheOFestival = new JLabel("Escolhe o Festival:");
- lblEscolheOFestival.setForeground(new Color(0, 51, 102));
- lblEscolheOFestival.setHorizontalAlignment(SwingConstants.CENTER);
- lblEscolheOFestival.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- lblEscolheOFestival.setBounds(6, 176, 388, 27);
- Painel_Bilhetes.add(lblEscolheOFestival);
- final JLabel label_tipo_bilhtete = new JLabel("Tipo de Bilhete:");
- label_tipo_bilhtete.setForeground(new Color(0, 51, 102));
- label_tipo_bilhtete.setHorizontalAlignment(SwingConstants.CENTER);
- label_tipo_bilhtete.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- label_tipo_bilhtete.setBounds(6, 282, 388, 27);
- label_tipo_bilhtete.setVisible(false);
- Painel_Bilhetes.add(label_tipo_bilhtete);
- final JComboBox cbox_tipo_bilhete = new JComboBox();
- cbox_tipo_bilhete.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
- cbox_tipo_bilhete.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
- cbox_tipo_bilhete.setAlignmentX(CENTER_ALIGNMENT);
- cbox_tipo_bilhete.setBackground(new Color(51, 204, 153));
- cbox_tipo_bilhete.setBorder(null);
- cbox_tipo_bilhete.setFont(new Font("Helvetica Neue", Font.PLAIN, 15));
- cbox_tipo_bilhete.setForeground(new Color(0, 51, 102));
- cbox_tipo_bilhete.setModel(new DefaultComboBoxModel(new String[] {
- "Passe 3 Dias", "Bilhete Dia 1", "Bilhete Dia 2",
- "Bilhete Dia 3" }));
- cbox_tipo_bilhete.setBounds(6, 321, 388, 55);
- cbox_tipo_bilhete.setVisible(false);
- cbox_tipo_bilhete.setSelectedItem(null);
- Painel_Bilhetes.add(cbox_tipo_bilhete);
- final JLabel lblBilheteCp = new JLabel("Bilhete CP");
- lblBilheteCp.setBounds(6, 401, 388, 27);
- lblBilheteCp.setForeground(new Color(0, 51, 102));
- lblBilheteCp.setHorizontalAlignment(SwingConstants.CENTER);
- lblBilheteCp.setVisible(false);
- lblBilheteCp.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- Painel_Bilhetes.add(lblBilheteCp);
- final JRadioButton rdbtnSim = new JRadioButton("SIM");
- rdbtnSim.setForeground(new Color(0, 51, 102));
- rdbtnSim.setFont(new Font("Helvetica Neue", Font.PLAIN, 16));
- rdbtnSim.setFocusPainted(false);
- rdbtnSim.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- rdbtnSim.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
- rdbtnSim.setBorder(null);
- rdbtnSim.setBackground(new Color(0, 51, 102));
- rdbtnSim.setHorizontalAlignment(SwingConstants.CENTER);
- rdbtnSim.setBounds(109, 440, 86, 23);
- rdbtnSim.setVisible(false);
- rdbtnSim.setActionCommand("SIM");
- Painel_Bilhetes.add(rdbtnSim);
- final JRadioButton rdbtnNao = new JRadioButton("NÃO");
- rdbtnNao.setForeground(new Color(0, 51, 102));
- rdbtnNao.setFont(new Font("Helvetica Neue", Font.PLAIN, 16));
- rdbtnNao.setHorizontalAlignment(SwingConstants.CENTER);
- rdbtnNao.setFocusPainted(false);
- rdbtnNao.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- rdbtnNao.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
- rdbtnNao.setBorder(null);
- rdbtnNao.setBackground(new Color(0, 51, 102));
- rdbtnNao.setBounds(207, 440, 86, 23);
- rdbtnNao.setVisible(false);
- rdbtnNao.setActionCommand("NÃO");
- Painel_Bilhetes.add(rdbtnNao);
- final JButton btnAvancar = new JButton("AVAN\u00C7AR");
- btnAvancar.setBounds(97, 505, 218, 55);
- btnAvancar.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- btnAvancar.setBorder(thickBorder);
- btnAvancar.setBackground(new Color(51, 204, 153));
- btnAvancar.setForeground(new Color(0, 51, 102));
- btnAvancar.setVisible(false);
- Painel_Bilhetes.add(btnAvancar);
- JButton btnVoltar = new JButton("VOLTAR");
- btnVoltar.setHorizontalTextPosition(SwingConstants.CENTER);
- btnVoltar.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- btnVoltar.setBorder(thickBorder);
- btnVoltar.setBounds(6, 6, 93, 29);
- btnVoltar.setBackground(new Color(51, 204, 153));
- btnVoltar.setBorder(thickBorder);
- btnVoltar.setForeground(new Color(0, 51, 102));
- Painel_Bilhetes.add(btnVoltar);
- bGroup_CP.add(rdbtnNao);
- bGroup_CP.add(rdbtnSim);
- btnVoltar.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- Painel_Inicio.setVisible(true);
- Painel_Bilhetes.setVisible(false);
- }
- });
- Painel_Dados.setBackground(new Color(255, 255, 255));
- Painel_Dados.setBounds(0, 0, 400, 578);
- Painel_Contentor.add(Painel_Dados);
- Painel_Dados.setLayout(null);
- Painel_Dados.setVisible(false);
- JLabel label_logo_3 = new JLabel("");
- label_logo_3.setIcon(new ImageIcon("/Users/MarcioLopes/Documents/workspace/FEST_APP/src/img/logo.png"));
- label_logo_3.setBounds(159, 6, 94, 141);
- Painel_Dados.add(label_logo_3);
- JLabel lbl_OTeuNome = new JLabel("O teu nome:");
- lbl_OTeuNome.setForeground(new Color(0, 51, 102));
- lbl_OTeuNome.setFont(new Font("Helvetica", Font.PLAIN, 14));
- lbl_OTeuNome.setBounds(6, 171, 388, 29);
- Painel_Dados.add(lbl_OTeuNome);
- textField_nome = new JTextField();
- textField_nome.setFont(new Font("Helvetica Neue", Font.PLAIN, 13));
- textField_nome.setBounds(6, 200, 388, 29);
- textField_nome.setBorder(new LineBorder(new Color(51, 204, 153), 2,true));
- Painel_Dados.add(textField_nome);
- textField_nome.setColumns(10);
- textField_nome.setCaretColor(verde);
- textField_nome.setForeground(new Color(0, 51, 102));
- textField_nome.addKeyListener(new KeyAdapter(){
- public void keyTyped(KeyEvent e){
- char ch = e.getKeyChar();
- if(Character.isDigit(ch)){
- JOptionPane.showMessageDialog(null, "Caracter Inválido!");
- }
- }
- });
- textField_email = new JTextField();
- textField_email.setFont(new Font("Helvetica Neue", Font.PLAIN, 13));
- textField_email.setBorder(new LineBorder(new Color(51, 204, 153), 2,true));
- textField_email.setBounds(6, 271, 388, 29);
- textField_email.setCaretColor(verde);
- textField_email.setForeground(new Color(0, 51, 102));
- Painel_Dados.add(textField_email);
- textField_email.setColumns(10);
- JLabel lbl_OTeuEmail = new JLabel("O teu email:");
- lbl_OTeuEmail.setForeground(new Color(0, 51, 102));
- lbl_OTeuEmail.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- lbl_OTeuEmail.setBounds(6, 243, 388, 29);
- Painel_Dados.add(lbl_OTeuEmail);
- textField_dia = new JTextField();
- textField_dia.setSelectedTextColor(new Color(0, 51, 102));
- textField_dia.setFont(new Font("Helvetica Neue", Font.PLAIN, 13));
- textField_dia.setBorder(new LineBorder(new Color(51, 204, 153), 2, true));
- textField_dia.setBounds(159, 320, 49, 28);
- textField_dia.setCaretColor(verde);
- textField_dia.setForeground(new Color(0, 51, 102));
- Painel_Dados.add(textField_dia);
- textField_dia.setColumns(2);
- textField_dia.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- char c = e.getKeyChar();
- if (!((c >= '0') && (c <= '9') || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))) {
- getToolkit().beep();
- e.consume();
- }
- }
- });
- textField_dia.setDocument(new JTextFieldLimit(2));
- textField_mes = new JTextField();
- textField_mes.setFont(new Font("Helvetica Neue", Font.PLAIN, 13));
- textField_mes.setCaretColor(verde);
- textField_mes.setForeground(new Color(0, 51, 102));
- textField_mes.setBounds(220, 320, 49, 28);
- textField_mes.setBorder(new LineBorder(new Color(51, 204, 153), 2, true));
- Painel_Dados.add(textField_mes);
- textField_mes.setColumns(10);
- textField_mes.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- char c = e.getKeyChar();
- if (!((c >= '0') && (c <= '9') || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))) {
- getToolkit().beep();
- e.consume();
- }
- }
- });
- textField_mes.setDocument(new JTextFieldLimit(2));
- textField_ano = new JTextField();
- textField_ano.setFont(new Font("Helvetica Neue", Font.PLAIN, 13));
- textField_ano.setBorder(new LineBorder(new Color(51, 204, 153), 2, true));
- textField_ano.setBounds(281, 320, 72, 28);
- Painel_Dados.add(textField_ano);
- textField_ano.setCaretColor(verde);
- textField_ano.setForeground(new Color(0, 51, 102));
- textField_ano.setColumns(10);
- textField_ano.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- char c = e.getKeyChar();
- if (!((c >= '0') && (c <= '9') || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))) {
- getToolkit().beep();
- e.consume();
- }
- }
- });
- textField_ano.setDocument(new JTextFieldLimit(4));
- JLabel lblDataDeNascimento = new JLabel("Data de nascimento:");
- lblDataDeNascimento.setForeground(new Color(0, 51, 102));
- lblDataDeNascimento.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- lblDataDeNascimento.setBounds(6, 320, 388, 29);
- Painel_Dados.add(lblDataDeNascimento);
- JRadioButton rdbtnBi = new JRadioButton("B.I.");
- rdbtnBi.setForeground(new Color(0, 51, 102));
- rdbtnBi.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnBi.setBounds(197, 363, 72, 23);
- rdbtnBi.setActionCommand("B.I.");
- Painel_Dados.add(rdbtnBi);
- JRadioButton rdbtnCc = new JRadioButton("C.C.");
- rdbtnCc.setForeground(new Color(0, 51, 102));
- rdbtnCc.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnCc.setBounds(269, 363, 63, 23);
- rdbtnCc.setActionCommand("C.C.");
- Painel_Dados.add(rdbtnCc);
- JLabel lblDocumentoDeIdentificao = new JLabel(
- "Documento de Identifica\u00E7\u00E3o:");
- lblDocumentoDeIdentificao.setForeground(new Color(0, 51, 102));
- lblDocumentoDeIdentificao.setFont(new Font("Helvetica Neue",
- Font.PLAIN, 14));
- lblDocumentoDeIdentificao.setBounds(6, 361, 388, 29);
- Painel_Dados.add(lblDocumentoDeIdentificao);
- JButton btnVoltar_1 = new JButton("VOLTAR");
- btnVoltar_1.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- Painel_Dados.setVisible(false);
- Painel_Bilhetes.setVisible(true);
- }
- });
- btnVoltar_1.setHorizontalTextPosition(SwingConstants.CENTER);
- btnVoltar_1.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- btnVoltar_1.setBorder(thickBorder);
- btnVoltar_1.setBounds(6, 6, 93, 29);
- Painel_Dados.add(btnVoltar_1);
- textField_identificacao = new JTextField();
- textField_identificacao.setFont(new Font("Helvetica Neue", Font.PLAIN,13));
- textField_identificacao.setBorder(new LineBorder(new Color(51, 204, 153), 2, true));
- textField_identificacao.setBounds(6, 398, 388, 29);
- textField_identificacao.setColumns(10);
- textField_identificacao.setCaretColor(verde);
- textField_identificacao.setForeground(new Color(0, 51, 102));
- textField_identificacao.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- char c = e.getKeyChar();
- if (!((c >= '0') && (c <= '9') || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE))) {
- getToolkit().beep();
- e.consume();
- }
- }
- });
- textField_identificacao.setDocument(new JTextFieldLimit(9));
- textField_identificacao.setVisible(false);
- Painel_Dados.add(textField_identificacao);
- final JLabel lblSexo = new JLabel("Sexo:");
- lblSexo.setForeground(new Color(0, 51, 102));
- lblSexo.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- lblSexo.setBounds(6, 439, 49, 29);
- lblSexo.setVisible(false);
- Painel_Dados.add(lblSexo);
- final JRadioButton rdbtnM = new JRadioButton("M");
- rdbtnM.setForeground(new Color(0, 51, 102));
- rdbtnM.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnM.setBounds(50, 438, 49, 29);
- rdbtnM.setVisible(false);
- rdbtnM.setActionCommand("Masculino");
- Painel_Dados.add(rdbtnM);
- final JRadioButton rdbtnF = new JRadioButton("F");
- rdbtnF.setForeground(new Color(0, 51, 102));
- rdbtnF.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnF.setBounds(97, 438, 49, 29);
- rdbtnF.setVisible(false);
- rdbtnF.setActionCommand("Feminino");
- Painel_Dados.add(rdbtnF);
- final JLabel lblDistrito = new JLabel("Distrito:");
- lblDistrito.setForeground(new Color(0, 51, 102));
- lblDistrito.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- lblDistrito.setBounds(167, 439, 72, 29);
- lblDistrito.setVisible(false);
- Painel_Dados.add(lblDistrito);
- final JComboBox comboBox_Distritos = new JComboBox();
- comboBox_Distritos.setForeground(new Color(0, 51, 102));
- comboBox_Distritos.setBackground(new Color(102, 204, 153));
- comboBox_Distritos.setModel(new DefaultComboBoxModel(new String[] { "Aveiro",
- "Beja", "Braga", "Bragan\u00E7a", "Castelo Branco", "Coimbra",
- "\u00C9vora", "Faro", "Guarda", "Leiria", "Lisboa",
- "Portalegre", "Porto", "Santar\u00E9m", "Set\u00FAbal",
- "Viana do Castelo", "Vila Real", "Viseu" }));
- comboBox_Distritos.setBounds(228, 439, 166, 29);
- comboBox_Distritos.setVisible(false);
- comboBox_Distritos.setSelectedItem(null);
- Painel_Dados.add(comboBox_Distritos);
- bGroup_Identificacao.add(rdbtnBi);
- bGroup_Identificacao.add(rdbtnCc);
- bGroup_Sexo.add(rdbtnM);
- bGroup_Sexo.add(rdbtnF);
- final JButton btnAvancar_1 = new JButton("AVAN\u00C7AR");
- btnAvancar_1.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent arg0) {
- Painel_Dados.setVisible(false);
- Painel_Metodo_Pagamento.setVisible(true);
- }
- });
- btnAvancar_1.setBounds(97, 505, 218, 55);
- btnAvancar_1.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- btnAvancar_1.setBorder(thickBorder);
- btnAvancar_1.setBackground(new Color(51, 204, 153));
- btnAvancar_1.setForeground(new Color(0, 51, 102));
- btnAvancar_1.setVisible(false);
- Painel_Dados.add(btnAvancar_1);
- Painel_Metodo_Pagamento.setBackground(new Color(255, 255, 255));
- Painel_Metodo_Pagamento.setBounds(0, 0, 400, 578);
- Painel_Contentor.add(Painel_Metodo_Pagamento);
- Painel_Metodo_Pagamento.setLayout(null);
- Painel_Metodo_Pagamento.setVisible(false);
- JLabel label = new JLabel("");
- label.setIcon(new ImageIcon("/Users/MarcioLopes/Documents/workspace/FEST_APP/src/img/logo.png"));
- label.setBounds(156, 23, 86, 112);
- Painel_Metodo_Pagamento.add(label);
- JLabel lblComoQueresPagar = new JLabel("Como Queres Pagar?");
- lblComoQueresPagar.setHorizontalAlignment(SwingConstants.CENTER);
- lblComoQueresPagar.setForeground(new Color(0, 51, 102));
- lblComoQueresPagar.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- lblComoQueresPagar.setBounds(6, 175, 388, 37);
- Painel_Metodo_Pagamento.add(lblComoQueresPagar);
- JRadioButton rdbtnPaypal = new JRadioButton("Paypal");
- rdbtnPaypal.setForeground(new Color(0, 51, 102));
- rdbtnPaypal.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnPaypal.setBounds(67, 246, 141, 23);
- rdbtnPaypal.setActionCommand("Paypal");
- Painel_Metodo_Pagamento.add(rdbtnPaypal);
- JRadioButton rdbtnVisa = new JRadioButton("Visa");
- rdbtnVisa.setForeground(new Color(0, 51, 102));
- rdbtnVisa.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnVisa.setBounds(220, 246, 174, 23);
- rdbtnVisa.setActionCommand("Visa");
- Painel_Metodo_Pagamento.add(rdbtnVisa);
- JRadioButton rdbtnMastercard = new JRadioButton("MasterCard");
- rdbtnMastercard.setForeground(new Color(0, 51, 102));
- rdbtnMastercard.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnMastercard.setBounds(67, 372, 141, 23);
- rdbtnMastercard.setActionCommand("MasterCard");
- Painel_Metodo_Pagamento.add(rdbtnMastercard);
- JRadioButton rdbtnPayshop = new JRadioButton("PayShop");
- rdbtnPayshop.setForeground(new Color(0, 51, 102));
- rdbtnPayshop.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnPayshop.setBounds(67, 308, 141, 23);
- rdbtnPayshop.setActionCommand("PayShop");
- Painel_Metodo_Pagamento.add(rdbtnPayshop);
- JRadioButton rdbtnMbnet = new JRadioButton("MBNet");
- rdbtnMbnet.setForeground(new Color(0, 51, 102));
- rdbtnMbnet.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnMbnet.setBounds(220, 308, 174, 23);
- rdbtnMbnet.setActionCommand("MBNet");
- Painel_Metodo_Pagamento.add(rdbtnMbnet);
- JRadioButton rdbtnAmericanExpress = new JRadioButton("American Express");
- rdbtnAmericanExpress.setForeground(new Color(0, 51, 102));
- rdbtnAmericanExpress.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- rdbtnAmericanExpress.setBounds(220, 372, 174, 23);
- rdbtnAmericanExpress.setActionCommand("American Express");
- Painel_Metodo_Pagamento.add(rdbtnAmericanExpress);
- final JButton button = new JButton("AVAN\u00C7AR");
- button.setForeground(new Color(0, 51, 102));
- button.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- button.setBorder(thickBorder);
- button.setBackground(new Color(51, 204, 153));
- button.setForeground(new Color(0, 51, 102));
- button.setFont(new Font("Helvetica Neue", Font.PLAIN, 20));
- button.setBackground(new Color(51, 204, 153));
- button.setBounds(97, 505, 218, 55);
- button.setVisible(false);
- Painel_Metodo_Pagamento.add(button);
- JButton btnVoltar_2 = new JButton("VOLTAR");
- btnVoltar_2.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- Painel_Metodo_Pagamento.setVisible(false);
- Painel_Dados.setVisible(true);
- }
- });
- btnVoltar_2.setHorizontalTextPosition(SwingConstants.CENTER);
- btnVoltar_2.setFont(new Font("Helvetica Neue", Font.PLAIN, 14));
- btnVoltar_2.setBorder(thickBorder);
- btnVoltar_2.setBounds(6, 6, 93, 29);
- Painel_Metodo_Pagamento.add(btnVoltar_2);
- // botoes
- bG_pagamento.add(rdbtnPaypal);
- bG_pagamento.add(rdbtnVisa);
- bG_pagamento.add(rdbtnMastercard);
- bG_pagamento.add(rdbtnPayshop);
- bG_pagamento.add(rdbtnMbnet);
- bG_pagamento.add(rdbtnAmericanExpress);
- Painel_Fim.setBackground(new Color(255, 255, 255));
- Painel_Fim.setBounds(0, 0, 400, 578);
- Painel_Contentor.add(Painel_Fim);
- Painel_Fim.setLayout(new GridLayout(0, 1, 0, 0));
- JLabel lbl_fim_obrigado = new JLabel("OBRIGADO!");
- lbl_fim_obrigado.setHorizontalTextPosition(SwingConstants.CENTER);
- lbl_fim_obrigado.setHorizontalAlignment(SwingConstants.CENTER);
- lbl_fim_obrigado.setForeground(new Color(0, 51, 102));
- lbl_fim_obrigado.setFont(new Font("Helvetica Neue", Font.PLAIN, 25));
- Painel_Fim.add(lbl_fim_obrigado);
- JLabel lbl_fim_men_bilhete = new JLabel("O seu bilhete está na consola! :)");
- lbl_fim_men_bilhete.setHorizontalTextPosition(SwingConstants.CENTER);
- lbl_fim_men_bilhete.setHorizontalAlignment(SwingConstants.CENTER);
- lbl_fim_men_bilhete.setForeground(new Color(0, 51, 102));
- lbl_fim_men_bilhete.setFont(new Font("Helvetica Neue", Font.PLAIN, 15));
- Painel_Fim.add(lbl_fim_men_bilhete);
- JLabel lbl_fim_logo = new JLabel("");
- lbl_fim_logo.setHorizontalAlignment(SwingConstants.CENTER);
- lbl_fim_logo.setIcon(new ImageIcon("/Users/MarcioLopes/Documents/workspace/FEST_APP/src/img/logo.png"));
- Painel_Fim.add(lbl_fim_logo);
- Painel_Fim.setVisible(true);
- button.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- if (cbox_festival.getSelectedItem() != null) {
- Painel_Metodo_Pagamento.setVisible(false);
- Painel_Fim.setVisible(true);
- System.out.println("______...FESTAPP...______");
- System.out.println(".....BILHETE Festival.....");
- System.out.println("FESTIVAL: "+cbox_festival.getSelectedItem().toString());
- System.out.println("TIPO DE BILHETE: "+cbox_tipo_bilhete.getSelectedItem().toString());
- System.out.println("BILHETE CP: " + bGroup_CP.getSelection().getActionCommand());
- System.out.println(".....Dados Festivaleiro.....");
- System.out.println("NOME: " + textField_nome.getText());
- System.out.println("EMAIL: " + textField_email.getText());
- System.out.println("DATA DE NASCIMENTO: " + textField_dia.getText() + "-"+ textField_mes.getText()+ "-" + textField_ano.getText());
- System.out.println("DOCUMENTO DE IDENTIFICAÇÃO: " + bGroup_Identificacao.getSelection().getActionCommand() + " Número: " + textField_identificacao.getText());
- System.out.println("SEXO: " + bGroup_Sexo.getSelection().getActionCommand());
- System.out.println("DISTRITO: " + comboBox_Distritos.getSelectedItem().toString());
- System.out.println("MÉTODO DE PAGAMENTO: " + bG_pagamento.getSelection().getActionCommand());
- System.out.println("Obrigado pela preferência do serviço!");
- System.out.println("DIVERTE-TE!");
- }
- }
- }
- );
- Painel_Metodo_Pagamento.setVisible(false);
- cbox_festival.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- String e_cbox_festival = (String) cbox_festival
- .getSelectedItem();
- if (cbox_festival.equals(false)) {
- JOptionPane.showMessageDialog(null,
- "Preenche o Festival a que desejas ir!");
- } else {
- label_tipo_bilhtete.setVisible(true);
- cbox_tipo_bilhete.setVisible(true);
- }
- }
- });
- cbox_tipo_bilhete.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (cbox_tipo_bilhete.equals(false)) {
- JOptionPane.showMessageDialog(null,
- "Preenche os dias a que desejas ir!");
- } else {
- lblBilheteCp.setVisible(true);
- rdbtnSim.setVisible(true);
- rdbtnNao.setVisible(true);
- }
- }
- });
- rdbtnSim.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- btnAvancar.setVisible(true);
- }
- });
- rdbtnNao.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- btnAvancar.setVisible(true);
- }
- });
- btnAvancar.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Painel_Bilhetes.setVisible(false);
- Painel_Dados.setVisible(true);
- }
- });
- btnAvancar_1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if ((textField_email.getText().contains("@"))
- && (textField_email.getText().contains("."))
- && (!textField_email.getText().contains(" "))) {
- String usuario = new String(textField_email.getText()
- .substring(0,
- textField_email.getText().lastIndexOf('@')));
- String dominio = new String(
- textField_email.getText()
- .substring(
- textField_email.getText()
- .lastIndexOf('@') + 1,
- textField_email.getText().length()));
- if ((usuario.length() >= 1)
- && (!usuario.contains("@"))
- && (dominio.contains("."))
- && (!dominio.contains("@"))
- && (dominio.indexOf(".") >= 1)
- && (dominio.lastIndexOf(".") < dominio.length() - 1)) {
- }
- else {
- JOptionPane.showMessageDialog(null,"E-mail Inválido");
- textField_email.requestFocus();
- }
- } else {
- JOptionPane.showMessageDialog(null,"E-mail Inválido");
- textField_email.requestFocus();
- }
- }
- });
- btnAvancar_1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if ((textField_nome.getText().isEmpty()))
- {
- JOptionPane.showMessageDialog(null,"Preencha o seu nome!");
- }
- if ((textField_dia.getText().isEmpty()))
- {
- JOptionPane.showMessageDialog(null,"Preencha o seu dia de nascimento!");
- }
- if ((textField_mes.getText().isEmpty()))
- {
- JOptionPane.showMessageDialog(null,"Preencha o seu mês de nascimento!");
- }
- if ((textField_ano.getText().isEmpty()))
- {
- JOptionPane.showMessageDialog(null,"Preencha o seu ano de nascimento!");
- }
- if ((textField_identificacao.getText().isEmpty()))
- {
- JOptionPane.showMessageDialog(null,"Preencha o seu número de identificação pessoal!");
- }
- }
- });
- rdbtnBi.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- textField_identificacao.setVisible(true);
- lblSexo.setVisible(true);
- rdbtnM.setVisible(true);
- rdbtnF.setVisible(true);
- }
- });
- rdbtnCc.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- textField_identificacao.setVisible(true);
- lblSexo.setVisible(true);
- rdbtnM.setVisible(true);
- rdbtnF.setVisible(true);
- }
- });
- rdbtnM.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- textField_identificacao.setVisible(true);
- lblDistrito.setVisible(true);
- comboBox_Distritos.setVisible(true);
- }
- });
- rdbtnF.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- textField_identificacao.setVisible(true);
- lblDistrito.setVisible(true);
- comboBox_Distritos.setVisible(true);
- }
- });
- comboBox_Distritos.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (comboBox_Distritos.equals(false)) {
- JOptionPane.showMessageDialog(null,
- "Preenche o o teu Distrito");
- } else {
- btnAvancar_1.setVisible(true);
- }
- }
- });
- rdbtnPaypal.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- button.setVisible(true);
- }
- });
- rdbtnVisa.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- button.setVisible(true);
- }
- });
- rdbtnMastercard.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- button.setVisible(true);
- }
- });
- rdbtnPayshop.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- button.setVisible(true);
- }
- });
- rdbtnMbnet.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- button.setVisible(true);
- }
- });
- rdbtnAmericanExpress.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent arg0) {
- button.setVisible(true);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement