Presentation is loading. Please wait.

Presentation is loading. Please wait.

PROGRAMMING GRAPHICAL USER INTERFACES Lecture 21 JAVA GUI BASICS Basic Java GUI Components –java.awt.Component, java.awt.Container, javax.swing.JComponent,

Similar presentations


Presentation on theme: "PROGRAMMING GRAPHICAL USER INTERFACES Lecture 21 JAVA GUI BASICS Basic Java GUI Components –java.awt.Component, java.awt.Container, javax.swing.JComponent,"— Presentation transcript:

1 PROGRAMMING GRAPHICAL USER INTERFACES Lecture 21 JAVA GUI BASICS Basic Java GUI Components –java.awt.Component, java.awt.Container, javax.swing.JComponent, …java.awt.Componentjava.awt.Containerjavax.swing.JComponent Event handling –packages java.awt.event and javax.swing.eventjava.awt.eventjavax.swing.event Creating UI layouts –using and creating layout managers –java.awt.LayoutManager and java.awt.LayoutManager2java.awt.LayoutManagerjava.awt.LayoutManager2 Using resources –using resource bundles for different locales –java.util.ResourceBundlejava.util.ResourceBundle

2 PROGRAMMING GRAPHICAL USER INTERFACES Lecture 22 COMPONENTS Component addMouseListener() addKeyListener()... getBounds() getComponentAt()... void paint(Graphics) Container add(Component) remove(Component) setLayoutManager()... Button Canvas Label... Panel Box Window... JComponent setBorder() setUI()... Swing Components AWT Swing

3 PROGRAMMING GRAPHICAL USER INTERFACES Lecture 23 WINDOWS & FRAMES Container add(Component) remove(Component) setLayoutManager()... Window addWindowListener() pack() show()... Frame setIconImage() setMenuBar() setTitle()... Dialog setModal() setTitle()... MenuContainer JFrame getContentPane() setJMenuBar()... contentPane JWindow JDialog getContentPane()... contentPane Swing AWT

4 PROGRAMMING GRAPHICAL USER INTERFACES Lecture 24 LAYOUT Container add(component) add(component, constraints) add(name, component) remove(Component) setLayoutManager() validate() doLayout()... layoutManager LayoutManager addLayoutComponent(name, component) removeLayoutComponent(component) preferredLayoutSizer() minimumLayoutSize() layoutContainer(container) LayoutManager2 addLayoutComponent(comp, constraints) invalidateLayout() maximumLayoutSize()... FlowLayoutGridLayout BoxLayoutCardLayoutOverlayLayoutGridBagLayoutBorderLayout... layoutManager.layoutContainer(this);...

5 PROGRAMMING GRAPHICAL USER INTERFACES Lecture 25 EVENTS EventListener Component addMouseListener(listener) removeMouseListener(listener) processMouseEvent(mouseEvent)... listenerList MouseListener mouseClicked(mouseEvent) mousePressed(mouseEvent) mouseReleased(mouseEvent) mouseEntered(mouseEvent) mouseExited(mouseEvent) ActionListener MouseMotionListener KeyListener mouseEvent( MOUSE_PRESSED, 123, 456) MouseEvent getX() getY() getClickCount()

6 PROGRAMMING GRAPHICAL USER INTERFACES Lecture 26 EVENTS cont’d MouseEvent getX() getY() getClickCount() KeyEvent ActionEvent InputEvent getModifiers() getWhen() ComponentEvent getComponent() FocusEventWindowEvent AWTEvent getID() EventObject getSource() many notification event types other AWT events ContainerEventPaintEvent


Download ppt "PROGRAMMING GRAPHICAL USER INTERFACES Lecture 21 JAVA GUI BASICS Basic Java GUI Components –java.awt.Component, java.awt.Container, javax.swing.JComponent,"

Similar presentations


Ads by Google