Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private JPanel contentPane;
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- try {
- Aluno7_Ruben frame = new Aluno7_Ruben();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public Aluno7_Ruben() {
- setIconImage(Toolkit.getDefaultToolkit().getImage("C:\Users\Jou00E3o Gil\workspace\sala de aula\pic\icon\Science-Classroom-icon.png"));
- setTitle("PC7-Ruben Gato");
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- setBounds(100, 100, 450, 300);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- JLabel lblNewLabel = new JLabel("Detalhes/Notas:");
- lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 17));
- lblNewLabel.setBounds(10, 106, 194, 23);
- contentPane.add(lblNewLabel);
- JLabel lblNewLabel_1 = new JLabel("Localizau00E7u00E3o da avaria:");
- lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 17));
- lblNewLabel_1.setBounds(10, 11, 169, 20);
- contentPane.add(lblNewLabel_1);
- JCheckBox Teclado = new JCheckBox ("Teclado");
- Teclado.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- PrintWriter writer;
- try {
- String texto1="O teclado esta danificado";
- writer = new PrintWriter("C:\Users\João Gil\workspace\sala de aula\pic\notas.txt");
- writer.println(texto1 );
- writer.close();
- } catch (FileNotFoundException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
- });
- Teclado.setToolTipText("Selecionar caso esteja danificado");
- Teclado.setBounds(6, 54, 94, 23);
- contentPane.add(Teclado);
- JCheckBox Rato = new JCheckBox ("Rato");
- Rato.setToolTipText("Selecionar caso esteja danificado");
- Rato.setBounds(98, 54, 81, 23);
- contentPane.add(Rato);
- JCheckBox Monitor = new JCheckBox ("Monitor");
- Monitor.setToolTipText("Selecionar caso esteja danificado");
- Monitor.setBounds(190, 54, 96, 23);
- contentPane.add(Monitor);
- JCheckBox Torre = new JCheckBox ("Torre");
- Torre.setToolTipText("Selecionar caso esteja danificado");
- Torre.setBounds(288, 54, 109, 23);
- contentPane.add(Torre);
- JButton Adicionar_notas = new JButton("Escrever novas notas");
- Adicionar_notas.addActionListener(new ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- FAZJA(evt);
- }
- });
- Adicionar_notas.setBounds(137, 224, 159, 23);
- contentPane.add(Adicionar_notas);
- File file = new File("C:\Users\João Gil\workspace\sala de aula\pic\notas.txt");
- FileInputStream fis = null;
- String texto = "";
- try {
- fis = new FileInputStream(file);
- int content;
- while ((content = fis.read()) != -1) {
- texto += (char) content;
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- if (fis != null) {
- fis.close();
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
- JTextArea textArea1 = new JTextArea(texto);
- textArea1.setEditable(false);
- textArea1.setWrapStyleWord(true);
- textArea1.setBounds(10, 128, 414, 85);
- contentPane.add(textArea1);
- }
- protected void FAZJA(ActionEvent evt) {
- this.dispose();
- new Gravação_Dados().setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement