test/jdk/javax/swing/JToolTip/4644444/bug4644444.java
author ssadetsky
Wed, 03 Apr 2019 15:43:25 -0700
branchJDK-8200758-branch
changeset 57303 eff0cf668c29
parent 47216 71c04702a3d5
permissions -rw-r--r--
8221876:[macOS] JPackage install takes long time Reviewed-by: almatvee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30449
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     1
/*
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     2
 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     4
 *
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     8
 *
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    13
 * accompanied this code).
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    14
 *
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    18
 *
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    21
 * questions.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    22
 */
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    23
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    24
import java.awt.*;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    25
import javax.swing.*;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    26
import java.awt.event.*;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    27
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    28
/*
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    29
 * test
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    30
 * @bug  4644444 8076246
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    31
*/
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    32
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    33
public class bug4644444 extends JApplet {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    34
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    35
        JPanel panel;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    36
        JButton button;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    37
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    38
        public bug4644444() throws Exception {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    39
            java.awt.EventQueue.invokeLater( () -> {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    40
                panel = new JPanel();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    41
                button = new JButton("whooo");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    42
                button.setToolTipText("Somthing really long 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    43
                panel.add(button);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    44
                getContentPane().add(panel);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    45
            });
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    46
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    47
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    48
    public void init() {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    49
                String[][] instructionsSet =
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    50
                {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    51
                        {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    52
                                " Note : Incase of Assertion failure,user can enter",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    53
                                " remarks by pressing 'Assertion Fail Remarks ' button",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    54
                                " ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    55
                                " You would see a testframe with a Button",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    56
                        " ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    57
                                " ON ALL PLATFORMS",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    58
                        "1. Move the mouse on the button, ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    59
                        "   so that the tooltip attached to it comes up ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    60
                        "2. Tool tip should get adjusted it-self to show ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    61
                        "       its full length of text. ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    62
                        "3. If tooltip  text gets cut, ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    63
                        "   press 'Assertion Fail' else press 'Assertion Pass'",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    64
                        "4. Similarly, move the applet to different locations of the screen, ",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    65
                        "   & see if tooltip works properly everywhere. "
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    66
                        }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    67
                };
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    68
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    69
                String[] exceptionsSet =
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    70
                {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    71
                        "JToolTip is shown partially when placed very close to screen boundaries",
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    72
                };
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    73
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    74
                Sysout.setInstructionsWithExceptions(instructionsSet,exceptionsSet);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    75
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    76
        }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    77
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    78
        public void start (){}
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    79
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    80
        public void destroy(){
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    81
            if(Sysout.failStatus())    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    82
                String failMsg = Sysout.getFailureMessages();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    83
                failMsg = failMsg.replace('\n',' ');
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    84
                throw new RuntimeException(failMsg);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    85
            }// End destroy
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    86
        }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    87
}
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    88
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    89
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    90
/****************************************************
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    91
 Standard Test Machinery
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    92
 DO NOT modify anything below -- it's a standard
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    93
  chunk of code whose purpose is to make user
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    94
  interaction uniform, and thereby make it simpler
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    95
  to read and understand someone else's test.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    96
 ****************************************************/
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    97
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    98
/**
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
    99
 This is part of the standard test machinery.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   100
 It creates a dialog (with the instructions), and is the interface
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   101
  for sending text messages to the user.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   102
 To print the instructions, send an array of strings to Sysout.createDialog
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   103
  WithInstructions method.  Put one line of instructions per array entry.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   104
 To display a message for the tester to see, simply call Sysout.println
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   105
  with the string to be displayed.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   106
 This mimics System.out.println but works within the test harness as well
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   107
  as standalone.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   108
 */
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   109
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   110
class Sysout
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   111
 {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   112
   private static TestDialog dialog;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   113
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   114
   public static void createDialogWithInstructions( String[] instructions )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   115
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   116
      dialog = new TestDialog( new Frame(), "Instructions" );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   117
      dialog.printInstructions( instructions );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   118
      dialog.show();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   119
      println( "Any messages for the tester will display here." );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   120
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   121
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   122
   public static void createDialog( )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   123
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   124
      dialog = new TestDialog( new Frame(), "Instructions" );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   125
      String[] defInstr = { "Instructions will appear here. ", "" } ;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   126
      dialog.printInstructions( defInstr );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   127
      dialog.show();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   128
      println( "Any messages for the tester will display here." );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   129
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   130
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   131
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   132
   public static void printInstructions( String[] instructions )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   133
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   134
      dialog.printInstructions( instructions );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   135
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   136
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   137
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   138
   public static void println( String messageIn )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   139
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   140
      dialog.displayMessage( messageIn );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   141
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   142
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   143
   public static void setInstructionsWithExceptions(String instructionsSet[][],
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   144
                                                    String exceptionsSet[]) {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   145
       createDialogWithInstructions(instructionsSet[0]);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   146
       dialog.setInstructions(instructionsSet);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   147
       dialog.setExceptionMessages(exceptionsSet);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   148
   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   149
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   150
   public static String getFailureMessages()   {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   151
       return dialog.failureMessages;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   152
   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   153
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   154
   public static boolean failStatus()  {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   155
       return dialog.failStatus;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   156
   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   157
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   158
 }// Sysout  class
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   159
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   160
/**
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   161
  This is part of the standard test machinery.  It provides a place for the
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   162
   test instructions to be displayed, and a place for interactive messages
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   163
   to the user to be displayed.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   164
  To have the test instructions displayed, see Sysout.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   165
  To have a message to the user be displayed, see Sysout.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   166
  Do not call anything in this dialog directly.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   167
  */
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   168
class TestDialog extends Dialog
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   169
 {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   170
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   171
   TextArea instructionsText;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   172
   TextArea messageText;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   173
   int maxStringLength = 70;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   174
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   175
   Panel assertPanel;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   176
   Button assertPass,assertFail,remarks;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   177
   HandleAssert handleAssert;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   178
   boolean failStatus=false;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   179
   int instructionCounter=0;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   180
   String instructions[][];
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   181
   int exceptionCounter=0;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   182
   String exceptionMessages[];
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   183
   String failureMessages="<br>";
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   184
   String remarksMessage=null;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   185
   RemarksDialog remarksDialog;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   186
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   187
   //DO NOT call this directly, go through Sysout
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   188
   public TestDialog( Frame frame, String name )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   189
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   190
      super( frame, name );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   191
      int scrollBoth = TextArea.SCROLLBARS_BOTH;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   192
      instructionsText = new TextArea( "", 14, maxStringLength, scrollBoth );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   193
      add( "North", instructionsText );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   194
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   195
      messageText = new TextArea( "", 3, maxStringLength, scrollBoth );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   196
      add("Center", messageText);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   197
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   198
      assertPanel = new Panel(new FlowLayout());
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   199
      assertPass=new Button("Assertion Pass");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   200
      assertPass.setName("Assertion Pass");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   201
      assertFail=new Button("Assertion Fail");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   202
      assertFail.setName("Assertion Fail");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   203
      remarks = new Button("Assertion Fail Remarks");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   204
      remarks.setEnabled(false);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   205
      remarks.setName("Assertion Remarks");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   206
      assertPanel.add(assertPass);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   207
      assertPanel.add(assertFail);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   208
      assertPanel.add(remarks);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   209
      handleAssert = new HandleAssert();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   210
      assertPass.addActionListener(handleAssert);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   211
      assertFail.addActionListener(handleAssert);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   212
      remarks.addActionListener(handleAssert);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   213
      add("South",assertPanel);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   214
      pack();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   215
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   216
      show();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   217
    }// TestDialog()
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   218
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   219
   //DO NOT call this directly, go through Sysout
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   220
   public void printInstructions( String[] instructions )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   221
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   222
      //Clear out any current instructions
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   223
      instructionsText.setText( "" );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   224
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   225
      //Go down array of instruction strings
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   226
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   227
      String printStr, remainingStr;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   228
      for( int i=0; i < instructions.length; i++ )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   229
       {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   230
     //chop up each into pieces maxSringLength long
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   231
     remainingStr = instructions[ i ];
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   232
     while( remainingStr.length() > 0 )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   233
      {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   234
        //if longer than max then chop off first max chars to print
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   235
        if( remainingStr.length() >= maxStringLength )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   236
         {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   237
           //Try to chop on a word boundary
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   238
           int posOfSpace = remainingStr.
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   239
          lastIndexOf( ' ', maxStringLength - 1 );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   240
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   241
           if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   242
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   243
           printStr = remainingStr.substring( 0, posOfSpace + 1 );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   244
           remainingStr = remainingStr.substring( posOfSpace + 1 );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   245
         }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   246
        //else just print
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   247
        else
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   248
         {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   249
           printStr = remainingStr;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   250
           remainingStr = "";
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   251
         }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   252
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   253
            instructionsText.append( printStr + "\n" );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   254
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   255
      }// while
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   256
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   257
       }// for
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   258
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   259
    }//printInstructions()
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   260
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   261
   //DO NOT call this directly, go through Sysout
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   262
   public void displayMessage( String messageIn )
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   263
    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   264
      messageText.append( messageIn + "\n" );
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   265
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   266
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   267
   public void emptyMessage()   {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   268
       messageText.setText("");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   269
   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   270
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   271
   public void setInstructions(String insStr[][])    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   272
       instructions=insStr;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   273
   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   274
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   275
   public void setExceptionMessages(String exceptionMessages[])   {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   276
       this.exceptionMessages=exceptionMessages;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   277
   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   278
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   279
   class HandleAssert implements ActionListener   {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   280
        public void actionPerformed(ActionEvent ae)    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   281
           if(ae.getSource()==remarks)  {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   282
               remarksDialog = new RemarksDialog(TestDialog.this,
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   283
                                        "Assertion Remarks Dialog",true);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   284
               remarks.setEnabled(false);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   285
               if(remarksMessage!=null)
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   286
                    failureMessages+=". User Remarks : "+remarksMessage;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   287
           }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   288
           else {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   289
               if(instructionCounter<instructions.length-1) {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   290
                   emptyMessage();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   291
                   instructionCounter++;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   292
                   printInstructions(instructions[instructionCounter]);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   293
               }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   294
               else {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   295
                   emptyMessage();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   296
                   displayMessage("Testcase Completed");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   297
                   displayMessage("Press 'Done' button in the "+
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   298
                                                    "BaseApplet to close");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   299
                   assertPass.setEnabled(false);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   300
                   assertFail.setEnabled(false);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   301
               }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   302
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   303
               if(ae.getSource()==assertPass)    {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   304
                   // anything to be done in future
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   305
               }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   306
               else if(ae.getSource()==assertFail)   {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   307
                   remarks.setEnabled(true);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   308
                   if(!failStatus)
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   309
                       failStatus=true;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   310
                   if(exceptionCounter<exceptionMessages.length)   {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   311
                        failureMessages = failureMessages + "<br>"+
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   312
                                    exceptionMessages[exceptionCounter];
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   313
                   }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   314
               }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   315
               exceptionCounter++;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   316
           }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   317
        }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   318
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   319
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   320
    class RemarksDialog extends Dialog  implements ActionListener{
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   321
        Panel rootPanel,remarksPanel;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   322
        TextArea textarea;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   323
        Button addRemarks,cancelRemarks;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   324
        public RemarksDialog(Dialog owner,String title,boolean modal)  {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   325
            super(owner,title,modal);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   326
            rootPanel = new Panel(new BorderLayout());
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   327
            remarksPanel = new Panel(new FlowLayout());
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   328
            textarea = new TextArea(5,30);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   329
            addRemarks=new Button("Add Remarks");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   330
            addRemarks.addActionListener(this);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   331
            cancelRemarks = new Button("Cancel Remarks");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   332
            cancelRemarks.addActionListener(this);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   333
            remarksPanel.add(addRemarks);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   334
            remarksPanel.add(cancelRemarks);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   335
            rootPanel.add(textarea,"Center");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   336
            rootPanel.add(remarksPanel,"South");
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   337
            add(rootPanel);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   338
            setBounds(150,150,400,200);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   339
            setVisible(true);
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   340
        }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   341
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   342
        public void actionPerformed(ActionEvent ae) {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   343
            remarksMessage=null;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   344
            if(ae.getSource()==addRemarks)  {
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   345
                String msg = textarea.getText().trim();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   346
                if (msg.length()>0)
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   347
                    remarksMessage=msg;
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   348
            }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   349
            dispose();
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   350
        }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   351
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   352
    }
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   353
8638a0d1ce4d 8076315: move 4 manual functional swing tests to regression suite
yan
parents:
diff changeset
   354
}// TestDialog  class