Search CTAT

Eclipse WindowBuilder Configuration

Applies to CTAT 3.1 or later

As of CTAT 3.1, we recommend using Eclipse WindowBuilder to create Java student interfaces. With previous versions of CTAT, we recommended NetBeans.

You do not need to follow these instructions if you are using Flash for creating student interfaces.

Watch a video showing how to configure Eclipse WindowBuilder

(Video opens in new window)

One-time configuration:

Each time you create a student interface:

One-time configuration

1. Install Eclipse and WindowBuilder

After installing CTAT, download and install Eclipse, which includes WindowBuilder. The following versions of Eclipse currently include WindowBuilder:

  • Eclipse IDE for Java Developers

If you are familiar with Eclipse and have it installed already, you can install WindowBuilder as an Eclipse plugin.

2. Set WindowBuilder defaults

  1. In Eclipse, select Preferences from the Window menu.
  2. In the Preferences dialog, select WindowBuilder > Swing > Code Generation
  3. Under "Default code generation settings", set the "Variable generation" to "Field" by clicking on the "Field" tab.
  4. For compatibility with NetBeans, select "initComponents" from the "Method name for new statements" dropdown.

3. Set up CTAT in Eclipse

  1. Set up a project in Eclipse by clicking File > New > Java Project
  2. In the New Java Project dialog, enter a Project name (e.g., "CTAT"), uncheck "Use default location", and browse for the folder where CTAT is installed
  3. Click Next.
  4. Important: On the Libraries tab, select all entries beginning with CTAT/deploy and click Remove.
  5. Note: Failure to do this step will result in an error when you try to run your tutor: "(java.lang.SecurityException: class someClassName's signer information does not match signer information of other classes in the same package".

  6. Click Finish.
  7. Expand the new project in the Package Explorer, right-click on the "Projects" folder in Navigation panel, and select New > Other... from the menu.
  8. Select WindowBuilder > Swing Designer > JPanel in the dialog, and click the Next button.
  9. In the "New JPanel" dialog enter a folder name for your tutor in the Package field, e.g., myNewTutor.
  10. In the "New JPanel" dialog enter a file name for your tutor in the Name field, e.g., StudentInterface.
  11. Click the "Finish" button. should open with a "Source" and "Design" tab at the bottom.
  12. Select the "Design" tab.
  13. In the "Palette" panel, right-click on any of the displayed folders (e.g., System) and select "Import Jar..." from the menu.
  14. Select ctat.jar as the Jar Archive, then click the "Select All" button.
  15. Select <New Category> and enter a name for the CTAT components, e.g., "CTAT".
  16. Click OK.

Each time you create a student interface

1. Set up tutor interface

  1. Create a new JPanel class following steps 4-9 above.
  2. Click on "AbsoluteLayout" and drop it in the JPanel.
  3. Click on "CTAT_Options" and drop it in the JPanel.
  4. In Source view, add the following line of Java code to the top of the file, directly beneath the existing line that begins with "import":
    import edu.cmu.pact.BehaviorRecorder.Controller.CTAT_Launcher;
  5. While still in Source view, add a main method directly before the final closing brace, substituting the class name for <filename>, e.g., StudentInterface:
    public static void main(String args[]) { 
      new CTAT_Launcher(args).launch(new <filename>());
  6. Design a simple interface by adding CTAT components to your JPanel in Design view.

Note: Make sure you set the CommName property for each widget you add to your interface. The CommName should be set to the widget's variable name, which is displayed at the top of the Properties panel after selecting a widget.

2. Run tutor

  1. Save the tutor.
  2. In the Navigation panel, right-click on the file name, and select Run As... -> Java Application.
  3. Verify that the student interface and CTAT opened.