! #"$&%')(&%%*#+, #-!(&. /0'1 #"2. awt34 5#617

Size: px
Start display at page:

Download "! #"$&%')(&%%*#+, #-!(&. /0'1 #"2. awt34 5#617"

Transcription

1 ! #"$&%')(&%%*#+, #-!(&. /0'1 #"2 awt34 5#617

2 89 : A # B! #"$&%' B&C&D %" B&E <>" D BGFHFHF Ï <> #%"<J<>KL<>" B =?% D < B #<> B =?<>" D B A #"<>< awt34 5#6NM

3 O P Q?ST awt34 5#6NU

4 V W ST X YT Z[ \]?^`_ Contains all of the classes for creating user interfaces and for painting graphics and images. Interface Summary ActiveEvent Adjustable Composite CompositeCon text An interface for events that know how dispatch themselves. The interface for objects which have an adjustable numeric value contained within a bounded range of values. The Composite interface, along with CompositeContext, defines the methods to compose a draw primitive with the underlying graphics area. The CompositeContext interface defines the encapsulated and optimized environment for a compositing operation. ItemSelectable The interface for objects which contain a set of items for which zero or more can be selected. LayoutManag er LayoutManag er2 MenuContaine r Paint PaintContext PrintGraphics Shape Stroke Transparency Defines the interface for classes that know how to layout Containers. Defines an interface for classes that know how to layout Containers based on a layout constraints object. The super class of all menu related containers. This Paint interface defines how color patterns can be generated for Graphics2D operations. The PaintContext interface defines the encapsulated and optimized environment to generate color patterns in device space for fill or stroke operations on a Graphics2D. An class which provides a print graphics context for a page. The Shape interface provides definitions for objects that represent some form of geometric shape. The Stroke interface allows a Graphics2D object to obtain a Shape that is the decorated outline, or stylistic representation of the outline, of the specified Shape. The Transparency interface defines the common transparency modes for implementing classes. awt34 5#6ba

5 V W ST X YT Z[ \]?^`c Class Summary AlphaComposite AWTEvent AWTEventMultica ster AWTPermission BasicStroke BorderLayout Button Canvas CardLayout Checkbox CheckboxGroup CheckboxMenuIte m Choice Color Component ComponentOrienta tion Container Cursor Dialog Dimension Event This AlphaComposite class implements the basic alpha compositing rules for combining source and destination pixels to achieve blending and transparency effects with graphics and images. The root event class for all AWT events. A class which implements efficient and thread safe multi cast event dispatching for the AWT events defined in the java.awt.event package. This class is for AWT permissions. The BasicStroke class defines a basic set of rendering attributes for the outlines of graphics primitives. A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center. This class creates a labeled button. A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user. A CardLayout object is a layout manager for a container. A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. The CheckboxGroup class is used to group together a set of Checkbox buttons. This class represents a check box that can be included in a menu. The Choice class presents a pop up menu of choices. A class to encapsulate colors in the default sgb color space or colors in arbitrary color spaces identified by a ColorSpace. A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user. The ComponentOrientation class encapsulates the language sensitive orientation that is to be used to order the elements of a component or of text. A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components. A class to encapsulate the bitmap representation of the mouse cursor. A Dialog is a top level window with a title and a border that is typically used to take some form of input from the user. The Dimension class encapsulates the width and height of a component (in integer precision) in a single object. Event is a platform independent class that encapsulates events from the platform s Graphical User Interface in the Java 1.0 event model. awt34 5#6bd

6 V W ST X YT Z[ \]?^`e EventQueue FileDialog FlowLayout Font FontMetrics Frame GradientPaint Graphics Graphics2D GraphicsConfigTe mplate GraphicsConfigura tion GraphicsDevice GraphicsEnvironm ent GridBagConstraint s GridBagLayout GridLayout Image Insets Label List MediaTracker EventQueue is a platform independent class that queues events, both from the underlying peer classes and from trusted application classes. The FileDialog class displays a dialog window from which the user can select a file. A flow layout arranges components in a left to right flow, much like lines of text in a paragraph. The Font class represents fonts. The FontMetrics class defines a font metrics object, which encapsulates information about the rendering of a particular font on a particular screen. A Frame is a top level window with a title and a border. The GradientPaint class provides a way to fill a Shape with a linear color gradient pattern. The Graphics class is the base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off screen images. This Graphics2D class extends the Graphics class to provide more sophisticated control over geometry, coordinate transformations, color management, and text layout. The GraphicsConfigTemplate class is used to obtain a valid GraphicsConfiguration. The GraphicsConfiguration class describes the characteristics of a graphics destination such as a printer or monitor. The GraphicsDevice class describes the graphics devices that might be available in a particular graphics environment. The GraphicsEnvironment class describes the collection of GraphicsDevice objects and Font objects available to a Java(tm) application on a particular platform. The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class. The GridBagLayout class is a flexible layout manager that aligns components vertically and horizontally, without requiring that the components be of the same size. The GridLayout class is a layout manager that lays out a container s components in a rectangular grid. The class Image is the superclass of all classes that represent graphical images. An Insets object is a representation of the borders of a container. A Label object is a component for placing text in a container. The List component presents the user with a scrolling list of text items. The MediaTracker class is a utility class to track the status of a number of media objects. awt34 5#6Nf

7 V W ST X YT Z[ \]?^`g Menu MenuBar MenuComponent MenuItem MenuShortcut Panel Point Polygon PopupMenu PrintJob ectangle enderinghints enderinghints.ke y Scrollbar ScrollPane SystemColor TextArea TextComponent TextField TexturePaint Toolkit Window A Menu object is a pull down menu component that is deployed from a menu bar. The MenuBar class encapsulates the platform s concept of a menu bar bound to a frame. The class MenuComponent is the superclass of all menu related components. All items in a menu must belong to the class MenuItem, or one of its subclasses. A class which represents a keyboard accelerator for a MenuItem. Panel is the simplest container class. A point representing a location in (x, y) coordinate space, specified in integer precision. The Polygon class encapsulates a description of a closed, two dimensional region within a coordinate space. A class that implements a menu which can be dynamically popped up at a specified position within a component. As the inheritance hierarchy implies, a PopupMenu can be used anywhere a Menu can be used. An class which initiates and executes a print job. A ectangle specifies an area in a coordinate space that is enclosed by the ectangle object s top left point (x, y) in the coordinate space, its width, and its height. The enderinghints class contains rendering hints that can be used by the Graphics2D class, and classes that implement BufferedImageOp and aster. Defines the base type of all keys used to control various aspects of the rendering and imaging pipelines. The Scrollbar class embodies a scroll bar, a familiar user interface object. A container class which implements automatic horizontal and/or vertical scrolling for a single child component. A class to encapsulate symbolic colors representing the color of GUI objects on a system. A TextArea object is a multi line region that displays text. The TextComponent class is the superclass of any component that allows the editing of some text. A TextField object is a text component that allows for the editing of a single line of text. The TexturePaint class provides a way to fill a Shape with a texture that is specified as a BufferedImage. This class is the superclass of all actual implementations of the Abstract Window Toolkit. A Window object is a top level window with no borders and no menubar. awt34 5#6ih

