示例#1
0
  /**
   * Create a new LibraryUI object - showing an authentication dialog then bringing up the main
   * window.
   */
  public LibraryUI() {
    super("JDBC Library");
    // Uncomment the following if you'd rather not see everything in bold
    // UIManager.put("swing.boldMetal", Boolean.FALSE);

    // Initialise everything
    initActions();
    initUI();
    initFocusTraversalPolicy();
    setSize(600, 600);

    // Show Authentication dialog
    AuthDialog ad = new AuthDialog(this, "Authentication");
    ad.setVisible(true);
    String userName = ad.getUserName();
    String password = ad.getDatabasePassword();

    // Create data model
    model = new LibraryModel(this, userName, password);

    // Center window on screen
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    Point center = ge.getCenterPoint();
    setLocation(center.x - getSize().width / 2, center.y - getSize().height / 2);

    // Show ourselves
    setVisible(true);
  }
示例#2
0
 public void ajustaFrameTela() {
   // ajusta o jframe corretamente na tela...
   this.setSize(
       GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getSize());
 }