Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT SWT login form
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sachintendulkar
SWT login form
1 Answer(s)      6 years and 2 months ago
Posted in : Swing AWT



Advertisement
View Answers

November 28, 2008 at 3:49 AM


Hi friend,

Code to solve the problem :

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;

public class LoginForm {
Display display = new Display();
Shell shell = new Shell(display);
Label label1,label2;
Text username;
Text password;
Text text;

public LoginForm() {
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 LoginForm();
}
}

For more information on SWT visit to :

http://www.roseindia.net/tutorials/swt/

Thanks


Related Tutorials/Questions & Answers:
SWT login form - Swing AWT
SWT login form  Hi, I want code to create a login form in SWT. My...(2, false)); shell.setText("Login form"); label1=new Label(shell...|SWT.CANCEL); messageBox.setText("Login Form"); messageBox.setMessage
Login Form in SWT
Login Form in SWT       This section illustrates you how to create Login Form. To create a login form in SWT, the Label class set the labels User Name and Password and Text
Advertisements
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components...() { setTitle("Login Form"); setLayout(null); label1 = new JLabel
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components...; LoginDemo() { setTitle("Login Form"); setLayout(null); label1 = new
Login form and registration
Login form and registration  I need a complete code for ligin and new user registration form and validation
administrator login form
administrator login form   Hi iam using struts frame work backend as oracle .i want code for administrator login form thanks in advance
Spring login form application
Spring login form application  Hi Please give me the Spring login form application so that i can understand its flow ?   Hi please find the link of the tutorial Spring Applications
login form - JSP-Servlet
login form  Q no.1:- Creat a login form in servlets?  Hi...*; import javax.servlet.http.*; public class Login extends HttpServlet...(); pw.println(""); pw.println("Login"); pw.println(""); pw.println
login form validation - JSP-Servlet
login form validation  hi, how to validate the login form that contains user name and password using post method . the validation should not allow user to login in the address bar thanks regards, anand
Login form in jscript
Login form in jscript  For example the html script is <...; charset=utf-8" /> <title>:: validation form::</title> <script...;td align="center" valign="top"> <form name="form1" onsubmit
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
Spring alternative to Form Based Login
Spring alternative to Form Based Login  print("code sample");how can we make a server to listen to login event i.e. Authenticate a user not using jsp. Using a login form we can use the jspringsecurity_check. How can we do
Login Form
Login Form       Login form in struts: Whenever you goes to access data from... for a login form using struts. UserLoginAction Class: When you download Login
Login form
Login Form with jsp      ... of login form will really help to understand jsp page. In this  example we... are going to insert the data in the login form which will be displayed onto
Struts 2.1.8 Login Form
Struts 2.1.8 Login Form      ... to validate the login form using Struts 2 validator framework. About the example: This example will display the login form to the user. If user enters Login Name
SWT
to popup the list of Indian states.    Login Form in SWT To create a login form in SWT, the Label class set the labels User Name... shell.setLayout(new GridLayout(2, false)) sets the layout of the login form
Login Form in Java - Java Beginners
Login Form in Java  Hi, In my Project, I am using Java-JDBC-Mysql...) How to create frontage form in java to validate it. regards, Prashant...*; import java.awt.*; import java.awt.event.*; import java.sql.*; class Form
login form using java bean in eclipse
login form using java bean in eclipse  I have made a college community website but i need to implement beans to my login and contact us page. how can i do
how to login form through spring dao module
how to login form through spring dao module  here i want to chek user details in database through form by using spring dao module.please give me some reference example to me
Example of login form validation in struts2.2.1framework.
Example of login form validation in struts2.2.1 framework. In this example, we will introduce you to about the login form validation in struts2.2.1 framework. Our login form validation example does not validate the user against
getting error in your login form code
getting error in your login form code  i tried your code for login form but i am getting an error.the error is undefined index userid...   hi friend, your form's input must have following : <input type
Login form using Jsp in hibernate - Hibernate
Login form using Jsp in hibernate   Hai Friend, As I new To hibernate, I'm facing problem in My project(JSP with hibernate).. My login form... and entering into Menu Form.. plz can any one help for my problem... Thanks
How to put the image in footer in login form ?
How to put the image in footer in login form ?  Hi, how to put the image in footer in login form ?   Here is an example that shows image on footer along with Login Form in Java Swing. import javax.swing.*; import
Login Form using Ajax
Login Form using Ajax       This section provides you an easy and complete implementation of login form...;/action> Develop a Login Form Using Ajax : The GUI of the application
PHP MySQL Login Form
Login Form using PHP and MySQL: In any website generally it is mandatory to have a login form to keep your data secure. In this regard we need to have... will study how to create a login form, connect with the database server and login
Login Form with Java GUI using Netbeans
Login Form with Java GUI using Netbeans  Hi there! I'm a beginner... have different user to login? Now that I've only administrator who is able to login. But, I would like to have other user to login too such as end-user
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.  I am successfully able to create a session on successful login, but I want to display
For my website,As soon as the user is able to succesfully login, a Testimonial form appears.
For my website,As soon as the user is able to succesfully login, a Testimonial form appears.  For my website,As soon as the user is able to succesfully login, a Testimonial FORM appears in the same page. How to do. Please Help
 

 

 

DMCA.com