StyleEditorDemoApplication
The application's user interface consists of the following:
- File Menu
- Open MathML...
- Save MathML...
- Quit
- Help Menu
- About MathFlow SDK Structure Editor
- MathML source panel
- Preview image panel
- Edit Equation ... button
NOTE: The code discussed below can be found in StyleEditorDemoApplication.java.
- The application's constructor sets the title and font preferences, and then calls initUI() to create the application's UI elements. It also changes the cursor to a wait cursor. For more information on setting the font preferences, see Java Rendering Engine.
- The
createEditor method creates the two objects, which are then passed into the constructor of the SampleStyleEditorDialog.- A StyleConfigurationInfo object is created to indicate which features are turned on or off in the editor. You can also set the type of end-user help system in this object. See the sample code and End-User Help Options for choosing and setting your help system.
- The key string is set, which is either the path to a FlexNet license file or a license key string assigned by Design Science. See the sample code and MathFlow SDK Licenses for help setting the license string and more information about the license types.
- The method
showEditor checks if createEditor()has been successful and displays the Style Editor as a dialog. - The
updateSrcAndImage method retrieves the MathML from the editor using the editor's getMathML method, and displays it in the MathML source panel. It also retrieves an image of the equation, using the editor's getEquationImage method, and its size, using the editor's getPreferredWidthAt and getPreferredHeightAt methods. The equation is then displayed in the Image preview panel. - The
notifyEditorShown method is used by the editorDialog to notify the host application when the editor has been shown. The host application then resets the cursor back to its default state. The host application can also display a customized SampleStyleEditorAboutBox.
|