Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Check out GFW from CVS into Eclipse

GFW is located in $CVSROOT/physics/GUIFramework

Read and run the example code

An example can be found in the class edu.stanford.slac.gfw.example.GfwExample

When running the example, please observe:

...

For a quick development (e.g. GUI mock ups), we recommend the Netbeans GUI Builder (sometimes called "Matisse").
A nice overview of all Swing components is at http://java.sun.com/docs/books/tutorial/ui/features/components.html

...

Using GFW to build a GUI Application

  1. If you have not already done so, create a Java Project (File -> New -> Java Project). TODO: Add naming guidelines.
  2. Add the GFW to your Eclipse project buildpath. You can do this either by including the GUIFramework project from your workspace, or by including the GUIFramework.jar from its production location (/usr/local/lcls/physics/GUIFramework/jar/GUIFramework.jar).
  3. Instantiate the custom components. For instance, if you have not yet created the main class, now you would do so. Note, that this class is likely to be in a different package to the User Interface package if you are separating UI components from application code.
  4. Create a BasicFrame or a ModelFrame instance of the GFW, e.g
    Code Block
    final BasicFrame myFrame = new BasicFrame("My Frame"); //'final', because it's used later in an anonymous class
    
    or
    Code Block
    final ModelFrame myFrame = new ModelFrame("My Model Frame"); 
    
  5. Add custom components to various areas of the GFW frame, such as
    • Title Bar
      Code Block
      myFrame.addToTitleBar(myComponent);
      
    • Tab 1
      Code Block
      myFrame.addTopTab1(myComponent);
      
    • Tab 2
      Code Block
      myFrame.addTopTab2(myComponent);
      
    • New Tab
      Code Block
      myFrame.addTopTab(myComponent, "My Label");
      
    • Bottom ScrollPane
      Code Block
      myFrame.addToBottomScrollPane(myComponent);
      
  6. Set application version
    Code Block
    BasicFrame myFrame = ...; // see above
    JLabel appVersionLabel = myFrame.getBasicPanel().getStatusPanel().getAppVersionLabel();
    appVersionLabel.setText("my version"); //run in the GUI thread, of before displaying the frame
    
  7. #Add event listeners to the appropriate widgets
  8. Display the GFW frame
    Code Block
    SwingUtilities.invokeLater(new Runnable() {
    	public void run() {
    		myFrame.setVisible(true);
    	}
    });
    

...