Hi
I am new to the forum and new to J2EE. I have a JSP page which gets data from a bean which interacts with database to provide this information. The JSP then calls another bean with the data got to populate this data into a Pie Chart. That pie chart bean uses all the values and creates the pie chart and returns as a JPanel. I need to display the panel in the same window as what the JSP is running. Unfortunately I do not know how to do that. I create a JFrame and pass the panel to it it woks. But that means it throws another window other than the window on which the current JSP runs. How do I populate the pie chart in the current windo of JSP
JFrame myFrame = new JFrame("MYPie");
upsFrame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent evt)
{
System.out.println("Window closing . Will Dispose");
int ok = 0;
int cancel = 2;
int anwser = JOptionPane.showConfirmDialog((JFrame) evt.getSource(),
"Do you want to close", "information",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (anwser == ok)
{
System.out.println("Since given Yes in Joption wil dispose the Frame");
((JFrame) evt.getSource()).dispose();
}
else
{
}
}
}
);
gridPieBean.setPieChartTitle("GRID ENGINE OVERVIEW");
gridPieBean.setPieChartSubTitle("GRID ENGINE USAGE");
gridPieBean.setBGColor("#aaaaaa");
out.println("Calling to contruct a Pie Chart: ");
String myPieItems[] = new String[2]; // allocate storage
myPieItems[0] = new String(new Integer(brokerStatsPerf.getNumJobsRunning()).toString() + ",NUMJOBSRUN,ffff00");
myPieItems[1] = new String(new Integer(brokerStatsPerf.getNumTasksPending()).toString() + ",NUMJOBSPEN,ffbb00");
//myPieItems[0] = new String(new Integer(brokerStatsPerf.getNumBusyEngines()).toString() + ",BUSYENGINES,ffbb00");
//myPieItems[1] = new String(new Integer(brokerStatsPerf.getNumTotalEngines()).toString() + ",TOTALENGINES,ffff00");
myPieItems[0] = new String( "80,NUMJOBSRUN,ffff00");
myPieItems[1] = new String("20,NUMJOBSPEN,ffbb00");
gridPieBean.setPieItems(myPieItems,2);
gridPieBean.setPanelHieght(frameHieght-700);
gridPieBean.setPanelWidth(frameWidth);
gridPieBean.init();
myFrame.getContentPane().add("Center", gridPieBean);
myFrame.resize(frameHieght,frameWidth);
myFrame.show();
}
catch(Exception e)
{
System.out.println("Caught exception");
}
%>
[