Results 1 to 8 of 8
Thread: jfreechart and jpanel
- 04-05-2012, 08:55 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 12
- Rep Power
- 0
- 04-05-2012, 08:57 AM #2
Re: jfreechart and jpanel
That's not enough information to offer any targeted advice. Maybe you need to understand how layout managers work; go through this Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-05-2012, 10:17 AM #3
Member
- Join Date
- Mar 2012
- Posts
- 12
- Rep Power
- 0
Re: jfreechart and jpanel
hi db
plz see the screen shot below:

the green area is the jpanel. iam using the matisse builder(netbeans platform) to develop the gui.
i have a pie chart created using jfreechart
i need to display the chart inside the panel.
after creating the piechart , i did the following
ChartPanel piechart=new ChartPanel(chart); //chart is the piechart with required values
jpanel.add(piechart);
but after executing,i dont see the chart but only the panel
- 04-05-2012, 10:56 AM #4
Re: jfreechart and jpanel
So, have you gone through the layout tutorial?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-06-2012, 12:53 PM #5
Member
- Join Date
- Mar 2012
- Posts
- 12
- Rep Power
- 0
Re: jfreechart and jpanel
db,
i went through the tutorial specifically, swings with the netbeans part...
i came across these codes:
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(someBorder);
contentPane.add(someComponent, BorderLayout.CENTER);
contentPane.add(anotherComponent, BorderLayout.PAGE_END);
topLevelContainer.setContentPane(contentPane);
The following question may be absurd for you but i cant get hold of it:
the topLevelContainer is either jFrame/jDialog/jApplet, but with refernce to the above pic(attached in my previous reply),which is the toplevelcontainer? with reference to which object iam supposed to use setContentpane() menthod?
please once again remember iam using netbeans platform.
- 04-06-2012, 02:44 PM #6
Re: jfreechart and jpanel
If you find the visual designer too difficult to use (no shame in that, it's an advanced tool, not meant for beginners, regardless of what Oracle would have you believe) it's not difficult to learn to write Swing code by hand. You'll find ample guidance in the other sections of the tutorial I gqave you a link for.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-06-2012, 03:22 PM #7
Member
- Join Date
- Mar 2012
- Posts
- 12
- Rep Power
- 0
Re: jfreechart and jpanel
db,
i found a way around it. i just copied the generated code for another component and refactored it to match my chart component.
here is the code: i have commented out the changed code.....
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(99, 99, 99)
.addComponent(jButton1)// .addComponent(chart)
.addContainerGap(146, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(69, 69, 69)
.addComponent(jButton1)//.addComponent(chart)
.addContainerGap(113, Short.MAX_VALUE))
);
- 04-06-2012, 03:43 PM #8
Similar Threads
-
JFreeChart 1.0.14
By java software in forum Java SoftwareReplies: 1Last Post: 08-10-2012, 07:46 AM -
Jfreechart
By aaruviswa in forum Web FrameworksReplies: 2Last Post: 03-17-2011, 06:51 AM -
How to add jfreechart to jPanel?
By Ypsilon IV in forum AWT / SwingReplies: 2Last Post: 12-07-2010, 06:52 AM -
[SOLVED] Little help on adding a jfreechart graph to Jpanel
By Manfizy in forum New To JavaReplies: 5Last Post: 02-25-2009, 08:01 AM -
JFreeChart 1.0.5
By levent in forum Java SoftwareReplies: 0Last Post: 05-10-2007, 05:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks