13
Copyright © 2015 – Curt Hill Window Builder Again Some more features

Copyright © 2015 – Curt Hill Window Builder Again Some more features

Embed Size (px)

DESCRIPTION

Variables Windows Builder is like a large number of other GUI builders It generates poor names for things –These are only the component names If the component is not referenced in code, we do not care –Labels and buttons are often not referenced in code Fortunately we may do something about it Copyright © 2015 – Curt Hill

Citation preview

Page 1: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Copyright © 2015 – Curt Hill

Window Builder Again

Some more features

Page 2: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Introduction• A few more features of Windows

Builder plugin• Changing variables

Copyright © 2015 – Curt Hill

Page 3: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Variables• Windows Builder is like a large

number of other GUI builders• It generates poor names for things

– These are only the component names• If the component is not referenced in

code, we do not care– Labels and buttons are often not

referenced in code• Fortunately we may do something

about itCopyright © 2015 – Curt Hill

Page 4: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Variable Names• It is always possible to have Eclipse

do a replace all– This might confuse Windows Builder but

a reparse is possible• The better way is to use the property

inspector to change the name• The field is Variable

Copyright © 2015 – Curt Hill

Page 5: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Variable Field

Copyright © 2015 – Curt Hill

Page 6: Copyright © 2015 – Curt Hill Window Builder Again Some more features

JTextField size• The contents of a JTextField does not

affect its size like a label or button• Instead it has a columns property in

the property inspector• It also may be set with the

setColumns method in the code

Copyright © 2015 – Curt Hill

Page 7: Copyright © 2015 – Curt Hill Window Builder Again Some more features

About Box• The about button can be

accomplished in a number of ways• Here is one:

– Create a JDialog that is a second file• We add a new file to the project just

like we did before• Instead of a Windows Application

(which is a JFrame we use a JDialog• Then we have to fill in the JDialog and

show it from the main windowCopyright © 2015 – Curt Hill

Page 8: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Adding JDialog

Copyright © 2015 – Curt Hill

Page 9: Copyright © 2015 – Curt Hill Window Builder Again Some more features

About Box Again• This is a little more complicated than I

would like• Here is the easier alternative• On the web site there is a pre-made

About dialog– It is HTML to facilitate copying

• Place this in your file– At the very end – after the last brace

• In the comment there is the mechanism for calling it

Copyright © 2015 – Curt Hill

Page 10: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Web Page

Copyright © 2015 – Curt Hill

Page 11: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Copy All of This

Copyright © 2015 – Curt Hill

Page 12: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Finally• The Event handler just copies in the

call which is in comments:MyAbout a = new MyAbout(null, false, "The program purpose", "Your name", "year");

• Then modifies it:MyAbout a = new MyAbout(null, false, “Convert years to seconds” “Curt Hill", “2015");

Copyright © 2015 – Curt Hill

Page 13: Copyright © 2015 – Curt Hill Window Builder Again Some more features

Conclusion• Of course, there is plenty more to

know• However, we will next do a demo

concerning the line drawing and clean up

• All using Windows Builder

Copyright © 2015 – Curt Hill