tips.html
来自「eclipse插件jigloo」· HTML 代码 · 共 481 行 · 第 1/2 页
HTML
481 行
<font face="Helvetica, Arial, sans-serif"><br>
</font><font face="Helvetica, Arial, sans-serif"><b><a name="help16"></a>Hiding code from Jigloo.</b>
<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Surround a block
of code with a //$hide>>$ and a //$hide<<$
comment and Jigloo will not parse that block. Useful for designing a
GUI which only appears if a condition is true or false - hide the part
of the conditional block which you don't want to design with Jigloo
just yet. Or for making sure that Jigloo doesn't try and instantiate
classes that you don't want to be instantiated (perhaps if they try and
make a DB connection or write to a file when instantiated).<br>
</font></blockquote>
<font face="Helvetica, Arial, sans-serif"><u><b><big>Coding tips</big></b></u><br>
<br>
</font>
<font face="Helvetica, Arial, sans-serif"><b><a name="help7"></a>Use Jigloo's visual inheritance.</b>
<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Instead of designing a lot of separate but similar visual classes,
design a base class with publically-accessible buttons, panels etc, and
use Jigloo to build extensions of this class. The "Flowershop" <a href="other.html#examples">examples</a> which Jigloo can create for you demonstrate visual inheritance.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><br>
</font><font face="Helvetica, Arial, sans-serif"><b><a name="help8"></a>Re-formatting the source code</b><br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Jigloo allows you
to define how you want GUI elements to be coded - either using getter
methods for Swing elements (as produced by JBuilder, the Eclipse VE
project, etc) or as blocks separated by braces, tagged comments or
blank lines. Elements created by Jigloo will be added to the code using
the defined style, but to re-format the entire source using the current
style, right-click anywhere in the Form Editor and choose
"Source->Reformat code to current coding style". For more
details, refer to <a href="code.html#code_gen">this section</a>.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><br>
<br>
</font>
<div align="left"><font face="Helvetica, Arial, sans-serif"><b><u><big>Productivity tips</big></u><br>
</b><br>
Here are some tips, mainly involving key strokes, which will increase your productivity.<b><br>
<br>
<a name="help9"></a>Stopping & starting code parsing.<br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">Since Jigloo will
automatically parse any changes you make to your code, after a given
delay, if you are making a lot of code changes, you will save time by
turning parsing off, and on again when you have finished.</font><font face="Helvetica, Arial, sans-serif"> Just hit Ctrl+Alt+P in the source editor to toggle code parsing on and off.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help10"></a>Multi-selecting elements (by CTRL and selection marquee).</b></font><font face="Helvetica, Arial, sans-serif"><b><img alt="" src="images/multi-sel2.PNG" align="right" border="1" height="65" width="184"></b></font><font face="Helvetica, Arial, sans-serif"><b><img alt="" src="images/multi-sel1.PNG" align="right" border="1" height="65" width="182"></b></font><font face="Helvetica, Arial, sans-serif"><b><br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">You can hold CTRL
down when selecting elements in the form editor and this will
multi-select the elements. <br>
<br>
In addition, you can hold SHIFT down while
dragging the mouse and a red rectangle (a selection marquee) will appear which you can drag
around all the elements you wish to select (see figures). <i>Note that to select an element you only need to intersect it with the marquee</i>. Then any
properties you change, or any resizing or moving or copy/cut/pasting
you do will apply to all selected elements.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help11"></a>Select a component in the Outline by holding Alt down while clicking in the source editor. </b><br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Normally,
clicking or moving the cursor over a piece of code (eg a property
setter) selects the relevant component in the form editor, but shows
the java outline in the Outline view - holding Alt down while clicking
on the mouse shows the component tree in the Outline view instead.
This may not work on Linux systems where Alt may have a pre-defined function.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help12"></a>Moving elements<br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif"><b><img alt="" src="images/move2.PNG" align="right" border="1" height="58" width="268"></b></font><font face="Helvetica, Arial, sans-serif"><b><img alt="" src="images/move1.PNG" align="right" border="1" height="58" width="264"></b></font><font face="Helvetica, Arial, sans-serif">Depending on the layout used by a container, components can be rearranged inside a container by dragging with the mouse.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help13"></a>Copying & pasting elements<br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">You can hold CTRL down when dragging one or more elements in the form editor and this will paste copies of the elements.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help14"></a>Changing preferred sizes in GridBag and Form Layouts<br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">When using a GridBag or JGoodies Form layout, normally resizing a component will change it's </font><font face="Helvetica, Arial, sans-serif">gridx/y/width/height values. However, </font><font face="Helvetica, Arial, sans-serif">by
holding SHIFT down when resizing an element you will change the
preferredSize property of an element, rather than it's
gridx/y/width/height values.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help15"></a>Changing an element's text property quickly</b>.
<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Double-click on a button, label, group, etc in the Form Editor and a
text field will appear, allowing you to edit it's text. This applies to
any component which has a "text" property.<big><br>
</big></font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><u><big><br>
</big></u></b><big><u><b>Custom components</b></u></big><br>
</font>
<font face="Helvetica, Arial, sans-serif">
<br>
<big><b><small><a name="help5"></a>How
can I give my custom component an icon that will show up in Jigloo's
"Custom" palette, instead of the default java-bean icon?<br>
</small></b></big></font><font face="Helvetica, Arial, sans-serif"><br>
You
need to create a BeanInfo class for your custom class, and define the
getIcon method. For an example of how to do this, look at the Swing
FlowerShop</font><font face="Helvetica, Arial, sans-serif"> example which you can
create by hitting CTRL+N, then in the "New" wizard, select "GUI
Forms->Examples->Swing Inheritance/JavaBean (FlowerShop) example".<big><br>
<b><br>
<br>
</b></big><small></small><br>
</font>
<font face="Helvetica, Arial, sans-serif"><b><u><big>Miscellaneous</big></u></b></font>
<blockquote>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help17"></a>Maximize the main editor by double-clicking on it's name tag</b>. <br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Fills Eclipse with the parts of Jigloo essential for designing forms.<br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><img alt="" src="images/move3.PNG" align="right" border="1" height="112" width="291"></font><font face="Helvetica, Arial, sans-serif"><b><a name="help18"></a>How to move a component that is behind another
component.</b><br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Say you have a JPanel inside a
JScrollPane and you want to move the JScrollPane - first select the
JScrollPane in the Outline view, then click and drag a <i><b>blue</b></i>
region of the selection border (which is made up of alternating black
and blue regions.</font><font face="Helvetica, Arial, sans-serif"><b><br>
</b></font></blockquote><div align="left"><font face="Helvetica, Arial, sans-serif"><b><a name="help19"></a>Working with SWT classes not initially created by Jigloo<br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">Many Java GUIs
built by hand or by other GUI builders can be modified succesfully by
Jigloo, but for SWT GUIs you might want to use some Jigloo tools to
migrate the code to a more Jigloo-friendly form:<br>
</font>
<ul>
<li><font face="Helvetica, Arial, sans-serif">Migrate to using the
SWTResourceManager to manage fonts, colors and images - do this by
right-clicking anywhere on the Form Editor and choosing
"Source->Convert to using SWTResourceManager"</font></li>
<li><font face="Helvetica, Arial, sans-serif">Insert a new showGUI
method which will display the SWT Composite inside a Shell, using the
size of the Composite (if it is defined) to set the size of the Shell.</font></li>
</ul>
<font face="Helvetica, Arial, sans-serif">For more details, <a href="getting_started.html#migrating">read this</a>.<br>
</font></blockquote>
<font face="Helvetica, Arial, sans-serif"><b><br>
<u><big>Problems<br>
</big></u></b></font><font face="Helvetica, Arial, sans-serif"><b><u><big><br>
</big></u></b></font><font face="Helvetica, Arial, sans-serif"><b><a name="help20_0"></a></b><b><big><font><small><big><small>Why can't I change the location/size of my GUI elements?</small></big></small></font></big></b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">This is probably because of the layout
manager you are using. For example, if you have a JPanel which uses a
FlowLayout and you keep adding JButtons to it, then the JButtons will
assume their most natural sizes - you will be able to change their
sizes and re-order them but you will not be able to set their absolute
position in the JPanel, since that is determined by the JPanel's layout
manager. If you want to set the absolute position as well as size, then
try using the Anchor or Absolute layouts (for Swing), or Form or
Absolute layouts (for SWT).<br>
<br>
But reading up a bit about the other layouts - the GridBag or JGoodies
Form layouts for Swing, or the Grid layout for SWT can be particularly
useful - will allow you to benefit from these layout managers.<br>
<br>
</font><font face="Helvetica, Arial, sans-serif"><b><u><big>
</big></u></b></font></blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help20"></a>Errors with properties or fields not being recognized</b><br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><></font><font face="Helvetica, Arial, sans-serif">If say Java 1.5 is used to run Eclipse, then the
properties of Swing components generated by Jigloo will be those for
Java 1.5, but if you use a Java 1.4 JRE inside Eclipse to build and run
programs then some properties added by the Java 1.5 version will cause
a compile error. The same goes for the SWT library - if SWT version 3
is used to run Eclipse, but SWT 2 is used to run and build programs
inside Eclipse then you might get compile errors. The solution is to
use the same Java or SWT libraries to run Eclipse as to run programs
inside Eclipse.<br>
</font></blockquote>
<font face="Helvetica, Arial, sans-serif"><b><a name="help21"></a>Problems on Linux<br>
</b></font>
<blockquote><font face="Helvetica, Arial, sans-serif">If you have
problems on Linux/GTK (such as the "+" signs not expanding in the GUI
Properties editor) then make sure you have version 2.1.1 of GTK and
it's accompanying packages (pango, glib, atk) - a useful article, with
download links is here: <a href="http://developer.gnome.org/doc/API/2.4/gtk/gtk-building.html">http://developer.gnome.org/doc/API/2.4/gtk/gtk-building.html</a><br>
</font>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><br>
<br>
</font>
<blockquote>
</blockquote>
</div>
<blockquote><font face="Helvetica, Arial, sans-serif">
</font></blockquote>
</div>
<ul>
</ul>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?