View Javadoc

1   package com.wickle.clanwar.client;
2   
3   import org.eclipse.swt.widgets.Shell;
4   import org.eclipse.swt.widgets.Display;
5   import org.eclipse.swt.graphics.Rectangle;
6   import org.eclipse.swt.events.DisposeEvent;
7   import org.eclipse.swt.events.DisposeListener;
8   import org.eclipse.swt.widgets.MenuItem;
9   import org.eclipse.swt.widgets.Menu;
10  import org.eclipse.swt.layout.GridLayout;
11  import org.eclipse.swt.graphics.Color;
12  import org.eclipse.swt.widgets.Composite;
13  import org.eclipse.swt.layout.FormLayout;
14  import org.eclipse.swt.layout.GridData;
15  import org.eclipse.swt.layout.FormData;
16  import org.eclipse.swt.layout.FormAttachment;
17  import org.eclipse.swt.widgets.Button;
18  import org.eclipse.swt.layout.RowLayout;
19  import org.eclipse.swt.layout.RowData;
20  import org.eclipse.swt.events.SelectionAdapter;
21  import org.eclipse.swt.events.SelectionEvent;
22  import org.eclipse.swt.SWT;
23  
24  /***
25  * This code was generated using CloudGarden's Jigloo
26  * SWT/Swing GUI Builder, which is free for non-commercial
27  * use. If Jigloo is being used commercially (ie, by a
28  * for-profit company or business) then you should purchase
29  * a license - please visit www.cloudgarden.com for details.
30  */
31  public class MainGUI extends org.eclipse.swt.widgets.Composite {
32  	private Button button1;
33  	private Composite right;
34  	private Composite left;
35  	private Composite center;
36  	private Composite toolbox;
37  	private MenuItem aboutMenuItem;
38  	private MenuItem contentsMenuItem;
39  	private Menu helpMenu;
40  	private MenuItem helpMenuItem;
41  	private MenuItem exitMenuItem;
42  	private MenuItem closeFileMenuItem;
43  	private MenuItem saveFileMenuItem;
44  	private MenuItem newFileMenuItem;
45  	private MenuItem openFileMenuItem;
46  	private Menu fileMenu;
47  	private MenuItem fileMenuItem;
48  	private Menu menu1;
49  
50  	public MainGUI(Composite parent, int style) {
51  		super(parent, style);
52  		initGUI();
53  	}
54  
55  	/***
56  	* Initializes the GUI.
57  	* Auto-generated code - any changes you make will disappear.
58  	*/
59  	public void initGUI(){
60  		try {
61  			preInitGUI();
62  	
63  			toolbox = new Composite(this,SWT.NULL);
64  			center = new Composite(this,SWT.NULL);
65  			left = new Composite(center,SWT.BORDER);
66  			button1 = new Button(left,SWT.PUSH| SWT.CENTER);
67  			right = new Composite(center,SWT.BORDER);
68  	
69  			this.setSize(new org.eclipse.swt.graphics.Point(725,513));
70  			final Color MainGUIbackground = new Color(Display.getDefault(),128,128,128);
71  			this.setBackground(MainGUIbackground);
72  	
73  			GridData toolboxLData = new GridData();
74  			toolboxLData.verticalAlignment = GridData.BEGINNING;
75  			toolboxLData.horizontalAlignment = GridData.FILL;
76  			toolboxLData.widthHint = -1;
77  			toolboxLData.heightHint = 18;
78  			toolboxLData.horizontalIndent = 0;
79  			toolboxLData.horizontalSpan = 1;
80  			toolboxLData.verticalSpan = 1;
81  			toolboxLData.grabExcessHorizontalSpace = true;
82  			toolboxLData.grabExcessVerticalSpace = false;
83  			toolbox.setLayoutData(toolboxLData);
84  			toolbox.setSize(new org.eclipse.swt.graphics.Point(725,18));
85  			FormLayout toolboxLayout = new FormLayout();
86  			toolbox.setLayout(toolboxLayout);
87  			toolboxLayout.marginWidth = 0;
88  			toolboxLayout.marginHeight = 0;
89  			toolboxLayout.spacing = 0;
90  			toolbox.layout();
91  	
92  			GridData centerLData = new GridData();
93  			centerLData.verticalAlignment = GridData.FILL;
94  			centerLData.horizontalAlignment = GridData.FILL;
95  			centerLData.widthHint = -1;
96  			centerLData.heightHint = -1;
97  			centerLData.horizontalIndent = 0;
98  			centerLData.horizontalSpan = 1;
99  			centerLData.verticalSpan = 1;
100 			centerLData.grabExcessHorizontalSpace = false;
101 			centerLData.grabExcessVerticalSpace = true;
102 			center.setLayoutData(centerLData);
103 			center.setSize(new org.eclipse.swt.graphics.Point(725,475));
104 	
105 			GridData leftLData = new GridData();
106 			leftLData.verticalAlignment = GridData.FILL;
107 			leftLData.horizontalAlignment = GridData.BEGINNING;
108 			leftLData.widthHint = 48;
109 			leftLData.heightHint = -1;
110 			leftLData.horizontalIndent = 0;
111 			leftLData.horizontalSpan = 1;
112 			leftLData.verticalSpan = 1;
113 			leftLData.grabExcessHorizontalSpace = false;
114 			leftLData.grabExcessVerticalSpace = true;
115 			left.setLayoutData(leftLData);
116 			left.setSize(new org.eclipse.swt.graphics.Point(48,461));
117 	
118 			RowData button1LData = new RowData(44, 37);
119 			button1.setLayoutData(button1LData);
120 			button1.setText("JMS");
121 			button1.setSize(new org.eclipse.swt.graphics.Point(44,37));
122 			button1.addSelectionListener( new SelectionAdapter() {
123 				public void widgetDefaultSelected(SelectionEvent evt) {
124 					button1WidgetDefaultSelected(evt);
125 				}
126 				public void widgetSelected(SelectionEvent evt) {
127 					button1WidgetSelected(evt);
128 				}
129 			});
130 			RowLayout leftLayout = new RowLayout(256);
131 			left.setLayout(leftLayout);
132 			leftLayout.type = SWT.HORIZONTAL;
133 			leftLayout.marginWidth = 0;
134 			leftLayout.marginHeight = 0;
135 			leftLayout.spacing = 3;
136 			leftLayout.wrap = true;
137 			leftLayout.pack = true;
138 			leftLayout.fill = false;
139 			leftLayout.justify = false;
140 			leftLayout.marginLeft = 3;
141 			leftLayout.marginTop = 3;
142 			leftLayout.marginRight = 3;
143 			leftLayout.marginBottom = 3;
144 			left.layout();
145 	
146 			GridData rightLData = new GridData();
147 			rightLData.verticalAlignment = GridData.FILL;
148 			rightLData.horizontalAlignment = GridData.FILL;
149 			rightLData.widthHint = -1;
150 			rightLData.heightHint = -1;
151 			rightLData.horizontalIndent = 0;
152 			rightLData.horizontalSpan = 1;
153 			rightLData.verticalSpan = 1;
154 			rightLData.grabExcessHorizontalSpace = true;
155 			rightLData.grabExcessVerticalSpace = true;
156 			right.setLayoutData(rightLData);
157 			FormLayout rightLayout = new FormLayout();
158 			right.setLayout(rightLayout);
159 			rightLayout.marginWidth = 0;
160 			rightLayout.marginHeight = 0;
161 			rightLayout.spacing = 0;
162 			right.layout();
163 			GridLayout centerLayout = new GridLayout(2, true);
164 			center.setLayout(centerLayout);
165 			centerLayout.marginWidth = 5;
166 			centerLayout.marginHeight = 5;
167 			centerLayout.numColumns = 2;
168 			centerLayout.makeColumnsEqualWidth = false;
169 			centerLayout.horizontalSpacing = 5;
170 			centerLayout.verticalSpacing = 5;
171 			center.layout();
172 			GridLayout thisLayout = new GridLayout(1, true);
173 			this.setLayout(thisLayout);
174 			thisLayout.marginWidth = 0;
175 			thisLayout.marginHeight = 0;
176 			thisLayout.numColumns = 1;
177 			thisLayout.makeColumnsEqualWidth = false;
178 			thisLayout.horizontalSpacing = 5;
179 			thisLayout.verticalSpacing = 0;
180 			this.layout();
181 			menu1 = new Menu(getShell(),SWT.BAR);
182 			fileMenuItem = new MenuItem(menu1,SWT.CASCADE);
183 			fileMenu = new Menu(fileMenuItem);
184 			openFileMenuItem = new MenuItem(fileMenu,SWT.CASCADE);
185 			newFileMenuItem = new MenuItem(fileMenu,SWT.CASCADE);
186 			saveFileMenuItem = new MenuItem(fileMenu,SWT.CASCADE);
187 			closeFileMenuItem = new MenuItem(fileMenu,SWT.CASCADE);
188 			exitMenuItem = new MenuItem(fileMenu,SWT.CASCADE);
189 			helpMenuItem = new MenuItem(menu1,SWT.CASCADE);
190 			helpMenu = new Menu(helpMenuItem);
191 			contentsMenuItem = new MenuItem(helpMenu,SWT.CASCADE);
192 			aboutMenuItem = new MenuItem(helpMenu,SWT.CASCADE);
193 	
194 			getShell().setMenuBar(menu1);
195 	
196 			fileMenuItem.setText("File");
197 	
198 			fileMenuItem.setMenu(fileMenu);
199 	
200 			openFileMenuItem.setText("Open");
201 	
202 			newFileMenuItem.setText("New");
203 	
204 			saveFileMenuItem.setText("Save");
205 	
206 			closeFileMenuItem.setText("Close");
207 	
208 			exitMenuItem.setText("Exit");
209 	
210 			helpMenuItem.setText("Help");
211 	
212 			helpMenuItem.setMenu(helpMenu);
213 	
214 			contentsMenuItem.setText("Contents");
215 	
216 			aboutMenuItem.setText("About");
217 			addDisposeListener(new DisposeListener() {
218 				public void widgetDisposed(DisposeEvent e) {
219 					MainGUIbackground.dispose();
220 				}
221 			});
222 	
223 			postInitGUI();
224 		} catch (Exception e) {
225 			e.printStackTrace();
226 		}
227 	}
228 	/*** Add your pre-init code in here 	*/
229 	public void preInitGUI(){
230 	}
231 
232 	/*** Add your post-init code in here 	*/
233 	public void postInitGUI(){
234 	}
235 
236 	/*** Auto-generated main method */
237 	public static void main(String[] args){
238 		showGUI();
239 	}
240 
241 	/***
242 	* This static method creates a new instance of this class and shows
243 	* it inside a new Shell.
244 	*
245 	* It is a convenience method for showing the GUI, but it can be
246 	* copied and used as a basis for your own code.	*
247 	* It is auto-generated code - the body of this method will be
248 	* re-generated after any changes are made to the GUI.
249 	* However, if you delete this method it will not be re-created.	*/
250 	public static void showGUI(){
251 		try {
252 			Display display = Display.getDefault();
253 			Shell shell = new Shell(display);
254 			MainGUI inst = new MainGUI(shell, SWT.NULL);
255 			shell.setLayout(new org.eclipse.swt.layout.FillLayout());
256 			Rectangle shellBounds = shell.computeTrim(0,0,725,493);
257 			shell.setSize(shellBounds.width, shellBounds.height);
258 			shell.open();
259 			while (!shell.isDisposed()) {
260 				if (!display.readAndDispatch())
261 					display.sleep();
262 			}
263 		} catch (Exception e) {
264 			e.printStackTrace();
265 		}
266 	}
267 	/*** Auto-generated event handler method */
268 	protected void button1WidgetDefaultSelected(SelectionEvent evt){
269 	System.out.println("hola");
270 		//TODO add your handler code here
271 	}
272 
273 	/*** Auto-generated event handler method */
274 	protected void button1WidgetSelected(SelectionEvent evt){
275 		testJMS jms = new testJMS(); 
276 		jms.testjms();
277 	System.out.println("listo");
278 		//TODO add your handler code here
279 	}
280 }