--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java Wed Dec 09 11:38:30 2009 +0300
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java Thu Dec 10 12:08:58 2009 +0300
@@ -27,52 +27,61 @@
import java.awt.*;
import java.awt.event.*;
-import java.awt.peer.LightweightPeer;
-
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
-import javax.swing.event.*;
-
import java.beans.*;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's InternalFrameUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JInternalFrame}.
*
* @author David Kloba
* @author Joshua Outwater
* @author Rich Schiavi
+ * @since 1.7
*/
-class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
- PropertyChangeListener {
+public class SynthInternalFrameUI extends BasicInternalFrameUI
+ implements SynthUI, PropertyChangeListener {
private SynthStyle style;
- private static DesktopManager sharedDesktopManager;
- private boolean componentListenerAdded = false;
-
- private Rectangle parentBounds;
-
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param b component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent b) {
return new SynthInternalFrameUI((JInternalFrame)b);
}
- public SynthInternalFrameUI(JInternalFrame b) {
+ protected SynthInternalFrameUI(JInternalFrame b) {
super(b);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void installDefaults() {
frame.setLayout(internalFrameLayout = createLayoutManager());
updateStyle(frame);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
frame.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallComponents() {
if (frame.getComponentPopupMenu() instanceof UIResource) {
frame.setComponentPopupMenu(null);
@@ -80,6 +89,10 @@
super.uninstallComponents();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
frame.removePropertyChangeListener(this);
super.uninstallListeners();
@@ -104,6 +117,10 @@
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(frame, ENABLED);
style.uninstallDefaults(context);
@@ -115,6 +132,10 @@
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -124,24 +145,28 @@
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- public int getComponentState(JComponent c) {
+ private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected JComponent createNorthPane(JInternalFrame w) {
titlePane = new SynthInternalFrameTitlePane(w);
titlePane.setName("InternalFrame.northPane");
return titlePane;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected ComponentListener createComponentListener() {
if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
return new ComponentHandler() {
- public void componentResized(ComponentEvent e) {
+ @Override public void componentResized(ComponentEvent e) {
if (frame != null && frame.isMaximum()) {
JDesktopPane desktop = (JDesktopPane)e.getSource();
for (Component comp : desktop.getComponents()) {
@@ -168,6 +193,10 @@
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -178,6 +207,10 @@
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -185,15 +218,29 @@
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintInternalFrameBorder(context,
g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
SynthStyle oldStyle = style;
JInternalFrame f = (JInternalFrame)evt.getSource();