Modifiable JOptionPane : OptionPane « Swing JFC « Java






Modifiable JOptionPane

    
/*
 * $Id: ModifiableJOptionPane.java,v 1.1.1.1 2005/04/07 18:36:21 pocho Exp $
 */


import java.awt.Component;
import java.awt.HeadlessException;

import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;


/**
 * {@link javax.swing.JOptionPane} that can be modified for creating resizable
 * dialogs and so on. Default implementation of {@link javax.swing.JOptionPane}
 * creates allways unresizable dialog.
 * 
 * @version $Name:  $ - $Revision: 1.1.1.1 $ - $Date: 2005/04/07 18:36:21 $
 */
public class ModifiableJOptionPane extends JOptionPane {
  
  private boolean resizable;

  public ModifiableJOptionPane() {
    super();
  }

  /**
   * @param message
   */
  public ModifiableJOptionPane(Object message) {
    super(message);
  }

  /**
   * @param message
   * @param messageType
   */
  public ModifiableJOptionPane(Object message, int messageType) {
    super(message, messageType);
  }

  /**
   * @param message
   * @param messageType
   * @param optionType
   */
  public ModifiableJOptionPane(Object message, int messageType, int optionType) {
    super(message, messageType, optionType);
  }

  /**
   * @param message
   * @param messageType
   * @param optionType
   * @param icon
   */
  public ModifiableJOptionPane(Object message, int messageType, int optionType,
                              Icon icon) {
    super(message, messageType, optionType, icon);
  }

  /**
   * @param message
   * @param messageType
   * @param optionType
   * @param icon
   * @param options
   */
  public ModifiableJOptionPane(Object message, int messageType, int optionType,
                              Icon icon, Object[] options) {
    super(message, messageType, optionType, icon, options);
  }

  /**
   * @param message
   * @param messageType
   * @param optionType
   * @param icon
   * @param options
   * @param initialValue
   */
  public ModifiableJOptionPane(Object message, int messageType, int optionType,
                              Icon icon, Object[] options, Object initialValue) {
    super(message, messageType, optionType, icon, options, initialValue);
  }

  
  /**
   * @see javax.swing.JOptionPane#createDialog(java.awt.Component, java.lang.String)
   */
  public JDialog createDialog(Component parentComponent, String title)
      throws HeadlessException {
    JDialog dialog = super.createDialog(parentComponent, title);
    dialog.setResizable(isResizable());
    return dialog;
  }
  
  
  /**
   * @see javax.swing.JOptionPane#createInternalFrame(java.awt.Component, java.lang.String)
   */
  public JInternalFrame createInternalFrame(Component parentComponent,
                                            String title) {
    JInternalFrame frame = super.createInternalFrame(parentComponent, title);
    frame.setResizable(isResizable());
    return frame;
  }
  
  public void setResizable(boolean b) {
    this.resizable = b;
  }
  
  public boolean isResizable() {
    return resizable;
  }
}

   
    
    
    
  








Related examples in the same category

1.A Program that Uses the JOptionPane Class to Get User Input
2.Demonstrates JoptionPaneDemonstrates JoptionPane
3.OptionPane Sample: simple dialogOptionPane Sample: simple dialog
4.JOptionPane demoJOptionPane demo
5.JOptionPane utilities
6.Simple Input DialogSimple Input Dialog
7.Demonstrate JOptionPaneDemonstrate JOptionPane
8.Display error message dialog with JOptionPane.ERROR_MESSAGE
9.Display warning message dialog with JOptionPane.WARNING_MESSAGE
10.Display question message dialog with JOptionPane.QUESTION_MESSAGE
11.Display information message dialog with JOptionPane.INFORMATION_MESSAGE
12.Show a message dialog with JOptionPane
13.Create a message dialog box with different options
14.Show message in two lines in a dialog box
15.Modal dialog with yes/no button
16.Modal dialog with OK/cancel and a text field
17.Wait (forever) for a non-null click and then quit
18.Create a Confirm Dialog Box
19.Create a Message Dialog Box
20.Use a JOptionPane
21.Yes no cancel dialog
22.OK cancel option dialog
23.Dialog with default options
24.Localize a JOptionPane dialog
25.Customize JOptionPane buttons
26.Exercise Options
27.Message dialog helperMessage dialog helper
28.Exercise all JOptionPane based dialogs