hi,i have a unique problem.actually i wish to put a polarchart developed using JFreechart on the frame that already has components placed on it.What i want to do is to make the particular component overlap the polarchart.

How can i do so?
i thought of creating the polar chart using panel and then placing the above mentioned component on the panel therby placing the entire panel on the Jframe.

Do you want to see both of them at the same time or one at a time?

Do you want to see both of them at the same time or one at a time?

both at the same time


Create two panels - one for chart and another for other components.

i tried doing that but at a time only one component is visible.I want to place the component object exactly in the centre of the chart.

but just the chart appears.

here's the code snippet

JPanel mainpanel=new JPanel();
	final JPanel main = new JPanel(new BorderLayout());
        final JPanel optionsPanel = new JPanel();
 	cirarc12 c2=new cirarc12();//the component neede to be place don the top
	main.add(chartPanel, BorderLayout.CENTER);

I think i'm going wrong with the layout managers.please help..

Use NORTH attribute.


call setOpaque(false) on everything that you need to see through

Use NORTH attribute.


Doing that is still not working...i can only see the chart....may be i shouldn't be using BorderLayout here.

I am unable to help with that code posted at #5. I have a sample program.

import java.awt.*;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;

import javax.swing.*;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

public class Best extends JFrame{
    JPanel top=new JPanel();
    JPanel cen=new JPanel();
    public Best(){
          top.add(new JButton("Add"));
          top.add(new JButton("Add"));
          top.add(new JButton("Add"));

    public void run() {
        // create a dataset...
        final DefaultPieDataset data = new DefaultPieDataset();
        data.setValue("One", new Double(10.3));
        data.setValue("Two", new Double(8.5));
        data.setValue("Three", new Double(3.9));
        data.setValue("Four", new Double(3.9));
        data.setValue("Five", new Double(3.9));
        data.setValue("Six", new Double(3.9));

        // create a pie chart...
        final boolean withLegend = true;
        final JFreeChart chart = ChartFactory.createPieChart(
        final Graphics2D g2 = (Graphics2D) cen.getGraphics();
        final Rectangle2D chartArea = new Rectangle2D.Double(0, 0, 400, 300);
        chart.draw(g2, chartArea, null, null);
    public static void main(String[] args) {
        Best app = new Best();