Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package stocksalesmanager.dialogs;
- import org.eclipse.swt.SWT;
- import org.eclipse.swt.widgets.*;
- import org.eclipse.swt.layout.*;
- public class LoginForm extends Composite
- {
- private Text username;
- private Text password;
- private Button loginButton;
- public LoginForm(Composite parent, int style)
- {
- super(parent, style);
- createGUI();
- }
- public String getUsername()
- {
- return username.getText();
- }
- public String getPassword()
- {
- return password.getText();
- }
- private void createGUI()
- {
- setLayout(new GridLayout(2, false));
- // Username
- {
- new Label(this, SWT.NONE).setText("Username:");
- username = new Text(this, SWT.BORDER);
- username.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false));
- }
- // Password
- {
- new Label(this, SWT.NONE).setText("Password:");
- password = new Text(this, SWT.PASSWORD | SWT.BORDER);
- password.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false));
- }
- // Login button
- {
- GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = SWT.END;
- gridData.verticalAlignment = SWT.END;
- loginButton = new Button(this, SWT.PUSH);
- loginButton.setText("Login");
- loginButton.setLayoutData(gridData);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement