/// <summary>
        /// Sets the title in a uniform fashion, as determined by the values passed in.
        /// The general pattern of the title will be
        /// "AppName - DataSet Base Name - Window Name (status)" </summary>
        /// <param name="frame"> the frame on which to set the title.  Cannot be null. </param>
        /// <param name="dataset"> the dataset from which to get the base dataset name.   The
        /// basename can be null or "", in which case it won't be included in the title.
        /// The dataset can be null. </param>
        /// <param name="window_title"> the title of the window.  Can be null or "", in which
        /// case it won't be included in the title. </param>
        /// <param name="status"> the status of the window.  Can be null or "", in which case
        /// it won't be included in the title. </param>
        public static void setTitle(JFrame frame, DataSet dataset, string window_title, string status)
        {
            string title = "";
            int    count = 0;

            string appName = JGUIUtil.getAppNameForWindows().Trim();

            if (!appName.Trim().Equals(""))
            {
                title += appName;
                count++;
            }

            if (dataset != null)
            {
                string basename = dataset.getBaseName();
                if (!string.ReferenceEquals(basename, null) && !basename.Trim().Equals(""))
                {
                    if (count > 0)
                    {
                        title += " - ";
                    }
                    title += basename.Trim();
                    count++;
                }
            }

            if (!string.ReferenceEquals(window_title, null) && !window_title.Trim().Equals(""))
            {
                if (count > 0)
                {
                    title += " - ";
                }
                title += window_title.Trim();
                count++;
            }

            if (!string.ReferenceEquals(status, null) && !status.Trim().Equals(""))
            {
                if (count > 0)
                {
                    title += " ";
                }
                title += "(" + status + ")";
            }

            frame.setTitle(title);
        }
예제 #2
0
        public static void main(string[] args)
        {
            JFrame jframe = new JFrame();

            jframe.setTitle("Debug");
            jframe.setDefaultCloseOperation(3);
            jframe.pack();
            jframe.setVisible(false);
            FilenameDialog filenameDialog = new FilenameDialog(jframe, true, "Save as...");

            [email protected]("Showing dialog...");
            filenameDialog.setVisible(true);
            string text = filenameDialog.getFilename();

            [email protected](new StringBuilder().append("Filename: ").append(text).append(" (length = ").append(String.instancehelper_length(text)).append(')').toString());
            java.lang.System.exit(0);
        }
예제 #3
0
        /**
         * Main program (used when run as application instead of applet).
         */
        public static void main(String[] args)
        {
            DelaunayAp applet = new DelaunayAp();              // Create applet

            applet.init();                                     // Perform applet initialization
            JFrame dWindow = new JFrame();                     // Create window

            dWindow.setSize(700, 500);                         // Set window size
            dWindow.setTitle("Voronoi/Delaunay Window");
            // Set window title
            dWindow.getContentPane().setLayout(new BorderLayout());
            // Specify layout manager
            dWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // Specify closing behavior
            dWindow.getContentPane().add(applet, "Center");
            // Place applet into window
            dWindow.setVisible(true);                          // Show the window
        }
예제 #4
0
 public void imageEnd()
 {
     lock (lockObj)
     {
         // copy buffer
         image.setRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
         repaint();
         // update stats
         t.end();
         seconds += t.seconds();
         frames++;
         if (seconds > 1)
         {
             // display average fps every second
             frame.setTitle(string.Format("Sunflow v{0} - {1} fps", SunflowAPI.VERSION, frames / seconds));
             frames  = 0;
             seconds = 0;
         }
     }
 }