Article View: borland.public.jbuilder.java.api
Article #3538TextArea problem - help please
From: Paul Richards
Date: Sat, 29 Nov 1997 00:00
Date: Sat, 29 Nov 1997 00:00
70 lines
2190 bytes
2190 bytes
Why won't my TextArea show its contents? The load() method correctly
loads data using txtarea = (TextArea)in.readObject(); The debugger
shows that the txtarea String contains the serialized data - so why
doesn't it show when repaint() is called?
TIA
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.zip.*;
import java.util.Properties;
public class NoteIt02a extends Frame
{
protected int width, height;
protected TextArea txtarea, intxtarea;
protected Frame frame;
protected Font font;
// main()
public static void main(String[] args)
{
new NoteIt02a();
}
// constructor
public NoteIt02a()
{
super( "Note It" );
txtarea = new TextArea( "", 50, 75, TextArea.SCROLLBARS_NONE );
txtarea.setBackground( Color.yellow );
txtarea.setForeground( Color.blue );
font = new Font( "SansSerif", Font.BOLD, 12 );
txtarea.setFont( font );
this.add(txtarea);
<snip>
}
..
void load()
{
FileDialog f = new FileDialog( this, "Load NoteIts",
FileDialog.LOAD );
f.show();
String filename = f.getFile();
if ( filename != null )
{
try {
FileInputStream fis = new FileInputStream( filename
);
GZIPInputStream gzis = new GZIPInputStream( fis );
ObjectInputStream in = new ObjectInputStream( gzis
);
txtarea = (TextArea)in.readObject();
in.close();
repaint(); ???????????????
} // end try
catch ( Exception e )
{
System.out.println( e );
}
} // end if
} // end load
} // end class
++ *Paul*
++ from Cheltenham, England
++ Fri, 28 Nov 1997 18:43 GMT
++ WinNT build 1381 + SP3
Technical Details
Message-ID:
<VA.00000024.0240884d@p5>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,51624ce4e0a3d730,start X-Google-Attributes: gid1089d0,public From: Paul Richards <paul.richards@virgin.net> Subject: TextArea problem - help please Date: 1997/11/29 Message-ID: <VA.00000024.0240884d@p5> X-Deja-AN: 293570251 Reply-To: paul.richards@virgin.net Organization: None Newsgroups: borland.public.jbuilder.java.api