8 V W ST X YT Z[ \]?^`j Exception Summary AWTException IllegalComponentStateE xception Signals that an Absract Window Toolkit exception has occurred. Signals that an AWT component is not in an appropriate state for the requested operation. Error Summary AWTError Thrown when a serious Abstract Window Toolkit error has occurred. Package java.awt Description Contains all of the classes for creating user interfaces and for painting graphics and images. A user interface object such as a button or a scrollbar is called, in AWT terminology, a component. The Component class is the root of all AWT components. See Component for a detailed description of properties that all AWT compo nents share. Some components fire events when a user interacts with the components. The AWTEvent class and its subclasses are used to represent the events that AWT components can fire. See AWTEvent for a description of the AWT event model. A container is a component that can contain components and other containers. A con tainer can also have a layout manager that controls the visual placement of components in the container. The AWT package contains several layout manager classes and an interface for building your own layout manager. See Container and LayoutManager for more information. awt34 5#6Nk

9 z { }4~ 4 4~ ƒ H 4 H5ˆ ŠŒ 3 lnmö pqpsr tvuwuwxiy Ž # šš œ ž Ÿ ŠŒ 4 ƒ ~ 4 ŠŒ 6 } { Ÿ Š 3 ƒ } ŠŒ 4 ƒ ~ 4 ŠŒ 6 } { { 4 H~ } } H5 3 «ª # šš œ ž Š }5 œh ± ² ³ ² ª ª ~ }ŠŒ µ }4 ƒ { 4 H~ } } H5 H~ }ŠŒ }4 ƒ Šƒ H~ } [ H~ }ŠŒ 4 ƒ Š L { }4 ŠŒ 3 Š }5 œh ² ž ƒ H 4 { ƒš { ŠŒ 3 ƒ } ¹ ª ± ² Ž šš œ º ƒ 4 { [~ Š 5 Š { [ H~ }ŠŒ }ƒ H5ˆ #» { }4 ŠŒ 3 ƒ } ¹ ª ³ œ ¼ ª ½ ¾ 4 { Š { }4 ŠŒ 3 ƒ Š H~ H5 ƒ } œ œ šà # ² ¹ º ƒ 4 { ƒ ƒ4 ƒ } ƒ ƒ 4 } { 4 Š { }4 ŠŒ 3 ƒ Š H~ H5 Š }5 ª ± ² Á# ª ~ }ŠŒ Ã Ä ƒ Š ~ H~ }ŠŒ 4 Š ~ ~ ƒ ƒ } ŠŒ { }4 ŠŒ ˆ #» 5 }4 ~ { } { L Šˆ #»ƒ H }4 ƒ H5 ~ }ŠŒ µ }4 ƒšh Å H~ 4 3 ƒ Š H~ H5 Š }5 ª Á# ª ÇÆ«z Ã Ä ƒ Š ~ ŠŒ { }4 ŠŒ 3 Š }5 ª š ŒÂ ª ± ² ³ ² ª ª ~ }ŠŒ µ }4 ƒ º Š 4 { 4 H~ } } H5 H~ }ŠŒ }4 ƒ4 Š { } Š ŠŒ ƒƒ H~ } 4 H~ }ŠŒ 4 ƒ Š L { }4 ŠŒ 3 Š }5 ª ± ² Ž šš œ ƒ } ~ Š 5 4 { [~ Š 5 Š ƒ { [ H~ }ŠŒ }ƒ H5ˆ #» { }4 ŠŒ 3 Š }5 ª ³ œ ¼ ª ½ ƒ } 4 { ŠŒ È4 Š[ { 4 H~ } } H5 4 ƒ } #3 awt34 5#6NÉ

10 lnmö pqpslnö y?êëö p A Canvas component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user. An application must subclass the Canvas class in order to get useful functionality such as creating a custom component. The paint method must be overridden in order to perform custom graphics on the canvas. Constructor Summary Canvas() Constructs a new Canvas. Canvas(GraphicsConfiguration config) Constructs a new Canvas given a GraphicsConfiguration object. Method Summary addnotify() Creates the peer of the canvas. paint(graphics g) This method is called to repaint this canvas. awt34 5#617 Ì

11 Ö lnmö pqpslní?îðïñtòtxióõồ A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. Clicking on a check box changes its state from "on" to "off," or from "off" to "on." Constructor Summary Checkbox() Creates a check box with no label. Checkbox(String label) Creates a check box with the specified label. Checkbox(String label, boolean state) Creates a check box with the specified label and sets the specified state. Checkbox(String label, boolean state, CheckboxGroup group) Creates a check box with the specified label, in the specified check box group, and set to the specified state. Checkbox(String label, CheckboxGroup group, boolean state) Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group. awt34 5#617H7

12 lnmö pqpslní?îðïñtòtxióõôø Method Summary additemlistener(itemlistener l) Adds the specified item listener to receive item events from this check box. addnotify() Creates the peer of the Checkbox. CheckboxGr oup getcheckboxgroup() Determines this check box s group. String getlabel() Gets the label of this check box. Object[] getselectedobjects() eturns an array (length 1) containing the checkbox label or null if the checkbox is not selected. boolean getstate() Determines whether this check box is in the "on" or "off" state. protected String paramstring() eturns the parameter string representing the state of this check box. protected protected processevent(awtevent e) Processes events on this check box. processitemevent(itemevent e) Processes item events occurring on this check box by dispatching them to any registered ItemListener objects. removeitemlistener(itemlistener l) emoves the specified item listener so that the item listener no longer receives item events from this check box. setcheckboxgroup(checkboxgroup g) Sets this check box s group to be the specified check box group. setlabel(string label) Sets this check box s label to be the string argument. setstate(boolean state) Sets the state of this check box to the specified state. awt34 5#617 M

13 lnmö pqpslní?xiùïîúôt The Choice class presents a pop up menu of choices. The current choice is displayed as the title of the menu. In the picture, "Green" is the current choice. Pushing the mouse button down on the object causes a menu to appear with the current choice highlighted. Constructor Summary Choice() Creates a new choice menu. Method Summary add(string item) Adds an item to this Choice menu. additem(string item) Adds an item to this Choice. additemlistener(itemlistener l) Adds the specified item listener to receive item events from this Choice menu. addnotify() Creates the Choice s peer. String getitem(int index) Gets the string at the specified index in this Choice menu. int getitemcount() eturns the number of items in this Choice menu. int getselectedindex() eturns the index of the currently selected item. String getselecteditem() Gets a representation of the current choice as a string. Object[] getselectedobjects() eturns an array (length 1) containing the currently selected item. insert(string item, int index) Inserts the item into this choice at the specified position. awt34 5#617 U

14 lnmö pqpslní?xiùïîúôø protected String paramstring() eturns the parameter string representing the state of this choice menu. protected protected processevent(awtevent e) Processes events on this choice. processitemevent(itemevent e) Processes item events occurring on this Choice menu by dispatching them to any registered ItemListener objects. remove(int position) emoves an item from the choice menu at the specified position. remove(string item) emove the first occurrence of item from the Choice menu. removeall() emoves all items from the choice menu. removeitemlistener(itemlistener l) emoves the specified item listener so that it no longer receives item events from this Choice menu. select(int pos) Sets the selected item in this Choice menu to be the item at the specified position. select(string str) Sets the selected item in this Choice menu to be the item whose name is equal to the specified string. awt34 5#617 a

15 Û P ÜÜÞÝ ß P A Label object is a component for placing text in a container. A label displays a single line of read only text. The text can be changed by the application, but a user cannot edit it directly. Field Summary static int CENTE Indicates that the label should be centered. static int LEFT Indicates that the label should be left justified. static int IGHT Indicates that the label should be right justified. Constructor Summary Label() Constructs an empty label. Label(String text) Constructs a new label with the specified string of text, left justified. Label(String text, int alignment) Constructs a new label that presents the specified string of text with the specified alignment. Method Summary addnotify() Creates the peer for this label. int getalignment() Gets the current alignment of this label. String gettext() Gets the text of this label. protected String paramstring() eturns the parameter string representing the state of this label. setalignment(int alignment) Sets the alignment for this label to the specified alignment. settext(string text) Sets the text for this label to the specified text. awt34 5#617 d

16 Ö lnmö pqpsà ÙpquáỒ The List component presents the user with a scrolling list of text items. The list can be set up so that the user can choose either one item or multiple items. Constructor Summary List() Creates a new scrolling list. List(int rows) Creates a new scrolling list initialized with the specified number of visible lines. List(int rows, boolean multiplemode) Creates a new scrolling list initialized to display the specified number of rows. awt34 5#617 f

17 lnmö pqpsâãïäåximmòtö ä The Scrollbar class embodies a scroll bar, a familiar user interface object. A scroll bar provides a convenient means for allowing a user to select from a range of values. The following three vertical scroll bars could be used as slider controls to pick the red, green, and blue components of a color: Alternatively, a scroll bar can represent a range of values. For example, if a scroll bar is used for scrolling through text, the width of the "bubble" or "thumb" can represent the amount of text that is visible. Here is an example of a scroll bar that represents a range: awt34 5#617 h

18 Ö lnmö pqpsæçäåö èví?ùïpéồ The Graphics class is the base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off screen images. Constructor Summary protect ed Graphics() Constructs a new Graphics object. Method Summary clearect(int x, int y, int width, int height) Clears the specified rectangle by filling it with the background color of the current drawing surface. clipect(int x, int y, int width, int height) Intersects the current clip with the specified rectangle. copyarea(int x, int y, int width, int height, int dx, int dy) Copies an area of the component by a distance specified by dx and dy. Graphics create() Creates a new Graphics object that is a copy of this Graphics object. Graphics create(int x, int y, int width, int height) Creates a new Graphics object based on this Graphics object, but with a new translation and clip area. dispose() Disposes of this graphics context and releases any system resources that it is using. draw3dect(int x, int y, int width, int height, boolean raised) Draws a 3 D highlighted outline of the specified rectangle. drawarc(int x, int y, int width, int height, int startangle, int arcangle) Draws the outline of a circular or elliptical arc covering the specified rectangle. drawbytes(byte[] data, int offset, int length, int x, int y) Draws the text given by the specified byte array, using this graphics context s current font and color. drawchars(char[] data, int offset, int length, int x, int y) Draws the text given by the specified character array, using this graphics context s current font and color. boolean boolean drawimage(image img, int x, int y, Color bgcolor, ImageObserver observer) Draws as much of the specified image as is currently available. drawimage(image img, int x, int y, ImageObserver observer) Draws as much of the specified image as is currently available. awt34 5#617 k

19 lnmö pqpsæçäåö èví?ùïpéôø boolean boolean boolean boolean drawimage(image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. drawimage(image img, int x, int y, int width, int height, ImageObserver observer) Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. drawimage(image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. drawimage(image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. drawline(int x1, int y1, int x2, int y2) Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context s coordinate system. drawoval(int x, int y, int width, int height) Draws the outline of an oval. drawpolygon(int[] xpoints, int[] ypoints, int npoints) Draws a closed polygon defined by arrays of x and y coordinates. drawpolygon(polygon p) Draws the outline of a polygon defined by the specified Polygon object. drawpolyline(int[] xpoints, int[] ypoints, int npoints) Draws a sequence of connected lines defined by arrays of x and y coordinates. drawect(int x, int y, int width, int height) Draws the outline of the specified rectangle. drawoundect(int x, int y, int width, int height, int arcwidth, int archeight) Draws an outlined round cornered rectangle using this graphics context s current color. drawstring(attributedcharacteriterator iterator, int x, int y) Draws the text given by the specified iterator, using this graphics context s current color. drawstring(string str, int x, int y) Draws the text given by the specified string, using this graphics context s current font and color. fill3dect(int x, int y, int width, int height, boolean raised) Paints a 3 D highlighted rectangle filled with the current color. awt34 5#617 É

20 lnmö pqpsæçäåö èví?ùïpéôøê fillarc(int x, int y, int width, int height, int startangle, int arcangle) Fills a circular or elliptical arc covering the specified rectangle. filloval(int x, int y, int width, int height) Fills an oval bounded by the specified rectangle with the current color. fillpolygon(int[] xpoints, int[] ypoints, int npoints) Fills a closed polygon defined by arrays of x and y coordinates. fillpolygon(polygon p) Fills the polygon defined by the specified Polygon object with the graphics context s current color. fillect(int x, int y, int width, int height) Fills the specified rectangle. filloundect(int x, int y, int width, int height, int arcwidth, int archeight) Fills the specified rounded corner rectangle with the current color. finalize() Disposes of this graphics context once it is no longer referenced. Shape getclip() Gets the current clipping area. ectangl e getclipbounds() eturns the bounding rectangle of the current clipping area. ectangl e getclipbounds(ectangle r) eturns the bounding rectangle of the current clipping area. ectangl e getclipect() Deprecated. As of JDK version 1.1, replaced by getclipbounds(). Color getcolor() Gets this graphics context s current color. Font getfont() Gets the current font. FontMetr ics getfontmetrics() Gets the font metrics of the current font. FontMetr ics getfontmetrics(font f) Gets the font metrics for the specified font. boolean hitclip(int x, int y, int width, int height) eturns true if the specified rectangular area intersects the bounding rectangle of the current clipping area. setclip(int x, int y, int width, int height) Sets the current clip to the rectangle specified by the given coordinates. setclip(shape clip) Sets the current clipping area to an arbitrary clip shape. awt34 5#6NMŒÌ

21 lnmö pqpsæçäåö èví?ùïpéôøë setcolor(color c) Sets this graphics context s current color to the specified color. setfont(font font) Sets this graphics context s font to the specified font. setpaintmode() Sets the paint mode of this graphics context to overwrite the destination with this graphics context s current color. setxomode(color c1) Sets the paint mode of this graphics context to alternate between this graphics context s current color and the new specified color. String tostring() eturns a String object representing this Graphics object s value. translate(int x, int y) Translates the origin of the graphics context to the point (x, y) in the current coordinate system. awt34 5#6NM 7

22 ì ÊËÎÐy?uwÙ /0% D <> B í& #<>"<> B #<>KL%"%î<>KL<>"é$&`% D <>ï D <>2, # Dð%"% <>KL<>"ñ "$&*#<> B *# < ñ< #=?òå*#<>=?<>" D " òå #%*# < #"<>A #ôó *# #<>"<>ó <>2, # õ #%"<J<>KL<>"ñ "$&*#<> B&D "] #" "õ ö$& D " <>KL<>"ðñ "$&*#<>KL #<>"< % # ô%" D "1%=?òå%"<>"<J!( awt34 5#6NMHM

