svn-gvsig-desktop / trunk / libraries / libRaster / src-test / tmp / TestJNI.java @ 12522
History | View | Annotate | Download (1.6 KB)
1 | 11113 | nacho | package tmp; |
---|---|---|---|
2 | |||
3 | import java.awt.BorderLayout; |
||
4 | import java.awt.event.ActionEvent; |
||
5 | import java.awt.event.ActionListener; |
||
6 | import java.io.IOException; |
||
7 | |||
8 | import javax.swing.JButton; |
||
9 | import javax.swing.JFrame; |
||
10 | import javax.swing.JLabel; |
||
11 | import javax.swing.JPanel; |
||
12 | |||
13 | import es.gva.cit.jgdal.Gdal; |
||
14 | import es.gva.cit.jgdal.GdalException; |
||
15 | |||
16 | public class TestJNI extends Thread{ |
||
17 | |||
18 | public class Internal extends Thread{ |
||
19 | public void run() { |
||
20 | System.out.println("1"); |
||
21 | System.loadLibrary("jgdal"); |
||
22 | Gdal g = new Gdal();
|
||
23 | try {
|
||
24 | g.open("/home/nacho/images/03AUG23153350-M2AS-000000122423_01_P001.TIF", 0); |
||
25 | System.out.println(g.getRasterXSize() + " " + g.getRasterYSize()); |
||
26 | } catch (GdalException e) {
|
||
27 | e.printStackTrace(); |
||
28 | } catch (IOException e) { |
||
29 | e.printStackTrace(); |
||
30 | } catch (Exception e) { |
||
31 | e.printStackTrace(); |
||
32 | } |
||
33 | System.out.println("2"); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | public void run(){ |
||
38 | JFrame frame = new JFrame(); |
||
39 | frame.setSize(410, 200); |
||
40 | JPanel p = new JPanel(); |
||
41 | JLabel l = new JLabel("VENTANA PRINCIPAL"); |
||
42 | p.setLayout(new BorderLayout()); |
||
43 | JButton b = new JButton("Cerrar"); |
||
44 | b.addActionListener(new ActionListener() { |
||
45 | public void actionPerformed(ActionEvent e) { |
||
46 | System.out.println("CERRAR MAIN"); |
||
47 | } |
||
48 | }); |
||
49 | p.add(l, BorderLayout.NORTH);
|
||
50 | p.add(b, BorderLayout.CENTER);
|
||
51 | |||
52 | frame.getContentPane().add(p); |
||
53 | frame.show(); |
||
54 | |||
55 | /*while(true){
|
||
56 | try {
|
||
57 | sleep(1000);
|
||
58 | } catch (InterruptedException e) {
|
||
59 | e.printStackTrace();
|
||
60 | }
|
||
61 | System.out.println("END");
|
||
62 | }*/
|
||
63 | } |
||
64 | |||
65 | public static void main(String arg[]) { |
||
66 | TestJNI t = new TestJNI();
|
||
67 | Internal t1 = t.new Internal(); |
||
68 | t.run(); |
||
69 | t1.run(); |
||
70 | } |
||
71 | |||
72 | } |