Menu

[r3057]: / trunk / ch.sahits.codegen.test / fragments / headless_test / Taz3.java  Maximize  Restore  History

Download this file

234 lines (204 with data), 7.6 kB

  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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
package ch.sahits;
import java.util.Iterator;
import java.util.Vector;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
public class Taz {
private Display display = new Display();
private Shell shell = new Shell(display);
private String date="20080809";
private String date="20080809";
private String date="20080809";
private String date="20080809";
private String date="20080809";
private String date="20080809";
private String date="20080809";
private String date="20080809";
private String date="20080809";
private Label lbl;
private Text txtUsername;
private Label lbl1;
private Text txtPassword;
private Label lbl2;
private Text txtDescription;
private Label lbl3;
private Composite checkCreditComp;
private Button checkCredit;
private Button checkCredit1;
private Button checkCredit2;
private Label lbl4;
private List listTop5;
private Label lbl5;
private Combo comboTop3;
private Label lbl6;
private Composite fupFileComp;
private Text fupFile;
private Button btnBrowseFile;
private Label lbl7;
private Composite checkZutatComp;
private Button checkZutat;
private Button checkZutat1;
private Button checkZutat2;
private Button btnInput3;
private Button btnInput31;
/**
* Default constructor initializes this GUI element
*/
public Taz(){
createControl(getShell());
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
// If no more entries in event queue
display.sleep();
}
}
display.dispose();
}
/**
* Create all the field instances
* @param parent container
*/
private void init(Composite parent){
lbl = new Label(parent,SWT.NULL);
txtUsername = new Text(parent,SWT.BORDER | SWT.SINGLE);
lbl1 = new Label(parent,SWT.NULL);
txtPassword = new Text(parent,SWT.BORDER | SWT.PASSWORD);
lbl2 = new Label(parent,SWT.NULL);
txtDescription = new Text(parent,SWT.BORDER | SWT.WRAP| SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
lbl3 = new Label(parent,SWT.NULL);
checkCreditComp = new Composite(parent,SWT.NULL);
checkCredit = new Button(parent,SWT.CHECK);
checkCredit1 = new Button(parent,SWT.CHECK);
checkCredit2 = new Button(parent,SWT.CHECK);
lbl4 = new Label(parent,SWT.NULL);
listTop5 = new org.eclipse.swt.widgets.List(parent,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
lbl5 = new Label(parent,SWT.NULL);
comboTop3 = new Combo(parent,SWT.DROP_DOWN);
lbl6 = new Label(parent,SWT.NULL);
fupFileComp = new Composite(parent,SWT.NULL);
fupFile = new Text(parent,SWT.BORDER | SWT.SINGLE);
btnBrowseFile = new Button(parent,SWT.PUSH);
lbl7 = new Label(parent,SWT.NULL);
checkZutatComp = new Composite(parent,SWT.NULL);
checkZutat = new Button(parent,SWT.CHECK);
checkZutat1 = new Button(parent,SWT.CHECK);
checkZutat2 = new Button(parent,SWT.CHECK);
btnInput3 = new Button(parent,SWT.PUSH);
btnInput31 = new Button(parent,SWT.PUSH);
}
/**
* Retrive the shell of this GUI element
* @return shell
*/
private Shell getShell(){
return shell;
}
/**
* Set the control up with the layout and the input fields
*/
private void createControl(Composite composite) {
Composite container = shell;//new Composite(composite, SWT.NULL);
init(container);
container.setFont(composite.getFont());
GridLayout layout = new GridLayout();
container.setLayout(layout);
int nColumns = 4;
layout.numColumns = nColumns;
layout.verticalSpacing = 9;
// Create the different elements
createInput(container, lbl, txtUsername, "User name:", true, true,
true, "", "");
createPassword(container, lbl1, txtPassword, "Password:", true, true,
true, "", "");
createTextArea(container, lbl2, txtDescription, "Description:", true,
true, true, "", "Some text");
{
Button[] btns = {checkCredit, checkCredit1, checkCredit2};
String[] text = {"Mastercard", "Visa", "AmericanExpress"};
String[] tooltip = {"", "", ""};
boolean[] visible={true, true, true};
boolean[] editable={true, true, true};
boolean[] selected ={true, false, false};
createRadioButtons(container,checkCreditComp, lbl3, btns, "Credit card:", text,
tooltip, visible, editable,selected);
}
{
Vector<String> l = new Vector<String>();l.add("Heino");l.add("Michael Jackson");l.add("Tom Waits");l.add("Nina Hagen");l.add("Marianne Rosenberg");
createList(container, lbl4, listTop5, "Artists:", true, true,
true, "", l, true);
}
{
Vector<String> l = new Vector<String>();l.add("Prince");l.add("Wired Al");l.add("R.E.M.");l.add("Red Hot chilli Peppers");l.add("Wham");
createCombo(container, lbl5, comboTop3, "More Artists", true,
true, true, "",
-1, l);
}
Vector<String> l = new Vector<String>();l.add("text/*");
{
String[] accType = {"text/*"};
createFileBrowse(container, fupFileComp, lbl6, fupFile, btnBrowseFile, "File upload:", true,
true, true, "", "Search",
"Search", accType);
}
{
Button[] btns = {checkZutat, checkZutat1, checkZutat2};
String[] text = {"salami", "funghi", "anchovi"};
String[] tooltip = {"", "", ""};
boolean[] visible={true, true, true};
boolean[] editable={true, true, true};
boolean[] selected ={false, false, false};
createCheckBoxes(container,checkZutatComp, lbl7, btns, "Topping:",text,
tooltip , visible, editable, selected);
}
createButton(container, btnInput3, " Save ", "",
true, true);createResetButton(container, btnInput31, " Cancel", "",
true, true);
}
/**
* Create a button
* @param parent container
* @param btn Button
* @param btnText button text
* @param tooltip button tooltip
* @param visible is the button visible
* @param editable is the button cklickable
*/
private void createButton(Composite parent,Button btn,String btnText,String tooltip,boolean visible,boolean editable) {
btn.setText(btnText);
btn.setToolTipText(tooltip);
btn.setEnabled(editable);
btn.setVisible(visible);
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// set the default data
}
});
}
/**
* Create a reset buttonbutton
* @param parent container
* @param btn Button
* @param btnText button text
* @param tooltip button tooltip
* @param visible is the button visible
* @param editable is the button cklickable
*/
private void createResetButton(Composite parent,Button btn,String btnText,String tooltip,boolean visible,boolean editable) {
btn.setText(btnText);
btn.setToolTipText(tooltip);
btn.setEnabled(editable);
btn.setVisible(visible);
btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// set the default data
}
});
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.