30 * @build TestBundle TestBundle_es TestBundle_iw |
30 * @build TestBundle TestBundle_es TestBundle_iw |
31 * @build TestBundle1 TestBundle1_ar |
31 * @build TestBundle1 TestBundle1_ar |
32 * @run main WindowTest |
32 * @run main WindowTest |
33 */ |
33 */ |
34 |
34 |
35 import java.awt.*; |
35 import java.awt.Frame; |
36 import java.applet.*; |
36 import java.awt.Panel; |
|
37 import java.awt.FlowLayout; |
|
38 import java.awt.BorderLayout; |
|
39 import java.awt.Button; |
|
40 import java.awt.Component; |
|
41 import java.awt.ComponentOrientation; |
|
42 import java.awt.Container; |
37 import java.util.Locale; |
43 import java.util.Locale; |
38 import java.util.ResourceBundle; |
44 import java.util.ResourceBundle; |
39 |
45 |
40 public class WindowTest extends Applet { |
46 public class WindowTest { |
41 static Exception failure=null; |
|
42 static Thread mainThread=null; |
|
43 |
47 |
44 public static void main(String args[]) throws Exception { |
48 public static void main(String args[]) throws Exception { |
45 mainThread = Thread.currentThread(); |
49 Frame frame = new Frame(); |
46 WindowTest app = new WindowTest(); |
50 frame.setSize(200,200); |
47 app.start(); |
51 frame.setVisible(true); |
48 try { |
52 try { |
49 Thread.sleep(300000); |
53 doTest(frame); |
50 } catch (InterruptedException e) { |
54 } finally { |
51 if (failure != null) { |
55 frame.setVisible(false); |
52 throw failure; |
56 frame.dispose(); |
53 } |
|
54 } |
57 } |
55 } |
58 } |
56 |
59 |
57 public void start() { |
60 public static void doTest (Frame myFrame) throws Exception{ |
58 try { |
|
59 doTest(); |
|
60 } catch (Exception e) { |
|
61 failure = e; |
|
62 } |
|
63 mainThread.interrupt(); |
|
64 } |
|
65 |
|
66 public void doTest() { |
|
67 System.out.println("WindowTest {"); |
61 System.out.println("WindowTest {"); |
68 |
62 |
69 ResourceBundle rb; |
63 ResourceBundle rb; |
70 Frame myFrame; |
|
71 |
64 |
72 // Create a window containing a hierarchy of components. |
65 // Create a window containing a hierarchy of components. |
73 System.out.println(" Creating component hierarchy..."); |
66 System.out.println(" Creating component hierarchy..."); |
74 myFrame = new Frame(); |
|
75 myFrame.setLayout(new FlowLayout()); |
67 myFrame.setLayout(new FlowLayout()); |
76 Panel panel1 = new Panel(); |
68 Panel panel1 = new Panel(); |
77 panel1.setLayout(new BorderLayout()); |
69 panel1.setLayout(new BorderLayout()); |
78 panel1.add("North", new Button("North")); |
70 panel1.add("North", new Button("North")); |
79 panel1.add("South", new Button("South")); |
71 panel1.add("South", new Button("South")); |
113 System.out.println(" Applying TestBundle_es and verifying..."); |
105 System.out.println(" Applying TestBundle_es and verifying..."); |
114 rb = ResourceBundle.getBundle("TestBundle", new Locale("es", "")); |
106 rb = ResourceBundle.getBundle("TestBundle", new Locale("es", "")); |
115 myFrame.applyResourceBundle(rb); |
107 myFrame.applyResourceBundle(rb); |
116 verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT); |
108 verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT); |
117 |
109 |
118 |
|
119 myFrame.setVisible(false); |
|
120 myFrame.dispose(); |
|
121 System.out.println("}"); |
110 System.out.println("}"); |
122 } |
111 } |
123 |
112 |
124 static void verifyOrientation(Component c, ComponentOrientation orient) { |
113 static void verifyOrientation(Component c, ComponentOrientation orient) { |
125 |
114 |