コード例 #1
0
 private void closeAll() {
   if (parent != null) {
     parent.dispose();
   }
   if (dialog != null) {
     dialog.dispose();
   }
   if (frame != null) {
     frame.dispose();
   }
   if (window != null) {
     window.dispose();
   }
 }
コード例 #2
0
  public void doTest() throws Exception {

    robot.waitForIdle(delay);

    parent.clickOpenButton(robot);
    robot.waitForIdle(delay);

    dialog.activated.waitForFlagTriggered();
    assertTrue(
        dialog.activated.flag(),
        "Dialog did not trigger " + "Window Activated event when it became visible");

    dialog.closeGained.waitForFlagTriggered();
    assertTrue(
        dialog.closeGained.flag(),
        "the 1st button did not gain focus " + "when the Dialog became visible");

    assertTrue(
        dialog.closeButton.hasFocus(),
        "the 1st button in the Dialog " + "gained focus but lost it afterwards");

    dialog.openGained.reset();

    robot.type(KeyEvent.VK_TAB);

    dialog.openGained.waitForFlagTriggered();
    assertTrue(
        dialog.openGained.flag(),
        "Tab navigation did not happen properly on Dialog. Open button "
            + "did not gain focus on tab press when parent frame is visible");

    dialog.clickOpenButton(robot);
    robot.waitForIdle(delay);

    frame.activated.waitForFlagTriggered();
    assertTrue(
        frame.activated.flag(),
        "Frame did not trigger activated when "
            + "made visible. Dialog and its parent frame are visible");

    frame.checkUnblockedFrame(robot, "Frame is the parent of a visible Dialog.");
    window.checkUnblockedWindow(robot, "Frame and its child Dialog are visible.");

    robot.waitForIdle(delay);

    EventQueue.invokeAndWait(this::closeAll);
  }
コード例 #3
0
  private void createGUI() {

    parent = new CustomFrame();
    parent.setTitle("Parent");
    parent.setLocation(50, 50);

    dialog = new CustomDialog(parent);
    dialog.setTitle("Dialog");
    dialog.setModalityType((Dialog.ModalityType) null);
    dialog.setLocation(250, 50);

    frame = new TestFrame();
    frame.setTitle("Frame");
    frame.setLocation(50, 250);

    window = new TestWindow(frame);
    window.setLocation(250, 250);

    parent.setVisible(true);
  }
コード例 #4
0
ファイル: FrameTest.java プロジェクト: JasonLil/Zong
 public static GroupFrame createFrameWithChildren() {
   // frame
   GroupFrame frame = new GroupFrame();
   frame.setPosition(new Point2f(50, 75));
   frame.setSize(new Size2f(80, 50));
   frame.setRotation(30);
   // child frame
   GroupFrame child = new GroupFrame();
   child.setPosition(new Point2f(20, 10));
   child.setSize(new Size2f(30, 20));
   child.setRotation(30);
   // child frame of child frame
   TestFrame child2 = new TestFrame();
   child2.setPosition(new Point2f(-15, -10));
   child2.setSize(new Size2f(5, 5));
   child2.setRotation(45);
   // hierarchy
   child.addChildFrame(child2);
   frame.addChildFrame(child);
   return frame;
 }
コード例 #5
0
ファイル: Test.java プロジェクト: luischavez/text-game-engine
  public Test() {
    frame.setVisible(true);
    initEngine();
    while (true) {
      String action = Context.getInstance().getReceiver().read(String.class);

      if (!world.execute(action)) {
        Context.getInstance().getSender().clear();
        Context.getInstance().getSender().send("Accion invalida!!\n");
      }
    }
  }
コード例 #6
0
  private static void createAndShowGUI() {

    drawingSurface = new DrawingSurface();
    //  controlPanel = new ControlPanel(drawingSurface);
    // drawingSurface.controlPanel = controlPanel;

    controlPanel = new TestFrame(drawingSurface);

    drawingSurface.controlPanel = controlPanel;

    System.out.println("Created GUI on EDT? " + SwingUtilities.isEventDispatchThread());
    JFrame f = new JFrame("Graphical Model");
    // Set Location

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

    f.setLocation(dim.width / 10, dim.height / 10);

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setResizable(false);
    f.add(drawingSurface);
    f.pack();

    f.setVisible(true);

    /*  JFrame controlPanelFrame = new JFrame("Control Panel");
    controlPanelFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    controlPanelFrame.add(new ControlPanel(drawingSurface));
    controlPanelFrame.setLocation(f.getLocation().x+f.getWidth(), f.getLocation().y);
    controlPanelFrame.pack();

    controlPanelFrame.setVisible(true);*/
    controlPanel.setLocation(f.getLocation().x + f.getWidth(), f.getLocation().y);

    controlPanel.pack();
    controlPanel.setVisible(true);
  }
コード例 #7
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Thread t =
       new Thread(
           new Runnable() {
             public void run() {
               while (!drawView.getOnDrawFirstCalled()) {
                 try {
                   Thread.sleep(200);
                 } catch (InterruptedException e) {
                   e.printStackTrace();
                 }
               }
               test();
             }
           });
   t.start();
 }
コード例 #8
0
 Model getModel() {
   return testFrame.getModel();
 }