Logo Search packages:      
Sourcecode: octave-java version File versions  Download package

static void org::octave::JDialogBox::main ( String[]  args ) [inline, static]

Tests the dialogs

Parameters:
argsString[] - not used.

Definition at line 864 of file JDialogBox.java.

References errordlg(), helpdlg(), inputdlg(), listdlg(), and questdlg().

   {
      TeXtranslator t = new TeXtranslator();

      if(false)
      {
         // find out key names of icon UI resources
         UIDefaults df = UIManager.getLookAndFeelDefaults ();

         for ( Enumeration e = df.keys (); e.hasMoreElements (); )
         {
            String s = e.nextElement ().toString ();

            if ( s.toLowerCase ().contains ( "icon" ) )
            {
               System.out.println ( s );
            }
         }
      }

      try
      {
         Class[] argTypes = new Class[1];
         argTypes[0] = String.class;

         java.lang.reflect.Constructor c = ClassHelper.findConstructor ( java.lang.StringBuffer.class,
                                                       argTypes );
         Object argValues[] = new Object[1];
         argValues[0] = new String("initial value");
         Object sb = c.newInstance(argValues);
         System.out.println(sb.toString());

         ClassHelper.invokeMethod(sb,"append",argValues,argTypes);
         System.out.println(sb.toString());

         argValues = new Object[2];
         argTypes = new Class[2];
         argTypes[0] =  Integer.class;
         argTypes[1] = String.class;
         argValues[0] = new Integer(0);
         argValues[1] = new String("inserted");

         ClassHelper.invokeMethod(sb,"insert",argValues,argTypes);
         System.out.println(sb.toString());
      }
      catch ( Throwable e )
      {}

      if ( true )
      {
         return;
      }

      helpdlg ( "If you need help\nyou should ask for help\nif someone is around\notherwise you are on your own.",
                "Information" );

      String[] options = new String[4];
      options[0] = "Yeah \\vartheta is too low";
      options[1] = "Maybe";
      options[2] = "Nay \\vartheta is too high";
      options[3] = "Maybe";

      System.out.println ( questdlg ( "Is it too cold?", "Temperature", options ) );

      // test variants of errordlg
      // does not affect layering of dialog
      errordlg ( "Background error!", "Error" );

      // test variants of helpdlg

      // test variants of inputdlg
      String prompt[] = new String[2];
      prompt[0] = "Question 1";
      prompt[1] = "Question 2";
      String defaults[] = new String[2];
      defaults[0] = "1.1";
      defaults[1] = "2.2";
      String title = "Enter values";

      Integer rc[] = new Integer[2 * 2];
      rc[0] = new Integer ( 1 );
      rc[1] = new Integer ( 2 );
      rc[2] = new Integer ( 10 );
      rc[3] = new Integer ( 20 );

      inputdlg ( prompt, title, rc, defaults );

      String listcell[] = new String[4];
      listcell[0] = "a \\alpha";
      listcell[1] = "b \\beta";
      listcell[2] = "c \\gamma";
      listcell[3] = "d \\delta";

      Integer size[] = new Integer[2];
      size[0] = new Integer ( 80 );
      size[1] = new Integer ( 100 );

      Integer initial[] = new Integer[2];
      initial[0] = new Integer ( 4 );
      initial[1] = new Integer ( 2 );

      String promptcell[] = new String[2];
      promptcell[0] = "Select something";
      promptcell[1] = "(or even more than one thing)";

      int idx[] = listdlg ( listcell,
                            "Multiple",
                            size,
                            initial,
                            "name",
                            promptcell,
                            "okstring",
                            "cancelstring" );

      if ( idx != null )
      {
         for ( int i = 0; i < idx.length; i++ )
         {
            System.out.println ( idx[i] );
         }
      }
   }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index