< prev index next >
test/java/awt/ComponentOrientation/WindowTest.java
Print this page
*** 30,79 ****
* @build TestBundle TestBundle_es TestBundle_iw
* @build TestBundle1 TestBundle1_ar
* @run main WindowTest
*/
! import java.awt.*;
! import java.applet.*;
import java.util.Locale;
import java.util.ResourceBundle;
! public class WindowTest extends Applet {
! static Exception failure=null;
! static Thread mainThread=null;
public static void main(String args[]) throws Exception {
! mainThread = Thread.currentThread();
! WindowTest app = new WindowTest();
! app.start();
try {
! Thread.sleep(300000);
! } catch (InterruptedException e) {
! if (failure != null) {
! throw failure;
}
}
- }
-
- public void start() {
- try {
- doTest();
- } catch (Exception e) {
- failure = e;
- }
- mainThread.interrupt();
- }
! public void doTest() {
System.out.println("WindowTest {");
ResourceBundle rb;
- Frame myFrame;
// Create a window containing a hierarchy of components.
System.out.println(" Creating component hierarchy...");
- myFrame = new Frame();
myFrame.setLayout(new FlowLayout());
Panel panel1 = new Panel();
panel1.setLayout(new BorderLayout());
panel1.add("North", new Button("North"));
panel1.add("South", new Button("South"));
--- 30,71 ----
* @build TestBundle TestBundle_es TestBundle_iw
* @build TestBundle1 TestBundle1_ar
* @run main WindowTest
*/
! import java.awt.Frame;
! import java.awt.Panel;
! import java.awt.FlowLayout;
! import java.awt.BorderLayout;
! import java.awt.Button;
! import java.awt.Component;
! import java.awt.ComponentOrientation;
! import java.awt.Container;
import java.util.Locale;
import java.util.ResourceBundle;
! public class WindowTest {
public static void main(String args[]) throws Exception {
! Frame frame = new Frame();
! frame.setSize(200,200);
! frame.setVisible(true);
try {
! doTest(frame);
! } finally {
! frame.setVisible(false);
! frame.dispose();
}
}
! public static void doTest (Frame myFrame) throws Exception{
System.out.println("WindowTest {");
ResourceBundle rb;
// Create a window containing a hierarchy of components.
System.out.println(" Creating component hierarchy...");
myFrame.setLayout(new FlowLayout());
Panel panel1 = new Panel();
panel1.setLayout(new BorderLayout());
panel1.add("North", new Button("North"));
panel1.add("South", new Button("South"));
*** 113,125 ****
System.out.println(" Applying TestBundle_es and verifying...");
rb = ResourceBundle.getBundle("TestBundle", new Locale("es", ""));
myFrame.applyResourceBundle(rb);
verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT);
-
- myFrame.setVisible(false);
- myFrame.dispose();
System.out.println("}");
}
static void verifyOrientation(Component c, ComponentOrientation orient) {
--- 105,114 ----
< prev index next >