示例#1
0
  // By default the GridBagLayout stuffs up tab ordering for the
  // borrow book and return book panes, so I need this to ensure it's all
  // the right way round.
  private void initFocusTraversalPolicy() {
    Container nearestRoot = (isFocusCycleRoot()) ? this : getFocusCycleRootAncestor();
    final FocusTraversalPolicy defaultPolicy = nearestRoot.getFocusTraversalPolicy();

    MapFocusTraversalPolicy mine = new MapFocusTraversalPolicy(defaultPolicy, tabbedPane);
    mine.putAfter(retISBN, retCustID);
    mine.putAfter(retCustID, returnButton);
    mine.putAfter(returnButton, tabbedPane);
    mine.putAfter(borISBN, borCustID);
    mine.putAfter(borCustID, borDay);
    mine.putAfter(borDay, borMonth);
    mine.putAfter(borMonth, borYear);
    mine.putAfter(borYear, borrowButton);
    mine.putAfter(borrowButton, tabbedPane);

    mine.putBefore(retCustID, retISBN);
    mine.putBefore(returnButton, retCustID);
    mine.putBefore(borCustID, borISBN);
    mine.putBefore(borDay, borCustID);
    mine.putBefore(borMonth, borDay);
    mine.putBefore(borYear, borMonth);
    mine.putBefore(borrowButton, borYear);

    mine.putTabBefore("Borrow Book", borrowButton);
    mine.putTabBefore("Return Book", returnButton);

    nearestRoot.setFocusTraversalPolicy(mine);
  }
示例#2
0
  /**
   * The start() method is called when the page containing the applet first appears on the screen.
   * The AppletWizard's initial implementation of this method starts execution of the applet's
   * thread.
   */
  public void start() {
    super.start();
    if (m_screenField == null) { // This is the code that runs if this is an applet
      m_screenField = new AppletScreen();
      m_screenField.setTask(this);
      m_screenField.setScreenFieldView(m_screenField.setupScreenFieldView(true));
      // NOTE: When an Applet Screen passes no parent, the SApplet peer is not created, set it!
      m_screenField.init(null, null, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
      // x this.addRecordOwner(m_screenField);

      this.setupLookAndFeel(null);
      Container container = this.getBottomPane();
      while (container != null) {
        if (container.getParent() == null)
          container.setFocusTraversalPolicy(
              new MyFocusTraversalPolicy()); // Set the traversal policy for an applet
        container = container.getParent();
      }
    }

    BaseScreen.makeScreenFromParams(
        this, null, m_screenField, ScreenConstants.DONT_PUSH_TO_BROWSER, null);
  }