OOP:
J Java GUI Romi Satria Wahono
[email protected] http //romisatriawahono net http://romisatriawahono.net HP: 08780878-80480485 YM: YM romi_sw r mi s
Romi Satria Wahono
Lahir di Madiun, 2 Oktober 1974 SD Sompok Semarang (1987) SMPN 8 Semarang g (1990) SMA Taruna Nusantara, Nusantara, Magelang (1993) S1, S1 S2 dan S3 (on (on--leave) dari Department of Computer Sciences, Saitama University, University, Japan (1994(1994-2004) Core C C Competence: t Software S ft E i Engineering, Engineering i , eLearning L i System, Knowledge Management Founder dan Koordinator IlmuKomputer.Com l CEO PT Brainmatics Cipta p Informatika
Materi 1.
OOP Concepts: Concepts:
2.
Java Fundamentals: Fundamentals:
3 3.
Java Advanced: Advanced:
4.
Java GUI: GUI:
5.
Java GUI with Netbeans: Netbeans:
K Konsep p dan d P Paradigma di Object ObjectObj t-Oriented Oi t d Memahami Sintaks dan Grammar Bahasa Java Eksepsi, Thread, Java API Swing, GUI Component, Event Handling Mengembangkan Aplikasi Berbasis GUI dengan Java
J Java GUI
Materi 1. 1 Konsep K G hi l User Graphical U Interface I t f (GUI) di Java d 2. Komponen Dasar Swing 3. Penanganan Kejadian (Event Handling)
Konsep p Graphical p User Interface (GUI) di Java
API untuk Aplikasi GUI di Java 1. AWT (Abstract Window Toolkit): Library dan komponen GUI (java.awt) yang pertama kali diperkenalkan oleh Java, Sun tidak merekomendasikan lagi l penggunaan komponen GUI dari AWT 2. Swing or JFC (Java Foundation Class): Library dan komponen GUI (javax.swing ((javax javax.swing) javax swing) swing) terbaru dari Java dan yang direkomendasikan Sun untuk pemrograman GUI. GUI Komponen Swing sebagian besar adalah turunan AWT dan lebih lengkap daripada AWT
Fitur Swing
K Komponen GUI Lengkap L k : button, b tt l tb , listbox, listbox combobox,, textarea, combobox textarea, dsb
Pluggable Look Look--andand-Feel: Feel: tampilan GUI dapat diubah d a sesuai a d dengan ga kehendak da (tidak da pperlu mengikuti native OS)
Data Transfer Antar Komponen: drag and drop, copy and paste
I t Internationalization t l t : proses desain aplikasi l k yang
memungkinkan aplikasi dijalankan sesuai dengan preferensi f tanpa rekompilasi l
Localization a izati n: pproses e translasi t an a i te teks kee baha bahasaa lokal a dan menambahkan komponen lokal
Komponen Swing
Komponen Dasar Swing 1. Top Top--Level Container: kontainer dasar dimana komponen lainnya diletakkan (JFrame JFrame,, JDialog dan Applet Applet)) 2. Intermediate Container: Container: kontainer perantara dimana komponen lainnya diletakkan (JPanel, JPanell, JScrollPane JScrollPane, ll , JTabbedPane JTabbedPane,, JToolbar JToolbar, l , JSplitPane JSplitPane) l ) 3. Atomic Component: Component: komponen yang memiliki fungsi spesifik f dan menerima interaksi langsung dari user (JButton utton,, JLabel JLabel,, JTextArea JTextArea,, dsb) dsb) 4. Layout Manager: Manager: mengatur tata letak dan posisi komponen dalam kontainer (BorderLayout BorderLayout,, BoxLayout BoxLayout,, FlowLayout, FlowLayout l , GridBagLayout, GridBagLayout d , GridLayout) GridLayout d ) 5. Event Handling: Handling: menangani event yang dilakukan user (klik kl k mouse mouse,, ketik k k keyboard, k b d, perbesar keyboard b f frame, frame , dsb d dsb) b)
Top--Level Container Top
JFrame,, JDialog JFrame JDialog,, Applet
Penggunaan Top Top--Level Container
Komponen GUI akan ditampilkan sebagai bagian dari containment hierarchy (Susunan hirarki komponen yang menjadikan toptop-level container sebagai rootnya rootnya)) Setiap komponen GUI hanya dapat dimuat pada satu top--level container. Dan setiap top top top--level container pane y yang g berisi komponenkomponen p memiliki satu content p komponen GUI Kitaa dapa dapat menambahkan a a a menubar a pada top topp-level container.. Menubar secara konvensi ditempatkan di container topp-level container, tapi p di luar content ppane , dalam top kecuali pada look and feel MacOS yang memberi kita opsi penempatan lebih bebas
Containment Hierarchy
Aplikasi GUI berbasis Swing paling tidak memiliki satu containment hierarchy dengan JFrame sebagai rootnya Jika sebuah aplikasi memiliki satu window utama t d dua dan d dialog d l artinya t aplikasi l k tersebut t b t memiliki tiga containment hierarchy dan juga tiga toptop-level l l container Satu containment c ntainment hierarchy hie a chy memiliki memi iki Jframe Jf ame sebagai root, dan dua yang lain memiliki JDialog sebagai root
Content Pane dan Menu Bar 1.
Menambahkan content pane pada Jframe frame.getContentPane frame.getContentPane().add( g ().add(yellowLabel yellowLabel , y BorderLayout.CENTER); BorderLayout.CENTER );
2.
Menambahkan komponen p ppada content pane p JPanel
contentPane = new JPanel JPanel(new (new BorderLayout()); BorderLayout()); contentPane.setBorder((someBorder ); contentPane.setBorder contentPane.add( contentPane.add t tP dd(someComponent dd( C t, BorderLayout.CENTER); BorderLayout.CENTER ); contentPane.add( contentPane add( contentPane.add add(anotherComponent , BorderLayout.PAGE_END); BorderLayout.PAGE_END ); frame.setContentPane((contentPane frame.setContentPane contentPane); ); 3.
Menambahkan menu bar pada Jframe frame.setJMenuBar frame.setJMenuBar( a a (g greenMenuBar a );;
Root Pane
Setiap toptop-level container sebenarnya didukung oleh l h satu t intermediate i t di t container t i b bernama roott pane.. Root pane mengelola content pane, menu pane bar b dan d dua d kontainer k t i l i (layered lain (l d pane dan d glass l pane) Layered pane mengatur kedalaman l posisi komponen dengan menggunakan nilai depth (int (int)) Glass pane sering digunakan untuk menangkap kejadian j atau menempatkan p gambar ppada suatu g wilayah dimana terdapat satu atau banyak komponen p
JFrame //1. Create the frame JFrame frame = new JFrame("Frame Beraksi"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation( frame setDefaultCloseOperation( frame.setDefaultCloseOperation setDefaultCloseOperation(JFrame.EXIT JFrame JFrame.EXIT_ EXIT_ N_CLOSE); N CLOSE); //3. Create components p and put p them in the frame //...create emptyLabel... emptyLabel... frame.getContentPane().add( frame.getContentPane ().add(emptyLabel emptyLabel , BorderLayout.CENTER BorderLayout.CENTER); ); //4. Size the frame frame.pack(); frame pack(); frame.pack pack(); //5. Show it frame.setVisible(true); frame.setVisible (true);
FrameBeraksi.java import javax.swing javax.swing.*; .*; public l class l FrameBeraksi { public static void main(String[] args){ args){ JFrame frame f = new JFrame("Frame Beraksi"); frame.setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE frame.setDefaultCloseOperation JFrame.EXIT_ON_CLOSE); ); JLabel emptyLabel = new JLabel("Frame Beraksi"); frame.getContentPane().add( frame.getContentPane ().add(emptyLabel emptyLabel); ); frame.setSize(400,200); frame.setSize(400,200); frame.setVisible(true); frame.setVisible (true); } }
FrameBeraksi2.java import javax.swing javax.swing.*; .*; public l class l FrameBeraksi2 extends JFrame { public FrameBeraksi2() { super("Frame Beraksi 2"); setSize(300, setSize (300, 100); setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE setDefaultCloseOperation JFrame.EXIT_ON_CLOSE); ); setVisible(true); setVisible (true); } public static void main(String[] arguments) { FrameBeraksi2 frame= f new FrameBeraksi2(); } }
FrameBeraksi3.java import javax.swing.JFrame javax.swing.JFrame;; public bli class l F FrameBeraksi3 B k i3 extends t d JFrame JF { public FrameBeraksi3() { super("Frame super( Frame Beraksi 33"); ); setBounds(400, setBounds (400, 300, 10, 10); setVisible(true); setVisible (true); } ppublic static a void d main(String[] ma n(S ng[] arguments) a g m n ){ FrameBeraksi3 frame = new FrameBeraksi3(); for (int i = 10; i < 400; i++) { frame.setBounds(400 frame.setBounds (400 - (i/2), 300 - (i/2), i, i); } } }
Atomic Component
Fitur Standard JComponent
Tool Tips: Tips: setToolTipText setToolTipText() () P t Painting and d Borders: Borders B d : setBorder(), setBorder tB d (), () paintComponent paintComponent() tC t() t() Pluggable Look and Feel: Feel: UIManager.setLookAndFeel() UIManager.setLookAndFeel() Properties:: putClientProperty Properties putClientProperty(), (), getClientProperty() getClientProperty() Layout:: setMinimumSize Layout setMinimumSize(), (), setMaximumSize setMaximumSize,, setAlignmentX() setAlignmentX () Drag and Drop: Drop: component .setDragEnabled .setDragEnabled(true) setDragEnabled(true) Double Buffering: Buffering: untuk menghaluskan gambar Key Bindings: Bindings: untuk mnemonics dan accelerators l
JButton import javax.swing. javax swing.*; javax.swing public class ButtonBeraksi extends JFrame { ad = new JButton("Load"); JButton("Load"); ad ; JButton load JButton save = new JButton("Save"); JButton("Save"); public ButtonBeraksi() ButtonBeraksi() { super("Button Beraksi"); Beraksi"); setSize(140, setSize (140, 170); setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE setDefaultCloseOperation JFrame JFrame.EXIT_ON_CLOSE); EXIT ON CLOSE); CLOSE); JPanel pane = new JPanel JPanel(); (); pane.add(load); pane.add p (load); pane.add(save); pane.add (save); add(pane); setVisible setVisible(true); l (true); } public static void main(String[] arguments) { ButtonBeraksi button = new ButtonBera }
Layout Manager
BorderLayoutBeraksi.java importt java.awt.*; t* Import java.awt.event java.awt.event.*; .*; import javax.swing.*; javax.swing.*; public bl class l BorderLayoutBeraksi d k extends d JFrame { JButton nButton = new JButton("North"); JButton("North"); JButton sButton = new JButton("South"); JButton("South"); JButton eButton = new JButton("East"); JButton("East"); JButton wButton = new JButton("West"); JButton("West"); JButton cButton = new JButton("Center"); JButton("Center"); JButton(( Center ); JButton public BorderLayoutBeraksi BorderLayoutBeraksi() () { super("Border Layout Beraksi"); Beraksi"); setSize(240, setSize(240, 280); setDefaultCloseOperation((JFrame.EXIT_ON_CLOS setDefaultCloseOperation E); setLayout(new setLayout (new BorderLayout()); BorderLayout()); add(nButton add( nButton,, BorderLayout.NORTH); BorderLayout.NORTH); add(sButton add( sButton,, BorderLayout.SOUTH BorderLayout.SOUTH); ); add(eButton add( eButton,, BorderLayout.EAST); BorderLayout.EAST); add(wButton add( wButton,, BorderLayout.WEST BorderLayout.WEST); ); add(cButton add( cButton,, BorderLayout.CENTER BorderLayout.CENTER); ); }
public bl static void d main(String[] ( [] args args)) { BorderLayoutBeraksi frame = new BorderLayoutBeraksi(); BorderLayoutBeraksi (); Frame.setVisible(true); Frame.setVisible (true); } }
BoxLayoutBeraksi.java importt java.awt.*; t * importt javax.swing javax.swing.*; .*; * public class BoxLayoutBeraksi extends JFrame { public BoxLayoutBeraksi() B xLay utBeraksi() BoxLayoutBeraksi utBeraksi() { super("BoxLayoutBeraksi super(" BoxLayoutBeraksi"); "); setSize(430, setSize(430, 150); setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE setDefaultCloseOperation JFrame.EXIT_ON_CLOSE); );
JPanel commandPane = new JPanel JPanel(); (); BoxLayout horizontal = new BoxLayout((commandPane,BoxLayout.X AXIS); BoxLayout commandPane.setLayout(horizontal); commandPane.setLayout (horizontal); JButton subscribe = new JButton("Subscribe"); JButton("Subscribe"); JButton unsubscribe = new JButton("Unsubscribe"); JButton ("Unsubscribe");; JButton refresh = new JButton JButton("Refresh"); ("Refresh"); commandPane.add(subscribe); commandPane.add (subscribe); commandPane.add(unsubscribe); commandPane.add (unsubscribe); commandPane.add(refresh); commandPane.add (refresh); add(commandPane add( commandPane); ); }
public bl static void d main(String[] ( [] args args)) { BoxLayoutBeraksi st = new BoxLayoutBeraksi(); BoxLayoutBeraksi (); } }
FlowLayoutBeraksi.java importt java.awt.*; t * bImport bI t java.awt.event java.awt.event.*; t t.*; * import javax.swing javax.swing.*; .*; public class FlowLayoutBeraksi extends JFrame { JButton a = new JButton JButton("Alibi"); ("Alibi"); lb JButton b = new JButton("Burglar"); JButton("Burglar"); JButton c = new JButton("Corpse"); JButton("Corpse"); JButton d = new JButton("Deadbeat"); JButton("Deadbeat"); JButton e = new JButton JButton("Evidence"); ("Evidence"); public static void main(String[] args) args) { FlowLayoutBeraksi frame = new FlowLayoutBeraksi(); FlowLayoutBeraksi (); JButton f = new JButton("Fugitive"); JButton("Fugitive"); public FlowLayoutBeraksi FlowLayoutBeraksi() () { super("Flow Layout Beraksi"); Beraksi"); setSize(360, setSize(360, 120); setDefaultCloseOperation( p (JFrame.EXIT_ON_CLOSE JFrame.EXIT_ON_CLOSE); ); setDefaultCloseOperation FlowLayout lm = new FlowLayout FlowLayout((FlowLayout.LEFT); FlowLayout.LEFT); setLayout(lm); setLayout (lm); add(a); add(b); add(c); add(d); add(e); add(f); setVisible(true); setVisible (true); }
public bl static t t void d main(String[] (St [] args args)) { FlowLayoutBeraksi frame = new FlowLayoutBeraksi(); FlowLayoutBeraksi (); } }
CardLayoutBeraksi.java import javax.swing. javax swing.*; import java javax.swing java.awt. awt *; a CardLayoutBeraksi{ CardLayoutBeraksi a d ay a { class public static void main(String[] args){ args){ JFrame frame = new JFrame JFrame("Card ("Card Layout Beraksi Beraksi"); "); JPanel panel1 = new JPanel JPanel(); (); JPanel panel2 = new JPanel JPanel(); (); JButton button = new JButton("Button JButton("Button dalam panel ke 1"); JT tA t t JT tA ("T ( Ttdllk2 2")) JTextArea text = new JTextArea JTextArea("Text ("Text dalam panel ke 2"); ppanel1.add(button); ppanel2.add(text); JTabbedPane tab = new JTabbedPane JTabbedPane(); (); tab.add(panel1, tab.add (panel1, "Tab 1"); tab.add(panel2, tab.add(panel2, "Tab 2"); frame.getContentPane().add(tab,BorderLayout.NORTH frame.getContentPane().add( tab,BorderLayout.NORTH); ); frame.setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE frame.setDefaultCloseOperation JFrame.EXIT_ON_CLOSE); ); frame frame.pack frame.pack(); pack(); frame.setVisible pack(); frame frame.setVisible(true); setVisible(true); setVisible(true); } }
GridLayoutBeraksi.java importt java.awt.*; t * importt java.awt.event java.awt.event.*; t t.*; * import javax.swing javax.swing.*; .*; public bl class l GridLayoutBeraksi d k extends d JFrame { JButton marcia = new JButton("Marcia"); JButton carol = new JButton("Carol"); JButton("Carol"); JButton greg = new JButton("Greg"); JButton("Greg"); JButton jan = new JButton("Jan"); JButton("Jan"); JButton alice = new JButton("Alice"); JButton("Alice"); JButton(( Alice ); JButton JButton peter = new JButton JButton("Peter"); ("Peter"); JButton cindy = new JButton("Cindy"); JButton("Cindy"); JButton mike = new JButton JButton("Mike"); ("Mike"); JButton bobby = new JButton("Bobby"); JButton("Bobby"); public GridLayoutBeraksi GridLayoutBeraksi() () { super(" Grid Layout Beraksi "); setSize(260, setSize (260, 260); setDefaultCloseOperation((JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation JFrame.EXIT_ON_CLOSE); JPanel pane = new JPanel JPanel(); ();
GridLayout G idL t family f il = new GridLayout(3, GridLayout (3, 3, 10, 10); pane.setLayout(family); pane.setLayout(family); pane.add( pane.add dd((marcia); dd marcia i )); pane.add pane.add(carol); dd((carol); dd ( l) pane.add((greg pane.add greg); ); pane.add pane.add((jan jan); ); pane.add((alice pane.add alice); ); pane.add(peter); pane.add(peter); pane.add((cindy); pane.add cindy); pane.add(mike); pane.add(mike); pane.add(bobby); pane.add dd(b dd (b bb ) (bobby);
}
add(pane); setVisible(true); setVisible (true);
public static void main(String[] args args)) { GridLayoutBeraksi frame = new G GridLayoutBeraksi GridLayoutBeraksi(); idL tB k i() i(); () } }
Penanganan g Kejadian j (Event Handling)
Event
Event adalah kejadian atau peristiwa yang dilakukan oleh l h user terhadap t h d user interface i t f menggunakan k peralatan mouse dan keyboard Setiap objek dapat dinotifikasi f jika suatu event terjadi sehingga objek tersebut dapat memutukan apa yang harus h dilakukan l untuk menanggapi (menangani menangani)) event tersebut (event handling) Agar suatu objek dapat dinotifikasi tentang suatu j harus mendaftarkan diri sebagai g event event, objek listener ke sumber yg menghasilkan event, dan mengimplementasikan g p interface listener yg sesuai
Proses Penanganan Event 1. Komponen harus didaftarkan sebagai pendengar (listener) dg menggunakan gg method addXXXListener addXXXListener() () JButton tombolSelesai = new JButton(“Selesai”); tombolSelesai.addActionListener(this); tombolSelesai.addActionListener (this);
2. Meng Meng--implementasi interface listener atau meng meng--extends class adapter (bisa juga dengan membuat inner class) 11. class l HelloGUI H ll implements l MouseListener{} MouseListener {} 2. class HelloGUI extends MouseAdapter{} MouseAdapter{} atau
class HelloGUI extends JFrame JFrame{{ class handler extends MouseAdapter MouseAdapter{}} {}}
3. Menuliskan code penangan kejadian pada method class handler extends MouseAdapter{ MouseAdapter{ public void mouseClicked mouseClicked((MouseEvent e){ //code penangan kejadian }}
Listener ((Semua Semua Komponen Swing) Listener
Deskripsi
ComponentListener
Mendengarkan perubahan size, position, atau visibility dari komponen
FocusListener
Mendengarkan ketika komponen mendapatkan atau kehilangan g fokus keyboard
KeyListener
Mendengarkan penekanan tombol keyboard (hanya untuk komponen yang mendapat fokus keyboard)
MouseListener
Mendengarkan penekanan mouse, klik mouse, pelepasan mouse, dan pergerakan mouse
MouseMotionListener
Mendengarkan perubahan posisi kursor mouse pada komponen
MouseWheelListener
Mendengarkan pergerakan roda mouse pada komponen
HierarchyListener
Mendengarkan perubahan hirarki komponen karena kejadian yang berubah
HierarchyBoundListener
Mendengarkan perubahan hirarki komponen karena kejadian pergerakan dan perubahan ukuran
Listener API Table -1Listener or Adapter Ad
Listener Method h d
ActionListener
actionPerformed actionPerformed((ActionEvent) ActionEvent)
AncestorListener
ancestorAdded( ancestorAdded(AncestorEvent) AncestorEvent) ancestorMoved((AncestorEvent) ancestorMoved AncestorEvent) ancestorRemoved((AncestorEvent) ancestorRemoved AncestorEvent)
CaretListener
caretUpdate( caretUpdate(CaretEvent) CaretEvent)
CellEditorListener
editingStopped( editingStopped(ChangeEvent) ChangeEvent) editingCanceled((ChangeEvent) editingCanceled ChangeEvent)
ChangeListener
stateChanged( stateChanged(ChangeEvent) ChangeEvent)
ComponentListener ComponentAdapter
componentHidden(ComponentEvent) componentHidden( ComponentEvent) componentMoved((ComponentEvent componentMoved ComponentEvent)) componentResized((ComponentEvent) componentResized ComponentEvent) componentShown((ComponentEvent componentShown
ContainerListener ContainerAdapter
componentAdded( p (ContainerEvent ContainerEvent)) componentAdded componentRemoved((ContainerEvent) componentRemoved ContainerEvent)
DocumentListener
changedUpdate( changedUpdate(DocumentEvent) DocumentEvent) insertUpdate( p (DocumentEvent) DocumentEvent) insertUpdate removeUpdate((DocumentEvent) removeUpdate DocumentEvent)
ExceptionListener
exceptionThrown exceptionThrown(Exception) (Exception)
D k Deskripsi
Listener API Table -2Listener or Adapter
Listener Method
FocusListener FocusAdapter
focusGained(FocusEvent focusGained( FocusEvent)) focusLost((FocusEvent focusLost FocusEvent))
HierarchyBoundsListener HierarchyBoundsAdapter
ancestorMoved(HierarchyEvent ancestorMoved( HierarchyEvent)) ancestorResized((HierarchyEvent ancestorResized HierarchyEvent))
HierarchyListener
hierarchyChanged( hierarchyChanged(HierarchyEvent HierarchyEvent))
HyperlinkListener
hyperlinkUpdate( hyperlinkUpdate(HyperlinkEvent HyperlinkEvent))
InputMethodListener
caretPositionChanged( caretPositionChanged(InputMethodEvent InputMethodEvent)) inputMethodTextChanged((InputMethodEvent inputMethodTextChanged InputMethodEvent))
InternalFrameListener InternalFrameAdapter
internalFrameActivated(InternalFrameEvent internalFrameActivated( InternalFrameEvent)) internalFrameClosed((InternalFrameEvent internalFrameClosed InternalFrameEvent)) internalFrameClosing internalFrameClosing( lF Cl (InternalFrameEvent I InternalFrameEvent) lF E ) internalFrameDeactivated((InternalFrameEvent internalFrameDeactivated InternalFrameEvent)) internalFrameDeiconified((InternalFrameEvent internalFrameDeiconified InternalFrameEvent)) iinternalFrameIconified( internalFrameIconified t lF I ifi d( d(InternalFrameEvent) I t InternalFrameEvent lF E t) t) internalFrameOpened((InternalFrameEvent internalFrameOpened InternalFrameEvent))
ItemListener
itemStateChanged( itemStateChanged(ItemEvent ItemEvent))
KeyListener KeyAdapter
keyPressed(KeyEvent keyPressed( KeyEvent)) keyReleased((KeyEvent keyReleased KeyEvent)) keyTyped( keyTyped(KeyEvent
Deskripsi
Listener API Table -3Listener or Adapter Ad
Listener Method h d
ListDataListener
contentsChanged contentsChanged((ListDataEvent) ListDataEvent) intervalAdded((ListDataEvent) intervalAdded ListDataEvent) iintervalRemoved( intervalRemoved t lR d(ListDataEvent d( Li ListDataEvent) tD t E t) t)
ListSelectionListener
valueChanged valueChanged((ListSelectionEvent) ListSelectionEvent)
MenuDragMouseListener
menuDragMouseDragged menuDragMouseDragged((MenuDragMouseEvent) MenuDragMouseEvent) menuDragMouseEntered((MenuDragMouseEvent) menuDragMouseEntered MenuDragMouseEvent) menuDragMouseExited((MenuDragMouseEvent) menuDragMouseExited MenuDragMouseEvent) menuDragMouseReleased((MenuDragMouseEvent) menuDragMouseReleased MenuDragMouseEvent)
MenuKeyListener
menuKeyPressed( menuKeyPressed(MenuKeyEvent) MenuKeyEvent) menuKeyReleased((MenuKeyEvent) menuKeyReleased MenuKeyEvent) menuKeyTyped((MenuKeyEvent) menuKeyTyped MenuKeyEvent)
MenuListener
menuCanceled menuCanceled((MenuEvent) MenuEvent) menuDeselected((MenuEvent) menuDeselected MenuEvent) menuSelected((MenuEvent) menuSelected MenuEvent)
M MouseInputListener I Li MouseInputAdapter
mouseClicked( mouseClicked Cli k d( d(MouseEvent M MouseEvent) E ) mouseEntered((MouseEvent) mouseEntered MouseEvent) mouseExited((MouseEvent) mouseExited MouseEvent) MouseEvent)) mousePressed((MouseEvent mousePressed mouseReleased((MouseEvent) mouseReleased MouseEvent) mouseDragged((MouseEvent) mouseDragged MouseEvent) mouseMoved((MouseEvent) mouseMoved MouseEvent)
D k Deskripsi
Listener API Table -4Listener or Adapter
Listener Method
MouseListener
mouseClicked( mouseClicked(MouseEvent MouseEvent)) mouseEntered((MouseEvent mouseEntered MouseEvent)) mouseExited((MouseEvent mouseExited MouseEvent)) mousePressed((MouseEvent mousePressed MouseEvent)) mouseReleased((MouseEvent mouseReleased MouseEvent))
MouseMotionListener MouseMotionAdapter, MouseMotionAdapter p , MouseInputAdapter
mouseDragged(MouseEvent mouseDragged( MouseEvent)) mouseMoved((MouseEvent mouseMoved MouseEvent))
MouseWheelListener MouseAdapter
popupMenuCanceled(PopupMenuEvent popupMenuCanceled( PopupMenuEvent)) popupMenuWillBecomeInvisible((PopupMenuEvent popupMenuWillBecomeInvisible PopupMenuEvent)) popupMenuWillBecomeVisible((PopupMenuEvent popupMenuWillBecomeVisible PopupMenuEvent))
PropertyChangeListener
propertyChange( propertyChange(PropertyChangeEvent PropertyChangeEvent))
TableColumnModelListener
columnAdded( columnAdded(TableColumnModelEvent TableColumnModelEvent)) columnMoved((TableColumnModelEvent columnMoved TableColumnModelEvent)) columnRemoved((TableColumnModelEvent columnRemoved TableColumnModelEvent)) columnMarginChanged((ChangeEvent columnMarginChanged ChangeEvent)) columnSelectionChanged((ListSelectionEvent columnSelectionChanged ListSelectionEvent))
TableModelListener
tableChanged( TableModelEvent)) tableChanged(TableModelEvent
Deskripsi
Listener API Table -5LListener ste e oor Adapter dapte
LListener ste e Method et od
TreeExpansionListener
treeCollapsed(TreeExpansionEvent) treeExpanded(TreeExpansionEvent)
TreeModelListener
treeNodesChanged(TreeModelEvent) treeNodesInserted(TreeModelEvent) treeNodesRemoved(TreeModelEvent) treeStructureChanged(TreeModelEvent)
TreeSelectionListener
valueChanged(TreeSelectionEvent)
TreeWillExpandListener
treeWillCollapse(TreeExpansionEvent) treeWillExpand(TreeExpansionEvent)
UndoableEditListener
undoableEditHappened(UndoableEditEvent)
VetoableChangeListener
vetoableChange(PropertyChangeEvent)
WindowFocusListener WindowAdapter
( ) windowGainedFocus(WindowEvent) windowLostFocus(WindowEvent)
WindowListener WindowAdapter
windowActivated(WindowEvent) windowClosed(WindowEvent) windowClosing(WindowEvent) d Cl (W d ) windowDeactivated(WindowEvent) windowDeiconified(WindowEvent) windowIconified(WindowEvent) windowOpened(WindowEvent)
WindowStateListener WindowAdapter
windowStateChanged(WindowEvent)
Deskripsi Des ps
Referensi -1
Sharon Zakhour et al, The Java Tutorial Fourth Edition,, http://java.sun.com/docs/books/tutorial Edition http //java sun com/docs/books/tutorial Deitel & Deitel, Java How to Program Sixth Edition Edition,, P t Hall, Prentice H ll 2004 Kathy Sierra & Bert Bates, Head First Java 2nd Edition,, O’Reilly, 2005 Edition Rogers g Cadenhead d d & Laura Lemay, y, Teach Yourself Java 6 in 21 Days, Days, Sams Publishing, 2007 Robert Lafore Lafore,, Data Structures and Algorithms in Java Second Edition, Edition, Sams Publishing, 2003
Referensi -2
Tim Pengembang JENI, JENI 11-6, Depdiknas, 2007 Abdul Kadir, Dasar Pemrograman Java 2, 2, Penerbit Andi, A d 2004 Indrajani dan Martin, Pemrograman Berbasis Objek dengan Java, Java, Elex Media Komputindo, 2007 LN Harnaningrum, Harnaningrum g , Algoritma g dan Pemrograman d g Java,, Graha Ilmu, Java Ilmu, 2009 Rachmad Hakim & Sutarto Sutarto,, Mastering Java, Java, Elex Media Komputindo Komputindo,, 2009