...
- If you have not already done so, create a Java Project (File -> New -> Java Project). TODO: Add naming guidelines.
- Add 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 importing them into your new project (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 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); } });
...