23 ø y?uwîðäåù ö ÏÏÎéà ÙpquwÎÐy?ÎÐä Listener Interface Adapter Class Methods ActionListener none actionperformed AdjustmentListener none adjustmentvaluechanged ComponentListener ContainerListener FocusListener ComponentAdapter ContainerAdapter FocusAdapter componenthidden componentmoved componentesized componentshown componentadded componentemoved focusgained focuslost ItemListener none itemstatechanged KeyListener MouseListener MouseMotionListener KeyAdapter MouseAdapter MouseMotionAdapter keypressed keyeleased keytyped mouseclicked mouseentered mouseexited mousepressed mouseeleased mousedragged mousemoved TextListener none textvaluechanged WindowListener WindowAdapter windowactivated windowclosed windowclosing windowdeactivated windowdeiconified windowiconified windowopened awt34 5#6NMHU

24 ú ÙèvÙiû ÙiÎÐÊËÎÐy?uwÙ AWT Component Types of Events It Can Generate actio n adjustme nt compon ent contain er focu s ite m ke y mous e mouse motion Button X X X X X X Canvas X X X X X Checkbox X X X X X X CheckboxMenuItem Note: This is not a Component subclass! * X Choice X X X X X X Component X X X X X Container X X X X X X Dialog X X X X X X X Frame X X X X X X X Label X X X X X List X X X X X X X MenuItem Note: This is not a Component subclass! X Panel X X X X X X Scrollbar X X X X X X ScrollPane X X X X X X TextArea X X X X X X TextComponent X X X X X X TextField X X X X X X X Window X X X X X X X tex t windo w awt34 5#6NM a

