Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package trabalho;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JTextField;
- import javax.swing.JButton;
- import javax.swing.JLabel;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class tela extends JFrame {
- private JPanel contentPane;
- private JTextField textField;
- private JButton btnNewButton_1;
- private JLabel lblNewLabel_1;
- private JLabel lblNewLabel_2;
- private JLabel lblResposta;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- tela frame = new tela();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- public void cadastrar(){
- }
- public void visualizar(){
- }
- /**
- * Create the frame.
- */
- public tela() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 450, 300);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- textField = new JTextField();
- textField.setBounds(139, 59, 127, 20);
- contentPane.add(textField);
- textField.setColumns(10);
- textField.getText();
- JLabel lblNewLabel = new JLabel("A RESPOSTA EST\u00C1....");
- lblNewLabel.setBounds(139, 165, 127, 14);
- contentPane.add(lblNewLabel);
- /*ArrayList fraseDescobrir = new ArrayList();
- ArrayList dica = new ArrayList();
- */
- //tipo[] nome_do_array = new tipo[numero_de_elementos];
- btnNewButton_1 = new JButton("CONFIRMAR RESPOSTA");
- btnNewButton_1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- }
- });
- btnNewButton_1.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent arg0) {
- /*
- if(fraseresposta.equals("24 horas por dia")){
- lblNewLabel.setText("Correto");
- } else{
- lblNewLabel.setText("ERRADO");
- }
- */
- String fraseresposta = textField.getText();
- String[] fraseDescobrir = new String[1];
- fraseDescobrir[1] = "24 horas";
- String[] dica = new String[1];
- dica[1] = "24 h ";
- if(fraseDescobrir[1].equals(fraseresposta)){
- lblNewLabel.setText("Correto");
- } else{
- lblNewLabel.setText("ERRADO");
- }
- }});
- btnNewButton_1.setBounds(95, 115, 171, 23);
- contentPane.add(btnNewButton_1);
- lblNewLabel_1 = new JLabel("24 h ");
- lblNewLabel_1.setBounds(139, 34, 46, 14);
- contentPane.add(lblNewLabel_1);
- lblNewLabel_2 = new JLabel("DICA:");
- lblNewLabel_2.setBounds(79, 33, 36, 17);
- contentPane.add(lblNewLabel_2);
- lblResposta = new JLabel("RESPOSTA:");
- lblResposta.setBounds(63, 62, 66, 14);
- contentPane.add(lblResposta);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement