When I include the panel in a web page, nothing appears. Here's the code.
// MyPanel.java
public class MyPanel extends Composite
{
public MyPanel ()
{
AbsolutePanel absolutePanel = new AbsolutePanel();
initWidget(absolutePanel);
Label helloLabel = new Label("Hello");
absolutePanel.add( helloLabel , 10, 10);
Label byeLabel = new Label("Goodbye");
absolutePanel.add( byeLabel , 30, 10);
}
}
// MyApp.java
public class MyApp implements EntryPoint
{
/**
* This is the entry point method.
*/
public void onModuleLoad()
{
RootPanel.get( "myappdiv" ).add( new MyPanel() );
}
}
// index.html
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="myapp/myapp.nocache.js"></script>
</head>
<body">
<div id="myappdiv"/>
</body>
</html>
If I include just one widget (no AbsolutePanel) the widget appears.
public class MyPanel extends Composite
{
public MyPanel ()
{
Label helloLabel = new Label("Hello");
initWidget( helloLabel );
}
}
Are panels (for some reason) not allowed in cases like this? AbsolutePanel is (derived) from Widget, so it seems like it should work.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4sZcoLWYsHwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment