90 likes | 392 Views
Informatics Engineering – University of Brawijaya. Advanced Java Programming. Swing part-one. Eriq Muhammad Adams J e riq.adams@ub.ac.id. Agenda. Overview Netbeans Matisse GUI Builder Internationalization SwingWorker. Overview.
E N D
Informatics Engineering – University of Brawijaya Advanced Java Programming Swing part-one Eriq Muhammad Adams J eriq.adams@ub.ac.id
Agenda • Overview • Netbeans Matisse GUI Builder • Internationalization • SwingWorker
Overview • JFC (Java Foundation Class) consist of AWT, Swing, Java 2D, Drag n Drop, Accessibility. • The Abstract Window Toolkit (AWT) is the part of Java designed for creating user interfaces and painting graphics and images.
Overview (cont.) • Swing is built on top of AWT. • Swing uses MVC architecture. • All swing components conform to JavaBeans specification. • Support event handling and dispatching.
Overview (cont.) • Swing Component’s Hierarchy :
Overview (cont.) • By default all AWT and Swing-based applications start off with two threads. One is the main application thread which handles execution of the main() method. The other, referred to as the event-dispatching thread, is responsible for handling events, painting, and layout. • If you have time-consuming process in GUI application, you have to start your process in another thread in order not looks laggy. SwingWorker will help you to do that. • For rapid n easy development please use NetbeansMattise GUI Builder. • You can extends any swing components to create new components, but please check free components out there before to save time.
Netbeans Matisse GUI Builder • Please check these tutorials to learn about matisse. • GUI Building in NetBeans IDE Tutorial http://netbeans.org/kb/docs/java/quickstart-gui.html • NetBeans IDE GUI Builder Visual Feedback Legend http://netbeans.org/kb/docs/java/quickstart-gui-legend.html • Handling Images in A GUI Application http://netbeans.org/kb/docs/java/gui-image-display.html • Adding a FileChooser to a GUI Application http://netbeans.org/kb/docs/java/gui-filechooser.html • Creating a Graphical Client for Twitter http://netbeans.org/kb/docs/websvc/twitter-swing.html • Designing a Basic Java Form Using the GridBagCustomizer http://netbeans.org/kb/docs/java/gbcustomizer-basic.html • Designing an Advanced Java Form Using the GridBagCustomizer http://netbeans.org/kb/docs/java/gbcustomizer-advanced.html • Designing a Swing GUI in NetBeans IDE Screencast http://netbeans.org/kb/docs/java/gui-builder-screencast.html
Internationalization • If you want your application support several languages, you have to add internationalization. • Internationalization commonly be called i8n. • Please check tutorial about i8n with Matisse at http://netbeans.org/kb/docs/java/gui-automatic-i18n.html
SwingWorker • SwingWorker used when you have background process / task that time consuming process. Create SwingWorker Procedure for background task Procedure if background task completed Start background task