wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes I am not able to display panel in my applet by embedding applet in html. Please help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "I am not able to display panel in my applet by embedding applet in html. Please help." Watch "I am not able to display panel in my applet by embedding applet in html. Please help." New topic
Author

I am not able to display panel in my applet by embedding applet in html. Please help.

arindamin ghosh
Greenhorn

Joined: Mar 28, 2011
Posts: 1
I am not able to display panel in my applet by embedding applet in html. Please help.
It is displaying draw string "sample applet 9" but the chartpanel is not being displayed.


html file:
<APPLET
CODE="SampleApplet.class"
WIDTH="700" HEIGHT="400"
ARCHIVE = "jfreechart-1.0.13.jar,jcommon-1.0.16.jar"
>
</APPLET>

applet code:
public void paint(Graphics g) {
g.drawString("sample applet 9", 100, 100);

XYDataset dataset = createDataset();
JFreeChart chart = createChart(dataset);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
chartPanel.setVisible(true);
getContentPane().add(chartPanel);
g.dispose();
g.finalize();
g = null;
//setVisible(true);
}

Advance Thanks.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4572
    
    5

Arindamin, welcome to the Ranch!

1. Any painting method override should invoke the super implementation, unless the entire area of the component is being painted in the custom painting code.

2. Painting method overrides are to be used for painting alone. Not for adding components or any other business logic.

3. Don't dispose() the passed in Graphics reference. You only need to dispose() any Graphics objects that you create in your code.

4. It is virtually never required to call finalize() in client code.

The code snippet you posted isn't enough to give more specific advice than this. To get better help sooner, post a SSCCE that clearly demonstrates your problem.

Also, please go through the Swing tutorial.


luck, db
There are no new questions, but there may be new answers.
 
GeeCON Prague 2014
 
subject: I am not able to display panel in my applet by embedding applet in html. Please help.