25 Ûðü ü P 8ý ý P?^`_ þå%2, =?=? ÿ ÿ!! "!! # $ % &'&( ) &( &( * &' +, &' %-. / " " * !, &' %-. / :94 2 " * &'&' 4 7!, &' %-. / ;<1* 4 2 " * ! &' %, -. /0=13 14 * "6567 / 7! &' %, -. / &' 7! &' %, -. /0> &' %, -. /0A 2 A ! &' %, -. /0BCA * *6567 D 7! &' %, -. /012 " -.E 13 FC" ;<G 1-."6567 &'H $ &'7! &' %, -. / " ! &' %, -. /0* 1=A 2I567 / 7! awt34 5#6NM d

26 Ûðü ü P 8ý ý P?^`c # KJ, J &'5 LM! G # &' N/ J J N N ND $ N &'H N /! H J H! * &' J J &'! * $ &'/N &'/N &'/! 3 ) O 6&', N N/ N! H D$ ) /! H D$ ) /! /! $ J 5 #! # $ % P Q+ 4 MP Q! 4 P Q! H D P Q!,P J Q P P # Q / # P Q Q &'H P H &'N :94 2 " * Q! &' P P # Q / # P Q Q &'H P H &'N 12 2 " " * Q! P Q! awt34 5#6NMHf

27 Ûðü ü P 8ý ý P?^`e # $ % 4 MP Q I4 P Q! &' # P IG # P Q Q! &' G D/ # P H Q! 5 IG # P Q! &' * $ P 7 D0H C S 12 2 " 3 7 Q! &' " $ P # Q! &' K P 12 2 " 3 Q! * &' P H &'Q! P 7 7 N Q! &'/056 I* $ P Q! &'/&' 3 ) P 7 7 Q! ÿ ÿk C&' &' # &'TU&'/P &'/N7 2 7 Q! P 7 -. # H 7 N &'/Q! ÿ ÿ6&' # &' # P I # P Q Q! P N 12 2 " " * Q! # $ % 4 P Q+! /5, &'! 4 &'&' 56 I4 P Q! &'&' &' # P IG # P Q Q! &'&' &' G D/ # P H Q! &'/056 I* $ P Q! &'/&' 3 ) P 7 7 Q! &' # &'TU&'/P &'/N7 4 &'C / 7 Q! &'&' P 7 -. # H 7 N &'/Q! awt34 5#6NMŒh

28 Ûðü ü P 8ý ý P?^`g / 5 IG # P Q! / &' * $ P 7 * 1=A 2 7 Q! / &' " $ P # Q! / &' K P * 1=A 2 Q! / * &' P H &'Q! &'&' P 7 8:&' 7 N / Q! &', 656 I3 ) O P MQ! &', &' " H H P V VQ! &'&' P 7 7 N&', Q! 4 56 I4 P Q! &' # P IG # P Q Q! &'/056 I* $ P Q! &'/&' 3 ) P 7 &' /056 I H D$ )P Q! /&' * $ P 7 * * /7 Q! /056 I H D$ )P Q! /&' * $ P 7 F * /7 Q! &' 5 IG # P Q! &' &' * $ P Q! &' &' " $ P # Q! &' &' G D/ # P Q! &' &' K P Q! &' * &' P H &'Q! / J J C56 IG # P Q! / J J &' * $ P 7 = Q! / J J &' G D/ # P / Q! / J J &' K P =13 14 * " Q! / J J * &' P H &'Q! / C56 I3 ) O P WQ! C56 I3 ) O P WQ! 7 Q! ÿ ÿ6 0 awt34 5#6NMHk

29 Ûðü ü P 8ý ý 56 IG # P &' * $ P 7 D7 &' G D/ # P / &' K P > 1?<-.3 * &' P H &'Q! 56 IG # P Q! &' * $ P 7 A X 7 Q! &' K P A 2 A 3 Q! * &' P H &'Q! C56 I3 ) O P WQ! D $ 5 IG # P Q! D $ &' * $ P 7 YZA 36 $ 7 Q! D $ &' " $ P # Q! D $ &' G D/ # P Q! D $ &' K P BCA * * Q! D $ * &' P H &'Q! &'H 5 IG # P Q! &'H &' * $ P 7 C&'H $ &'7 Q! &'H &' " $ P # Q! &'H &' G D/ # P $ # Q! &'H &' K P 12 " -.E 13 FC" ;<G 1-." Q! &'H * &' P H &'Q! J H 56 I H P Q! J H A P 7 M7 Q! J H A P 7 [M7 Q! J H A P 7 \M7 Q! J H A P 7 ]^M7 Q! awt34 5#6NMHÉ

30 Ûðü ü P 8ý ý P?^`_ ÿ ÿ X a56 I4 P Q! &' G D/ # P H Q! P Q! P I* $ P 7 b7 Q Q! P Q! P I* $ P 7 H /b7 Q Q! P J H Q! P /Q! P /Q! P 7 2 H 7 NQ! ÿ ÿ6 5 I4 P Q! &' G D/ # P H Q! P &' Q! Q! P / J J Q! P / Q! P I* $ P 7 7 Q Q! P Q! P &'H Q! P 7 7 NQ! ÿ ÿ6c# P 7 " &' 7 ND $ Q! 5 I4 P Q! &' # P IO # P O # * " O3 Q Q! &' G D/ # P H Q! P &'/Q! P 7 -. # H 7 NQ! P &'&' N :94 2 " * Q! P N 12 3 ;<1* 4 2 " * Q! awt34 5#6NUŒÌ

31 + Ûðü ü P 8ý ý P?^`d # $ % 6&' P Q+ # $ % 6&' P Q+ # $ % 6 4, P " Q+ -. /0 K 656/ K P Q! $ 5, K Q+ &' # &'TU&'/P 7 7 Q! &',P K 65 56=13 14 * " Q+ -. /0 56/ / 3 ) P Q! -. /056 / 3 ) P Q!,P 5 5 # Q&' # &'TU&'/P 7 = 3 4 C b S C&' 7 Q! &'+ / J # 5 MN J # 5 / J # 5 A / &'A P Q! 5 P / J # Kf MQ g g P / J # Kh 5 # KJ, J &'Q! H P 2 # $ O " ) )Q + 5 #!,P i i5 # Q + J # 5 A / &'A P Q! 5 P J # Kf MQ6g gp J # Kh 5 # KJ, J &'Q! H P 2 # $ O " ) )Q + J # 5 e! awt34 5#6NU 7

32 &' Ûðü ü P 8ý ý P?^`j,P Q &' # &'TU&'/P 7 = 3 4 b #, /7 Q!,P K 5 5 > 1?<-.3 Q + &' # &'TU&'/P 7 D 7 Q! &',P K 5 5 A 2 A 3 Q + -. /05 / 3 ) P Q! -. /0H 5 J H / -. A P Q!,P 5 5 # Q&' # &'TU&'/P 7 A X b e6 S C&' 7 Q! &'+ J # 5 J # 5 A / &'A P Q! 5 P J # Kf MQ g g P J # Kh 5 # KJ, J &'Q! H P 2 # $ O " ) )Q + 5 #!,P Q &' # &'TU&'/P 7 A X b e6 k &( ) &' 7 Q! &',P K 5 5 * 1=A 2 Q + -.@&' # P 7 * / 1Bk7 Q! P P # Q / # P Q Q &'H P H &'N 12 3 ;<1* 4 2 " * Q! &',P K " 3 Q + -.@&' # P " 3 7 Q! H D P Q!,P J Q P P # Q / # P Q Q &'H P H &'N :94 2 " * Q! awt34 5#6NUHM

