Swing part-two Eriq Muhammad Adams J [email protected].
-
Upload
tobias-richards -
Category
Documents
-
view
212 -
download
0
Transcript of Swing part-two Eriq Muhammad Adams J [email protected].
![Page 1: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/1.jpg)
Swing part-two
*Advanced Java Programming
Eriq Muhammad Adams [email protected]
Info
rmati
cs E
ngin
eeri
ng –
Univ
ers
ity o
f B
raw
ijaya
![Page 2: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/2.jpg)
Agenda
*Beans Binding
*Look and Feel
*Create Installer & Executable
*Useful Components
![Page 3: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/3.jpg)
Beans Binding
*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 4: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/4.jpg)
Beans Binding (cont.)
*General Data flow
Source Target
Converter
ConverterValidator
![Page 5: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/5.jpg)
Beans Binding (cont.)
*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 6: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/6.jpg)
Beans Binding (cont.)
*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 7: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/7.jpg)
Beans Binding (cont.)
*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
Demo available at http://eriq.lecture.ub.ac.id/files/2011/03/BeansBindingDemo.zip
![Page 8: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/8.jpg)
Look n Feel
*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 9: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/9.jpg)
Create Installer & Executable*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 10: Swing part-two Eriq Muhammad Adams J eriq.adams@ub.ac.id.](https://reader036.fdocuments.in/reader036/viewer/2022083009/5697bf7a1a28abf838c82f68/html5/thumbnails/10.jpg)
Useful Components
*JDIC (JDesktop Integration Component) Project : http://java.net/projects/jdic/
*SwingX (Extended Swing Component) : https://swingx.dev.java.net
*SwingLabs : http://swinglabs.org