Swing Component
Class com.gp.api.swing.MxComponent can
be used in rich client applications to display, print,
and save charts into the files in a variety of formats. After you create an instance of MxComponent you can add it to
any Swing container and treat as an ordinary Swing component. Sample topic
of this section contains code snippets for creating, showing and modifying charts.
The following are some of the MxComponent API methods. To
view all available methods click here.
- public MxComponent()
- Creates a new instance of MxComponent.
- public MxWidgetStyle getStyle()
- Returns the chart's style object.
- public void setStyle(MxWidgetStyle style)
- Sets the chart's style object.
- public MxWidgetModel getModel()
- Retruns the model that the chart uses to obtain the data. For charts, this model will always be
an instance of MxChartStyle.
- public void setModel(MxWidgetModel model)
- Sets the model that the chart uses to obtain the data.
- public boolean isRightMouseButtonMenuEnabled()
- Returns true if the rightMouseButton menu is enabled.This menu allows the end-user to customize
some of the current chart's styles.
- public void setRightMouseButtonMenuEnabled(boolean value)
- Enables/disables the rightMouseButton menu.
- public void saveTo(java.io.File file)
- Saves the object into the file using file's extension as image type.
- public void export()
- Opens a file dialog allowing an end-user to select the file type and location, and then
saves the object into the selected file using saveTo function.
- public void print(String jobName)
- Prints the object
- public byte [] getBytes(String type)
- Creates an image of specified type (PNG, JPG, SWF, SVG, PDF, TIF,
or another supported type) and returns its bytes.
- public void addMxComponentListener(MxComponentListener l)
- Adds the specified listener to receive events from this component.
- public void removeMxComponentListener(MxComponentListener l)
- Removes the specified listener so that it no longer receives events from this component.