PDA

View Full Version : Newbee. Custom component



uozturk
27 Jun 2009, 8:58 AM
Newbee to GWt.


I just developed a very simple class, to hover a text; but gwt compiler does not recognize it. It gives the error:


[ERROR] Line 10: The import ms.webclient.ui.HoverText cannot be resolved
[ERROR] Line 36: HoverText cannot be resolved to a type


here's the code:


public

class HoverText extends Text

{


public HoverText()


{


this( "" );


}




public HoverText(String text)


{



super( text );



setStyleAttribute( "cursor", "hand" );


setStyleAttribute( "color", "#0000FF" );


setStyleAttribute( "padding", "3" );


setStyleAttribute( "text-decoration", "underline" );



sinkEvents( Events.OnClick );


sinkEvents( Events.OnMouseOver );


sinkEvents( Events.OnMouseOut );




addListener( Events.OnMouseOver, new Listener<ComponentEvent>() {


publicvoid handleEvent( ComponentEvent be )


{


be.stopEvent();


setStyleAttribute( "color", "#000066" );


}


} );




addListener( Events.OnMouseOut, new Listener<ComponentEvent>() {


publicvoid handleEvent( ComponentEvent be )


{


be.stopEvent();


setStyleAttribute( "color", "#0000FF" );


}


} );

}

}

so what to do?

uozturk
27 Jun 2009, 8:59 AM
i had indented the code; why it appeared just like above :)

Shawn.in.Tokyo
27 Jun 2009, 2:16 PM
I don't think it has anything to do with the code itself.

[ERROR] Line 10: The import ms.webclient.ui.HoverText cannot be resolved

Your class is not being found. You have to get it on the classpath. How to do that depends on if you are using and IDE or running from a script.

All the Best,

Shawn

uozturk
29 Jun 2009, 12:25 PM
i figured out that the problem is my HovetText class is not located in the mycompany.myproject.client package that gwt expect it to find. but the question is; what if i want to develop such custom components as a framework out of this gwt module.