03/02/2003: How Can I Improve the I/O Speed for System.out.println Using Java?
Normally, the System.out print stream has a buffer size of 128 and flushes the buffer whenever a newline character is encountered.
The following four lines of java change the buffer size to 1024 and doesn’t flush the buffer for newline characters.
FileOutputStream fdout = new FileOutputStream(FileDescriptor.out); BufferedOutputStream bos = new BufferedOutputStream(fdout, 1024); PrintStream ps = new PrintStream(bos, false); System.setOut(ps);
03/01/2003: How to Find the Parent Frame of a Component Using Java
How to Find the Parent Frame of a Component Using Java
Frame getParentFrame() { Component p = this; while ( (p = p.getParent()) != null && !(p instanceof Frame) ) ; return( (Frame)p ); }