Provides the look and feel for a JEditorPane in the
Synth look and feel.
| Method from javax.swing.plaf.synth.SynthEditorPaneUI Detail: |
public static ComponentUI createUI(JComponent c) {
return new SynthEditorPaneUI();
}
Creates a UI for the JTextPane. |
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
|
protected void installDefaults() {
// Installs the text cursor on the component
super.installDefaults();
JComponent c = getComponent();
Object clientProperty =
c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
if (clientProperty == null
|| clientProperty == localFalse) {
c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
localTrue);
}
updateStyle((JTextComponent)getComponent());
}
|
protected void paint(SynthContext context,
Graphics g) {
super.paint(g, getComponent());
}
|
protected void paintBackground(Graphics g) {
// Overriden to do nothing, all our painting is done from update/paint.
}
|
void paintBackground(SynthContext context,
Graphics g,
JComponent c) {
context.getPainter().paintEditorPaneBackground(context, g, 0, 0,
c.getWidth(), c.getHeight());
}
|
public void paintBorder(SynthContext context,
Graphics g,
int x,
int y,
int w,
int h) {
context.getPainter().paintEditorPaneBorder(context, g, x, y, w, h);
}
|
protected void propertyChange(PropertyChangeEvent evt) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
updateStyle((JTextComponent)evt.getSource());
}
super.propertyChange(evt);
}
This method gets called when a bound property is changed
on the associated JTextComponent. This is a hook
which UI implementations may change to reflect how the
UI displays bound properties of JTextComponent subclasses.
This is implemented to rebuild the ActionMap based upon an
EditorKit change. |
protected void uninstallDefaults() {
SynthContext context = getContext(getComponent(), ENABLED);
JComponent c = getComponent();
c.putClientProperty("caretAspectRatio", null);
style.uninstallDefaults(context);
context.dispose();
style = null;
Object clientProperty =
c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
if (clientProperty == localTrue) {
getComponent().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
Boolean.FALSE);
}
super.uninstallDefaults();
}
|
public void update(Graphics g,
JComponent c) {
SynthContext context = getContext(c);
SynthLookAndFeel.update(context, g);
paintBackground(context, g, c);
paint(context, g);
context.dispose();
}
|