import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class Startfenster {
Text ueberblick, chatfenster, eingabe;
Button chateingabe, senden, neuesSpiel, rundruf, lobby;
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Startfenster().createShell(display);
shell.setSize(600, 400);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
public Shell createShell(final Display display) {
final Shell shell = new Shell(display);
shell.setText("Startfenster");
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
shell.setLayout(gridLayout);
Composite links = new Composite(shell, SWT.NONE);// BORDER, H_SCROLL and V_SCROLL
GridLayout grid2 = new GridLayout();
grid2.numColumns = 2;
links.setLayout(grid2);
ueberblick = new Text(links, SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
GridData gridDataUeberblick = new GridData(GridData.FILL, GridData.CENTER, true,true);
gridDataUeberblick.widthHint = 400;
gridDataUeberblick.heightHint = 200;
gridDataUeberblick.horizontalSpan = 2;
gridDataUeberblick.grabExcessVerticalSpace = true;
gridDataUeberblick.horizontalAlignment = GridData.FILL;
gridDataUeberblick.verticalAlignment = GridData.FILL;
gridDataUeberblick.grabExcessHorizontalSpace = true;
ueberblick.setText("Ueberblick der Tische");
ueberblick.setBackground(Color.BLUE);
ueberblick.setLayoutData(gridDataUeberblick);
chatfenster = new Text(links, SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
GridData gridData3 = new GridData(GridData.FILL, GridData.CENTER, true, true);
gridData3.widthHint = 400;
gridData3.heightHint = 75;
gridData3.horizontalSpan = 2;
gridData3.grabExcessVerticalSpace = true;
gridData3.horizontalAlignment = GridData.FILL;
gridData3.verticalAlignment = GridData.FILL;
gridData3.grabExcessHorizontalSpace = true;
chatfenster.setText("Joe: Hey Leute, will denn keiner spielen?\nHalle Berry: nee, kein Bock auf dich\nBob: ich aber. Komm an Tisch 45");
chatfenster.setLayoutData(gridData3);
Text eingabe = new Text(links, SWT.BORDER); // BORDER, H_SCROLL, V_SCROLL, MULTI,SINGLE, READ_ONLY and WRAP
GridData gridData4 = new GridData(GridData.FILL, GridData.CENTER, true, true);
gridData4.widthHint = 300;
gridData4.heightHint = 50;
eingabe.setText("Eingabe...");
gridData4.horizontalSpan = 1;
gridData4.widthHint = 260;
gridData4.heightHint = 20;
eingabe.setTextLimit(30);// max Anzahl an Zeichen
eingabe.setLayoutData(gridData4);
senden = new Button(links, SWT.PUSH);
// gridData4.widthHint = 30;
senden.setText("senden");
senden.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_END));
Composite rechts = new Composite(shell, SWT.NONE);// BORDER, H_SCROLL and V_SCROLL
GridLayout gridRechts = new GridLayout();
gridRechts.numColumns = 1;
rechts.setLayout(gridRechts);
// rest.setBounds(400,10,380,240);
GridData buttons = new GridData(GridData.CENTER, GridData.CENTER, true, true);
buttons.widthHint = 100;
Button neuesSpiel = new Button (rechts, SWT.PUSH);
neuesSpiel.setText("Neues Spiel");
neuesSpiel.setLayoutData(buttons);
Button rundruf = new Button (rechts, SWT.PUSH);
rundruf.setText("Rundruf");
rundruf.setLayoutData(buttons);
Text lobby = new Text(rechts, SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.READ_ONLY); // BORDER, H_SCROLL, V_SCROLL, MULTI,SINGLE, READ_ONLY and WRAP
GridData gridLobby = new GridData(GridData.FILL, GridData.CENTER, true, true);
gridLobby.widthHint = 100;
gridLobby.heightHint = 250;
gridLobby.grabExcessVerticalSpace = true;
gridLobby.verticalAlignment = GridData.FILL;
lobby.setText("Lobby\n\nPlayer1\nRedZac\nFlitzer\nBob\nJoe");
lobby.setLayoutData(gridLobby);
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent arg0) {
}
});
shell.pack();
return shell;
}
}