Inline::Java

Robrt on 2003-10-15T01:46:58

I'm not a Java fan. Not even close. But there are some cool things written in it. Touchgraph is one of those cool things.

Even cooler, is using it from perl:

use Inline (
Java => 'STUDY',
STUDY => ['javax.swing.JFrame',
'com.touchgraph.graphlayout.GLPanel',
],
AUTOSTUDY => 1,
);

my $frame = new javax::swing::JFrame("foo");
my $glp = com::touchgraph::graphlayout::GLPanel->new();
$frame->getContentPane()->add($glp);
$frame->setSize(500,500);
my $tgp = $glp->getTGPanel();
$tgp->clearAll();

my $n1 = $tgp->addNode();
$n1->setType(4);
$n1->setLabel("Apple");

my $n2 = $tgp->addNode();
$n2->setType(1);
$n2->setLabel("Orange");

my $e12 = $tgp->addEdge($n1,$n2,100);

$frame->setVisible(1);
print "looping\n";
while (1) {};