--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java Wed Dec 09 11:38:30 2009 +0300
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java Thu Dec 10 12:08:58 2009 +0300
@@ -34,23 +34,33 @@
import javax.swing.plaf.basic.BasicToolTipUI;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.View;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's ToolTipUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToolTip}.
*
* @author Joshua Outwater
+ * @since 1.7
*/
-class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
- SynthUI {
+public class SynthToolTipUI extends BasicToolTipUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
-
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthToolTipUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults(JComponent c) {
updateStyle(c);
}
@@ -61,6 +71,10 @@
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults(JComponent c) {
SynthContext context = getContext(c, ENABLED);
style.uninstallDefaults(context);
@@ -68,14 +82,26 @@
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners(JComponent c) {
c.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners(JComponent c) {
c.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -85,10 +111,6 @@
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
JComponent comp = ((JToolTip)c).getComponent();
@@ -98,6 +120,10 @@
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -108,11 +134,19 @@
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintToolTipBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -120,9 +154,14 @@
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
JToolTip tip = (JToolTip)context.getComponent();
- String tipText = tip.getToolTipText();
Insets insets = tip.getInsets();
View v = (View)tip.getClientProperty(BasicHTML.propertyKey);
@@ -140,6 +179,10 @@
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getPreferredSize(JComponent c) {
SynthContext context = getContext(c);
Insets insets = c.getInsets();
@@ -164,6 +207,10 @@
return prefSize;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JToolTip)e.getSource());