|
What this is
Other links
The source code
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - added the following constants
*******************************************************************************/
package eclipseCon2005.KCH.AuthDemo.views;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
import eclipseCon2005.KCH.AuthDemo.Auth;
public class LoginView extends ViewPart {
public LoginView() {
super();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
public void createPartControl(Composite parent) {
Composite composite = new Composite(parent, SWT.BORDER);
GridLayout gridLayout = new GridLayout(2, false);
composite.setLayout(gridLayout);
Label label1 = new Label(composite, SWT.NONE);
label1.setText("User:");
final Text user = new Text(composite, SWT.NONE);
Label label2 = new Label(composite, SWT.NONE);
label2.setText("Password:");
final Text password = new Text(composite, SWT.PASSWORD);
Button login = new Button(composite, SWT.PUSH);
login.setText("Login");
login.setLayoutData(new GridData(GridData.FILL_HORIZONTAL,
GridData.FILL_VERTICAL, true, false, 2, 1));
login.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
if (!Auth.getInstance().login(user.getText(), password.getText())) {
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPart#setFocus()
*/
public void setFocus() {
}
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.