advanced java programming

13
Swing [part.2] Eriq Muhammad Adams [email protected] | http://eriq.lecture.ub.ac

Upload: krysta

Post on 15-Jan-2016

24 views

Category:

Documents


0 download

DESCRIPTION

Informatics– University of Brawijaya. Advanced Java Programming. Swing [part.2]. Eriq Muhammad Adams J [email protected] | http://eriq.lecture.ub.ac.id. Beans Binding. Specification is in JSR 295. Is used to synchronized properties between two objects. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Advanced Java Programming

Swing [part.2]

Eriq Muhammad Adams [email protected] | http://eriq.lecture.ub.ac.id

Page 2: Advanced Java Programming

*Specification is in JSR 295.

*Is used to synchronized properties between two objects.

*Beans binding now fully support matisse GUI Builder (make easier for developer for binding data).

*There are binding source and target.

*Update strategies: Read/Write, Read-Only, Read-Once

*If you want to synchronize properties of two objects but they have different types you have to create Converter.

*Use Validator to filter binding’s value from target.

Page 3: Advanced Java Programming

*General Data flow

Page 4: Advanced Java Programming

*Extends org.jdesktop.beansbinding.Converter<S,T> to create new Converter. S is source type, and T is target type.

*Override convertForward(S value):T to converts a value from the source type to the target type.

*Override convertReverse(T value):S to converts a value from the target type to the source type.

*Please learn my tutorial at :http://scc-ub.googlecode.com/files/tutorial.photomanager.pdf.zip

,source code available at :

http://scc-ub.googlecode.com/files/PhotoManager.zip

Page 5: Advanced Java Programming

*To create a new Validator you have to extends org.jdesktop.beansbinding.Validator<T>. T is target type.

*Override validate(T value):Validator.Result to define validation procedure.

Page 6: Advanced Java Programming

*Example :When several items in Jlist is selected, the JComboBox will automatically populated. If JTextField ‘s value will be changed according to selected item in JComboBox

When several items in Jlist is selected, the JComboBox will automatically populated. If JTextField ‘s value will be changed according to selected item in JComboBox

Demo available at http://eriq.lecture.ub.ac.id/files/2011/03/BeansBindingDemo.zip

Page 7: Advanced Java Programming

Transferable (data)

Transferable (data)

Page 8: Advanced Java Programming

*DnD ConstantsACTION_NONE -- no action taken

ACTION_COPY -- the DragSource leaves the data intact

ACTION_MOVE -- the DragSource deletes the data upon successful completion of the drop

ACTION_COPY or ACTION_MOVE -- the DragSource will perform either action requested by the DropTarget

ACTION_LINK or ACTION_REFERENCE -- a data change to either the source or the destination propagates to the other location

Page 9: Advanced Java Programming

*Draggable Component

Page 10: Advanced Java Programming

*Flow

Page 11: Advanced Java Programming

*Programmatically : use UIManager class.

*Non-Programmatically : use --cp:p look_and_feel_jar_path –laf look_and_feel_class_name

*Sample code available at http://eriq.lecture.ub.ac.id/files/2011/03/LookAndFeelDemo.zip

Page 12: Advanced Java Programming

*Launch4J , Jsmooth, etc is tool to create executable for java apps in windows.

*InnoSetup, NSIS, etc is used to create windows installer.

*Tools above are free for non-commercial or commercial use.

*Launch4j : http://launch4j.sourceforge.net

*Jsmooth : http:// jsmooth.sourceforge.net

*InnoSetup : http://www.jrsoftware.org/isinfo.php

*NSIS : http:// nsis.sourceforge.net

Page 13: Advanced Java Programming

*JDIC (JDesktop Integration Component) Project : http://java.net/projects/jdic/

*SwingX (Extended Swing Component) : https://swingx.dev.java.net

*SwingLabs : http://swinglabs.org