⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdialog.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   */  public JMenuBar getJMenuBar()  {    return getRootPane().getJMenuBar();  }  /**   * This method sets the JMenuBar used    * in this JDialog.   *   * @param menubar The JMenuBar to use.   */  public void setJMenuBar(JMenuBar menubar)  {    getRootPane().setJMenuBar(menubar);  }  /**   * This method sets the LayoutManager used in the JDialog.   * This method will throw an Error if rootPaneChecking is    * enabled.   *   * @param manager The LayoutManager to use.   */  public void setLayout(LayoutManager manager)  {    // Check if we're in initialization stage. If so, call super.setLayout    // otherwise, valid calls go to the content pane.    if (isRootPaneCheckingEnabled())      getContentPane().setLayout(manager);    else      super.setLayout(manager);  }  /**   * This method sets the JLayeredPane used in the JDialog.   * If the given JLayeredPane is null, then this method   * will throw an Error.   *   * @param layeredPane The JLayeredPane to use.   */  public void setLayeredPane(JLayeredPane layeredPane)  {    if (layeredPane == null)      throw new IllegalComponentStateException("layeredPane cannot be null.");    getRootPane().setLayeredPane(layeredPane);  }  /**   * This method returns the JLayeredPane used with this JDialog.   *   * @return The JLayeredPane used with this JDialog.   */  public JLayeredPane getLayeredPane()  {    return getRootPane().getLayeredPane();  }  /**   * This method returns the JRootPane used with this JDialog.   *   * @return The JRootPane used with this JDialog.   */  public JRootPane getRootPane()  {    if (rootPane == null)      setRootPane(createRootPane());    return rootPane;  }  /**   * This method sets the JRootPane used with this JDialog.   *   * @param root The JRootPane to use.   */  protected void setRootPane(JRootPane root)  {    if (rootPane != null)      remove(rootPane);    rootPane = root;    rootPane.show();    add(rootPane);  }  /**   * This method creates a new JRootPane.   *   * @return A new JRootPane.   */  protected JRootPane createRootPane()  {    return new JRootPane();  }  /**   * This method returns the ContentPane   * in the JRootPane.   *   * @return The ContentPane in the JRootPane.   */  public Container getContentPane()  {    return getRootPane().getContentPane();  }  /**   * This method sets the ContentPane to use with this   * JDialog. If the ContentPane given is null, this method   * will throw an exception.   *   * @param contentPane The ContentPane to use with the JDialog.   */  public void setContentPane(Container contentPane)  {    if (contentPane == null)      throw new IllegalComponentStateException("contentPane cannot be null.");    getRootPane().setContentPane(contentPane);  }  /**   * This method returns the GlassPane for this JDialog.   *   * @return The GlassPane for this JDialog.   */  public Component getGlassPane()  {    return getRootPane().getGlassPane();  }  /**   * This method sets the GlassPane for this JDialog.   *   * @param glassPane The GlassPane for this JDialog.   */  public void setGlassPane(Component glassPane)  {    getRootPane().setGlassPane(glassPane);  }  /**   * This method is called when a component is added to the    * the JDialog. Calling this method with rootPaneCheckingEnabled   * will cause an Error to be thrown.   *   * @param comp The component to add.   * @param constraints The constraints.   * @param index The position of the component.   */  protected void addImpl(Component comp, Object constraints, int index)  {    // If we're adding in the initialization stage use super.add.    // Otherwise pass the add onto the content pane.    if (isRootPaneCheckingEnabled())      getContentPane().add(comp, constraints, index);    else      super.addImpl(comp, constraints, index);  }  /**   * This method removes a component from the JDialog.   *   * @param comp The component to remove.   */  public void remove(Component comp)  {    // If we're removing the root pane, use super.remove. Otherwise    // pass it on to the content pane instead.    if (comp == rootPane)      super.remove(rootPane);    else       getContentPane().remove(comp);  }  /**   * This method returns whether rootPane checking is enabled.   *   * @return Whether rootPane checking is enabled.   */  protected boolean isRootPaneCheckingEnabled()  {    return rootPaneCheckingEnabled;  }  /**   * This method sets whether rootPane checking is enabled.   *   * @param enabled Whether rootPane checking is enabled.   */  protected void setRootPaneCheckingEnabled(boolean enabled)  {    rootPaneCheckingEnabled = enabled;  }  /**   * This method simply calls paint and returns.   *   * @param g The Graphics object to paint with.   */  public void update(Graphics g)  {    paint(g);  }      /**   * This method handles window events. This allows the JDialog   * to honour its default close operation.   *   * @param e The WindowEvent.   */  protected void processWindowEvent(WindowEvent e)  {    //	System.out.println("PROCESS_WIN_EV-1: " + e);    super.processWindowEvent(e);    //	System.out.println("PROCESS_WIN_EV-2: " + e);    switch (e.getID())      {      case WindowEvent.WINDOW_CLOSING:        {	  switch (getDefaultCloseOperation())	    {	    case DISPOSE_ON_CLOSE:	      {		dispose();		break;	      }	    case HIDE_ON_CLOSE:	      {		setVisible(false);		break;	      }	    case DO_NOTHING_ON_CLOSE:	      break;	    }	  break;        }      case WindowEvent.WINDOW_CLOSED:      case WindowEvent.WINDOW_OPENED:      case WindowEvent.WINDOW_ICONIFIED:      case WindowEvent.WINDOW_DEICONIFIED:      case WindowEvent.WINDOW_ACTIVATED:      case WindowEvent.WINDOW_DEACTIVATED:	break;      }  }  /**   * This method sets the action to take   * when the JDialog is closed.   *   * @param operation The action to take.   */  public void setDefaultCloseOperation(int operation)  {    /* Reference implementation allows invalid operations       to be specified.  If so, getDefaultCloseOperation       must return the invalid code, and the behaviour       defaults to DO_NOTHING_ON_CLOSE.  processWindowEvent       above handles this */    close_action = operation;  }  /**   * This method returns the action taken when   * the JDialog is closed.   *   * @return The action to take.   */  public int getDefaultCloseOperation()  {    return close_action;  }  /**   * This method returns a String describing the JDialog.   *   * @return A String describing the JDialog.   */  protected String paramString()  {    return "JDialog";  }  /**   * DOCUMENT ME!   *   * @return DOCUMENT ME!   */  public AccessibleContext getAccessibleContext()  {    if (accessibleContext == null)      accessibleContext = new AccessibleJDialog();    return accessibleContext;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -