Inserting Notepad.TXT document into JTextArea(Document) ???

Hi.
I've a JTextArea and I would like to insert a notepad.txt document into it for display only ie. the user is not allowed to edit it. Before I hurdle down a particular path, should I be using getDocumentBase() for this purpose?
Following is the stub code where I intend to pick up the notepad.txt document (and it would be even better to have formatted text instead of plain text):
public class ExplanatoryText extends JFrame {
  Image picture;
  Document AboutCredit;
  Font txtFont = new Font("Monospaced", Font.PLAIN,11);
  public ExplanatoryText()
    JFrame f = new JFrame("Explanatory Note : About Credit");
    f.setSize(800,200);
    f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    Container content = f.getContentPane();
    content.setBackground(Color.white);
    content.setLayout(new FlowLayout());
    // add the LoC description inside a scrollable area
    // use getDocumentBase() to retrieve a notepad.txt document (around 2-3k)
    AboutCredit = new PlainDocument();
    JTextArea explainTxt = new JTextArea(AboutCredit);
    explainTxt.setFont(txtFont);
    explainTxt.setMargin(new Insets(5,5,5,5));
    JScrollPane scrollpanel = new JScrollPane(explainTxt);
    scrollpanel.setPreferredSize(new Dimension(550,480));
    content.add(scrollpanel, BorderLayout.CENTER);
    f.setVisible(true);
  }// end of method ExplanatoryText
}// end of class ExplanatoryTextYIA :-)

Hi. Thank-you for taking time to look at my issue.
Indeed there are many ways of doing it if it weren't an applet. If it were a simple Java program, I would simply use an io-stream, like this :
public class ExplanatoryText extends JFrame {
  Font txtFont = new Font("Monospaced", Font.PLAIN,11);
  public ExplanatoryText(String fileName, String headerTxt) throws IOException
    JFrame f = new JFrame("Explanatory Note : " + headerTxt);
    f.setSize(800,200);
    f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    Container content = f.getContentPane();
    content.setBackground(Color.white);
    content.setLayout(new FlowLayout());
    File inputFile = new File(fileName);
    Reader readTxt = new FileReader(inputFile);
    JTextArea txtArea = new JTextArea();
    txtArea.read(readTxt,null);
    txtArea.setFont(txtFont);
    txtArea.setMargin(new Insets(5,5,5,5));
    JScrollPane scrollpanel = new JScrollPane(txtArea);
    scrollpanel.setPreferredSize(new Dimension(250,380));
    content.add(scrollpanel, BorderLayout.CENTER);
    f.setVisible(true);
  }// end of method ExplanatoryText
}// end of class ExplanatoryTextBut since it is an applet, it has run into the typical "Access Denied" problem when trying to read the input file from the locally mounted volumn.
Hence my question about whether using getDocumentBase and PlainDocument would be easier.
Thanks again for your input.

Similar Messages

  • Am unable to insert table and graphs into word document in labwindow/CVI? can any one help me ?

    Am unable to insert table and graphs into word document in labwindow/CVI? can any one help me ?

    Are you using the Word Report Generation instrument? You can find it in toolslib\activex\word\wordreport.fp under the CVI directory.
    The instrument comes with a sample project that shows how to include table and graphs in a Word document: see samples\activex\word\wordrpt.cws in the samples foder of your CVI installation.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Turning PDF Documents into Word Documents

    Can I use my Adobe Creative Suite 6 to turn PDF documents into Word Documents?

    Acrobat comes with most versions of Creative Suite and it is capable of converting PDFs to Word documents. The quality of the results depend on a number of things. If the PDF was originally generated from a Word source and it's well tagged, you will get much better results. More complicated layouts will generally have worse results and there will be considerable cleanup in Word needed. Exporting to text is sometimes better.
    For the future, there is a better forum for this type of question: http://forums.adobe.com/community/acrobat/creating__editing_%26_exporting_pdfs?view=discus sions

  • How to convert unstructured document into structured document

    I have many unstructured documents. Is it possible to convert these documents into strcutured documents? I know that structured FM uses DITA which is different from unstrcutured document. This is client's requirement so I want to get community views on this.

    Yanesh,
    I would approach this in 2 stages.
    Understand how DITA works independently of FrameMaker first. I say this because DITA is not a straight forward 'out of the box' experience. This could be a good starting point -http://www.technicalcommunicationcenter.com/2011/04/13/technical-book-review-practical-dit a-a-nuts-and-bolts-guide-to-structured-technical-writing/
    Understand how FrameMaker works with DITA. FrameMaker has it's own way of how you author DITA based content. You might want to look at tools such as DITA FMx - http://www.leximation.com/dita-fmx/, which claims to make DITA authoring easier with FrameMaker.
    If you are initially just producing PDF from your DITA content, then FrameMaker is probably the best way of getting the results you want, as FrameMaker templates work the same with structured content, as they do with unstructured.
    Good luck
    Mark

  • How to drag sections/pages from separate Pages document into current document using Pages 5

    I want to clarify whether or not Pages 5 allows users to drag individual pages and/or sections from separate Pages documents into the user's current working document. This feature was available in Pages 4 but seems to have been eliminated in the upgraded version.

    You can take this to be the answer for most things Pages 5…
    … No!
    Use Pages '09 instead.
    Peter

  • Applescript to insert graphic from file into Pages document

    I am trying to insert a picture from a file into Pages using Applescript, i.e. I am trying to do via script the same thing as the Menu command " Insert" followed by "Choose...".
    I have tried the following Applescript and variants of it but it does not work:
    set theFile to "xxx_HD:Users:xxx:Desktop:PagesScripts:picture.pct"
    tell application "Pages"
    tell document 1
    tell body text
    set thePar to make new paragraph at end
    set contents of thePar to make attachment theFile
    end tell
    end tell
    end tell
    I am not even sure that " make attachment" is the right command to use to insert a graphic from a file. I have not found any information anywhere on this. Can someone help please?

    Pages '09 should still be in your Applications/iWork folder.
    What do you like in the "new look"?
    Peter

  • Did somebody find out how to insert citations from Papers into a document of Pages 5.1?

    Apparently Apple has sacrificed Apple Script in the new version, which is required for these kind of functionality.
    I really loved Pages '09 for its stability, functionality and ease of use. I also do like the new look of Pages but unfortunately this is not what matters for professional use.
    Can't use Papers 5.1 like this :-(
    Best

    Pages '09 should still be in your Applications/iWork folder.
    What do you like in the "new look"?
    Peter

  • How can I combine separate pdf documents into one document with several pages

    I have been using Preview to separate pdf pages into separate pdf documents. How might I do the reverse. Preview appears to have combined the documents in the thumbnail, but will not allow saving this. It just saves the highlighted page.

    Open all the documents. Choose View > Contact Sheet. All the pages will be shown as thumbnails, separated by document. Select the pages you want in the final document and drag them into the desired order, in one document space.

  • Appending MS-Word documents into one document.

    Greetings,
    I've used the MS-Office VI's to create MS-word documents using a .dot template.   It is very handy and provides very good results with little effort.  
    For various intended reasons I create in number of one page documents.
    Anyone know how to append .doc files into one .doc file?  Any active-x commands able to do this?  
    Any help would be appreciated.
    Modemmad99

    Check out this other discussion forum post. It will show you how to use Active X commands or Report Generation Toolkit VIs to append documents together.
    Stephanie O.
    DIAdem Product Manager
    National Instruments

  • How to split a PDF document into several documents

    Hallo!I am using Adobe 7 at the office.
    Sometimes I receive large PDF documents (+1000 pages) whereby I only need a few pages for my reports.
    I would like to split these large PDFs into smaller PDFs.
    How can I achieve this?
    Thanks.

    Thanks.
    In my Documents menu,there is no option of Extract Pages.The options that appear are as below
    1)Digital Signatures
    2)Security
    3)Security Settings
    4)Trusted Identities
    5)Accessibility Quick Check
    6)Use local fonts
    Where else can I find the Extract pages option ?
    Thanks.

  • Can I load JPG, PDF documents into the Document section of iCloud

    I am concerned about the Document section of Icloud. I used Idisk for storing documents to readily have accessible. It appears that I can only store Iwork, Inumbers, Keynote files that are made from Apple's applications. That doesnt seem really customer friendly - a major step back from Idisk. I don't h

    Open all the documents. Choose View > Contact Sheet. All the pages will be shown as thumbnails, separated by document. Select the pages you want in the final document and drag them into the desired order, in one document space.

  • How can i merge multiple scanned documents into one document?

    Can anyone help me with this.  I need to email the document as one and not individual pages, not very professional!

    Choose the combine files otion on the star screen.
    Mylenium

  • Converting scanned documents into Word documents

    Is there a way to covert a scanned document in PDF format and convert it over to a Word document?

    My problem when I do that is that I get a lot of symbols that I do not
    recognize for example:
    lllC 1opic oftl1is essa}1is hoY" n1t..-dicaJ marijoru1n 3ffi:cts aJcoboldef)
    C1ldc11cc recovery. Fi I. does medical nlanJuana aid in 01Jcohol
    dl.-pcndc:nC\! n..'i:O'Cr}-? Seconc.l. *cb: *medical 1narijuona mask lhc
    ::;yn1ptom:; of alcohol dcpcodenc-c {lOd become  the drug of d..:pcndcncc?
    11 n1ig.h1be i111crt. ting to note lhal nlatijuana is listcll lly the 01·u1-
    :nrorccnu.:111 Agency
    Thank you for responding to my inquiry.  Is there something I'm doing wrong
    to get these results?
    Steve
    Steven Hirasuna
    [signature deleted by host]

  • Why does firefox turn word documents into firefox documents??

    wen i want to print a word document attached in an email I've received firefox won't open it and when i try to save the document to print it later instead firefox wants to save the document as a firefox document. If i change the format to word document and then save it, it can't be opened at all...
    == This happened ==
    Every time Firefox opened
    == i started using firefox instead of explorer

    Hello Myrorna.
    You may be having an usability problem with the email service you are using. Are you sure you are not seeing the word document in an online document viewer? Firefox doesn't read word documents, so it's not possible for Firefox to save documents as a word document.
    Unless you are using an add-on for such effect, in which case you need to contact its author for support.

  • Convert Word document into HTML document

    Hello,
    I require an idea to accomplish the conversion of a .doc (word file) to .html (HTML file) in LabVIEW.
    I am working on a project in which i am having reports being generated after each test case execution.
    The data after the each test is meant to be appended in the corresponding report.
    I just want to convert the .doc file  to .html file for only display purpose as this is a requirement.
    I dont want to use any kind of converters in this.
    I have to do some calculations and modifications in the report before saving it,  that's why i am thinking in this way as i had come to know that this is possible in LabVIEW.
    Can someone help me in this regard.
    Thanks & Regards,
    Samriddh Sarbalhi

    samriddh wrote:
    Hi,
    Can i do this programatically using LabVIEW VI's.
    As noted, you need to access the Microsoft Word ActiveX server using the LabVIEW ActiveX functions. There are several examples that ship with LabVIEW (Help -> Find Examples) on how to use ActiveX. You can also search the NI site. 

Maybe you are looking for