Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 6th, 2004, 03:52 PM
Registered User
Join Date: Dec 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to starsailor
Default can an applet read from a file

ive been trying to do this code and cant get it to read can anybody plaese help

import java.awt.*;
import java.util.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;

public class Assessement2 extends JApplet implements ActionListener{

    JLabel Title,Photo,Author,Topic,LQuote;
    JComboBox TopicCombo,AuthorCombo;
    JButton QuoteButton;
    JTextArea QuoteArea;//various variables that i needed to complete the program

    ArrayList theauthor = new ArrayList();
    ArrayList thesubject = new ArrayList();
    ArrayList Quote = new ArrayList();

public void init(){//this method is used to organise the interface

        Container c =getContentPane();

        Title=new JLabel("Quote Generator", JLabel.CENTER);
        Title.setFont(new Font("Serif", Font.BOLD, 24));

        //Photo=new JLabel(candle.gif);

        //private Image candle;

        Author=new JLabel("Authors Name");

        AuthorCombo=new JComboBox();

        Topic=new JLabel("Topic Area");

        TopicCombo=new JComboBox();

        LQuote=new JLabel("Quote", JLabel.CENTER);

        QuoteArea=new JTextArea();

        QuoteButton=new JButton("Press Here to Enter the Quote into the System");
        setBackground ( Color.black );

 public void FileLoad() {

    try {
      // Open the file that stores my quotes
        FileReader quoteStream = new FileReader ("Data.txt");
        BufferedReader quoteIn = new BufferedReader (quoteStream);

      String str, tmp;
      boolean FQuote = false;
      while ((str = quoteIn.readLine()) != null) {

      // Close the File
    } catch (IOException except) {
      JOptionPane.showMessageDialog (null, "The File was not readable");

  public void Randomise() {
    int QuoteButton = (int)(Math.floor(Math.random()*(Quote.size()-1)+1));

  public void DisplayQuote(int quoteIndex) {
    QuoteArea.setText ("");
    String s=(String)theauthor.get(quoteIndex);
    String st[]=s.split("#");

  private Object MakeObject(final String item) {

    return new Object() { public String toString() { return item; } };

  public void actionPerformed (ActionEvent e) {

    if (e.getSource() == QuoteButton) {
    } else if (e.getSource() == AuthorCombo) {
    } else if (e.getSource() == TopicCombo) {


Reply With Quote
  #2 (permalink)  
Old January 7th, 2005, 12:58 PM
Registered User
Join Date: Mar 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Does the applet have privileges to access the file system?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Text file and convert to Binary file VB.net sjlsysprg1 Pro VB.NET 2002/2003 4 June 29th, 2007 06:53 AM
setting codebase for applet inside jsp file picky Java Basics 0 December 12th, 2006 08:12 AM
Applet file access kp_kurian Java GUI 0 June 13th, 2004 10:20 PM
Java Applet that can read XML DOM and display text sankar XML 3 February 16th, 2004 11:16 AM
Java Applet that can read an XML file sankar J2EE 1 December 25th, 2003 05:40 AM

All times are GMT -4. The time now is 10:28 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.