...
- If you have not already done so, create a Java Project (File -> New -> Java Project). TODO: Add naming guidelines.
- Add the GFW and SwingUtil to your Eclipse project buildpath. You can do this either by including the
GUIFramework
andSwingUtil
projects to your workspace, and then importing them into your new project from your workspace(File -> Import -> Project from Workspace), or File -> Import... -> CVS -> Projects from CVS, or by including their jar files from the production distribution location. E.g. GUIFramework.jar from its production location is in/usr/local/lcls/physics/GUIFramework/jar/GUIFramework.jar
. - 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.
- Create a BasicFrame or a ModelFrame instance of the GFW, e.g
orCode Block final BasicFrame myFrame = new BasicFrame("My Frame");
Code Block final ModelFrame myFrame = new ModelFrame("My Model Frame");
- 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);
- Title Bar
- 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
- #Add event listeners to the appropriate widgets
- Display the GFW frame
Code Block SwingUtilities.invokeLater(new Runnable() { public void run() { myFrame.setVisible(true); } });
...
- Add your BasicFrameListener to your BasicFrameController.
Q: To which method of your BasicFrameController do you add it.
- it seems to me also that BasicFrameController is ambiguous - it's not clear whether the "basic" refers to the BasicFrame of Sergei's GFW, or one's own application's frame controller. It's hard to tell what's in the GFW, and what one is suppose to write.
Code Block BasicFrameListener myFrameListener = new MyFrameListener(); BasicFrameController myFrameController = new MyFrameController(myFrame); myFrameController.addBasicFrameListener(myFrameListener);
Set web help URL
If you want to provide help via the default GFW way, set the URL of your help website.
...