-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello-world-swing.pl
38 lines (27 loc) · 1020 Bytes
/
hello-world-swing.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
use warnings;
use strict;
use Java::Bridge;
use 5.10.0;
my $bridge = Java::Bridge->new('subprocess');
$bridge->setup_class('java.lang.Boolean');
my $true = Java::Bridge::java::lang::Boolean::TRUE();
my $false = Java::Bridge::java::lang::Boolean::FALSE();
my $bridge_obj = $bridge->fetch_bridge;
my $runnable = $bridge->create('uk.me.desert_island.theorbtwo.bridge.BridgedRunnable', $bridge_obj);
print $runnable, "\n";
exit;
$bridge->setup_class('javax.swing.JFrame');
Java::Bridge::javax::swing::JFrame->setDefaultLookAndFeelDecorated($false);
my $frame = $bridge->create('javax.swing.JFrame'); #, 'HelloWorldSwing');
$frame->setDefaultCloseOperation(Java::Bridge::javax::swing::JFrame::EXIT_ON_CLOSE());
$bridge->setup_class('javax.swing.JLabel');
my $label = $bridge->create('javax.swing.JLabel');
$label->setText("This\nis some text, i:\\literal\\backslashes");
$frame->getContentPane->add($label);
$frame->pack;
$frame->setVisible($true);
while (1) {
print "sleeping 5\n";
sleep 5;
}