33 + Ûðü ü P 8ý ý P?^`l &',P K 5 5 BCA * * Q + -.@&' # P 7 BCA * * 7 Q! &',P K " -.E 13 FC" ;<G 1-." Q + -.@&' # P 7 12 " -.E 13 FC" ;<G 1-." 7 Q! H P " ) )Q -.@&' # P 7 " ) 7 m )Q! &' # &'TU&'/P &'/N7 H C $ &(1OOe * A 2 " 7 Q! &' # &'TU&'/P 7 H C $ &(1OOe * A 2 " 7 Q! P P # Q / # P Q Q &'H P H &'N 12 2 " " * Q! # $ % 6H D P Q + J 5 #! 6&' # &'TU&'/P -. /0 J &'/Q + &'/&' 3 ) P J &'/Q! 6&' # &'TU&'/P * $ $N-. /0 J &'/Q + $&' 3 ) P J &'/Q! awt34 5#6NUHU

34 Ûðü ü P 8ý ý P?^`_on ;&<> D õ #%"<J%"1 òåòå*#<>kl #<>'1<> awt34 5#6NU a

35 Ûðü ü P 8ý ý P?^`_ _ awt34 5#6NU d

36 + Û P ü W 8ý ý P?^`_ p *#%+ Fq KL!!! #! # $ % &'&( D0) &( &(;<# $ C9 & & X! CA /C,, A /! C= H &(,, =! C3 H 6! C C $/! C;< / C! $! C / D0 D! # $ % P Q + & X C56& X P Q! $/ 56 H! &' G D/ # P $/ ÿ ÿ6 C H C,, A /C, # $ e $#,, /,, A /C56 A /P & X H N& X H /H Q!,, =r56,, A // = H &'P Q! awt34 5#6NUHf

37 Û P ü W 8ý ý P?^`c,, =&' P $/ Q!,, =, ;< P MNMN& X H N& X H /H Q! $ 56M! 56 I;< / P $ N$ N& X H e6p ] $ Q N & X H /H e6p ] $ Q Q! D056 I / DP Q! # $ % 6&' P Q,P P C5 56 # Q6g gp i &' P Q Q Q C56 I3 H P H &'Q! &' P Q! # $ % 6 # P Q H CP 3 H # 3 H P Q P Q! 3 H &' H P A # " ) Q -. D3 P Q! awt34 5#6NUŒh

38 Û P ü W # $ % 6&' P Q,P P Ci56 # QsstP &' P Q Q Q &' P Q! # $ % 6 Q C56 #! # $ % 6# P = H &(/Q D P,, =Q! P /Q! # $ % 6 P = H &(/Q / A /P,, A /NMNMN H &'Q! 8ý ý P?^`e awt34 5#6NUHk

39 + Û P ü W 8ý ý P?^`g " *#%2Up *#%+ Fq KL! #! # $ % &'&( / D0) &(1$ + C9 & & X! C4 &'! C4!!! C4 u v! C-. /u v &'! &'!! H! C # $ C&'56TU H 4 Aÿ6]! C # $ C&' 56TU H 4 Aÿ6LM! C # $ 56&' ÿ6wm! C # $ CH 5 ÿ6]! C! C! C &'H! C H! C H H! C $/! # $ % / DP ;< / C Q 56 /H 56 $ D! &'H 5x! H 56 $ #! awt34 5#6NUHÉ

40 Û P ü W H H 56 /! $/ 5x H! & X C56 I9 & P H N H /H Q! 56TU H K P H N H /H Q! 656 ÿ6]! &' 56 I4 P 56 I4 P &' )m6 Q! &' 56! 56P QP [ Q! H 56P QP ^ Q! 8ý ý P?^`j # $ % 6 P = H &(/Q + 9 C C56 I9 P Q! &(56 / -. &'P Q! 56 / T # &'P Q! H 56 / E # &'P Qyz]! &(5 wm! H &(56H wm wm! ÿ ÿ6 H C$D/ # /&' P $/ Q! /, ;< P &' X H N& X H /H Q! ÿ ÿ69 I H C D0 /&' P Q! /, 1 P &' N Q! ÿ ÿ69 I H C D0 # $ &' /&' P Q! / 1 P &' N Q! ÿ ÿ69 I H C&' 6H /&' P &'H Q! &')56P QP P TU H &'P P &( &' Qe6&'Q &' Qm6 )Q! &'@056P QP P TU H & P P &( &' Qe6&'Q &' / * P awt34 5#6ba Ì

41 Û P ü W 8ý ý P?^`_ ÿ ÿ69 I H K # CH /&' P H Q! )56P QP P TU H &'P P P &(m6&'q Qe6&'Q Qm6 QP P TU H & P P P &(m6&'q Qe6&'Q / * P / * P ÿ ÿ69 I H CH # H /&' P H H Q! H )56P QP P TU H &'P P P H &(m &(m6&'q H Qe6&'Q H Qm6 )Q! QP P TU H & P P P H &(m &(m6&'q H Qe6&'Q H / * P / * P awt34 5#6ba 7

42 Û P ü W 8ý ý P?^`d awt34 5#6baŒM

(listener)... MouseListener, ActionLister. (adapter)... MouseAdapter, ActionAdapter. java.awt AWT Abstract Window Toolkit GUI

(listener)... MouseListener, ActionLister. (adapter)... MouseAdapter, ActionAdapter. java.awt AWT Abstract Window Toolkit GUI 51 6!! GUI(Graphical User Interface) java.awt javax.swing (component) GUI... (container) (listener)... MouseListener, ActionLister (adapter)... MouseAdapter, ActionAdapter 6.1 GUI(Graphics User Interface

More information

GUI Event Handling 11. GUI Event Handling. Objectives. What is an Event? Hierarchical Model (JDK1.0) Delegation Model (JDK1.1)

GUI Event Handling 11. GUI Event Handling. Objectives. What is an Event? Hierarchical Model (JDK1.0) Delegation Model (JDK1.1) Objectives Write code to handle events that occur in a GUI 11 GUI Event Handling Describe the concept of adapter classes, including how and when to use them Determine the user action that originated the

More information

The AWT Package, An Overview

The AWT Package, An Overview Richard G Baldwin (512) 223-4758, baldwin@austin.cc.tx.us, http://www2.austin.cc.tx.us/baldwin/ The AWT Package, An Overview Java Programming, Lecture Notes # 110, Revised 02/21/98. Preface Introduction

More information

Lecture 7 A First Graphic Program And Data Structures & Drawing

Lecture 7 A First Graphic Program And Data Structures & Drawing Lecture 7 A First Graphic Program And Data Structures & Drawing Objective The objective is that you will understand: How to program the generation of 2D and 3D images. How to manipulate those images through

More information

Advanced Java Programming (17625) Event Handling. 20 Marks

Advanced Java Programming (17625) Event Handling. 20 Marks Advanced Java Programming (17625) Event Handling 20 Marks Specific Objectives To write event driven programs using the delegation event model. To write programs using adapter classes & the inner classes.

More information

AWT GRAPHICS CLASS. Introduction. Class declaration. Class constructors. Class methods

AWT GRAPHICS CLASS. Introduction. Class declaration. Class constructors. Class methods AWT GRAPHICS CLASS http://www.tutorialspoint.com/awt/awt_graphics_class.htm Copyright tutorialspoint.com Introduction The Graphics class is the abstract super class for all graphics contexts which allow

More information

OBJECT ORIENTED PROGRAMMING. Java GUI part 1 Loredana STANCIU Room B616

OBJECT ORIENTED PROGRAMMING. Java GUI part 1 Loredana STANCIU Room B616 OBJECT ORIENTED PROGRAMMING Java GUI part 1 Loredana STANCIU loredana.stanciu@upt.ro Room B616 What is a user interface That part of a program that interacts with the user of the program: simple command-line

More information

Unit 7: Event driven programming

Unit 7: Event driven programming Faculty of Computer Science Programming Language 2 Object oriented design using JAVA Dr. Ayman Ezzat Email: ayman@fcih.net Web: www.fcih.net/ayman Unit 7: Event driven programming 1 1. Introduction 2.

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT-V TWO MARKS QUESTION & ANSWER 1. What is the difference between the Font and FontMetrics class? Font class is used to set or retrieve the screen fonts.the Font class maps the characters of the language

More information

10/11/18. Introduction Panel Class Window Class Dialog class FileDialog class Menu, MenuItem class

10/11/18. Introduction Panel Class Window Class Dialog class FileDialog class Menu, MenuItem class A.Prof. Tran Van Lang, PhD Vietnam Academy of Science and Technology (VAST) Introduction Panel Class Window Class Dialog class FileDialog class Menu, MenuItem class Components A container is a component

More information

Graphics -- To be discussed

Graphics -- To be discussed Graphics -- To be discussed 1 Canvas Class... 1 2 Graphics Class... 1 3 Painting... 1 4 Color Models... 4 5 Animation's Worst Enemy: Flicker... 4 6 Working with Java Images... 5 6.1 Image Loading Chain

More information

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming

More information

SD Module-1 Advanced JAVA

SD Module-1 Advanced JAVA Assignment No. 4 SD Module-1 Advanced JAVA R C (4) V T Total (10) Dated Sign Title: Transform the above system from command line system to GUI based application Problem Definition: Write a Java program

More information

Graphics Applets. By Mr. Dave Clausen

Graphics Applets. By Mr. Dave Clausen Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported

More information

SD Module-1 Advanced JAVA. Assignment No. 4

SD Module-1 Advanced JAVA. Assignment No. 4 SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application

More information

GUI in Java TalentHome Solutions

GUI in Java TalentHome Solutions GUI in Java TalentHome Solutions AWT Stands for Abstract Window Toolkit API to develop GUI in java Has some predefined components Platform Dependent Heavy weight To use AWT, import java.awt.* Calculator

More information

OBJECT ORIENTED PROGRAMMING. Course 8 Loredana STANCIU Room B613

OBJECT ORIENTED PROGRAMMING. Course 8 Loredana STANCIU Room B613 OBJECT ORIENTED PROGRAMMING Course 8 Loredana STANCIU loredana.stanciu@upt.ro Room B613 Applets A program written in the Java programming language that can be included in an HTML page A special kind of

More information

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 9/e Copyright 1992-2012 by Pearson Education, Inc. All Rights Reserved. Overview capabilities for drawing two-dimensional shapes, controlling colors and controlling fonts. One of

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"

More information

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun! Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques

More information

Java AWT Windows, Text, & Graphics

Java AWT Windows, Text, & Graphics 2 AWT Java AWT Windows, Text, & Graphics The Abstract Windows Toolkit (AWT) contains numerous classes and methods that allow you to create and manage applet windows and standard windows that run in a GUI

More information

11/7/12. Discussion of Roulette Assignment. Objectives. Compiler s Names of Classes. GUI Review. Window Events

11/7/12. Discussion of Roulette Assignment. Objectives. Compiler s Names of Classes. GUI Review. Window Events Objectives Event Handling Animation Discussion of Roulette Assignment How easy/difficult to refactor for extensibility? Was it easier to add to your refactored code? Ø What would your refactored classes

More information

GUI DYNAMICS Lecture July 26 CS2110 Summer 2011

GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI Statics and GUI Dynamics 2 Statics: what s drawn on the screen Components buttons, labels, lists, sliders, menus,... Containers: components that contain

More information

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class.

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class. Q1. If you add a component to the CENTER of a border layout, which directions will the component stretch? A1. The component will stretch both horizontally and vertically. It will occupy the whole space

More information

Graphics Applets. By Mr. Dave Clausen

Graphics Applets. By Mr. Dave Clausen Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

Handling Mouse and Keyboard Events

Handling Mouse and Keyboard Events Handling Mouse and Keyboard Events 605.481 1 Java Event Delegation Model EventListener handleevent(eventobject handleevent(eventobject e); e); EventListenerObject source.addlistener(this);

More information

Java Applets / Flash

Java Applets / Flash Java Applets / Flash Java Applet vs. Flash political problems with Microsoft highly portable more difficult development not a problem less so excellent visual development tool Applet / Flash good for:

More information

Here is a list of a few of the components located in the AWT and Swing packages:

Here is a list of a few of the components located in the AWT and Swing packages: Inheritance Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality. Programming In A Graphical Environment Java is specifically designed

More information

Java Applet Basics. Life cycle of an applet:

Java Applet Basics. Life cycle of an applet: Java Applet Basics Applet is a Java program that can be embedded into a web page. It runs inside the web browser and works at client side. Applet is embedded in a HTML page using the APPLET or OBJECT tag

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

CSC207H: Software Design Lecture 11

CSC207H: Software Design Lecture 11 CSC207H: Software Design Lecture 11 Wael Aboelsaadat wael@cs.toronto.edu http://ccnet.utoronto.ca/20075/csc207h1y/ Office: BA 4261 Office hours: R 5-7 Acknowledgement: These slides are based on material

More information

Index SELF-STUDY. Symbols

Index SELF-STUDY. Symbols SELF-STUDY 393 Index Symbols -... 239 "Event-to-property"... 144 "Faux" variables... 70 %... 239 ( )... 239 (Pme) paradigm... 14 *... 239 +... 239 /... 239 =... 239 = Null... 46 A A project... 24-25, 35

More information

Programming graphics

Programming graphics Programming graphics Need a window javax.swing.jframe Several essential steps to use (necessary plumbing ): Set the size width and height in pixels Set a title (optional), and a close operation Make it

More information

GUI Software Architecture

GUI Software Architecture GUI Software Architecture P2: Requirements Analysis User Analysis Task Analysis Problem Scenarios Usability Criteria Scenario Your engineers just developed a new desktop computer. They give you the following

More information

Essential Series. Springer-Verlag London Ltd.

Essential Series. Springer-Verlag London Ltd. Essential Series Springer-Verlag London Ltd. Also in this series: Essential Visual Basic 4.0 fast 3-540-19998-5 Essential Delphi 2.0 fast 3-540-76026-1 Essential Java fast 3-540-76052-0 Essential Visual

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

The Java Programming Language Basics. Identifiers, Keywords, and Types. Expressions and Flow Control. Object-Oriented Programming. Objects and Classes

The Java Programming Language Basics. Identifiers, Keywords, and Types. Expressions and Flow Control. Object-Oriented Programming. Objects and Classes Building GUIs 8 Course Map This module covers setup and layout of graphical user interfaces. It introduces the Abstract Windowing Toolkit, a package of classes from which GUIs are built. Getting Started

More information

cs Java: lecture #5

cs Java: lecture #5 cs3101-003 Java: lecture #5 news: homework #4 due today homework #5 out today today s topics: applets, networks, html graphics, drawing, handling images graphical user interfaces (GUIs) event handling

More information

GUI Components: Part 1

GUI Components: Part 1 1 2 11 GUI Components: Part 1 Do you think I can listen all day to such stuff? Lewis Carroll Even a minor event in the life of a child is an event of that child s world and thus a world event. Gaston Bachelard

More information

BASICS OF GRAPHICAL APPS

BASICS OF GRAPHICAL APPS CSC 2014 Java Bootcamp Lecture 7 GUI Design BASICS OF GRAPHICAL APPS 2 Graphical Applications So far we ve focused on command-line applications, which interact with the user using simple text prompts In

More information

Abstract Window Toolkit Overview

Abstract Window Toolkit Overview In this chapter: Components Peers Layouts Containers And the Rest Summary 1 Abstract Window Toolkit Overview For years, programmers have had to go through the hassles of porting software from BSD-based

More information

JAVA. Object Oriented Programming with. M.T. Somashekara D.S.Guru K.S. Manjunatha

JAVA. Object Oriented Programming with. M.T. Somashekara D.S.Guru K.S. Manjunatha PH IL ea rn in g C op yr ig ht ed JAVA M at er ia l Object Oriented Programming with M.T. Somashekara D.S.Guru K.S. Manjunatha Object Oriented Programming with JAVA M.T. SOMASHEKARA Department of Computer

More information

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

Java: Graphical User Interfaces (GUI)

Java: Graphical User Interfaces (GUI) Chair of Software Engineering Carlo A. Furia, Marco Piccioni, and Bertrand Meyer Java: Graphical User Interfaces (GUI) With material from Christoph Angerer The essence of the Java Graphics API Application

More information

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing. COSC User Interfaces Module 3 Sequential vs. Event-driven Programming Example Programs DemoLargestConsole.java DemoLargestGUI.java Demo programs will be available on the course web page. GUI Program Organization

More information

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Graphics. Lecture 18 COP 3252 Summer June 6, 2017 Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple

More information

GUI Programming: Swing and Event Handling

GUI Programming: Swing and Event Handling GUI Programming: Swing and Event Handling Sara Sprenkle 1 Announcements No class next Tuesday My Fourth of July present to you: No quiz! Assignment 3 due today Review Collections: List, Set, Map Inner

More information

Packages: Putting Classes Together

Packages: Putting Classes Together Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic

More information

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline Sequential vs. Event-driven Programming Reacting to the user GUI Program Organization Let s digress briefly to examine the organization of our GUI programs We ll do this in stages, by examining three example

More information

Lecture 5: Java Graphics

Lecture 5: Java Graphics Lecture 5: Java Graphics CS 62 Spring 2019 William Devanny & Alexandra Papoutsaki 1 New Unit Overview Graphical User Interfaces (GUI) Components, e.g., JButton, JTextField, JSlider, JChooser, Containers,

More information

Overloading Example. Overloading. When to Overload. Overloading Example (cont'd) (class Point continued.)

Overloading Example. Overloading. When to Overload. Overloading Example (cont'd) (class Point continued.) Overloading Each method has a signature: its name together with the number and types of its parameters Methods Signatures String tostring() () void move(int dx,int dy) (int,int) void paint(graphicsg) (Graphics)

More information

CS11 Java. Fall Lecture 3

CS11 Java. Fall Lecture 3 CS11 Java Fall 2014-2015 Lecture 3 Today s Topics! Class inheritance! Abstract classes! Polymorphism! Introduction to Swing API and event-handling! Nested and inner classes Class Inheritance! A third of

More information

Supporting Materials

Supporting Materials Preface p. xxiii Introduction p. xxiii Key Features p. xxiii Chapter Outlines p. xxiv Supporting Materials p. xxvi Acknowledgments p. xxvii Java Fundamentals p. 1 Bits, Bytes, and Java p. 2 The Challenge

More information

11/6/15. Objec&ves. RouleQe. Assign 8: Understanding Code. Assign 8: Bug. Assignment 8 Ques&ons? PROGRAMMING PARADIGMS

11/6/15. Objec&ves. RouleQe. Assign 8: Understanding Code. Assign 8: Bug. Assignment 8 Ques&ons? PROGRAMMING PARADIGMS Objec&ves RouleQe Assign 8: Refactoring for Extensibility Programming Paradigms Introduc&on to GUIs in Java Ø Event handling Nov 6, 2015 Sprenkle - CSCI209 1 Nov 6, 2015 Sprenkle - CSCI209 2 Assign 8:

More information

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13 CONTENTS Chapter 1 Getting Started with Java SE 6 1 Introduction of Java SE 6... 3 Desktop Improvements... 3 Core Improvements... 4 Getting and Installing Java... 5 A Simple Java Program... 10 Compiling

More information

Mathematics for Computer Graphics - Lecture 13

Mathematics for Computer Graphics - Lecture 13 Mathematics for Computer Graphics - Lecture 13 Dr. Philippe B. Laval Kennesaw State University October 10, 2003 Abstract This document is about creating Java Applets as they relate to the project we are

More information

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4. 1 - What if the main method is declared as private? 1. The program does not compile 2. The program compiles but does not run 3. The program compiles and runs properly ( From Lectuer # 2) 4. The program

More information

Appendix F: Java Graphics

Appendix F: Java Graphics Appendix F: Java Graphics CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Appendix F: Java Graphics CS 121 1 / 1 Topics Graphics and Images Coordinate

More information

Unit - 2 Abstract Window Toolkit

Unit - 2 Abstract Window Toolkit Abstract Window Toolkit: (AWT) Java AWT is an API to develop GUI or window-based application in java. Java AWT provides many of user interface objects are called Components of the Java AWT. Java AWT components

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B Contents About the Course...xv Course Overview... xvi Course Map... xvii Module-by-Module Overview... xviii Course Objectives... xxii Skills Gained by Module... xxiii Guidelines for Module Pacing... xxiv

More information

Java - Applets. C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1,

Java - Applets. C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1, Java - Applets C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1, 5.3.2. Java is not confined to a DOS environment. It can run with buttons and boxes in a Windows

More information

What is Widget Layout? Laying Out Components. Resizing a Window. Hierarchical Widget Layout. Interior Design for GUIs

What is Widget Layout? Laying Out Components. Resizing a Window. Hierarchical Widget Layout. Interior Design for GUIs What is Widget Layout? Laying Out Components Positioning widgets in their container (typically a JPanel or a JFrame s content pane) Basic idea: each widget has a size and position Main problem: what if

More information

Appendix F: Java Graphics

Appendix F: Java Graphics Appendix F: Java Graphics CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Appendix F: Java Graphics CS 121 1 / 15 Topics Graphics and Images Coordinate

More information

Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI

Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI CBOP3203 Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI components like button, text input, scroll bar and others.

More information

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 331 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

Programming Mobile Devices J2SE GUI

Programming Mobile Devices J2SE GUI Programming Mobile Devices J2SE GUI University of Innsbruck WS 2009/2010 thomas.strang@sti2.at Graphical User Interface (GUI) Why is there more than one Java GUI toolkit? AWT write once, test everywhere

More information

CHAPTER 2. Java Overview

CHAPTER 2. Java Overview Networks and Internet Programming (0907522) CHAPTER 2 Java Overview Instructor: Dr. Khalid A. Darabkh Objectives The objectives of this chapter are: To discuss the classes present in the java.awt package

More information

Systems Programming Graphical User Interfaces

Systems Programming Graphical User Interfaces Systems Programming Graphical User Interfaces Julio Villena Román (LECTURER) CONTENTS ARE MOSTLY BASED ON THE WORK BY: José Jesús García Rueda Systems Programming GUIs based on Java

More information

Laying Out Components. What is Widget Layout?

Laying Out Components. What is Widget Layout? Laying Out Components Interior Design for GUIs What is Widget Layout? Positioning widgets in their container (typically a JPanel or a JFrame s content pane) Basic idea: each widget has a size and position

More information

Computer Programming Java AWT Lab 18

Computer Programming Java AWT Lab 18 Computer Programming Java AWT Lab 18 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University Copyrights 2015 DCSLab. All Rights Reserved Overview AWT Basic Use AWT AWT

More information

Creating Rich GUIs in Java. Amy Fowler Staff Engineer JavaSoft

Creating Rich GUIs in Java. Amy Fowler Staff Engineer JavaSoft 1 Creating Rich GUIs in Java Amy Fowler Staff Engineer JavaSoft 2 Tutorial Overview Toolkit principles & architecture GUI layout management Building custom components AWT futures 3 Toolkit Principles &

More information

Graphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson)

Graphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson) Graphics programming COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson) Overview Aims To provide an overview of Swing and the AWT To show how to build

More information

Java. GUI building with the AWT

Java. GUI building with the AWT Java GUI building with the AWT AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore

More information

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introducing Object Oriented Programming... 2 Explaining OOP concepts... 2 Objects...3

More information

Java Coordinate System

Java Coordinate System Java Graphics Drawing shapes in Java such as lines, rectangles, 3-D rectangles, a bar chart, or a clock utilize the Graphics class Drawing Strings Drawing Lines Drawing Rectangles Drawing Ovals Drawing

More information

Java Programming Lecture 6

Java Programming Lecture 6 Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components

More information

Graphical User Interfaces. Comp 152

Graphical User Interfaces. Comp 152 Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from

More information

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words.

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words. 1 2 12 Graphics and Java 2D One picture is worth ten thousand words. Chinese proverb Treat nature in terms of the cylinder, the sphere, the cone, all in perspective. Paul Cézanne Colors, like features,

More information

Graphics and Painting

Graphics and Painting Graphics and Painting Lecture 17 CGS 3416 Fall 2015 November 30, 2015 paint() methods Lightweight Swing components that extend class JComponent have a method called paintcomponent, with this prototype:

More information

Output in Window Systems and Toolkits

Output in Window Systems and Toolkits Output in Window Systems and Toolkits Recap Low-level graphical output models CRTs, LCDs, and other displays Colors (RGB, HSV) Raster operations (BitBlt) Lines, curves, path model Fonts Affine Transforms

More information

Resizing a Window. COSC 3461: Module 5B. What is Widget Layout? Size State Transitions. What is Widget Layout? Hierarchical Widget Layout.

Resizing a Window. COSC 3461: Module 5B. What is Widget Layout? Size State Transitions. What is Widget Layout? Hierarchical Widget Layout. COSC 3461: Module 5B Resizing a Window Widgets II What has changed? scrollbar added menu has wrapped toolbar modified (buttons lost) 2 What is Widget Layout? Size State Transitions Recall: each widget

More information

COMPSCI 230. Software Design and Construction. Swing

COMPSCI 230. Software Design and Construction. Swing COMPSCI 230 Software Design and Construction Swing 1 2013-04-17 Recap: SWING DESIGN PRINCIPLES 1. GUI is built as containment hierarchy of widgets (i.e. the parent-child nesting relation between them)

More information

Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing

Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Rui Moreira Some useful links: http://java.sun.com/docs/books/tutorial/uiswing/toc.html http://www.unix.org.ua/orelly/java-ent/jfc/

More information

SIMPLE APPLET PROGRAM

SIMPLE APPLET PROGRAM APPLETS Applets are small applications that are accessed on Internet Server, transported over Internet, automatically installed and run as a part of web- browser Applet Basics : - All applets are subclasses

More information

Frameworks. CS151 Chris Pollett Oct. 26, 2005.

Frameworks. CS151 Chris Pollett Oct. 26, 2005. Frameworks CS151 Chris Pollett Oct. 26, 2005. Outline Collections Framework GUI Frameworks - AWT and Swing The Java Collection Framework Last day, we began discussing the Java collection Framework. We

More information

AWT LIST CLASS. The List represents a list of text items. The list can be configured to that user can choose either one item or multiple items.

AWT LIST CLASS. The List represents a list of text items. The list can be configured to that user can choose either one item or multiple items. http://www.tutorialspoint.com/awt/awt_list.htm AWT LIST CLASS Copyright tutorialspoint.com Introduction The List represents a list of text items. The list can be configured to that user can choose either

More information

The AWT Event Model 9

The AWT Event Model 9 The AWT Event Model 9 Course Map This module covers the event-based GUI user input mechanism. Getting Started The Java Programming Language Basics Identifiers, Keywords, and Types Expressions and Flow

More information

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 331 Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT Lecturer: Michael Hotan slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer,

More information

The AWT Component Library 10

The AWT Component Library 10 The AWT Component Library 10 Course Map The JDK offers many components from which GUIs an be built. This module examines these AWT Components, and covers noncomponent AWT classes such as Color and Font,

More information

Windows and Events. created originally by Brian Bailey

Windows and Events. created originally by Brian Bailey Windows and Events created originally by Brian Bailey Announcements Review next time Midterm next Friday UI Architecture Applications UI Builders and Runtimes Frameworks Toolkits Windowing System Operating

More information

Dr. Hikmat A. M. AbdelJaber

Dr. Hikmat A. M. AbdelJaber Dr. Hikmat A. M. AbdelJaber GUI are event driven (i.e. when user interacts with a GUI component, the interaction (event) derives the program to perform a task). Event: click button, type in text field,

More information

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7 PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,

More information

I/O Framework and Case Study. CS151 Chris Pollett Nov. 2, 2005.

I/O Framework and Case Study. CS151 Chris Pollett Nov. 2, 2005. I/O Framework and Case Study CS151 Chris Pollett Nov. 2, 2005. Outline Character Streams Random Access Files Design case study Planning Iterations Character Streams Java internally represents strings as

More information

+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage)

