1 / 6

JAVA GUI BASICS

JAVA GUI BASICS. Basic Java GUI Components java.awt.Component , java.awt.Container , javax.swing.JComponent , … Event handling packages java.awt.event and javax.swing.event Creating UI layouts using and creating layout managers java.awt.LayoutManager and java.awt.LayoutManager2

lynsey
Download Presentation

JAVA GUI BASICS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JAVA GUI BASICS • Basic Java GUI Components • java.awt.Component, java.awt.Container, javax.swing.JComponent, … • Event handling • packages java.awt.event and javax.swing.event • Creating UI layouts • using and creating layout managers • java.awt.LayoutManager and java.awt.LayoutManager2 • Using resources • using resource bundles for different locales • java.util.ResourceBundle

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

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

  4. LAYOUT Container LayoutManager layoutManager addLayoutComponent(name, component)removeLayoutComponent(component)preferredLayoutSizer()minimumLayoutSize()layoutContainer(container) add(component)add(component, constraints)add(name, component)remove(Component)setLayoutManager()validate()doLayout()... LayoutManager2 FlowLayout GridLayout addLayoutComponent(comp, constraints)invalidateLayout()maximumLayoutSize()... ...layoutManager.layoutContainer(this);... BoxLayout CardLayout OverlayLayout GridBagLayout BorderLayout

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

  6. EVENTS cont’d AWTEvent EventObject getID() getSource() ComponentEvent ActionEvent other AWT events many notification event types getComponent() InputEvent FocusEvent WindowEvent getModifiers()getWhen() ContainerEvent PaintEvent MouseEvent KeyEvent getX()getY()getClickCount()

More Related