-1

So I have a few basic questions that are probably going to be very simple for you guys. Keep in mind, I am not a programmer. I'm just a low-level IT support person who took a few programming courses in high school.

I've got an Announcements program I'm trying to build in Java. The program will launch in a Java applet, and I want it to accept input from an "announcements.txt" file (which will be what we edit with new announcements) and then display it in the applet. I am using the latest version of NetBeans to stumble my way through this.

The program will be added to a group policy in Active Directory to launch at login for all employees.

My questions are:

  1. Can I just use FileOutputStream to write the "announcements.txt" to a TextArea? I've only ever dealt with console applications.

  2. I added a ScrollPane to the applet design, and just placed a TextArea over top of it. Is this how it is meant to be done? Will it automatically insert scroll bars when it goes outside the window or am I supposed to output the text directly to the ScrollPane?

Sorry if this all seems kind of basic. I'm an aspiring programmer, but I've got a LOT of work ahead of me before I become even semi-proficient. ANY INPUT IS APPRECIATED!!!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1st up use Swing (`JApplet`, `JTextArea`, `JScrollPane`) as opposed to AWT (`Applet`, `TextArea` etc.). 2nd, don't use an applet for this, instead use server side functionality (PHP, JSP, ASP, Servlet etc.) – Andrew Thompson Jun 11 '12 at 17:38

1 Answers1

2
  1. No.
    1. A JTextArea can accept an input stream to read from.
    2. An applet must access 'application' resources by URL.
  2. With the Swing equivalents, yes. With the AWT equivalents, the ScrollPane is not needed, since a TextArea has inbuilt scrollable ability.
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433