Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes

RunStandalone Class Reference

Runs instance of the JPWorld component inside the stand-alone application with own JFrame. More...

Inheritance diagram for RunStandalone:
Inheritance graph
[legend]
Collaboration diagram for RunStandalone:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RunStandalone ()
 Adds main component JPWorld to the content pane.

Static Public Member Functions

static void main (String[] args)
 Main program entry that creates and shows GUI.

Private Attributes

JPWorld wopComponent = new JPWorld ()
 Main component is instance of the JPWorld.

Static Private Attributes

static final long serialVersionUID = -6852878245259708233L
 Implements java.io.Serializable interface.

Detailed Description

Runs instance of the JPWorld component inside the stand-alone application with own JFrame.

Author:
Mikica B Kocic

Definition at line 15 of file RunStandalone.java.


Constructor & Destructor Documentation

RunStandalone.RunStandalone (  )

Adds main component JPWorld to the content pane.

Definition at line 30 of file RunStandalone.java.

References JPWorld.startTests(), and wopComponent.

Referenced by main().

    {
        super(
            "IP1-1.1: Multithreaded World of Particles (inefficient but educational)"
            );
        
        setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

        /* Adjust window dimensions not to exceed screen dimensions ...
         */
        Dimension win = new Dimension( 1024, 600 );
        Dimension scsz = Toolkit.getDefaultToolkit().getScreenSize();
        win.width  = Math.min( win.width, scsz.width );
        win.height = Math.min( win.height, scsz.height - 40 );
        setSize( win );
        setMinimumSize( new Dimension( 330, 100 ) );
        
        /* ... then center window on the screen.
         */
        setLocation( ( scsz.width - win.width )/2, ( scsz.height - 40 - win.height )/2 );
        
        /*  Register the thread tester component, then make frame visible
         */
        add( wopComponent );
        addKeyListener( wopComponent );
        setVisible( true );
        
        /* Start T1 & T2 tests delayed for 1 sec
         */
        wopComponent.startTests( 1f /*sec delay*/ );
    }

Member Function Documentation

static void RunStandalone.main ( String[]  args ) [static]

Main program entry that creates and shows GUI.

Parameters:
argsmain program arguments

Definition at line 67 of file RunStandalone.java.

References RunStandalone().

    {
        /*  Create and show GUI
         */
        Runnable doCreateAndShowGUI = new Runnable () {
            public void run () {
                new RunStandalone ();
            }
        };

        SwingUtilities.invokeLater( doCreateAndShowGUI );
    }

Member Data Documentation

final long RunStandalone.serialVersionUID = -6852878245259708233L [static, private]

Implements java.io.Serializable interface.

Definition at line 20 of file RunStandalone.java.

Main component is instance of the JPWorld.

Definition at line 25 of file RunStandalone.java.

Referenced by RunStandalone().


The documentation for this class was generated from the following file: