

Public Member Functions | |
| EntryLabel (ReadOnlyDisplayPanel panel) | |
| The constructor defines an interface to the DisplayPanel object. | |
| void | update (boolean on) |
| Update the display. | |
| javax.swing.Action | backward () |
| Not used. | |
| synchronized void | delete (Parser parser) |
| Delete element to left of Caret (if possible). | |
| synchronized void | setExpression (Parser parser) |
| Set a new expression from the Parser. | |
| synchronized void | clear (Parser parser) |
| Clear expression. | |
| synchronized void | insert (PObject p, Parser parser) |
| Insert element to right of Caret (if possible). | |
Static Private Attributes | |
| static final String | endhtml |
| This pads out the expression and makes it a bit taller if necessary so that new expressions are left-adjusted. | |
| static final long | serialVersionUID = 1L |
For various reasons it takes quite a lot of setting up. We want it to be editable and show HTML output (so, for example, that we can get square root or exponent signs). So we use a JTextPane. But we also want it to be a single line and scrollable; so we encapsulate it in a JViewPort. Finally we want to make sure we only scroll to valid positions (between PObject strings) so we add a NavigationFilter called Navigator. We also need a JPanel just to hold everything together.
| jscicalc.EntryLabel.EntryLabel | ( | ReadOnlyDisplayPanel | panel | ) |
The constructor defines an interface to the DisplayPanel object.
| panel | The display panel (we read values from CalculatorApplet through it) |
| void jscicalc.EntryLabel.update | ( | boolean | on | ) | [virtual] |
Update the display.
The parameter is probably redundant since we can get the value of on indirectly from the CalculatorApplet object.
| on | if false the calculator is switched off and so we don’t display anything; otherwise redisplay expression. |
Implements jscicalc.ScrollableLabel.
References jscicalc.ScrollableLabel.dotPosition, jscicalc.EntryLabel.endhtml, jscicalc.ReadOnlyCalculatorApplet.entryTextSize(), jscicalc.ScrollableLabel.expression, jscicalc.ReadOnlyDisplayPanel.getApplet(), jscicalc.ReadOnlyCalculatorApplet.getMinSize(), jscicalc.ReadOnlyCalculatorApplet.getMode(), jscicalc.ReadOnlyCalculatorApplet.getSizesSize(), jscicalc.ReadOnlyCalculatorApplet.minSize(), jscicalc.ScrollableLabel.panel, jscicalc.ScrollableLabel.setCaretVisible(), and jscicalc.ScrollableLabel.textPane.
Referenced by jscicalc.DisplayPanel.update().
| javax.swing.Action jscicalc.EntryLabel.backward | ( | ) |
Not used.
I tried allowing the CalculatorButton to fire an Action to move the Caret left, but it didn’t work
Referenced by jscicalc.DisplayPanel.backward().
| synchronized void jscicalc.EntryLabel.delete | ( | Parser | parser | ) |
Delete element to left of Caret (if possible).
| parser | If we delete we have to change the Parser too |
References jscicalc.ScrollableLabel.dotPosition, jscicalc.Navigator.dots, jscicalc.ScrollableLabel.expression, jscicalc.ScrollableLabel.getDotPosition(), jscicalc.pobject.PObject.name_array(), jscicalc.ScrollableLabel.navigator, and jscicalc.ScrollableLabel.textPane.
Referenced by jscicalc.DisplayPanel.delete().
| synchronized void jscicalc.EntryLabel.setExpression | ( | Parser | parser | ) |
Set a new expression from the Parser.
Useful if we’ve just loaded a new expression from history.
| parser | The Parser |
References jscicalc.ScrollableLabel.dotPosition, jscicalc.Navigator.dots, jscicalc.ScrollableLabel.expression, jscicalc.Parser.getExpression(), jscicalc.Parser.getList(), jscicalc.ScrollableLabel.navigator, and jscicalc.ScrollableLabel.newExpression().
Referenced by jscicalc.DisplayPanel.setExpression().
| synchronized void jscicalc.EntryLabel.clear | ( | Parser | parser | ) |
Clear expression.
Useful in response to OnButton, for example.
| parser | The Parser: we must also clear expression in the Parser |
References jscicalc.Parser.clearExpression(), jscicalc.ScrollableLabel.dotPosition, and jscicalc.ScrollableLabel.expression.
Referenced by jscicalc.DisplayPanel.clear().
Insert element to right of Caret (if possible).
| p | The PObject, usually goten from a CalculatorButton | |
| parser | If we delete we have to change the Parser too |
References jscicalc.Parser.add(), jscicalc.ScrollableLabel.dotPosition, jscicalc.Navigator.dots, jscicalc.ScrollableLabel.expression, jscicalc.ScrollableLabel.getDotPosition(), jscicalc.Parser.getExpression(), jscicalc.pobject.PObject.name_array(), jscicalc.ScrollableLabel.navigator, jscicalc.ScrollableLabel.newExpression(), and jscicalc.ScrollableLabel.textPane.
Referenced by jscicalc.DisplayPanel.insert().
final String jscicalc.EntryLabel.endhtml [static, private] |
Initial value:
"<sup> </sup><sub> <sub> " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " <sup> </sup><sub> </sub></p></html>"
Otherwise the display would start in the middle of the JViewPort. Navigator makes sure we can never try to edit this invisible region.
Referenced by jscicalc.EntryLabel.update().
final long jscicalc.EntryLabel.serialVersionUID = 1L [static, private] |
Reimplemented from jscicalc.ScrollableLabel.
1.5.5