-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainEx3.java
105 lines (86 loc) · 2.9 KB
/
MainEx3.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package ex3.view;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import ex3.controller.Ex3CancelaController;
import ex3.controller.Ex3OkController;
import ex3.controller.Ex3ProcuraController;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Image;
import javax.swing.ImageIcon;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class MainEx3 extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel tela;
private JTextField tfcaminho;
private JButton btnProcurar;
private JButton btnOk;
private JButton btnCancelar;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainEx3 frame = new MainEx3();
frame.setVisible(true);
frame.setResizable(false);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainEx3() {
setIconImage(Toolkit.getDefaultToolkit().getImage(".\\Run-Dialog.png").getScaledInstance(10, 10, Image.SCALE_SMOOTH));
setTitle("Executar");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 414, 211);
tela = new JPanel();
tela.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(tela);
tela.setLayout(null);
tfcaminho = new JTextField();
tfcaminho.setBounds(70, 84, 306, 22);
tela.add(tfcaminho);
tfcaminho.setColumns(10);
btnProcurar = new JButton("Procurar...");
btnProcurar.setBounds(279, 120, 97, 25);
tela.add(btnProcurar);
Ex3ProcuraController procura = new Ex3ProcuraController(tfcaminho);
btnProcurar.addActionListener(procura);
btnOk = new JButton("OK");
btnOk.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
btnOk.setBounds(61, 120, 97, 25);
tela.add(btnOk);
Ex3OkController executa = new Ex3OkController(tfcaminho, this);
btnOk.addActionListener(executa);
tfcaminho.addActionListener(executa);
btnCancelar = new JButton("Cancelar");
btnCancelar.setBounds(170, 120, 97, 25);
tela.add(btnCancelar);
Ex3CancelaController cancela = new Ex3CancelaController(this);
btnCancelar.addActionListener(cancela);
JLabel lblAbrir = new JLabel("Abrir:");
lblAbrir.setFont(new Font("Tahoma", Font.PLAIN, 13));
lblAbrir.setBounds(22, 87, 56, 16);
tela.add(lblAbrir);
JLabel lblNewLabel = new JLabel("<html>Digite o nome de um programa, pasta, documento ou <br/> recurso da Internet e o Windows o abrir\u00E1 para voc\u00EA.");
lblNewLabel.setIcon(new ImageIcon(".\\Run-Dialog3.png"));
lblNewLabel.setBounds(12, 2, 364, 72);
tela.add(lblNewLabel);
}
}