Basic User Interface¶
Every mathlet shares the same basic user interface with the following common features.
Title¶
The title is shown at top of the mathlet, i.e. above the canvases and the control panel. It can be set with:
setTitle(String)
This method is defined in the
BaseApplet
class.
Reset Button¶
A generic reset button can be used to re-initialize a scene. The button itself can be added by simply calling
addResetButton()
inside an extended
BaseApplet
class. By pressing the button, the method public void reset() {
...
}
will be called in the mathlet. To react on this event you will have to implement this method in the applet-class.
Dynamic Reset Button¶
[TODO]
Screenshot Button¶
A generic screenshot button can be used to create screenshots and videos by capturing graphical scenes or the complete mathlet.
The button will be visible when calling
addScreenShotButton()
inside an extended
BaseApplet
class.
Using Tabs¶
It is possible to open a new tab in the control-panel-, canvas- and center-pane. This is done by callingadd(String, Component)
on the following getters:
- getCanvasTabbedPane()
- getCenterTabbedPane()
- getControlTabbedPane()
These methods return a customized instance of aJTabbedPane
(an instance ofTabbedPanel
more precisly) which will show the real tab (with the tab’s title) only when more than one tab has been added.
Note: all of the BaseApplet
’s tabbed panes have allready a tab (containg the canvases, etc.). But the tab’s titles are not visible because they are the only tabs! The add
method of these tabbed panes request a String
for the tab’s title and an instance of Component
which can be e.g. a new ControlPanel
, Canvas
or JPanel
(they all extend the class Component
).
The title of the first (default) tab can be set through the TabbedPanel
proper method
setTitleAt(int, String)
The instance of this underlying SWING-class can be accessed through
getTabbedPane()
in the class
TabbedPanel
.