PasswordField Class

Hi guys,

Im new to vaadin so im trying some examples in the tutorial page… I encounter a problem w/ PasswordField w/c does not recognize the package class
import com.vaadin.ui.PasswordField
, what am I missing here? im using netbeans ide. Thanks.

You do not provide much information in either your Subject line or your question.

a) Did you remember the semicolon on the end of your import statement? (Simplistic I know, but good to check anyways)

b) Are you able to import other Vaadin classes? If not, then perhaps the Vaadin library is not on your
classpath
.

You should have downloaded the
vaadin-6.7.5.jar
file. That jar should be in the appropriate place for your IDE’s servlet container. Probably some kind of web content folder, in which there is a
WEB-INF
folder in which there is a
lib
folder in which you placed the jar.

I strongly suggest when starting out with Vaadin that you set your NetBeans aside, to use Eclipse Indigo. You may find that disappointing as did I – Eclipse is my least favorite IDE. But “Eclipse IDE for Java EE Developers” is the IDE of choice for Vaadin work. To that you add the very good Vaadin integration plugin. Soon after that, you may find adding JRebel to be handy as well, to avoid server restarts.

To install Eclipse, read the Book of Vaadin
chapter
or the
Fränkel book
.

Here’s my source code for a minimal example of the PasswordField component.

package com.example.dummy;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class DummyApplication extends Application {

    @Override
    public void init() {
        Window window = new Window( "Dummy Application" );

        TextField userNameField = new TextField( "User name:" );
        window.addComponent( userNameField );

        PasswordField passwordField = new PasswordField( "Password:" );
        window.addComponent( passwordField );

        Label nowLabel = new Label( new java.util.Date().toString() );
        window.addComponent( nowLabel );  // For debugging, to see when this code last ran.

        this.setMainWindow( window );

    }

}

I just did a very simple code


public void init() {
	Window mainWindow = new Window("My Vaadin Window");
        TextField username = new TextField("username:"); 
        PasswordField password = new PasswordField("password:");
        mainWindow.addComponent(username);
        mainWindow.addComponent(password);
        setMainWindow(mainWindow);
}
 

Im trying to work it out now w/ eclipse but im having problem running it on glassfish… I can start the glassfish in command line but failed to run on eclipse, error HTTP Status 404 -

btw, when I stop the glassfish via command line since it comes in bundled w/ my netbeans and run it through eclipse this is the error,
“GlassFish v3 requires a JDK 1.6 and not a JRE. Please add/select the correct JDK in the Server properties ‘Runtime Environment’ section.”
when I checked the runtime environment, only JRE is on the list, I dont know where to install JDK for glassfish using eclipse.

solved the problems w/ glassfish in eclipse… wheh! :grin:

still the problem w/ netbeans is there… :frowning:

problem solved… I installed vaadin plugin for netbeans w/c has a 6.2 version, I just replaced it w/ the latest version and viola, everything works fine. :grin: