← Back to feed
Renewal·서른의 생활코딩

Java Notes _2012.02.28

NS
normalstory
cover image



java.awt.* : Provides multimedia-related classes

Appearance varies depending on the system -> Use SWING package (increases execution time and memory)



Component class: event handling, paint() support (use after overriding)
(Component>) Container:

button, list, choice, text component, text field, text area are

defined as functions (above), attached to Container using add()

Panel, (Applet->replaced by JSP), ..=> FlowLayout method

Frame (creates window - do not instantiate with WINDOW / compose user class), ..=> FlowLayout method

Dialog (creates modal Dialog / compose user class), ..=> BorderLayout method

FileDialog (for opening or saving files), ..=> BorderLayout method

(create object and) attach.


cf.) WINDOW: exists to hold common content from Dialog and Frame for inheritance purposes


Dimension: stores the range of a rectangle in width and height format
Font, FontMetrics: stores font attribute values and provides supporting functions for processing.
Color: an object that stores color values
Graphics: uses a pointer to an already defined object (provides drawing-related methods)

 

 

Component layout related classes: BorderLayout (directional), FlowLayout (top-bottom), GridLayout (grid/matrix), CardLayout (card-switching)

Graphics output related classes: Color, Font, FontMetrics, Rectangle, Point, Polygon, Graphics, Image
Container classes: Frame, Panel, Dialog..


* repaint(time setting) -> update() covers the entire window or dialog area
Contains code that calls the paint function by default

-> paint(): override this function to write the code you want to output : first program




 

Layout Manager
: FlowLayout (left->right), BorderLayout (set direction), GridLayout (grid/matrix)
: To modify alignment, use the Container class's setLayout() method
: Reset alignment with setLayout(null)

This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.