Results 1 to 5 of 5
Thread: SWT login form
- 11-28-2008, 11:28 AM #1
Member
- Join Date
- Oct 2008
- Posts
- 8
- Rep Power
- 0
- 11-28-2008, 11:55 AM #2
Everybody wants here something,what have you done so far?
- 11-28-2008, 01:08 PM #3
Member
- Join Date
- Oct 2008
- Posts
- 8
- Rep Power
- 0
package testing;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;
public class check {
Display display = new Display();
Shell shell = new Shell(display);
Label label1,label2;
Text username;
Text password;
Text text;
public check() {
shell.setLayout(new GridLayout(2, false));
shell.setText("Login form");
label1=new Label(shell, SWT.NULL);
label1.setText("User Name: ");
username = new Text(shell, SWT.SINGLE | SWT.BORDER);
username.setText("");
username.setTextLimit(30);
label2=new Label(shell, SWT.NULL);
label2.setText("Password: ");
password = new Text(shell, SWT.SINGLE | SWT.BORDER);
System.out.println(password.getEchoChar());
password.setEchoChar('*');
password.setTextLimit(30);
Button button=new Button(shell,SWT.PUSH);
button.setText("Submit");
button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String selected=username.getText();
String selected1=password.getText();
if(selected==""){
MessageBox messageBox = new MessageBox(shell, SWT.OK |
SWT.ICON_WARNING |SWT.CANCEL);
messageBox.setMessage("Enter the User Name");
messageBox.open();
}
if(selected1==""){
MessageBox messageBox = new MessageBox(shell, SWT.OK |
SWT.ICON_WARNING |SWT.CANCEL);
messageBox.setMessage("Enter the Password");
messageBox.open();
}
else{
MessageBox messageBox=new MessageBox(shell,SWT.OK|SWT.CANCEL);
messageBox.setText("Login Form");
messageBox.setMessage("Welcome:" + username.getText());
messageBox.open();
}
}
});
username.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
password.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
public static void main(String[] args) {
new check();
}
}
My requirement is if the user press "enter" key instead of "submit" button after entering the data in text message box should open
- 12-17-2008, 08:35 AM #4
Member
- Join Date
- Dec 2008
- Location
- India->Maharashta->Pune
- Posts
- 2
- Rep Power
- 0
Menubar Problem in swt
hi everybody ,
i m shreedhar (new member)
becoz of menu bar my Dialog window is not displaying on ubuntu but it is working finely on xp
if you comment createMenubar method then Dialog is displaying properly on ubutu
my client want menubar in Dialog
- 09-07-2009, 03:14 PM #5
Member
- Join Date
- Sep 2009
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
[SOLVED] How to close the current form when i open a new form?
By tpyq in forum NetBeansReplies: 6Last Post: 11-28-2008, 06:55 AM -
enctype=multipart/form-data with form data in struts
By vk_satheesh in forum New To JavaReplies: 0Last Post: 09-19-2008, 12:48 PM -
help needed regarding LOGIN form
By innocent.crook in forum New To JavaReplies: 2Last Post: 07-08-2008, 04:03 PM -
cannot open database requested in login. Login fails
By banduskank in forum JDBCReplies: 0Last Post: 06-25-2008, 12:41 PM -
can i make a login form?
By mitsakos in forum New To JavaReplies: 2Last Post: 12-19-2007, 10:14 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks