Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
¿Cómo puedo crear un recordatorio en Netbeans que el usuario pueda editar?

Quiero crear un recordatorio que se muestre como una nota adhesiva en mi sistema. Mi idea inicial era tener un área de texto que pudiera actualizarse usando un archivo .txt guardado (lo cual fue una mala idea, así que no puedo mostrarte el código). Quiero que mi recordatorio se guarde incluso después de que el usuario cierre sesión en el sistema. ¿Qué puedes sugerir? Gracias. PD. Si no lo expliqué lo suficientemente claro, por favor hágamelo saber.

Aquí está el área de texto que se puede editar cuando el usuario quiere tener recordatorios como notas en el sistema.

imagen

EDITAR: soy simplemente un principiante en Netbeans, así que tengo este código:

 try { //// reader = new BufferedReader(new FileReader("C:\\Users\\cqm005\\Documents\\NetBeansProjects\\MASYhista\\ReminderText.txt")); // String text = null; // // // repeat until all lines is read // while ((text = reader.readLine()) != null) { // contents.append(text) // .append(System.getProperty( // "line.separator")); // } //} catch (FileNotFoundException e1) { // e1.printStackTrace(); //} catch (IOException e1) { // e1.printStackTrace(); //} finally { // try { // if (reader != null) { // reader.close(); // } // } catch (IOException e1) { // e1.printStackTrace(); // } //} //ReminderEditText.setText(contents.toString());

-para recuperar datos del archivo .txt

y solo uso

 outStream.print(ReminderEditText.getText()); outStream.close(); RefreshReminder();

para guardar recordatorios pero no funciona como esperaba. Por favor, ayúdame.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Para guardar/restaurar datos de un archivo de texto en un área de texto, haga algo como:

 import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import javax.swing.text.*; class TextAreaLoad extends JPanel { private JTextArea edit; public TextAreaLoad() { setLayout( new BorderLayout() ); edit = new JTextArea(30, 60); add(new JScrollPane(edit), BorderLayout.NORTH); JButton read = new JButton("Read TextAreaLoad.txt"); read.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { FileReader reader = new FileReader( "TextAreaLoad.txt" ); BufferedReader br = new BufferedReader(reader); edit.read( br, null ); br.close(); edit.requestFocus(); } catch(Exception e2) { System.out.println(e2); } } }); add(read, BorderLayout.LINE_START); JButton write = new JButton("Write TextAreaLoad.txt"); write.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { FileWriter writer = new FileWriter( "TextAreaLoad.txt" ); BufferedWriter bw = new BufferedWriter( writer ); edit.write( bw ); bw.close(); edit.setText(""); edit.requestFocus(); } catch(Exception e2) { System.out.println(e2); } } }); add(write, BorderLayout.LINE_END); } private static void createAndShowGUI() { JFrame frame = new JFrame("TextArea Load"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TextAreaLoad()); frame.pack(); frame.setLocationRelativeTo( null ); frame.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!