Skip to main content

what is the WindowContainer class?

1 reply [Last post]
allanhouston
Offline
Joined: 2006-02-14
Points: 0

I am a beginner of JAI, I use eclipse, I found the code in the Online book.
import java.awt.image.renderable.ParameterBlock;
import java.io.File;
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.media.jai.RenderedOp;
import javax.media.jai.widget.ScrollingImagePanel;

public class FileTest extends WindowContainer {

// Specify a default image in case the user fails to specify
// one at run time.
public static final String DEFAULT_FILE =
"./images/earth.jpg";

public static void main(String args[]) {
String fileName = null;

// Check for a filename in the argument.
if(args.length == 0) {
fileName = DEFAULT_FILE;
} else if(args.length == 1) {
fileName = args[0];
} else {
System.out.println("\nUsage: java " +
(new FileTest()).getClass().getName() +
" [file]\n");
System.exit(0);
}

new FileTest(fileName);
}

public FileTest() {}
public FileTest(String fileName) {

// Read the image from the designated path.
System.out.println("Creating operation to load image from '" +
fileName+"'");
RenderedOp img = JAI.create("fileload", fileName);

// Set display name and layout.
setTitle(getClass().getName()+": "+fileName);

// Display the image.
System.out.println("Displaying image");
add(new ScrollingImagePanel(img, img.getWidth(),
img.getHeight()));
pack();
show();
}
}

but I donn't know where is the windowcontainer class, can any body help me? I just want to show the picture on the frame.How to deal with it, I found that some person have the same questions, thank you !

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Brian Burkhalter

The WindowContainer class is just a Frame that implements WindowListener to
allow clicking the corner to close the window.

Brian

On Thu, 17 Nov 2005, jai-interest@javadesktop.org wrote:

> I am a beginner of JAI, I use eclipse, I found the code in the Online book.
> import java.awt.image.renderable.ParameterBlock;
> import java.io.File;
> import javax.media.jai.JAI;
> import javax.media.jai.PlanarImage;
> import javax.media.jai.RenderedOp;
> import javax.media.jai.widget.ScrollingImagePanel;
>
> public class FileTest extends WindowContainer {
>
> // Specify a default image in case the user fails to specify
> // one at run time.
> public static final String DEFAULT_FILE =
> "./images/earth.jpg";
>
> public static void main(String args[]) {
> String fileName = null;
>
> // Check for a filename in the argument.
> if(args.length == 0) {
> fileName = DEFAULT_FILE;
> } else if(args.length == 1) {
> fileName = args[0];
> } else {
> System.out.println("\nUsage: java " +
> (new FileTest()).getClass().getName() +
> " [file]\n");
> System.exit(0);
> }
>
> new FileTest(fileName);
> }
>
> public FileTest() {}
> public FileTest(String fileName) {
>
> // Read the image from the designated path.
> System.out.println("Creating operation to load image from '" +
> fileName+"'");
> RenderedOp img = JAI.create("fileload", fileName);
>
> // Set display name and layout.
> setTitle(getClass().getName()+": "+fileName);
>
> // Display the image.
> System.out.println("Displaying image");
> add(new ScrollingImagePanel(img, img.getWidth(),
> img.getHeight()));
> pack();
> show();
> }
> }
>
> but I donn't know where is the windowcontainer class, can any body help me? I just want to show the picture on the frame.How to deal with it, I found that some person have the same questions, thank you !
> ---
> [Message sent by forum member 'allanhouston' (allanhouston)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageID=125568&#125568
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

----------------
Brian Burkhalter
Java Multimedia, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net