+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage) +! Lecture 3: ArrayList & Standard Java Graphics +! Today n Reading n Standard Java Graphics (on course webpage) n Objectives n Review for this week s lab and homework assignment n Miscellanea (Random,

More information

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1 Block I Unit 2 Basic Constructs in Java M301 Block I, unit 2 1 Developing a Simple Java Program Objectives: Create a simple object using a constructor. Create and display a window frame. Paint a message

More information

Which of the following syntax used to attach an input stream to console?

Which of the following syntax used to attach an input stream to console? Which of the following syntax used to attach an input stream to console? FileReader fr = new FileReader( input.txt ); FileReader fr = new FileReader(FileDescriptor.in); FileReader fr = new FileReader(FileDescriptor);

More information

Chapter 12 Advanced GUIs and Graphics

Chapter 12 Advanced GUIs and Graphics Chapter 12 Advanced GUIs and Graphics Chapter Objectives Learn about applets Explore the class Graphics Learn about the classfont Explore the classcolor Java Programming: From Problem Analysis to Program

More information

Mobile Systeme Grundlagen und Anwendungen standortbezogener Dienste. Location Based Services in the Context of Web 2.0

Mobile Systeme Grundlagen und Anwendungen standortbezogener Dienste. Location Based Services in the Context of Web 2.0 Mobile Systeme Grundlagen und Anwendungen standortbezogener Dienste Location Based Services in the Context of Web 2.0 Department of Informatics - MIN Faculty - University of Hamburg Lecture Summer Term

More information