I've created a panel (AbsolutePanel) with a few widgets on it. They interact with one another (and with a backed via RPC).
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.