Created
November 15, 2012 14:27
-
-
Save Botffy/4078872 to your computer and use it in GitHub Desktop.
compile with jcommon-1.0.16, else the chart text doesn't show
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package frech; | |
import org.eclipse.swt.SWT; | |
import org.eclipse.swt.events.*; | |
import org.eclipse.swt.graphics.*; | |
import org.eclipse.swt.widgets.*; | |
import org.eclipse.swt.layout.*; | |
import org.eclipse.swt.custom.*; | |
import org.jfree.experimental.chart.swt.*; | |
import org.jfree.data.general.*; | |
import org.jfree.chart.*; | |
import org.jfree.chart.plot.*; | |
public class Frech { | |
public static void main(String[] args) { | |
Display display = new Display(); | |
Shell shell = new Shell(display); | |
shell.setLayout(new GridLayout()); | |
CTabFolder folder = new CTabFolder(shell, SWT.TOP); | |
GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1); | |
folder.setLayoutData(gd); | |
CTabItem ti=new CTabItem(folder, SWT.NONE); | |
ti.setText("Egyes"); | |
CTabItem ti2=new CTabItem(folder, SWT.NONE); | |
ti2.setText("Kettes"); | |
CTabItem ti3=new CTabItem(folder, SWT.NONE); | |
ti3.setText("Hármas"); | |
CTabItem ti4=new CTabItem(folder, SWT.NONE); | |
ti4.setText("Chart"); | |
Text text = new Text(folder, SWT.BORDER); | |
text.setText("Ohai"); | |
ti.setControl(text); | |
ti2.setControl(text); | |
Label c3 = new Label(folder, SWT.BORDER); | |
c3.setImage(display.getSystemImage(SWT.ICON_ERROR)); | |
ti3.setControl(c3); | |
ChartComposite composite = new ChartComposite(folder, SWT.NONE); | |
DefaultPieDataset dataset = new DefaultPieDataset(); | |
dataset.setValue("Mormota", new Double(49)); | |
dataset.setValue("Cica", new Double(51)); | |
JFreeChart piechart = ChartFactory.createPieChart("Állatok", dataset, true, true, false); | |
PiePlot plot = (PiePlot) piechart.getPlot(); | |
plot.setCircular(true); | |
composite.setChart(piechart); | |
ti4.setControl(composite); | |
shell.open(); | |
while(!shell.isDisposed()) { | |
if(!display.readAndDispatch()) { | |
display.sleep(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment