ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/vifstxt.htm

87 lines
4.4 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="IFSTextFileDocument" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="vifstxt" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>IFSTextFileDocument</title>
</head>
<body id="vifstxt"><a name="vifstxt"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">IFSTextFileDocument</h1>
<div><p></p>
<div class="section"><p>Text file documents allow a Java™ program to use any Java Foundation
Classes (JFC) graphical text component to edit or view text files in the integrated
file system on a server. (A text component is a graphical component used to
display text that the user can optionally edit.)</p>
</div>
<div class="section"><p>The <a href="javadoc/com/ibm/as400/vaccess/IFSTextFileDocument.html#NAVBAR_TOP"> IFSTextFileDocument</a> class is an implementation of the
JFC Document interface. It can be used directly with any JFC graphical text
component. Several text components, such as single line fields (JTextField)
and multiple line text areas (JTextArea), are available in JFC.</p>
</div>
<div class="section"><p>Text file documents associate the contents of a text component
with a text file. The Java program can load and save between the
text component and the text file at any time.</p>
</div>
<div class="section"><p>To use an IFSTextFileDocument, set both the system and path properties.
These properties can be set using a constructor or through the setSystem()
and setPath() methods. The IFSTextFileDocument object is then "plugged" into
the text component, typically using the text component's constructor or setDocument()
method.</p>
</div>
<div class="section"><p>Initially, the contents of the text component are empty. Use load()
to load the contents from the text file. Use save() to save the contents of
the text component to the text file.</p>
</div>
<div class="section"><p>The following example creates and loads an IFSTextFileDocument:</p>
</div>
<div class="section"><div class="p"><pre> // Create and load the
// IFSTextFileDocument object. Assume
// that "system" is an AS400 object
// created and initialized elsewhere.
IFSTextFileDocument ifsDocument = new IFSTextFileDocument (system, "/DirectoryA/MyFile.txt");
ifsDocument.load ();
// Create a text area to present the
// document.
JTextArea textArea = new JTextArea (ifsDocument);
// Add the text area to a frame.
// Assume that "frame" is a JFrame
// created elsewhere.
frame.getContentPane ().add (textArea);</pre>
<strong>Example</strong></div>
</div>
<div class="section"><p>Present an <a href="ifstextfiledocumentexample.htm#ifstextfiledocumentexample"> IFSTextFileDocument</a> in
a JTextPane.</p>
</div>
<div class="section"><p>Figure 1 shows the IFSTextFileDocument graphical user interface
component:</p>
</div>
<div class="section"><p><strong>Figure 1: IFSTextFileDocument example</strong></p>
</div>
<div class="section"><p><img src="rzahh083.gif" alt="IFSTextFileDocument example" /></p>
</div>
</div>
</body>
</html>