import javax.swing.JLabel;
import com.cloudgarden.resource.SWTResourceManager;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.OpenWindowListener;
import org.eclipse.swt.browser.ProgressAdapter;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
import org.eclipse.swt.browser.WindowEvent;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
/**
* This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
* Builder, which is free for non-commercial use. If Jigloo is being used
* commercially (ie, by a corporation, company or business for any purpose
* whatever) then you should purchase a license for each developer using Jigloo.
* Please visit [url=http://www.cloudgarden.com]Cloud Garden (Java Resources)[/url] for details. Use of Jigloo implies
* acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
* PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
* ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class NewComposite extends org.eclipse.swt.widgets.Composite {
{
// Register as a resource user - SWTResourceManager will
// handle the obtaining and disposing of resources
SWTResourceManager.registerResourceUser(this);
}
private Button goButton;
private CLabel Status;
private Label label1;
private Button AboutButton;
private JLabel lade2test;
private Text text1;
private Label ladetext;
private Button stopButton;
private Button forwarts;
private Button back;
private ProgressBar progressBar1;
private Button AktuButton;
private Button HomeButton;
private Browser browser1;
private CCombo addressCombo;
/**
* Auto-generated main method to display this
* org.eclipse.swt.widgets.Composite inside a new Shell.
*/
public static void main(String[] args) {
showGUI();
}
/**
* Overriding checkSubclass allows this class to extend
* org.eclipse.swt.widgets.Composite
*/
protected void checkSubclass() {
}
/**
* Auto-generated method to display this org.eclipse.swt.widgets.Composite
* inside a new Shell.
*/
public static void showGUI() {
Display display = Display.getDefault();
Shell shell = new Shell(display);
NewComposite inst = new NewComposite(shell, SWT.NULL);
Point size = inst.getSize();
shell.setLayout(new FillLayout());
shell.layout();
if (size.x == 0 && size.y == 0) {
inst.pack();
shell.pack();
} else {
Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y);
shell.setSize(shellBounds.width, shellBounds.height);
}
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
public NewComposite(org.eclipse.swt.widgets.Composite parent, int style) {
super(parent, style);
initGUI();
}
private void go() {
browser1.setUrl(addressCombo.getText());
if (addressCombo.indexOf(browser1.getUrl()) < 0)
addressCombo.add(browser1.getUrl());
}
private void initGUI() {
try {
FormLayout thisLayout = new FormLayout();
this.setLayout(thisLayout);
this.setSize(511, 387);
this.setBackground(SWTResourceManager.getColor(192, 192, 192));
{
lade2test = new JLabel();
FormData lade2testLData = new FormData();
lade2testLData.left = new FormAttachment(0, 1000, 362);
lade2testLData.top = new FormAttachment(0, 1000, 357);
lade2testLData.width = 46;
lade2testLData.height = 21;
lade2test.setLayout(null);
lade2test.setText("jLabel1");
lade2test.setOpaque(false);
lade2test.setEnabled(true);
}
{
text1 = new Text(this, SWT.NONE);
FormData text1LData = new FormData();
text1LData.width = 41;
text1LData.height = 15;
text1LData.bottom = new FormAttachment(1000, 1000, -3);
text1LData.right = new FormAttachment(1000, 1000, -126);
text1.setLayoutData(text1LData);
text1.setText("- Lade -");
text1.setVisible(true);
}
{
ladetext = new Label(this, SWT.NONE);
FormData ladetextLData = new FormData();
ladetextLData.width = 41;
ladetextLData.height = 15;
ladetextLData.bottom = new FormAttachment(1000, 1000, -3);
ladetextLData.right = new FormAttachment(1000, 1000, -70);
ladetext.setLayoutData(ladetextLData);
ladetext.setText("- Lade -");
ladetext.setBackground(SWTResourceManager.getColor(255, 255,
255));
ladetext.setVisible(false);
}
{
stopButton = new Button(this, SWT.PUSH | SWT.CENTER);
FormData stopButtonLData = new FormData();
stopButtonLData.width = 21;
stopButtonLData.height = 25;
stopButtonLData.top = new FormAttachment(0, 1000, 3);
stopButtonLData.left = new FormAttachment(0, 1000, 68);
stopButton.setLayoutData(stopButtonLData);
stopButton.setText("X");
stopButton.setBackground(SWTResourceManager.getColor(192, 192,
192));
stopButton.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_HAND));
stopButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
System.out.println("stopButton.widgetSelected, event="
+ evt);
// TODO add your code for stopButton.widgetSelected
browser1.stop();
}
});
}
{
forwarts = new Button(this, SWT.PUSH | SWT.CENTER);
FormData forwartsLData = new FormData();
forwartsLData.left = new FormAttachment(0, 1000, 42);
forwartsLData.top = new FormAttachment(0, 1000, 3);
forwartsLData.width = 25;
forwartsLData.height = 25;
forwarts.setLayoutData(forwartsLData);
forwarts.setText("->");
forwarts.setBackground(SWTResourceManager.getColor(192, 192,
192));
forwarts.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_HAND));
forwarts.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
System.out.println("forwarts.widgetSelected, event="
+ evt);
// TODO add your code for forwarts.widgetSelected
browser1.forward();
}
});
}
{
back = new Button(this, SWT.PUSH | SWT.CENTER);
FormData backLData = new FormData();
backLData.left = new FormAttachment(0, 1000, 5);
backLData.top = new FormAttachment(0, 1000, 2);
backLData.width = 37;
backLData.height = 26;
back.setLayoutData(backLData);
back.setBackground(SWTResourceManager.getColor(192, 192, 192));
back.setForeground(SWTResourceManager.getColor(0, 0, 255));
back.setBackgroundImage(SWTResourceManager
.getImage("ruckknopf.png"));
back.setImage(SWTResourceManager.getImage("ruckknopf.png"));
back.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND));
back.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
System.out.println("back.widgetSelected, event=" + evt);
// TODO add your code for back.widgetSelected
browser1.back();
}
});
}
{
AktuButton = new Button(this, SWT.PUSH | SWT.CENTER);
FormData AktuButtonLData = new FormData();
AktuButtonLData.left = new FormAttachment(0, 1000, 131);
AktuButtonLData.top = new FormAttachment(0, 1000, 3);
AktuButtonLData.width = 52;
AktuButtonLData.height = 25;
AktuButton.setLayoutData(AktuButtonLData);
AktuButton.setText("[ ]~>[*]");
AktuButton.setBackground(SWTResourceManager.getColor(192, 192,
192));
AktuButton.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_HAND));
AktuButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
System.out.println("AktuButton.widgetSelected, event="
+ evt);
// TODO add your code for AktuButton.widgetSelected
go();
}
});
}
{
HomeButton = new Button(this, SWT.PUSH | SWT.CENTER);
FormData HomeButtonLData = new FormData();
HomeButtonLData.left = new FormAttachment(0, 1000, 90);
HomeButtonLData.top = new FormAttachment(0, 1000, 3);
HomeButtonLData.width = 41;
HomeButtonLData.height = 25;
HomeButton.setLayoutData(HomeButtonLData);
HomeButton.setText("(^_^)");
HomeButton.setBackground(SWTResourceManager.getColor(192, 192,
192));
HomeButton.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_HAND));
HomeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
System.out.println("HomeButton.widgetSelected, event="
+ evt);
browser1.setUrl("google.de");
// TODO add your code for HomeButton.widgetSelected
}
});
}
{
browser1 = new Browser(this, SWT.NONE);
FormData browser1LData = new FormData();
browser1LData.left = new FormAttachment(0, 1000, 0);
browser1LData.top = new FormAttachment(0, 1000, 31);
browser1LData.width = 511;
browser1LData.height = 332;
browser1LData.bottom = new FormAttachment(1000, 1000, -24);
browser1LData.right = new FormAttachment(1000, 1000, 0);
browser1.setLayoutData(browser1LData);
browser1.setText("browser1");
browser1.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent evt) {
System.out
.println("browser1.focusGained, event=" + evt);
// TODO add your code for browser1.focusGained
}
});
browser1.addStatusTextListener(new StatusTextListener() {
public void changed(StatusTextEvent evt) {
System.out.println("browser1.changed, event=" + evt);
// TODO add your code for browser1.changed
// Status.setText(browser1);
}
});
browser1.addProgressListener(new ProgressAdapter() {
public void changed(ProgressEvent evt) {
System.out.println("browser1.changed, event=" + evt);
// TODO add your code for browser1.changed
progressBar1.setSelection(evt.current);
if (evt.current == 0)
// ladetext.setVisible(false);
text1.setVisible(false);
if (evt.current != 0)
text1.setVisible(true);
// ladetext.setVisible(true);
}
public void completed(ProgressEvent evt) {
System.out.println("browser1.completed, event=" + evt);
// TODO add your code for browser1.completed
addressCombo.setText(browser1.getUrl());
if (addressCombo.indexOf(browser1.getUrl()) < 0)
addressCombo.add(browser1.getUrl());
Status.setText("Fertig");
progressBar1.setSelection(100);
if (progressBar1.getSelection() == 100)
progressBar1.setSelection(evt.current);
if (evt.current == 0)
text1.setVisible(false);
if (evt.current != 0)
text1.setVisible(true);
}
});
}
{
AboutButton = new Button(this, SWT.PUSH | SWT.CENTER);
FormData AboutButtonLData = new FormData();
AboutButtonLData.width = 45;
AboutButtonLData.height = 21;
AboutButtonLData.bottom = new FormAttachment(1000, 1000, -1);
AboutButtonLData.right = new FormAttachment(1000, 1000, -11);
AboutButton.setLayoutData(AboutButtonLData);
AboutButton.setText("About");
AboutButton.setBackground(SWTResourceManager.getColor(192, 192,
192));
AboutButton.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_HAND));
}
{
label1 = new Label(this, SWT.NONE);
FormData label1LData = new FormData();
label1LData.left = new FormAttachment(0, 1000, 12);
label1LData.width = 35;
label1LData.height = 15;
label1LData.bottom = new FormAttachment(1000, 1000, -2);
label1.setLayoutData(label1LData);
label1.setText("Status:");
label1
.setBackground(SWTResourceManager.getColor(192, 192,
192));
}
{
Status = new CLabel(this, SWT.NONE);
FormData StatusLData = new FormData();
StatusLData.left = new FormAttachment(0, 1000, 53);
StatusLData.width = 279;
StatusLData.height = 19;
StatusLData.right = new FormAttachment(1000, 1000, -179);
StatusLData.bottom = new FormAttachment(1000, 1000, -2);
Status.setLayoutData(StatusLData);
Status.setText("statusleisteUnten");
Status
.setBackground(SWTResourceManager.getColor(255, 255,
128));
}
{
addressCombo = new CCombo(this, SWT.NONE);
addressCombo.setText("http://www.google.de/");
FormData cCombo1LData = new FormData();
cCombo1LData.left = new FormAttachment(0, 1000, 186);
cCombo1LData.top = new FormAttachment(0, 1000, 6);
cCombo1LData.width = 273;
cCombo1LData.height = 20;
cCombo1LData.right = new FormAttachment(1000, 1000, -52);
addressCombo.setLayoutData(cCombo1LData);
addressCombo.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_IBEAM));
addressCombo.setVisibleItemCount(15);
addressCombo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
if (evt.keyCode == SWT.CR)
go();
System.out.println("cCombo1.keyPressed, event=" + evt);
// TODO add your code for cCombo1.keyPressed
}
});
}
{
goButton = new Button(this, SWT.PUSH | SWT.CENTER);
FormData GoButtonLData = new FormData();
GoButtonLData.top = new FormAttachment(0, 1000, 3);
GoButtonLData.width = 42;
GoButtonLData.height = 24;
GoButtonLData.right = new FormAttachment(1000, 1000, -6);
goButton.setLayoutData(GoButtonLData);
goButton.setBackground(SWTResourceManager.getColor(192, 192,
192));
goButton.setImage(SWTResourceManager.getImage("forknopf.png"));
goButton.setGrayed(true);
goButton.setCursor(SWTResourceManager
.getCursor(SWT.CURSOR_HAND));
goButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
go();
System.out.println("goButton.widgetSelected, event="
+ evt);
// TODO add your code for goButton.widgetSelected
}
});
}
{
progressBar1 = new ProgressBar(this, SWT.NONE);
FormData progressBar1LData = new FormData();
progressBar1LData.width = 60;
progressBar1LData.height = 19;
progressBar1LData.right = new FormAttachment(1000, 1000, -60);
progressBar1LData.bottom = new FormAttachment(1000, 1000, -2);
progressBar1.setLayoutData(progressBar1LData);
progressBar1.setBackground(SWTResourceManager.getColor(192,
192, 192));
}
this.layout();
} catch (Exception e) {
e.printStackTrace();
}
}
}