Using jar file in Cocoa application
Using jar file in Cocoa application
- Subject: Using jar file in Cocoa application
- From: Aidas Dailide <email@hidden>
- Date: Sun, 16 Nov 2003 22:18:28 +0200
Hello,
I am trying to use jChart Java library in my Cocoa Objective-C
application. Unfortunately I have found many problems. I have no idea
how to "instantiate" Java objects. Could anyone give me example? For
example I have Java class org.jCharts.nonAxisChart.PieChart2D and it
has constructor PieChart2D(IPieChartDataSet iPieChartDataSet,
LegendProperties legendProperties,ChartProperties chartProperties,
int pixelWidth, int pixelHeight). How could I "instantiate" it?
Here is what I wrote so far:
id path=[NSJavaVirtualMachine defaultVirtualMachine];
[[NSJavaVirtualMachine alloc] initWithClassPath:
[[NSJavaVirtualMachine defaultClassPath]
stringByAppendingString:@"/jcharts.jar"]];
id
prop1=[[NSClassFromString(@"org.jCharts.properties.PieChart2DProperties"
) alloc] init];
id
data=[[NSClassFromString(@"org.jCharts.chartData.PieChartDataSet")
alloc] init];
id
chart=[[NSClassFromString(@"org.jCharts.nonAxisChart.PieChart2D")
alloc] init];
[chart PieChart2D:data
:[[NSClassFromString(@"org.jCharts.properties.LegendProperties") alloc]
init] :[[NSClassFromString(@"org.jCharts.properties.ChartProperties")
alloc] init] :450 :450];
static int RGB=1;
id img=[[NSClassFromString(@"java.swing.image") alloc] init];
[chart setGraphics2D:[[NSGraphicsContext currentContext]
graphicsPort]];
[chart render];
[[NSGraphicsContext currentContext] flushGraphics];
Thank you very much!
Aidas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.