copyright © 2015 – curt hill window builder again some more features

Post on 20-Jan-2018

218 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

TRANSCRIPT

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

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

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

Variable Field

Copyright © 2015 – Curt Hill

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

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

Adding JDialog

Copyright © 2015 – Curt Hill

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

Web Page

Copyright © 2015 – Curt Hill

Copy All of This

Copyright © 2015 – Curt Hill

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

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

top related