70 likes | 169 Views
Pane, Internal /External Frame, Image Processing. By: Greg. JTabbedPane. A component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon. Examples : PaintPanel Project, Tab Panel Project. JSplitPane. JSplitPane
E N D
Pane, Internal /External Frame, Image Processing By: Greg Java 9 - GUI
JTabbedPane • A component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon. • Examples : PaintPanel Project, Tab Panel Project Java 9 - GUI
JSplitPane • JSplitPane • Used to divide two (and only two) Components. • The two Components are graphically divided. • The two Components can then be interactively resized by the user. • Example: PaintPanel Project Java 9 - GUI
JDesktopPane and JInternalFrame • Multiple document interface • Main (parent) window • Child windows • Switch freely among documents • Example: Menu Project Java 9 - GUI
Windows (External Frame) • JFrame • Windows with title bar and border • Subclass of java.awt.Frame • Subclass of java.awt.Window • Heavyweight component • Three operations when user closes window • DISPOSE • DO_NOTHING • HIDE • EXIT_ON_CLOSE (Default) • Example: Menu Project Java 9 - GUI
Simple Image Processing • ImageIO class provides a set of methods that perform most simple Image I/O operations. • Reading an image in a supported format (GIF, BMP, PNG, or JPEG) is simple: File f = new File("c:\images\myimage.gif"); BufferedImage bi = ImageIO.read(f); • Image format will be auto-detected by the API based on the contents of the file. Java 9 - GUI
Simple Image Processing • Writing an image in a supported format is equally simple: BufferedImage bi; …. processed … File f = new File("c:\images\myimage.png"); ImageIO.write(bi, "png", f); • The list of supported formats may be obtained by calling ImageIO.getReaderFormatNames() or ImageIO.getWriterFormatNames(). • This will return an array of Strings containing the names of the available formats. Java 9 - GUI