⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.html

📁 eclipse插件jigloo
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <meta http-equiv="CONTENT-TYPE"
 content="text/html; charset=windows-1252">
  <title>Jigloo SWT Tutorial</title>
  <meta name="GENERATOR" content="OpenOffice.org 2.0  (Win32)">
  <meta name="AUTHOR" content="Cloudgarden.com">
  <meta name="CREATED" content="20051126;10023565">
  <meta name="CHANGED" content="16010101;0">
  <style>
	<!--
		TD P { margin-top: 0.1in; margin-bottom: 0.1in; color: #000000; font-family: "Arial", "Helvetica", sans-serif; font-size: 10pt }
		P { margin-top: 0.1in; margin-bottom: 0.1in; color: #000000; font-family: "Arial", "Helvetica", sans-serif; font-size: 10pt }
		H3 { font-size: 11pt }
		A:link { color: #0000ff }
	-->
	</style>
  <meta name="author" content="Jonathan Kinnersley">
</head>
<body bgcolor="#ffffff" dir="ltr" lang="en-US" link="#0000ff">
<h4 style="font-family: tahoma;"><small>A Jigloo SWT Tutorial</small></h4>
<small><font face="Helvetica, Arial, sans-serif"
 style="font-family: tahoma;">In this simple tutorial you will create a
simple browser with an "About" dialog.<br>
<br>
<span style="font-weight: bold;">Topics covered:</span><br>
</font></small>
<ul style="font-family: tahoma;">
  <li><small>Arranging elements using FormLayout<br>
    </small></li>
  <li><small>Navigating between visual elements in the tree outline and
their code</small></li>
  <li><small>Adding multiple&nbsp;</small><small>elements </small><small>
    </small><small>of the same type to a form<br>
    </small></li>
  <li><small>Multi-selecting </small><small>elements </small></li>
  <li><small>"Surround by" action - useful for times when you realise
you really need your elements to be in a tab folder, etc</small></li>
  <li><small>Changing which properties appear under the "Basic" and
"Expert" headings in the "GUI Properties" editor.</small></li>
</ul>
<small><font face="Helvetica, Arial, sans-serif"
 style="font-family: tahoma;"><br>
First you will need a Java project and (preferably) a package to hold
your classes. <br>
If you don't know how to do this then hitting <span
 style="font-weight: bold;">Ctrl+N</span> is a quick way to bring up
the "Create" dialog from which you can perform both these steps.<br>
<br>
<span style="font-weight: bold;">Creating the main application window<br>
<br>
</span></font></small>
<div style="margin-left: 40px; font-family: tahoma;"><small><span
 style="font-weight: bold;">Create new Composite</span><br>
</small>
<div style="margin-left: 40px;"><small>...again, Ctrl+N will show the
"create" dialog, from which you should select "GUI
forms-&gt;SWT-&gt;Composite"<br>
<br>
<img src="new_comp.png" title="" alt=""
 style="width: 497px; height: 397px;"><br>
<br>
As well as creating your composite, Jigloo will copy the jar and native
libraries into your project. It copies all the native libraries, even
though you generally will not need them all, but you never know...<br>
<br>
</small></div>
<small><span style="font-weight: bold;">Choose your editor preferences<br>
</span></small>
<div style="margin-left: 40px;"><small>Now we've got a Jigloo editor
open, let's change how it looks. Click on the "Open Jigloo preferences
editor" button in the toolbar to the left of the Jigloo editor. The
Eclipse preferences window appears with Jigloo selected. Choose
"Appearance and Behaviour" and then "Tabbed panels". This is useful
when you want to maximize your design area, but "Split-pane" can be
useful if you want to see immediately the connection between code and
GUI. <br>
<img src="../swing_tutorial/prefs.png" title="" alt=""
 style="width: 715px; height: 572px;"><br>
<br>
Now hit "OK" and close and re-open the Jigloo editor (you need to
do this to change to tabbed panels). If your java class does not
immediately re-open in the Jigloo editor, you can ensure that it uses
Jigloo's Form Editor by right-clicking on the class and choosing "Open
with-&gt;Form editor".<br>
<br>
<img src="../swing_tutorial/open_jigloo.png" title="" alt=""
 style="width: 518px; height: 314px;"><br>
</small><br>
</div>
<small><span style="font-weight: bold;"></span></small>
<div style="margin-left: 40px;"><small><br>
</small></div>
<small><span style="font-weight: bold;">
Start adding controls<br>
<br>
</span></small>
<div style="margin-left: 40px;"><small>The composite is created
initially with a FormLayout manager, which allows you to position
elements absolutely and relatively on the form and automatically
resizes them as the form changes shape. However, other layouts are
useful for certain purposes - for example GridLayout is very useful for
situations where your elements are layed out in a grid, with elements
spanning multiple rows or columns. If you wish to set a layout manager
for a composite, select it from the "layout" palette and then click on
the element you wish to apply it to, or right-click on the element and
use the "Set Layout" options.<br>
<br>
Let's add a "GO" button to the top right of the form. First click on
the "Button" icon in the "Controls" palette and "drop" the button in
the top-right corner of the form, using the alignment lines.<br>
<br>
<img src="go_align.png" title="" alt=""
 style="width: 105px; height: 73px;"><br>
<br>
Then enter a name and initial text (and an icon image if you like) in
the dialog that will appear.<br>
<br>
<img src="go_button.png" title="" alt=""
 style="width: 457px; height: 390px;"><br>
<br>
You may need to re-adjust the position of the button after it is added
to the form - Jigloo does a better job once it knows exactly how big
the button is.<br>
Then add a CCombo control to the top left of the form, call it
addressCombo with initial value "www.cloudgarden.com" and stretch it
over to meet the "GO" button. You can also drag it's bottom edge to
make it the same height as the goButton. Then right-click on the
addressCombo and choose "Set/Change style...-&gt;BORDER", which will
give it a 3D border.<br>
<br>
Now click on the alignment button at the top-right of the addressCombo
- an "alignment helper" should pop up (see image)<br>
<img src="align.png" title="" alt=""
 style="width: 386px; height: 235px;"><br>
<br>
Click on the right anchor button till the anchors look the same as in
the image above. Now the addressCombo's top, left and right edges are
anchored fixed distances from the top, left and right edges of the form
and it will expand horizontally if the form is resized.<br>
<br>
Then select the goButton and anchor it as shown in the image below, so
that it stays fixed in the top right corner of the form (and does not
resize) as the form is resized.<br>
<img src="go_anchor.png" title="" alt=""
 style="width: 276px; height: 235px;"><br>
<br>
Now close the alignment helper and make the main form bigger because we
will add more controls - notice that the addressCombo gets wider.<br>
<br>
Now add a "Status" CLabel to the bottom left of the form, an "About"
Button called (surprise) aboutButton to the bottom-right of the form, a
CLabel called statusLabel stretched along the bottom edge between the
other label and the aboutButton, and then add a Browser control in the
center of the form. <br>
<br>
<img src="browser1.png" title="" alt=""
 style="width: 739px; height: 490px;"><br>
<br>
Anchor all controls so that the browser control expands in both
directions and the statusLabel expands horizontally.<br>
<br>
You can test whether your form behaves as expected when it is resized
by clicking the "Preview" button in the outline view.<br>
<img src="preview.png" title="" alt=""
 style="width: 330px; height: 203px;"><br>
<br>
<br style="font-weight: bold;">
</small><small></small></div>
<small><span style="font-weight: bold;">Creating the About Dialog<br>
</span></small>
<div style="margin-left: 40px;"><small>Create a new SWT Dialog called
AboutDialog (use CTRL+N to open the "New" dialog)</small><br>
<small><img
 src="file:///C:/workspace-jigloo/jigloo/html/swt_tutorial/newDialog.png"
 title="" alt="" style="width: 500px; height: 167px;"></small><br>
<small></small><br>
<small>Again, it will already have FormLayout set as it's layout

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -