~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to javax/swing/JOptionPane.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
    }
76
76
 
77
77
    /**
78
 
     * DOCUMENT ME!
 
78
     * Returns the accessible role of this object, which is always
 
79
     * {@link AccessibleRole#OPTION_PANE}.
79
80
     *
80
 
     * @return DOCUMENT ME!
 
81
     * @return the accessible role of this object
81
82
     */
82
83
    public AccessibleRole getAccessibleRole()
83
84
    {
84
 
      return null;
 
85
      return AccessibleRole.OPTION_PANE;
85
86
    }
86
87
  }
87
88
 
197
198
  public static final String WANTS_INPUT_PROPERTY = "wantsInput";
198
199
 
199
200
  /** The value returned when the inputValue is uninitialized. */
200
 
  public static Object UNINITIALIZED_VALUE = "uninitializedValue";
 
201
  public static final Object UNINITIALIZED_VALUE = "uninitializedValue";
201
202
 
202
203
  /** The icon displayed in the dialog/internal frame. */
203
204
  protected Icon icon;
236
237
  protected boolean wantsInput;
237
238
 
238
239
  /** The common frame used when no parent is provided. */
239
 
  private static Frame privFrame = SwingUtilities.getOwnerFrame();
 
240
  private static Frame privFrame = (Frame) SwingUtilities.getOwnerFrame(null);
240
241
 
241
242
  /**
242
243
   * Creates a new JOptionPane object using a message of "JOptionPane
369
370
    inputValue = UNINITIALIZED_VALUE;
370
371
    value = UNINITIALIZED_VALUE;
371
372
 
372
 
    // FIXME: This dialog should be centered on the parent
373
 
    // or at the center of the screen (if the parent is null)
374
 
    // Need getGraphicsConfiguration to return non-null in
375
 
    // order for that to work so we know how large the 
376
 
    // screen is.
377
373
    dialog.getContentPane().add(this);
378
374
    dialog.setModal(true);
379
375
    dialog.setResizable(false);
380
 
 
 
376
    dialog.pack();
 
377
    dialog.setLocationRelativeTo(parentComponent);
 
378
    
381
379
    return dialog;
382
380
  }
383
381
 
860
858
  {
861
859
    JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
862
860
    JDialog dialog = pane.createDialog(parentComponent, "Select an Option");
863
 
 
864
 
    dialog.pack();
865
861
    dialog.show();
866
862
    
867
863
    if (pane.getValue() instanceof Integer)
888
884
  {
889
885
    JOptionPane pane = new JOptionPane(message, PLAIN_MESSAGE, optionType);
890
886
    JDialog dialog = pane.createDialog(parentComponent, title);
891
 
    dialog.pack();
892
887
    dialog.show();
893
888
 
894
889
    if (pane.getValue() instanceof Integer)
916
911
  {
917
912
    JOptionPane pane = new JOptionPane(message, messageType, optionType);
918
913
    JDialog dialog = pane.createDialog(parentComponent, title);
919
 
    dialog.pack();
920
914
    dialog.show();
921
915
 
922
916
    if (pane.getValue() instanceof Integer)
946
940
  {
947
941
    JOptionPane pane = new JOptionPane(message, messageType, optionType, icon);
948
942
    JDialog dialog = pane.createDialog(parentComponent, title);
949
 
    dialog.pack();
950
943
    dialog.show();
951
944
 
952
945
    if (pane.getValue() instanceof Integer)
972
965
    JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
973
966
    pane.setWantsInput(true);
974
967
    JDialog dialog = pane.createDialog(parentComponent, null);
975
 
    dialog.pack();
976
968
    dialog.show();
977
969
    
978
970
    return (String) pane.getInputValue();
999
991
    pane.setInitialSelectionValue(initialSelectionValue);
1000
992
    pane.setWantsInput(true);
1001
993
    JDialog dialog = pane.createDialog(parentComponent, null);
1002
 
    dialog.pack();
1003
994
    dialog.show();
1004
995
    
1005
996
    return (String) pane.getInputValue();
1025
1016
    JOptionPane pane = new JOptionPane(message, messageType);
1026
1017
    pane.setWantsInput(true);
1027
1018
    JDialog dialog = pane.createDialog(parentComponent, title);
1028
 
    dialog.pack();
1029
1019
    dialog.show();
1030
1020
    
1031
1021
    return (String) pane.getInputValue();
1058
1048
    pane.setSelectionValues(selectionValues);
1059
1049
    pane.setInitialSelectionValue(initialSelectionValue);
1060
1050
    JDialog dialog = pane.createDialog(parentComponent, title);
1061
 
    dialog.pack();
1062
1051
    dialog.show();
1063
1052
    
1064
1053
    return pane.getInputValue();
1079
1068
    JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
1080
1069
    pane.setWantsInput(true);
1081
1070
    JDialog dialog = pane.createDialog(null, null);
1082
 
    dialog.pack();
1083
1071
    dialog.show();
1084
1072
    
1085
1073
    return (String) pane.getInputValue();
1104
1092
    pane.setWantsInput(true);
1105
1093
    pane.setInitialSelectionValue(initialSelectionValue);
1106
1094
    JDialog dialog = pane.createDialog(null, null);
1107
 
    dialog.pack();
1108
1095
    dialog.show();
1109
1096
    
1110
1097
    return (String) pane.getInputValue();
1409
1396
  {
1410
1397
    JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE);
1411
1398
    JDialog dialog = pane.createDialog(parentComponent, null);
1412
 
    dialog.pack();
1413
1399
    dialog.show();   
1414
1400
  }
1415
1401
 
1428
1414
  {
1429
1415
    JOptionPane pane = new JOptionPane(message, messageType);
1430
1416
    JDialog dialog = pane.createDialog(parentComponent, title);
1431
 
    dialog.pack();
1432
1417
    dialog.show();
1433
1418
  }
1434
1419
 
1449
1434
    JOptionPane pane = new JOptionPane(message, messageType);
1450
1435
    pane.setIcon(icon);
1451
1436
    JDialog dialog = pane.createDialog(parentComponent, title);
1452
 
    dialog.pack();
1453
1437
    dialog.show();
1454
1438
  }
1455
1439
 
1479
1463
                                       options, initialValue);
1480
1464
 
1481
1465
    JDialog dialog = pane.createDialog(parentComponent, title);
1482
 
    dialog.pack();
1483
1466
    dialog.show();
1484
1467
 
1485
1468
    if (pane.getValue() instanceof Integer)
1493
1476
  public void updateUI()
1494
1477
  {
1495
1478
    setUI((OptionPaneUI) UIManager.getUI(this));
1496
 
    invalidate();
1497
1479
  }
1498
1480
 
1499
1481
  /**