1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* Copyright (c) 2006 Manuel Traut and Volker Dahnke
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors: Manuel Traut and Volker Dahnke
*/
package YalpClients.SwtClient.GUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
/*
* Class LoadDialog
*
* <em></em>
*
* @author Volker Dahnke / Manuel Traut
*
* @version 1 02-04-2006<br>
*/
public class LoadDialog extends Composite{
{
//Register as a resource user - SWTResourceManager will
//handle the obtaining and disposing of resources
SWTResourceManager.registerResourceUser(this);
}
private CLabel cLabel1;
private CLabel cLabel2;
private CLabel cLabel3;
private Shell parent;
public LoadDialog(Composite parent, int style) {
super(parent, style);
this.parent=(Shell)parent;
initDialog();
}
private void initDialog(){
GridLayout thisLayout = new GridLayout();
thisLayout.makeColumnsEqualWidth = true;
this.setLayout(thisLayout);
this.setSize(300,170);
{
Composite composite = new Composite(this, SWT.NONE);
FormLayout compositeLayout = new FormLayout();
composite.setLayout(compositeLayout);
GridData compositeLData = new GridData();
compositeLData.widthHint = 287;
compositeLData.heightHint = 165;
composite.setLayoutData(compositeLData);
composite.setVisible(true);
{
cLabel3 = new CLabel(composite, SWT.LEFT);
cLabel3.setText("Copyright (c) 2006 Manuel Traut and Volker Dahnke");
FormData cLabel3LData = new FormData();
cLabel3LData.width = 300;
cLabel3LData.height = 20;
cLabel3LData.left = new FormAttachment(0, 1000, 0);
cLabel3LData.top = new FormAttachment(0, 1000, 145);
cLabel3.setLayoutData(cLabel3LData);
cLabel3.setFont(SWTResourceManager.getFont("Times", 7, 0, false, false));
}
{
cLabel2 = new CLabel(composite, SWT.CENTER);
cLabel2.setText("Loading...");
FormData cLabel2LData = new FormData();
cLabel2LData.width = 105;
cLabel2LData.height = 25;
cLabel2LData.left = new FormAttachment(0, 1000, 91);
cLabel2LData.top = new FormAttachment(0, 1000, 123);
cLabel2.setLayoutData(cLabel2LData);
cLabel2.setFont(SWTResourceManager.getFont("Times", 12, 1, false, false));
}
{
cLabel1 = new CLabel(composite, SWT.CENTER);
FormData cLabel1LData = new FormData();
cLabel1LData.width = 200;
cLabel1LData.height = 120;
cLabel1LData.left = new FormAttachment(0, 1000, 40);
cLabel1LData.top = new FormAttachment(0, 1000, 0);
cLabel1.setLayoutData(cLabel1LData);
cLabel1.setImage(new Image(this.getDisplay(),"img/yalpV2.gif"));
}
}
}
public void show(){
Point size = this.getSize();
java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y);
this.parent.setLayout(new FillLayout());
this.parent.layout();
this.parent.setBounds(shellBounds);
this.parent.open();
}
public void close(){
this.parent.close();
}
}
|