我有一个使用stackpanel的类,然后在我的另一个类中调用然后在我的入口点类中调用。我的问题是如何让我的Stackpanel中显示GChart(三个面板中只有一个)。
package net.gui.client.content;
import net.gui.client.chart.ChartTuple;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.StackLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
/*
author Kenny Watts
since July 10, 2012
This class creates the stacked panels that
display the data in the main screen of the gui
*/
public class StackPanel extends StackLayoutPanel {
static int index = 0;
public static final String PANEL0NAME = "Critical Data:";
public static final String PANEL1NAME = "Supporting Data:";
public static final String PANEL2NAME = "Other Data:";
ChartTuple chartTest = new ChartTuple();
public StackPanel(int numTabs) {
super(Unit.PX);
// for (int i = 0; i < numTabs; i++) {
add(stackContent(0), PANEL0NAME, 25);
add(stackContent(1), PANEL1NAME, 25);
add(stackContent(2), PANEL2NAME, 25);
// }
showWidget(numTabs - 1);
addStyleName("body");
setAnimationDuration(500);
}
private Widget stackContent(int index) {
// String content = "This is data set numebr: " + index + ""
// + PanelUtils.randomText() + PanelUtils.randomText();
ScrollPanel p = new ScrollPanel(chartTest);
return (p);
}
}
这是我的stackpanel,这是我的图表类。
package net.gui.client.chart;
import com.googlecode.gchart.client.GChart;
/**
* Defines a bar-chart of x*x vs. x, with gridlines.
*/
public class ChartTuple extends GChart {
public ChartTuple() {
setChartTitle("<b>x<sup>2</sup> vs x</b>");
setChartSize(150, 150);
addCurve();
for (int i = 0; i < 10; i++)
getCurve().addPoint(i, i * i);
getCurve().setLegendLabel("x<sup>2</sup>");
getCurve().getSymbol().setSymbolType(SymbolType.VBAR_SOUTH);
getCurve().getSymbol().setBackgroundColor("red");
getCurve().getSymbol().setBorderColor("black");
getCurve().getSymbol().setModelWidth(1.0);
getXAxis().setAxisLabel("<b>x</b>");
getXAxis().setHasGridlines(true);
getYAxis().setAxisLabel("<b>x<sup>2</sup></b>");
getYAxis().setHasGridlines(true);
}
}
最后这是我的入门级课程:
package net.gui.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootLayoutPanel;
/**
* Main entry point class for the ISCI gui. this just add's the BasePanel to the
* rootlayoutpanel so it can be put into the HTML file.
*/
public class ISCI implements EntryPoint {
@Override
public void onModuleLoad() {
BasePanel basePanel = new BasePanel();
RootLayoutPanel.get().add(basePanel);
}
}
当我运行它时,我收到以下错误:“[ERROR] [ISCI] - 第16行:没有源代码可用于类型com.googlecode.gchart.client.GChart.SymbolType;您是否忘记继承所需的模块?”
答案 0 :(得分:0)
你是否继承了GChart gwt模块?
<inherits name='com.googlecode.gchart.GChart' />