diff options
Diffstat (limited to 'libjava/classpath/javax/swing/plaf/basic')
54 files changed, 2152 insertions, 2169 deletions
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java index 781269b2adf..1d6e8874dd3 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java @@ -51,15 +51,15 @@ import javax.swing.SwingConstants; * A button that displays an arrow (triangle) that points {@link #NORTH}, * {@link #SOUTH}, {@link #EAST} or {@link #WEST}. This button is used by * the {@link BasicComboBoxUI} class. - * + * * @see BasicComboBoxUI#createArrowButton */ public class BasicArrowButton extends JButton implements SwingConstants { - /** - * The direction that the arrow points. - * + /** + * The direction that the arrow points. + * * @see #getDirection() */ protected int direction; @@ -89,7 +89,7 @@ public class BasicArrowButton extends JButton implements SwingConstants * in the specified direction. If the <code>direction</code> is not one of * the specified constants, no arrow is drawn. * - * @param direction The direction the arrow points in (one of: + * @param direction The direction the arrow points in (one of: * {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}). */ public BasicArrowButton(int direction) @@ -103,7 +103,7 @@ public class BasicArrowButton extends JButton implements SwingConstants * Creates a new BasicArrowButton object with the given colors and * direction. * - * @param direction The direction to point in (one of: + * @param direction The direction to point in (one of: * {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}). * @param background The background color. * @param shadow The shadow color. @@ -133,7 +133,7 @@ public class BasicArrowButton extends JButton implements SwingConstants } /** - * Returns the direction of the arrow (one of: {@link #NORTH}, + * Returns the direction of the arrow (one of: {@link #NORTH}, * {@link #SOUTH}, {@link #EAST} and {@link #WEST}). * * @return The direction of the arrow. @@ -146,7 +146,7 @@ public class BasicArrowButton extends JButton implements SwingConstants /** * Sets the direction of the arrow. * - * @param dir The new direction of the arrow (one of: {@link #NORTH}, + * @param dir The new direction of the arrow (one of: {@link #NORTH}, * {@link #SOUTH}, {@link #EAST} and {@link #WEST}). */ public void setDirection(int dir) @@ -163,23 +163,23 @@ public class BasicArrowButton extends JButton implements SwingConstants public void paint(Graphics g) { super.paint(g); - + int height = getHeight(); int size = height / 4; - + int x = (getWidth() - size) / 2; int y = (height - size) / 2; - + ButtonModel m = getModel(); if (m.isArmed()) { x++; y++; } - + paintTriangle(g, x, y, size, direction, isEnabled()); } - + /** * Returns the preferred size of the arrow button. * @@ -220,17 +220,17 @@ public class BasicArrowButton extends JButton implements SwingConstants } /** - * Paints a triangle with the given size, location and direction. It is + * Paints a triangle with the given size, location and direction. It is * difficult to explain the rationale behind the positioning of the triangle - * relative to the given (x, y) position - by trial and error we seem to - * match the behaviour of the reference implementation (which is missing a + * relative to the given (x, y) position - by trial and error we seem to + * match the behaviour of the reference implementation (which is missing a * specification for this method). * * @param g the graphics device. * @param x the x-coordinate for the triangle's location. * @param y the y-coordinate for the triangle's location. * @param size the arrow size (depth). - * @param direction the direction of the arrow (one of: {@link #NORTH}, + * @param direction the direction of the arrow (one of: {@link #NORTH}, * {@link #SOUTH}, {@link #EAST} and {@link #WEST}). * @param isEnabled if <code>true</code> the arrow is drawn in the enabled * state, otherwise it is drawn in the disabled state. @@ -258,11 +258,11 @@ public class BasicArrowButton extends JButton implements SwingConstants } g.setColor(savedColor); } - + /** - * Paints an upward-pointing triangle. This method is called by the + * Paints an upward-pointing triangle. This method is called by the * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method. - * + * * @param g the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. @@ -270,7 +270,7 @@ public class BasicArrowButton extends JButton implements SwingConstants * @param isEnabled if <code>true</code> the arrow is drawn in the enabled * state, otherwise it is drawn in the disabled state. */ - private void paintTriangleNorth(Graphics g, int x, int y, int size, + private void paintTriangleNorth(Graphics g, int x, int y, int size, boolean isEnabled) { int tipX = x + (size - 2) / 2; @@ -297,11 +297,11 @@ public class BasicArrowButton extends JButton implements SwingConstants g.drawLine(baseX1 + 1, baseY + 1, baseX2 + 1, baseY + 1); } } - + /** - * Paints an downward-pointing triangle. This method is called by the + * Paints an downward-pointing triangle. This method is called by the * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method. - * + * * @param g the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. @@ -309,7 +309,7 @@ public class BasicArrowButton extends JButton implements SwingConstants * @param isEnabled if <code>true</code> the arrow is drawn in the enabled * state, otherwise it is drawn in the disabled state. */ - private void paintTriangleSouth(Graphics g, int x, int y, int size, + private void paintTriangleSouth(Graphics g, int x, int y, int size, boolean isEnabled) { int tipX = x + (size - 2) / 2; @@ -337,11 +337,11 @@ public class BasicArrowButton extends JButton implements SwingConstants g.drawLine(tipX + 1, tipY + 1, baseX2 + 1, baseY + 1); } } - + /** - * Paints a right-pointing triangle. This method is called by the + * Paints a right-pointing triangle. This method is called by the * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method. - * + * * @param g the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. @@ -349,7 +349,7 @@ public class BasicArrowButton extends JButton implements SwingConstants * @param isEnabled if <code>true</code> the arrow is drawn in the enabled * state, otherwise it is drawn in the disabled state. */ - private void paintTriangleEast(Graphics g, int x, int y, int size, + private void paintTriangleEast(Graphics g, int x, int y, int size, boolean isEnabled) { int tipX = x + (size - 1); @@ -357,7 +357,7 @@ public class BasicArrowButton extends JButton implements SwingConstants int baseX = x; int baseY1 = tipY - (size - 1); int baseY2 = tipY + (size - 1); - + Polygon triangle = new Polygon(); triangle.addPoint(tipX, tipY); triangle.addPoint(baseX, baseY1); @@ -378,11 +378,11 @@ public class BasicArrowButton extends JButton implements SwingConstants g.drawLine(baseX + 1, baseY2 + 1, tipX + 1, tipY + 1); } } - + /** - * Paints a left-pointing triangle. This method is called by the + * Paints a left-pointing triangle. This method is called by the * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method. - * + * * @param g the graphics device. * @param x the x-coordinate for the anchor point. * @param y the y-coordinate for the anchor point. @@ -390,7 +390,7 @@ public class BasicArrowButton extends JButton implements SwingConstants * @param isEnabled if <code>true</code> the arrow is drawn in the enabled * state, otherwise it is drawn in the disabled state. */ - private void paintTriangleWest(Graphics g, int x, int y, int size, + private void paintTriangleWest(Graphics g, int x, int y, int size, boolean isEnabled) { int tipX = x; @@ -398,7 +398,7 @@ public class BasicArrowButton extends JButton implements SwingConstants int baseX = x + (size - 1); int baseY1 = tipY - (size - 1); int baseY2 = tipY + (size - 1); - + Polygon triangle = new Polygon(); triangle.addPoint(tipX, tipY); triangle.addPoint(baseX, baseY1); @@ -418,5 +418,5 @@ public class BasicArrowButton extends JButton implements SwingConstants g.drawLine(baseX + 1, baseY1 + 1, baseX + 1, baseY2 + 1); } } - + } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java b/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java index 5e2cf2e48ca..83afc33a23d 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java @@ -252,7 +252,7 @@ public class BasicBorders * <code>UIDefaults</code> of the currently active look and feel * using the keys <code>“SplitPane.darkShadow”</code> and * <code>“SplitPane.highlight”</code>. - * + * * <p><img src="doc-files/BasicBorders.SplitPaneBorder-1.png" width="520" * height="200" alt="[A screen shot for JSplitPane.HORIZONTAL_SPLIT]" /> * @@ -284,7 +284,7 @@ public class BasicBorders * other two edges is the background color of the divider. * * <p><img src="doc-files/BasicBorders.SplitPaneDividerBorder-1.png" - * width="520" height="200" alt= + * width="520" height="200" alt= * "[A screen shot for JSplitPane.HORIZONTAL_SPLIT]" /> * * @return an instance of <code>SplitPaneDividerBorder</code>, which is @@ -332,7 +332,7 @@ public class BasicBorders UIManager.getColor("TextField.light"), UIManager.getColor("TextField.highlight")); } - + /** * Returns a two-pixel thick, green @@ -407,8 +407,8 @@ public class BasicBorders return sharedMarginBorder; } - - + + /** * A border whose appearance depends on the state of * the enclosed button. @@ -429,36 +429,36 @@ public class BasicBorders * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5. */ static final long serialVersionUID = -157053874580739687L; - - + + /** * The color for drawing the shaded parts of the border. * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel */ protected Color shadow; - - + + /** * The color for drawing the dark shaded parts of the border. * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel */ protected Color darkShadow; - - + + /** * The color for drawing the highlighted parts of the border. * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel */ protected Color highlight; - - + + /** * The color for drawing the bright highlighted parts of the border. * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel */ protected Color lightHighlight; - - + + /** * Constructs a new border for drawing a button in the Basic * look and feel. @@ -485,7 +485,7 @@ public class BasicBorders ? lightHighlight : Color.white; } - + /** * Paints the ButtonBorder around a given component. @@ -503,10 +503,10 @@ public class BasicBorders int x, int y, int width, int height) { ButtonModel bmodel = null; - + if (c instanceof AbstractButton) bmodel = ((AbstractButton) c).getModel(); - + BasicGraphicsUtils.drawBezel( g, x, y, width, height, /* pressed */ (bmodel != null) @@ -516,8 +516,8 @@ public class BasicBorders && ((JButton) c).isDefaultButton(), shadow, darkShadow, highlight, lightHighlight); } - - + + /** * Measures the width of this border. * @@ -534,7 +534,7 @@ public class BasicBorders * <code>bottom</code> fields indicate the width of the * border at the respective edge. * - * @see #getBorderInsets(java.awt.Component, java.awt.Insets) + * @see #getBorderInsets(java.awt.Component, java.awt.Insets) */ public Insets getBorderInsets(Component c) { @@ -545,7 +545,7 @@ public class BasicBorders return getBorderInsets(c, null); } - + /** * Measures the width of this border, storing the results into a * pre-existing Insets object. @@ -583,8 +583,8 @@ public class BasicBorders return insets; } } - - + + /** * A border that makes its enclosed component appear as lowered * into the surface. Typically used for text fields. @@ -668,7 +668,7 @@ public class BasicBorders ? lightHighlight : Color.white; } - + /** * Paints the FieldBorder around a given component. * @@ -688,8 +688,8 @@ public class BasicBorders shadow, darkShadow, highlight, lightHighlight); } - - + + /** * Measures the width of this border. * @@ -749,8 +749,8 @@ public class BasicBorders return insets; } } - - + + /** * An invisible, but spacing border whose margin is determined * by calling the <code>getMargin()</code> method of the enclosed @@ -772,8 +772,8 @@ public class BasicBorders * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5. */ static final long serialVersionUID = -3035848353448896090L; - - + + /** * Constructs a new MarginBorder. */ @@ -781,7 +781,7 @@ public class BasicBorders { // Nothing to do here. } - + /** * Measures the width of this border. * @@ -797,8 +797,8 @@ public class BasicBorders { return getBorderInsets(c, new Insets(0, 0, 0, 0)); } - - + + /** * Determines the insets of this border by calling the * <code>getMargin()</code> method of the enclosed component. The @@ -839,7 +839,7 @@ public class BasicBorders margin = ((JToolBar) c).getMargin(); else if (c instanceof JTextComponent) margin = ((JTextComponent) c).getMargin(); - + if (margin == null) insets.top = insets.left = insets.bottom = insets.right = 0; else @@ -853,7 +853,7 @@ public class BasicBorders return insets; } } - + /** * A border for drawing a separator line below JMenuBar. @@ -872,8 +872,8 @@ public class BasicBorders * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5. */ static final long serialVersionUID = -6909056571935227506L; - - + + /** * The shadow color, which is used for the upper line of the * two-pixel thick bottom edge. @@ -949,7 +949,7 @@ public class BasicBorders g.setColor(highlight); g.drawLine(x + 1, y + 1, x + width - 3, y + 1); - g.drawLine(x + width - 1, y, x + width - 1, y + 1); + g.drawLine(x + width - 1, y, x + width - 1, y + 1); } finally { @@ -1098,7 +1098,7 @@ public class BasicBorders { lowered = button.isSelected() || (/* mouse inside */ bmodel.isArmed() && bmodel.isPressed()); - focused = button.hasFocus() && button.isFocusPainted(); + focused = button.hasFocus() && button.isFocusPainted(); } if (lowered) @@ -1112,8 +1112,8 @@ public class BasicBorders shadow, darkShadow, highlight, lightHighlight); } - - + + /** * Measures the width of this border. * @@ -1124,7 +1124,7 @@ public class BasicBorders * <code>bottom</code> fields indicate the width of the * border at the respective edge. * - * @see #getBorderInsets(java.awt.Component, java.awt.Insets) + * @see #getBorderInsets(java.awt.Component, java.awt.Insets) */ public Insets getBorderInsets(Component c) { @@ -1135,7 +1135,7 @@ public class BasicBorders return getBorderInsets(c, null); } - + /** * Measures the width of this border, storing the results into a * pre-existing Insets object. @@ -1439,7 +1439,7 @@ public class BasicBorders y += rect.y - 1; int right = x + rect.width + 1; int bottom = y + rect.height + 1; - + Color oldColor = g.getColor(); try { @@ -1466,7 +1466,7 @@ public class BasicBorders } } - + /** * Measures the width of this border. * @@ -1616,7 +1616,7 @@ public class BasicBorders return true; } - + /** * Determines the JSplitPane whose divider is being painted. * @@ -1661,7 +1661,7 @@ public class BasicBorders */ static final long serialVersionUID = -3528666548001058394L; - + /** * Constructs a new border for drawing a JToggleButton in * the Basic look and feel. @@ -1708,7 +1708,7 @@ public class BasicBorders * is selected or not. */ BasicGraphicsUtils.drawBezel(g, x, y, width, height, - /* pressed */ false, + /* pressed */ false, /* default */ false, shadow, darkShadow, highlight, lightHighlight); @@ -1725,7 +1725,7 @@ public class BasicBorders * <code>bottom</code> fields indicate the width of the * border at the respective edge. * - * @see #getBorderInsets(java.awt.Component, java.awt.Insets) + * @see #getBorderInsets(java.awt.Component, java.awt.Insets) */ public Insets getBorderInsets(Component c) { @@ -1736,7 +1736,7 @@ public class BasicBorders return getBorderInsets(c, null); } - + /** * Measures the width of this border, storing the results into a * pre-existing Insets object. diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java index c99de2c708c..22033b6ad26 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java @@ -131,7 +131,7 @@ public class BasicButtonListener { // Do nothing here. } - + public void propertyChange(PropertyChangeEvent e) { // Store the TextLayout for this in a client property for speed-up @@ -166,31 +166,31 @@ public class BasicButtonListener * * @param b the button to check */ - protected void checkOpacity(AbstractButton b) - { + protected void checkOpacity(AbstractButton b) + { b.setOpaque(b.isContentAreaFilled()); } - - public void focusGained(FocusEvent e) - { + + public void focusGained(FocusEvent e) + { if (e.getSource() instanceof AbstractButton) { AbstractButton button = (AbstractButton) e.getSource(); if (button.isFocusPainted()) - button.repaint(); + button.repaint(); } } - + public void focusLost(FocusEvent e) { if (e.getSource() instanceof AbstractButton) { AbstractButton button = (AbstractButton) e.getSource(); if (button.isFocusPainted()) - button.repaint(); + button.repaint(); } } - + public void installKeyboardActions(JComponent c) { ButtonUI ui = ((AbstractButton) c).getUI(); @@ -198,7 +198,7 @@ public class BasicButtonListener { // Install InputMap. BasicButtonUI basicUI = (BasicButtonUI) ui; - String prefix = basicUI.getPropertyPrefix(); + String prefix = basicUI.getPropertyPrefix(); InputMap focusInputMap = (InputMap) UIManager.get(prefix + "focusInputMap"); SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, @@ -212,11 +212,11 @@ public class BasicButtonListener } SwingUtilities.replaceUIActionMap(c, am); } - - c.getActionMap().put("pressed", - new AbstractAction() + + c.getActionMap().put("pressed", + new AbstractAction() { - public void actionPerformed(ActionEvent e) + public void actionPerformed(ActionEvent e) { AbstractButton button = (AbstractButton) e.getSource(); ButtonModel model = button.getModel(); @@ -225,11 +225,11 @@ public class BasicButtonListener model.setPressed(true); } }); - - c.getActionMap().put("released", - new AbstractAction() + + c.getActionMap().put("released", + new AbstractAction() { - public void actionPerformed(ActionEvent e) + public void actionPerformed(ActionEvent e) { AbstractButton button = (AbstractButton) e.getSource(); ButtonModel model = button.getModel(); @@ -237,7 +237,7 @@ public class BasicButtonListener model.setPressed(false); model.setArmed(false); } - }); + }); } /** @@ -259,23 +259,23 @@ public class BasicButtonListener SwingUtilities.replaceUIActionMap(c, null); SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null); } - + public void stateChanged(ChangeEvent e) { // Need to repaint when the button state changes. ((AbstractButton) e.getSource()).repaint(); } - + public void mouseMoved(MouseEvent e) { // Nothing to do here. } - + public void mouseDragged(MouseEvent e) { // Nothing to do here. } - + public void mouseClicked(MouseEvent e) { // Nothing to do here. @@ -305,7 +305,7 @@ public class BasicButtonListener } /** - * Accept a mouse release event and set the button's + * Accept a mouse release event and set the button's * "pressed" property to <code>true</code>, if the model * is armed. If the model is not armed, ignore the event. * diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java index 9f685bb7bfd..1697c24d926 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java @@ -120,7 +120,7 @@ public class BasicButtonUI extends ButtonUI * * @return A new UI capable of drawing the component */ - public static ComponentUI createUI(final JComponent c) + public static ComponentUI createUI(final JComponent c) { if (sharedUI == null) sharedUI = new BasicButtonUI(); @@ -129,9 +129,9 @@ public class BasicButtonUI extends ButtonUI /** * Returns the default gap between the button's text and icon (in pixels). - * + * * @param b the button (ignored). - * + * * @return The gap. */ public int getDefaultTextIconGap(AbstractButton b) @@ -141,19 +141,19 @@ public class BasicButtonUI extends ButtonUI /** * Sets the text shift offset to zero. - * + * * @see #setTextShiftOffset() */ protected void clearTextShiftOffset() { textShiftOffset = 0; } - + /** * Returns the text shift offset. - * + * * @return The text shift offset. - * + * * @see #clearTextShiftOffset() * @see #setTextShiftOffset() */ @@ -164,7 +164,7 @@ public class BasicButtonUI extends ButtonUI /** * Sets the text shift offset to the value in {@link #defaultTextShiftOffset}. - * + * * @see #clearTextShiftOffset() */ protected void setTextShiftOffset() @@ -185,7 +185,7 @@ public class BasicButtonUI extends ButtonUI /** * Installs the default settings. - * + * * @param b the button (<code>null</code> not permitted). */ protected void installDefaults(AbstractButton b) @@ -218,7 +218,7 @@ public class BasicButtonUI extends ButtonUI /** * Removes the defaults added by {@link #installDefaults(AbstractButton)}. - * + * * @param b the button (<code>null</code> not permitted). */ protected void uninstallDefaults(AbstractButton b) @@ -229,11 +229,11 @@ public class BasicButtonUI extends ButtonUI /** * Creates and returns a new instance of {@link BasicButtonListener}. This - * method provides a hook to make it easy for subclasses to install a + * method provides a hook to make it easy for subclasses to install a * different listener. - * + * * @param b the button. - * + * * @return A new listener. */ protected BasicButtonListener createButtonListener(AbstractButton b) @@ -249,7 +249,7 @@ public class BasicButtonUI extends ButtonUI /** * Installs listeners for the button. - * + * * @param b the button (<code>null</code> not permitted). */ protected void installListeners(AbstractButton b) @@ -259,7 +259,7 @@ public class BasicButtonUI extends ButtonUI { b.addChangeListener(listener); b.addPropertyChangeListener(listener); - b.addFocusListener(listener); + b.addFocusListener(listener); b.addMouseListener(listener); b.addMouseMotionListener(listener); } @@ -271,7 +271,7 @@ public class BasicButtonUI extends ButtonUI /** * Uninstalls listeners for the button. - * + * * @param b the button (<code>null</code> not permitted). */ protected void uninstallListeners(AbstractButton b) @@ -281,7 +281,7 @@ public class BasicButtonUI extends ButtonUI { b.removeChangeListener(listener); b.removePropertyChangeListener(listener); - b.removeFocusListener(listener); + b.removeFocusListener(listener); b.removeMouseListener(listener); b.removeMouseMotionListener(listener); } @@ -304,12 +304,12 @@ public class BasicButtonUI extends ButtonUI /** * Install the BasicButtonUI as the UI for a particular component. * This means registering all the UI's listeners with the component, - * and setting any properties of the button which are particular to + * and setting any properties of the button which are particular to * this look and feel. * * @param c The component to install the UI into */ - public void installUI(final JComponent c) + public void installUI(final JComponent c) { super.installUI(c); if (c instanceof AbstractButton) @@ -395,7 +395,7 @@ public class BasicButtonUI extends ButtonUI * * @return The preferred dimensions of the component */ - public Dimension getPreferredSize(JComponent c) + public Dimension getPreferredSize(JComponent c) { AbstractButton b = (AbstractButton) c; Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, @@ -417,7 +417,7 @@ public class BasicButtonUI extends ButtonUI i = b.getRolloverSelectedIcon(); else if (b.getRolloverIcon() != null) i = b.getRolloverIcon(); - } + } else if (b.isSelected() && b.isEnabled()) { @@ -434,7 +434,7 @@ public class BasicButtonUI extends ButtonUI } /** - * Paint the component, which is an {@link AbstractButton}, according to + * Paint the component, which is an {@link AbstractButton}, according to * its current state. * * @param g The graphics context to paint with @@ -462,13 +462,13 @@ public class BasicButtonUI extends ButtonUI g.setFont(f); Icon icon = b.getIcon(); String text = b.getText(); - text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), + text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), text, icon, - b.getVerticalAlignment(), + b.getVerticalAlignment(), b.getHorizontalAlignment(), - b.getVerticalTextPosition(), + b.getVerticalTextPosition(), b.getHorizontalTextPosition(), - viewR, iconR, textR, + viewR, iconR, textR, text == null ? 0 : b.getIconTextGap()); @@ -541,7 +541,7 @@ public class BasicButtonUI extends ButtonUI /** * Paints the background area of an {@link AbstractButton} in the pressed - * state. This means filling the supplied area with a darker than normal + * state. This means filling the supplied area with a darker than normal * background. * * @param g The graphics context to paint with @@ -557,7 +557,7 @@ public class BasicButtonUI extends ButtonUI g.fillRect(area.x, area.y, area.width, area.height); } } - + /** * Paints the "text" property of an {@link AbstractButton}. * @@ -567,8 +567,8 @@ public class BasicButtonUI extends ButtonUI * @param text The text to paint */ protected void paintText(Graphics g, JComponent c, Rectangle textRect, - String text) - { + String text) + { AbstractButton b = (AbstractButton) c; Font f = b.getFont(); g.setFont(f); @@ -602,10 +602,10 @@ public class BasicButtonUI extends ButtonUI * @since 1.4 */ protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, - String text) + String text) { paintText(g, (JComponent) b, textRect, text); - } + } /** * A helper method that finds the BasicButtonListener for the specified diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java index e45970ed02c..79ce7b83411 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java @@ -52,7 +52,7 @@ import javax.swing.plaf.ComponentUI; */ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI { - + /** * Creates a new BasicCheckBoxMenuItemUI object. */ @@ -60,7 +60,7 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI { super(); } - + /** * Factory method to create a BasicCheckBoxMenuItemUI for the given {@link * JComponent}, which should be a JCheckBoxMenuItem diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java index 43001b8dbfc..0a4da00b2af 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java @@ -47,14 +47,14 @@ import javax.swing.plaf.ComponentUI; * A UI delegate for the {@link JCheckBox} component. */ public class BasicCheckBoxUI extends BasicRadioButtonUI -{ - +{ + /** - * Returns a UI delegate (that is, an instance of this class) for the + * Returns a UI delegate (that is, an instance of this class) for the * specified component. - * + * * @param c the component (this should be a {@link JCheckBox}). - * + * * @return A new instance of <code>BasicCheckBoxUI</code>. */ public static ComponentUI createUI(JComponent c) @@ -63,7 +63,7 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI } /** - * Returns the prefix for entries in the {@link UIManager} defaults table + * Returns the prefix for entries in the {@link UIManager} defaults table * (<code>"CheckBox."</code> in this case). * * @return "CheckBox." @@ -73,7 +73,3 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI return "CheckBox."; } } - - - - diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java index f37cbd7b838..10b56431ae2 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java @@ -74,12 +74,12 @@ public class BasicColorChooserUI extends ColorChooserUI public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName() == JColorChooser.CHOOSER_PANELS_PROPERTY) - makeTabs(chooser.getChooserPanels()); + makeTabs(chooser.getChooserPanels()); else if (e.getPropertyName() == JColorChooser.PREVIEW_PANEL_PROPERTY) - updatePreviewPanel(chooser.getPreviewPanel()); + updatePreviewPanel(chooser.getPreviewPanel()); else if (e.getPropertyName() == JColorChooser.SELECTION_MODEL_PROPERTY) - ((AbstractColorChooserPanel) pane.getSelectedComponent()) - .updateChooser(); + ((AbstractColorChooserPanel) pane.getSelectedComponent()) + .updateChooser(); chooser.repaint(); } @@ -100,10 +100,10 @@ public class BasicColorChooserUI extends ColorChooserUI { if (pane != null) { - AbstractColorChooserPanel panel = (AbstractColorChooserPanel) pane - .getSelectedComponent(); - if (panel != null) - panel.updateChooser(); + AbstractColorChooserPanel panel = (AbstractColorChooserPanel) pane + .getSelectedComponent(); + if (panel != null) + panel.updateChooser(); } chooser.repaint(); } @@ -190,30 +190,30 @@ public class BasicColorChooserUI extends ColorChooserUI { if (c instanceof JColorChooser) { - chooser = (JColorChooser) c; - chooser.setLayout(new BorderLayout()); + chooser = (JColorChooser) c; + chooser.setLayout(new BorderLayout()); - // Do this first, so we avoid doing work for property change events. - defaultChoosers = createDefaultChoosers(); - chooser.setChooserPanels(defaultChoosers); - pane = new JTabbedPane(); + // Do this first, so we avoid doing work for property change events. + defaultChoosers = createDefaultChoosers(); + chooser.setChooserPanels(defaultChoosers); + pane = new JTabbedPane(); - pane.addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent e) - { - pane.repaint(); - } - }); + pane.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent e) + { + pane.repaint(); + } + }); - makeTabs(defaultChoosers); + makeTabs(defaultChoosers); - chooser.add(pane, BorderLayout.NORTH); + chooser.add(pane, BorderLayout.NORTH); - installPreviewPanel(); + installPreviewPanel(); - installDefaults(); - installListeners(); + installDefaults(); + installListeners(); } } @@ -274,9 +274,9 @@ public class BasicColorChooserUI extends ColorChooserUI { if (prevContainer == null) { - prevContainer = new JPanel(); - prevContainer.setLayout(new BorderLayout()); - chooser.add(prevContainer, BorderLayout.CENTER); + prevContainer = new JPanel(); + prevContainer.setLayout(new BorderLayout()); + chooser.add(prevContainer, BorderLayout.CENTER); } prevContainer.removeAll(); prevContainer.add(preview, BorderLayout.CENTER); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java index d8792619656..b04f3fa014a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java @@ -69,7 +69,7 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor, } /** - * Returns the component that will be used by the combo box to display and + * Returns the component that will be used by the combo box to display and * edit the currently selected item in the combo box. * * @return The editor component, which is a {@link JTextField} in this case. @@ -138,7 +138,7 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor, } /** - * Adds an {@link ActionListener} to the editor component. If the user will + * Adds an {@link ActionListener} to the editor component. If the user will * edit currently selected item in the textfield and pressEnter, then action * will be performed. The actionPerformed of this ActionListener should * change the selected item of the comboBox to the newly editted selected @@ -163,7 +163,7 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor, } /** - * A subclass of {@link BasicComboBoxEditor} that implements the + * A subclass of {@link BasicComboBoxEditor} that implements the * {@link UIResource} interface. */ public static class UIResource extends BasicComboBoxEditor diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java index 3c8d1e8c589..761d7d11f5d 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java @@ -51,12 +51,12 @@ import javax.swing.border.Border; import javax.swing.border.EmptyBorder; /** - * A renderer for a {@link JComboBox}. + * A renderer for a {@link JComboBox}. * * @author Olga Rodimina */ -public class BasicComboBoxRenderer - extends JLabel +public class BasicComboBoxRenderer + extends JLabel implements ListCellRenderer, Serializable { /** @@ -75,7 +75,7 @@ public class BasicComboBoxRenderer /** * Returns preferredSize of the renderer - * + * * @return preferredSize of the renderer */ public Dimension getPreferredSize() diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java index ff636d684c1..07d4f42cdbd 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -100,9 +100,9 @@ public class BasicComboBoxUI extends ComboBoxUI protected JComboBox comboBox; /** - * The component that is responsible for displaying/editing the selected - * item of the combo box. - * + * The component that is responsible for displaying/editing the selected + * item of the combo box. + * * @see BasicComboBoxEditor#getEditorComponent() */ protected Component editor; @@ -144,11 +144,11 @@ public class BasicComboBoxUI extends ComboBoxUI * Popup list containing the combo box's menu items. */ protected ComboPopup popup; - + protected KeyListener popupKeyListener; - + protected MouseListener popupMouseListener; - + protected MouseMotionListener popupMouseMotionListener; /** @@ -187,7 +187,7 @@ public class BasicComboBoxUI extends ComboBoxUI } /** - * A factory method to create a UI delegate for the given + * A factory method to create a UI delegate for the given * {@link JComponent}, which should be a {@link JComboBox}. * * @param c The {@link JComponent} a UI is being created for. @@ -203,7 +203,7 @@ public class BasicComboBoxUI extends ComboBoxUI * Installs the UI for the given {@link JComponent}. * * @param c the JComponent to install a UI for. - * + * * @see #uninstallUI(JComponent) */ public void installUI(JComponent c) @@ -230,7 +230,7 @@ public class BasicComboBoxUI extends ComboBoxUI { currentEditor = createEditor(); comboBox.setEditor(currentEditor); - } + } installComponents(); installListeners(); @@ -246,7 +246,7 @@ public class BasicComboBoxUI extends ComboBoxUI * Uninstalls the UI for the given {@link JComponent}. * * @param c The JComponent that is having this UI removed. - * + * * @see #installUI(JComponent) */ public void uninstallUI(JComponent c) @@ -262,9 +262,9 @@ public class BasicComboBoxUI extends ComboBoxUI } /** - * Installs the defaults that are defined in the {@link BasicLookAndFeel} + * Installs the defaults that are defined in the {@link BasicLookAndFeel} * for this {@link JComboBox}. - * + * * @see #uninstallDefaults() */ protected void installDefaults() @@ -276,7 +276,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Creates and installs the listeners for this UI. - * + * * @see #uninstallListeners() */ protected void installListeners() @@ -312,7 +312,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Uninstalls the defaults and sets any objects created during * install to <code>null</code>. - * + * * @see #installDefaults() */ protected void uninstallDefaults() @@ -322,7 +322,7 @@ public class BasicComboBoxUI extends ComboBoxUI if (comboBox.getForeground() instanceof UIResource) comboBox.setForeground(null); - + if (comboBox.getBackground() instanceof UIResource) comboBox.setBackground(null); @@ -331,7 +331,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Detaches all the listeners we attached in {@link #installListeners}. - * + * * @see #installListeners() */ protected void uninstallListeners() @@ -429,7 +429,7 @@ public class BasicComboBoxUI extends ComboBoxUI } /** - * Creates and returns a layout manager for the combo box. Subclasses can + * Creates and returns a layout manager for the combo box. Subclasses can * override this method to provide a different layout. * * @return a layout manager for the combo box. @@ -452,7 +452,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Creates the component that will be responsible for displaying/editing - * the selected item in the combo box. This editor is used only when combo + * the selected item in the combo box. This editor is used only when combo * box is editable. * * @return A new component that will be responsible for displaying/editing @@ -484,7 +484,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Uninstalls components from this {@link JComboBox}. - * + * * @see #installComponents() */ protected void uninstallComponents() @@ -546,7 +546,7 @@ public class BasicComboBoxUI extends ComboBoxUI } /** - * Unconfigures the editor for this combo box. + * Unconfigures the editor for this combo box. */ protected void unconfigureEditor() { @@ -558,7 +558,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Configures the arrow button. - * + * * @see #configureArrowButton() */ public void configureArrowButton() @@ -569,7 +569,7 @@ public class BasicComboBoxUI extends ComboBoxUI arrowButton.setFocusable(false); arrowButton.addMouseListener(popup.getMouseListener()); arrowButton.addMouseMotionListener(popup.getMouseMotionListener()); - + // Mark the button as not closing the popup, we handle this ourselves. arrowButton.putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP, Boolean.TRUE); @@ -578,7 +578,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Unconfigures the arrow button. - * + * * @see #configureArrowButton() * * @specnote The specification says this method is implementation specific @@ -613,7 +613,7 @@ public class BasicComboBoxUI extends ComboBoxUI * * @param c The JComboBox to check * - * @return <code>true</code> if popup part of the JComboBox is visible and + * @return <code>true</code> if popup part of the JComboBox is visible and * <code>false</code> otherwise. */ public boolean isPopupVisible(JComboBox c) @@ -917,12 +917,12 @@ public class BasicComboBoxUI extends ComboBoxUI = new DefaultListCellRenderer(); /** - * Returns the default size for the display area of a combo box that does + * Returns the default size for the display area of a combo box that does * not contain any elements. This method returns the width and height of - * a single space in the current font, plus a margin of 1 pixel. + * a single space in the current font, plus a margin of 1 pixel. * * @return The default display size. - * + * * @see #getDisplaySize() */ protected Dimension getDefaultSize() @@ -937,7 +937,7 @@ public class BasicComboBoxUI extends ComboBoxUI } /** - * Returns the size of the display area for the combo box. This size will be + * Returns the size of the display area for the combo box. This size will be * the size of the combo box, not including the arrowButton. * * @return The size of the display area for the combo box. @@ -950,11 +950,11 @@ public class BasicComboBoxUI extends ComboBoxUI { renderer = DEFAULT_RENDERER; } - + Object prototype = comboBox.getPrototypeDisplayValue(); if (prototype != null) { - Component comp = renderer.getListCellRendererComponent(listBox, + Component comp = renderer.getListCellRendererComponent(listBox, prototype, -1, false, false); currentValuePane.add(comp); comp.setFont(comboBox.getFont()); @@ -971,7 +971,7 @@ public class BasicComboBoxUI extends ComboBoxUI { for (int i = 0; i < size; ++i) { - Component comp = renderer.getListCellRendererComponent(listBox, + Component comp = renderer.getListCellRendererComponent(listBox, model.getElementAt(i), -1, false, false); currentValuePane.add(comp); comp.setFont(comboBox.getFont()); @@ -1009,7 +1009,7 @@ public class BasicComboBoxUI extends ComboBoxUI (InputMap) UIManager.get("ComboBox.ancestorInputMap")); // Install any action maps here. } - + /** * Uninstalls the keyboard actions for the {@link JComboBox} there were * installed by in {@link #installListeners}. @@ -1024,7 +1024,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * A {@link LayoutManager} used to position the sub-components of the * {@link JComboBox}. - * + * * @see BasicComboBoxUI#createLayoutManager() */ public class ComboBoxLayoutManager implements LayoutManager @@ -1040,7 +1040,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Adds a component to the layout. This method does nothing, since the * layout manager doesn't need to track the components. - * + * * @param name the name to associate the component with (ignored). * @param comp the component (ignored). */ @@ -1052,7 +1052,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Removes a component from the layout. This method does nothing, since * the layout manager doesn't need to track the components. - * + * * @param comp the component. */ public void removeLayoutComponent(Component comp) @@ -1063,7 +1063,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Returns preferred layout size of the JComboBox. * - * @param parent the Container for which the preferred size should be + * @param parent the Container for which the preferred size should be * calculated. * * @return The preferred size for the given container @@ -1075,9 +1075,9 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Returns the minimum layout size. - * + * * @param parent the container. - * + * * @return The minimum size. */ public Dimension minimumLayoutSize(Container parent) @@ -1095,7 +1095,7 @@ public class BasicComboBoxUI extends ComboBoxUI */ public void layoutContainer(Container parent) { - // Position editor component to the left of arrow button if combo box is + // Position editor component to the left of arrow button if combo box is // editable Insets i = getInsets(); int arrowSize = comboBox.getHeight() - (i.top + i.bottom); @@ -1152,7 +1152,7 @@ public class BasicComboBoxUI extends ComboBoxUI } /** - * Handles {@link ItemEvent}s fired by the {@link JComboBox} when its + * Handles {@link ItemEvent}s fired by the {@link JComboBox} when its * selected item changes. */ public class ItemHandler extends Object implements ItemListener @@ -1297,7 +1297,7 @@ public class BasicComboBoxUI extends ComboBoxUI } } } - + } /** @@ -1328,7 +1328,7 @@ public class BasicComboBoxUI extends ComboBoxUI /** * Invoked whenever bound property of JComboBox changes. - * + * * @param e the event. */ public void propertyChange(PropertyChangeEvent e) @@ -1404,7 +1404,7 @@ public class BasicComboBoxUI extends ComboBoxUI isMinimumSizeDirty = true; comboBox.revalidate(); } - // FIXME: Need to handle changes in other bound properties. + // FIXME: Need to handle changes in other bound properties. } } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java index 11f832ae890..3e54ca7c62a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java @@ -483,7 +483,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup */ protected void installListListeners() { - // mouse listener listening to mouse events occuring in the + // mouse listener listening to mouse events occuring in the // combo box's list of items. listMouseListener = createListMouseListener(); list.addMouseListener(listMouseListener); @@ -613,7 +613,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup */ protected void autoScrollUp() { - // scroll up the scroll bar to make the item above visible + // scroll up the scroll bar to make the item above visible JScrollBar scrollbar = scroller.getVerticalScrollBar(); int scrollToNext = list.getScrollableUnitIncrement(super.getBounds(), SwingConstants.VERTICAL, @@ -621,8 +621,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup scrollbar.setValue(scrollbar.getValue() - scrollToNext); - // If we haven't reached the begging of the combo box's list of items, - // then highlight next element above currently highlighted element + // If we haven't reached the begging of the combo box's list of items, + // then highlight next element above currently highlighted element if (list.getSelectedIndex() != 0) list.setSelectedIndex(list.getSelectedIndex() - 1); } @@ -633,7 +633,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup */ protected void autoScrollDown() { - // scroll scrollbar down to make next item visible + // scroll scrollbar down to make next item visible JScrollBar scrollbar = scroller.getVerticalScrollBar(); int scrollToNext = list.getScrollableUnitIncrement(super.getBounds(), SwingConstants.VERTICAL, @@ -713,12 +713,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup for (int i = 0; i < maxRowCount; i++) { - Component comp = rend.getListCellRendererComponent(list, - comboBox.getModel() - .getElementAt(i), - -1, false, false); - Dimension dim = comp.getPreferredSize(); - totalHeight += dim.height; + Component comp = rend.getListCellRendererComponent(list, + comboBox.getModel() + .getElementAt(i), + -1, false, false); + Dimension dim = comp.getPreferredSize(); + totalHeight += dim.height; } return totalHeight == 0 ? 100 : totalHeight; @@ -995,9 +995,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { if (e.getPropertyName().equals("renderer")) { - list.setCellRenderer(comboBox.getRenderer()); - if (isVisible()) - hide(); + list.setCellRenderer(comboBox.getRenderer()); + if (isVisible()) + hide(); } if (e.getPropertyName().equals("model")) { diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java index 3f8730249da..e522938121a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java @@ -118,7 +118,7 @@ public class BasicDesktopIconUI extends DesktopIconUI yOffset = e.getY(); pane = frame.getDesktopPane(); if (pane != null) - pane.getDesktopManager().beginDraggingFrame(desktopIcon); + pane.getDesktopManager().beginDraggingFrame(desktopIcon); } /** @@ -129,7 +129,7 @@ public class BasicDesktopIconUI extends DesktopIconUI public void mouseReleased(MouseEvent e) { if (pane != null) - pane.getDesktopManager().endDraggingFrame(desktopIcon); + pane.getDesktopManager().endDraggingFrame(desktopIcon); xOffset = 0; yOffset = 0; } @@ -147,9 +147,9 @@ public class BasicDesktopIconUI extends DesktopIconUI int newHeight) { if (pane != null) - pane.getDesktopManager().dragFrame(f, newX, newY); + pane.getDesktopManager().dragFrame(f, newX, newY); else - desktopIcon.setBounds(newX, newY, newWidth, newHeight); + desktopIcon.setBounds(newX, newY, newWidth, newHeight); } } @@ -308,7 +308,7 @@ public class BasicDesktopIconUI extends DesktopIconUI /** The PropertyChangeListener listening to the JDesktopIcon. */ private transient PropertyChangeListener propertyHandler; - + /** The default icon used when no frame icon is given by the JInternalFrame. */ static Icon defaultIcon = new InternalFrameDefaultMenuIcon(); @@ -389,15 +389,15 @@ public class BasicDesktopIconUI extends DesktopIconUI { if (c instanceof JDesktopIcon) { - desktopIcon = (JDesktopIcon) c; - desktopIcon.setLayout(new BorderLayout()); - frame = desktopIcon.getInternalFrame(); + desktopIcon = (JDesktopIcon) c; + desktopIcon.setLayout(new BorderLayout()); + frame = desktopIcon.getInternalFrame(); - installDefaults(); - installComponents(); - installListeners(); + installDefaults(); + installComponents(); + installListeners(); - desktopIcon.setOpaque(true); + desktopIcon.setOpaque(true); } } @@ -409,11 +409,11 @@ public class BasicDesktopIconUI extends DesktopIconUI public void uninstallUI(JComponent c) { desktopIcon.setOpaque(false); - + uninstallListeners(); uninstallComponents(); uninstallDefaults(); - + frame = null; desktopIcon.setLayout(null); desktopIcon = null; @@ -444,7 +444,7 @@ public class BasicDesktopIconUI extends DesktopIconUI protected void uninstallComponents() { desktopIcon.remove(button); - + button = null; } @@ -460,29 +460,29 @@ public class BasicDesktopIconUI extends DesktopIconUI propertyHandler = new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent e) - { - if (e.getPropertyName().equals(JInternalFrame.TITLE_PROPERTY)) - button.setText(desktopIcon.getInternalFrame().getTitle()); - else if (e.getPropertyName().equals(JInternalFrame.FRAME_ICON_PROPERTY)) - { - Icon use = desktopIcon.getInternalFrame().getFrameIcon(); - if (use == null) - use = defaultIcon; - button.setIcon(use); - } - desktopIcon.revalidate(); - desktopIcon.repaint(); - } + public void propertyChange(PropertyChangeEvent e) + { + if (e.getPropertyName().equals(JInternalFrame.TITLE_PROPERTY)) + button.setText(desktopIcon.getInternalFrame().getTitle()); + else if (e.getPropertyName().equals(JInternalFrame.FRAME_ICON_PROPERTY)) + { + Icon use = desktopIcon.getInternalFrame().getFrameIcon(); + if (use == null) + use = defaultIcon; + button.setIcon(use); + } + desktopIcon.revalidate(); + desktopIcon.repaint(); + } }; frame.addPropertyChangeListener(propertyHandler); button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) - { + public void actionPerformed(ActionEvent e) + { deiconize(); - } + } }); } @@ -492,10 +492,10 @@ public class BasicDesktopIconUI extends DesktopIconUI protected void uninstallListeners() { // button is nulled so no need to remove it. - + frame.removePropertyChangeListener(propertyHandler); propertyHandler = null; - + desktopIcon.removeMouseMotionListener(mouseHandler); desktopIcon.removeMouseListener(mouseHandler); } @@ -506,7 +506,7 @@ public class BasicDesktopIconUI extends DesktopIconUI protected void installDefaults() { // FIXME: Move border to defaults. - desktopIcon.setBorder(new DesktopIconBorder()); + desktopIcon.setBorder(new DesktopIconBorder()); } /** @@ -578,7 +578,7 @@ public class BasicDesktopIconUI extends DesktopIconUI /** * This method deiconizes the JInternalFrame associated with the JDesktopIcon. */ - public void deiconize() + public void deiconize() { try { diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java index 4116858da9d..cbc3f9f8952 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java @@ -94,7 +94,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI public boolean isEnabled() { if (desktop.getSelectedFrame() != null) - return desktop.getSelectedFrame().isClosable(); + return desktop.getSelectedFrame().isClosable(); return false; } } @@ -133,7 +133,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI public boolean isEnabled() { if (desktop.getSelectedFrame() != null) - return desktop.getSelectedFrame().isMaximizable(); + return desktop.getSelectedFrame().isMaximizable(); return false; } } @@ -172,7 +172,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI public boolean isEnabled() { if (desktop.getSelectedFrame() != null) - return desktop.getSelectedFrame().isIconifiable(); + return desktop.getSelectedFrame().isIconifiable(); return false; } } @@ -191,23 +191,23 @@ public class BasicDesktopPaneUI extends DesktopPaneUI */ public void actionPerformed(ActionEvent e) { - // This is supposed to set the next selected frame. + // This is supposed to set the next selected frame. JInternalFrame[] frames = desktop.getAllFrames(); if (frames.length == 0) - return; + return; JInternalFrame sFrame = frames[0]; if (desktop.getSelectedFrame() != null) - sFrame = desktop.getSelectedFrame(); + sFrame = desktop.getSelectedFrame(); int i = 0; for (; i < frames.length; i++) - if (frames[i] == sFrame) - break; + if (frames[i] == sFrame) + break; - // FIXME: Navigate actions go reverse too. + // FIXME: Navigate actions go reverse too. if (i == frames.length) - i = 0; + i = 0; desktop.setSelectedFrame(frames[i]); } @@ -399,11 +399,11 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { if (c instanceof JDesktopPane) { - desktop = (JDesktopPane) c; + desktop = (JDesktopPane) c; - installDefaults(); - installDesktopManager(); - installKeyboardActions(); + installDefaults(); + installDesktopManager(); + installKeyboardActions(); } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java b/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java index b1fb727feeb..62657ad8660 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicDirectoryModel.java @@ -54,7 +54,7 @@ import javax.swing.filechooser.FileSystemView; /** * Implements an AbstractListModel for directories where the source - * of the files is a JFileChooser object. + * of the files is a JFileChooser object. * * This class is used for sorting and ordering the file list in * a JFileChooser L&F object. @@ -188,7 +188,7 @@ public class BasicDirectoryModel extends AbstractListModel if (filechooser.accept(files[i])) accepted.add(files[i]); } - + // Occasional check if we have been interrupted. if (isInterrupted()) return; @@ -286,7 +286,7 @@ public class BasicDirectoryModel extends AbstractListModel List added = newCache.subList(start, end); UpdateSwingRequest r = new UpdateSwingRequest(added, start, - null, 0); + null, 0); invokeLater(r); newCache = null; } @@ -332,10 +332,10 @@ public class BasicDirectoryModel extends AbstractListModel { public int compare(Object o1, Object o2) { - if (lt((File) o1, (File) o2)) - return -1; - else - return 1; + if (lt((File) o1, (File) o2)) + return -1; + else + return 1; } }; @@ -366,7 +366,7 @@ public class BasicDirectoryModel extends AbstractListModel } /** - * Fires a content change event. + * Fires a content change event. */ public void fireContentsChanged() { @@ -397,7 +397,7 @@ public class BasicDirectoryModel extends AbstractListModel } /** - * Returns the (java.io.File) object at + * Returns the (java.io.File) object at * an index in the list. * * @param index The list index @@ -441,7 +441,7 @@ public class BasicDirectoryModel extends AbstractListModel } /** - * Returns the size of the list, which only includes directories + * Returns the size of the list, which only includes directories * if the JFileChooser is set to DIRECTORIES_ONLY. * * Otherwise, both directories and files are included in the count. @@ -537,12 +537,12 @@ public class BasicDirectoryModel extends AbstractListModel || property.equals(JFileChooser.FILE_VIEW_CHANGED_PROPERTY) ) { - validateFileCache(); + validateFileCache(); } } /** - * Renames a file - However, does <I>not</I> re-sort the list + * Renames a file - However, does <I>not</I> re-sort the list * or replace the old file with the new one in the list. * * @param oldFile The old file @@ -584,4 +584,3 @@ public class BasicDirectoryModel extends AbstractListModel } } } - diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java index d514a87c8ee..6ddd2513b9a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java @@ -1,4 +1,4 @@ -/* BasicEditorPaneUI.java -- +/* BasicEditorPaneUI.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java index 4b6e2f79856..347686d6ea8 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java @@ -72,7 +72,7 @@ import javax.swing.plaf.metal.MetalIconFactory; /** - * A UI delegate for the {@link JFileChooser} component under the + * A UI delegate for the {@link JFileChooser} component under the * {@link BasicLookAndFeel}. */ public class BasicFileChooserUI extends FileChooserUI @@ -89,7 +89,7 @@ public class BasicFileChooserUI extends FileChooserUI { // Nothing to do here. } - + /** * Returns <code>true</code> always, as all files are accepted by this * filter. @@ -116,7 +116,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Handles a user action to approve the dialog selection. - * + * * @see BasicFileChooserUI#getApproveSelectionAction() */ protected class ApproveSelectionAction extends AbstractAction @@ -131,7 +131,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Sets the current selection and closes the dialog. - * + * * @param e the action event. */ public void actionPerformed(ActionEvent e) @@ -159,8 +159,8 @@ public class BasicFileChooserUI extends FileChooserUI else { File f = new File(filechooser.getCurrentDirectory(), getFileName()); - if ( selectedDir != null ) - f = selectedDir; + if ( selectedDir != null ) + f = selectedDir; if (filechooser.isTraversable(f)) { filechooser.setCurrentDirectory(f); @@ -212,7 +212,7 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * Retrieves the icon associated with the specified file/directory, if + * Retrieves the icon associated with the specified file/directory, if * there is one. * * @param f the file/directory. @@ -225,8 +225,8 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * Returns a description of the given file/directory. In this - * implementation, the description is the same as the name returned by + * Returns a description of the given file/directory. In this + * implementation, the description is the same as the name returned by * {@link #getName(File)}. * * @param f the file/directory. @@ -249,11 +249,11 @@ public class BasicFileChooserUI extends FileChooserUI { Icon val = getCachedIcon(f); if (val != null) - return val; + return val; if (filechooser.isTraversable(f)) - val = directoryIcon; + val = directoryIcon; else - val = fileIcon; + val = fileIcon; cacheIcon(f, val); return val; } @@ -287,9 +287,9 @@ public class BasicFileChooserUI extends FileChooserUI public String getTypeDescription(File f) { if (filechooser.isTraversable(f)) - return dirDescText; + return dirDescText; else - return fileDescText; + return fileDescText; } /** @@ -308,7 +308,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Handles an action to cancel the file chooser. - * + * * @see BasicFileChooserUI#getCancelSelectionAction() */ protected class CancelSelectionAction extends AbstractAction @@ -338,7 +338,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * An action to handle changes to the parent directory (for example, via * a click on the "up folder" button). - * + * * @see BasicFileChooserUI#getChangeToParentDirectoryAction() */ protected class ChangeToParentDirectoryAction extends AbstractAction @@ -366,7 +366,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * A mouse listener that handles double-click events. - * + * * @see BasicFileChooserUI#createDoubleClickListener(JFileChooser, JList) */ protected class DoubleClickListener extends MouseAdapter @@ -392,7 +392,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Handles a mouse click event. - * + * * @param e the event. */ public void mouseClicked(MouseEvent e) @@ -422,7 +422,7 @@ public class BasicFileChooserUI extends FileChooserUI String path = p.toString(); File f = fsv.createFileObject(path); filechooser.setSelectedFile(f); - + if (filechooser.isMultiSelectionEnabled()) { int[] inds = list.getSelectedIndices(); @@ -431,7 +431,7 @@ public class BasicFileChooserUI extends FileChooserUI allFiles[i] = (File) list.getModel().getElementAt(inds[i]); filechooser.setSelectedFiles(allFiles); } - + if (filechooser.isTraversable(f)) { setDirectorySelected(true); @@ -444,18 +444,18 @@ public class BasicFileChooserUI extends FileChooserUI } lastSelected = path; parentPath = f.getParent(); - + if (f.isFile()) setFileName(f.getName()); - else if (filechooser.getFileSelectionMode() != - JFileChooser.FILES_ONLY) + else if (filechooser.getFileSelectionMode() != + JFileChooser.FILES_ONLY) setFileName(path); } } /** * Handles a mouse entered event (NOT IMPLEMENTED). - * + * * @param e the mouse event. */ public void mouseEntered(MouseEvent e) @@ -465,9 +465,9 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * An action that changes the file chooser to display the user's home - * directory. - * + * An action that changes the file chooser to display the user's home + * directory. + * * @see BasicFileChooserUI#getGoHomeAction() */ protected class GoHomeAction extends AbstractAction @@ -497,7 +497,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * An action that handles the creation of a new folder/directory. - * + * * @see BasicFileChooserUI#getNewFolderAction() */ protected class NewFolderAction extends AbstractAction @@ -519,12 +519,12 @@ public class BasicFileChooserUI extends FileChooserUI { try { - filechooser.getFileSystemView().createNewFolder(filechooser - .getCurrentDirectory()); + filechooser.getFileSystemView().createNewFolder(filechooser + .getCurrentDirectory()); } catch (IOException ioe) { - return; + return; } filechooser.rescanCurrentDirectory(); filechooser.repaint(); @@ -533,7 +533,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * A listener for selection events in the file list. - * + * * @see BasicFileChooserUI#createListSelectionListener(JFileChooser) */ protected class SelectionListener implements ListSelectionListener @@ -556,24 +556,24 @@ public class BasicFileChooserUI extends FileChooserUI JList list = (JList) e.getSource(); Object f = list.getSelectedValue(); if (f == null) - return; + return; File file = filechooser.getFileSystemView().createFileObject(f.toString()); if (! filechooser.isTraversable(file)) - { - selectedDir = null; - filechooser.setSelectedFile(file); - } + { + selectedDir = null; + filechooser.setSelectedFile(file); + } else - { - selectedDir = file; - filechooser.setSelectedFile(null); - } + { + selectedDir = file; + filechooser.setSelectedFile(null); + } } } /** * DOCUMENT ME! - * + * * @see BasicFileChooserUI#getUpdateAction() */ protected class UpdateAction extends AbstractAction @@ -722,46 +722,46 @@ public class BasicFileChooserUI extends FileChooserUI // FIXME: describe what is contained in the bottom panel /** The bottom panel. */ JPanel bottomPanel; - + /** The close panel. */ JPanel closePanel; /** Text box that displays file name */ JTextField entry; - + /** Current parent path */ String parentPath; - + /** * The action for the 'approve' button. * @see #getApproveSelectionAction() */ private ApproveSelectionAction approveSelectionAction; - + /** * The action for the 'cancel' button. * @see #getCancelSelectionAction() */ private CancelSelectionAction cancelSelectionAction; - + /** * The action for the 'go home' control button. * @see #getGoHomeAction() */ private GoHomeAction goHomeAction; - + /** * The action for the 'up folder' control button. * @see #getChangeToParentDirectoryAction() */ private ChangeToParentDirectoryAction changeToParentDirectoryAction; - + /** * The action for the 'new folder' control button. * @see #getNewFolderAction() */ private NewFolderAction newFolderAction; - + /** * The action for ???. // FIXME: what is this? * @see #getUpdateAction() @@ -774,7 +774,7 @@ public class BasicFileChooserUI extends FileChooserUI * the directory on "Open" when in that mode. */ private File selectedDir; - + // -- end private -- /** @@ -810,7 +810,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Installs the UI for the specified component. - * + * * @param c the component (should be a {@link JFileChooser}). */ public void installUI(JComponent c) @@ -825,7 +825,7 @@ public class BasicFileChooserUI extends FileChooserUI installDefaults(fc); installComponents(fc); installListeners(fc); - + File path = filechooser.getCurrentDirectory(); if (path != null) parentPath = path.getParent(); @@ -834,7 +834,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Uninstalls this UI from the given component. - * + * * @param c the component (should be a {@link JFileChooser}). */ public void uninstallUI(JComponent c) @@ -868,7 +868,7 @@ public class BasicFileChooserUI extends FileChooserUI if (parentFiles.size() == 0) return; - } + } /** * Creates and install the subcomponents for the file chooser. @@ -996,9 +996,9 @@ public class BasicFileChooserUI extends FileChooserUI directoryOpenButtonText = "Open"; directoryOpenButtonToolTipText = "Open selected directory"; - directoryOpenButtonMnemonic + directoryOpenButtonMnemonic = new Integer((String) UIManager.get("FileChooser.directoryOpenButtonMnemonic")).intValue(); - + helpButtonText = "Help"; helpButtonToolTipText = "FileChooser help"; helpButtonMnemonic = new Integer((String) UIManager.get("FileChooser.helpButtonMnemonic")).intValue(); @@ -1010,7 +1010,7 @@ public class BasicFileChooserUI extends FileChooserUI saveButtonText = "Save"; saveButtonToolTipText = "Save selected file"; saveButtonMnemonic = new Integer((String) UIManager.get("FileChooser.saveButtonMnemonic")).intValue(); - + updateButtonText = "Update"; updateButtonToolTipText = "Update directory listing"; updateButtonMnemonic = new Integer((String) UIManager.get("FileChooser.updateButtonMnemonic")).intValue(); @@ -1041,7 +1041,7 @@ public class BasicFileChooserUI extends FileChooserUI saveButtonText = null; saveButtonToolTipText = null; - + updateButtonText = null; updateButtonToolTipText = null; } @@ -1067,9 +1067,9 @@ public class BasicFileChooserUI extends FileChooserUI /** * Creates a listener to handle changes to the properties of the given * file chooser component. - * + * * @param fc the file chooser component. - * + * * @return A new listener. */ public PropertyChangeListener createPropertyChangeListener(JFileChooser fc) @@ -1080,7 +1080,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Returns the current file name. - * + * * @return The current file name. */ public String getFileName() @@ -1092,7 +1092,7 @@ public class BasicFileChooserUI extends FileChooserUI * Returns the current directory name. * * @return The directory name. - * + * * @see #setDirectoryName(String) */ public String getDirectoryName() @@ -1105,12 +1105,12 @@ public class BasicFileChooserUI extends FileChooserUI * Sets the file name. * * @param filename the file name. - * + * * @see #getFileName() */ public void setFileName(String filename) { - // FIXME: it might be the case that this method provides an access + // FIXME: it might be the case that this method provides an access // point for the JTextField (or whatever) a subclass is using... //this.filename = filename; } @@ -1119,7 +1119,7 @@ public class BasicFileChooserUI extends FileChooserUI * Sets the directory name (NOT IMPLEMENTED). * * @param dirname the directory name. - * + * * @see #getDirectoryName() */ public void setDirectoryName(String dirname) @@ -1149,7 +1149,7 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * Returns the {@link JFileChooser} component that this UI delegate + * Returns the {@link JFileChooser} component that this UI delegate * represents. * * @return The component represented by this UI delegate. @@ -1184,7 +1184,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Returns the tool tip text for the approve (open/save) button. This first * checks the file chooser to see if a value has been explicitly set - if - * not, a default value appropriate for the type of file chooser is + * not, a default value appropriate for the type of file chooser is * returned. * * @param fc the file chooser. @@ -1236,7 +1236,7 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * Returns <code>true</code> if a directory is selected, and + * Returns <code>true</code> if a directory is selected, and * <code>false</code> otherwise. * * @return A boolean. @@ -1295,7 +1295,7 @@ public class BasicFileChooserUI extends FileChooserUI * @param fc the file chooser component. * * @return The file view. - * + * * @see JFileChooser#getFileView() */ public FileView getFileView(JFileChooser fc) @@ -1309,7 +1309,7 @@ public class BasicFileChooserUI extends FileChooserUI * @param fc the file chooser (<code>null</code> not permitted). * * @return The dialog title. - * + * * @see JFileChooser#getDialogTitle() */ public String getDialogTitle(JFileChooser fc) @@ -1326,7 +1326,7 @@ public class BasicFileChooserUI extends FileChooserUI * @param fc the file chooser (<code>null</code> not permitted). * * @return The approve button mnemonic. - * + * * @see JFileChooser#getApproveButtonMnemonic() */ public int getApproveButtonMnemonic(JFileChooser fc) @@ -1345,7 +1345,7 @@ public class BasicFileChooserUI extends FileChooserUI * @param fc the file chooser (<code>null</code> not permitted). * * @return The approve button text. - * + * * @see JFileChooser#getApproveButtonText() */ public String getApproveButtonText(JFileChooser fc) @@ -1362,7 +1362,7 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * Creates and returns a new action that will be used with the "new folder" + * Creates and returns a new action that will be used with the "new folder" * button. * * @return A new instance of {@link NewFolderAction}. @@ -1375,7 +1375,7 @@ public class BasicFileChooserUI extends FileChooserUI } /** - * Creates and returns a new action that will be used with the "home folder" + * Creates and returns a new action that will be used with the "home folder" * button. * * @return A new instance of {@link GoHomeAction}. @@ -1426,7 +1426,7 @@ public class BasicFileChooserUI extends FileChooserUI /** * Returns the update action (an instance of {@link UpdateAction}). * - * @return An action. + * @return An action. */ public Action getUpdateAction() { diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java index 9c7f1c4c5d1..5559214358e 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java @@ -66,4 +66,4 @@ public class BasicFormattedTextFieldUI extends BasicTextFieldUI { return "FormattedTextField"; } -}
\ No newline at end of file +} diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java index e73c39bf6ac..f270d3335d8 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java @@ -142,7 +142,7 @@ public class BasicGraphicsUtils g.setColor(darkShadow); g.drawLine(x + 1, y + 1, x2 - 2, y + 1); // top, inner g.drawLine(x + 1, y + 2, x + 1, y2 - 2); // left, inner - + g.setColor(highlight); g.drawLine(x + 1, y2 - 1, x2 - 1, y2 - 1); // bottom, inner g.drawLine(x2 - 1, y + 1, x2 - 1, y2 - 2); // right, inner @@ -156,8 +156,8 @@ public class BasicGraphicsUtils g.setColor(oldColor); } } - - + + /** * Determines the width of the border that gets painted by * {@link #drawEtchedRect}. @@ -229,7 +229,7 @@ public class BasicGraphicsUtils { return new Insets(2, 2, 2, 2); } - + /** * Draws a border that is suitable for buttons of the Basic look and @@ -310,8 +310,8 @@ public class BasicGraphicsUtils g.setColor(oldColor); } } - - + + /** * Draws a rectangle that appears lowered into the surface, given * four colors that are used for drawing. @@ -363,8 +363,8 @@ public class BasicGraphicsUtils darkShadow, shadow, highlight, lightHighlight); } - - + + /** * Draws a String at the given location, underlining the first * occurence of a specified character. The algorithm for determining @@ -390,7 +390,7 @@ public class BasicGraphicsUtils * the GNU Classpath implementation does not underline * anything if <code>underlinedChar</code> is outside * the range of <code>char</code>. - * + * * @param x the x coordinate of the text, as it would be passed to * {@link java.awt.Graphics#drawString(java.lang.String, * int, int)}. @@ -436,7 +436,7 @@ public class BasicGraphicsUtils * <code>text</code>. If <code>underlinedIndex</code> falls * outside the range <code>[0, text.length() - 1]</code>, the * text will be drawn without underlining anything. - * + * * @param x the x coordinate of the text, as it would be passed to * {@link java.awt.Graphics#drawString(java.lang.String, * int, int)}. @@ -518,7 +518,7 @@ public class BasicGraphicsUtils underline.width = underlineX1 - underlineX2; } - + underline.height = lineMetrics.getUnderlineThickness(); underline.y = lineMetrics.getUnderlineOffset(); if (underline.y == 0) @@ -597,7 +597,7 @@ public class BasicGraphicsUtils * <code>text</code>. If <code>underlinedIndex</code> falls * outside the range <code>[0, text.length() - 1]</code>, the * text will be drawn without underlining anything. - * + * * @param x the x coordinate of the text, as it would be passed to * {@link java.awt.Graphics#drawString(java.lang.String, * int, int)}. @@ -683,7 +683,7 @@ public class BasicGraphicsUtils underline.width = underlineX1 - underlineX2; } - + underline.height = lineMetrics.getUnderlineThickness(); underline.y = lineMetrics.getUnderlineOffset(); if (underline.y == 0) @@ -761,8 +761,8 @@ public class BasicGraphicsUtils * and <code>height</code> fields indicate the preferred * extent in pixels. * - * @see javax.swing.SwingUtilities#layoutCompoundLabel(JComponent, - * FontMetrics, String, Icon, int, int, int, int, Rectangle, Rectangle, + * @see javax.swing.SwingUtilities#layoutCompoundLabel(JComponent, + * FontMetrics, String, Icon, int, int, int, int, Rectangle, Rectangle, * Rectangle, int) */ public static Dimension getPreferredButtonSize(AbstractButton b, @@ -795,7 +795,7 @@ public class BasicGraphicsUtils b.getFontMetrics(b.getFont()), // see comment above b.getText(), b.getIcon(), - b.getVerticalAlignment(), + b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicHTML.java b/libjava/classpath/javax/swing/plaf/basic/BasicHTML.java index 6e26d5355a2..a7ce8b15b81 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicHTML.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicHTML.java @@ -145,7 +145,7 @@ public class BasicHTML { if (view != null) view.setParent(null); - + if (v != null) v.setParent(this); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java index cad0d0e8abe..1b5afa7f16e 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java @@ -53,16 +53,16 @@ public class BasicIconFactory implements Serializable { static final long serialVersionUID = 5605588811185324383L; - private static class DummyIcon + private static class DummyIcon implements Icon - { - public int getIconHeight() - { - return 10; + { + public int getIconHeight() + { + return 10; } - public int getIconWidth() - { - return 10; + public int getIconWidth() + { + return 10; } public void paintIcon(Component c, Graphics g, int x, int y) { @@ -118,7 +118,7 @@ public class BasicIconFactory implements Serializable } /** - * The icon used for {@link JCheckBoxMenuItem}s in the + * The icon used for {@link JCheckBoxMenuItem}s in the * {@link BasicLookAndFeel}. This icon has a size of 9x9 pixels. */ static class CheckBoxMenuItemIcon @@ -155,14 +155,14 @@ public class BasicIconFactory implements Serializable public void paintIcon(Component c, Graphics g, int x, int y) { JCheckBoxMenuItem item = (JCheckBoxMenuItem) c; - if (item.isSelected()) + if (item.isSelected()) { // paint the check... g.setColor(Color.black); g.drawLine(x + 1, y + 3, x + 1, y + 4); g.drawLine(x + 2, y + 4, x + 2, y + 5); for (int i = 0; i < 5; i++) - g.drawLine(x + 3 + i, y + 5 - i, x + 3 + i, y + 6 - i); + g.drawLine(x + 3 + i, y + 5 - i, x + 3 + i, y + 6 - i); } } } @@ -212,7 +212,7 @@ public class BasicIconFactory implements Serializable } /** The cached CheckBoxIcon instance. */ private static CheckBoxIcon checkBoxIcon; - + /** The cached RadioButtonIcon instance. */ private static RadioButtonIcon radioButtonIcon; @@ -246,34 +246,34 @@ public class BasicIconFactory implements Serializable { return new DummyIcon(); } - + /** * Returns a new instance of a 4 x 8 icon showing a small black triangle that - * points to the right. This is displayed in menu items that have a + * points to the right. This is displayed in menu items that have a * sub menu. - * + * * @return The icon. */ public static Icon getMenuArrowIcon() { return new Icon() { - public int getIconHeight() - { - return 8; - } - public int getIconWidth() - { - return 4; - } - public void paintIcon(Component c, Graphics g, int x, int y) - { - Color saved = g.getColor(); - g.setColor(Color.BLACK); + public int getIconHeight() + { + return 8; + } + public int getIconWidth() + { + return 4; + } + public void paintIcon(Component c, Graphics g, int x, int y) + { + Color saved = g.getColor(); + g.setColor(Color.BLACK); for (int i = 0; i < 4; i++) g.drawLine(x + i, y + i, x + i, y + 7 - i); - g.setColor(saved); - } + g.setColor(saved); + } }; } @@ -308,19 +308,19 @@ public class BasicIconFactory implements Serializable /** * Creates and returns an icon used when rendering {@link JCheckBoxMenuItem} * components. - * + * * @return An icon. */ public static Icon getCheckBoxMenuItemIcon() { return new CheckBoxMenuItemIcon(); } - + public static Icon getRadioButtonMenuItemIcon() { return getRadioButtonIcon(); } - + public static Icon createEmptyFrameIcon() { return new DummyIcon(); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java index ea8b4603691..48466050143 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java @@ -89,7 +89,7 @@ public class BasicInternalFrameTitlePane extends JComponent { super("Close"); } - + /** * This method is called when something closes the JInternalFrame. * @@ -371,7 +371,7 @@ public class BasicInternalFrameTitlePane extends JComponent { Icon frameIcon = frame.getFrameIcon(); if (frameIcon == null) - frameIcon = BasicDesktopIconUI.defaultIcon; + frameIcon = BasicDesktopIconUI.defaultIcon; frameIcon.paintIcon(this, g, 0, 0); } @@ -453,8 +453,8 @@ public class BasicInternalFrameTitlePane extends JComponent } if (title != null) - title.setBounds(insets.left + menupref.width, insets.top, - loc - menupref.width - insets.left, height); + title.setBounds(insets.left + menupref.width, insets.top, + loc - menupref.width - insets.left, height); } /** @@ -581,7 +581,7 @@ public class BasicInternalFrameTitlePane extends JComponent /** The icon displayed in the close button. */ protected Icon closeIcon; - + /** The JInternalFrame that this TitlePane is used in. */ protected JInternalFrame frame; @@ -620,7 +620,7 @@ public class BasicInternalFrameTitlePane extends JComponent * This is package-private to avoid an accessor method. */ transient JLabel title; - + static { // not constants in JDK @@ -739,7 +739,7 @@ public class BasicInternalFrameTitlePane extends JComponent selectedTitleColor = UIManager.getColor("InternalFrame.activeTitleBackground"); notSelectedTextColor = UIManager.getColor("InternalFrame.inactiveTitleForeground"); notSelectedTitleColor = UIManager.getColor("InternalFrame.inactiveTitleBackground"); - + closeIcon = UIManager.getIcon("InternalFrame.closeIcon"); iconIcon = UIManager.getIcon("InternalFrame.iconifyIcon"); maxIcon = UIManager.getIcon("InternalFrame.maximizeIcon"); @@ -755,7 +755,7 @@ public class BasicInternalFrameTitlePane extends JComponent selectedTitleColor = null; notSelectedTextColor = null; notSelectedTitleColor = null; - + closeIcon = null; iconIcon = null; maxIcon = null; @@ -894,17 +894,17 @@ public class BasicInternalFrameTitlePane extends JComponent paintTitleBackground(g); if (frame.getTitle() != null && title != null) { - Color saved = g.getColor(); + Color saved = g.getColor(); Font f = title.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); - if (frame.isSelected()) - g.setColor(selectedTextColor); - else - g.setColor(notSelectedTextColor); - title.setText(getTitle(frame.getTitle(), fm, title.getBounds().width)); - SwingUtilities.paintComponent(g, title, null, title.getBounds()); - g.setColor(saved); + if (frame.isSelected()) + g.setColor(selectedTextColor); + else + g.setColor(notSelectedTextColor); + title.setText(getTitle(frame.getTitle(), fm, title.getBounds().width)); + SwingUtilities.paintComponent(g, title, null, title.getBounds()); + g.setColor(saved); } } @@ -964,7 +964,7 @@ public class BasicInternalFrameTitlePane extends JComponent { // FIXME: Implement postClosingEvent when I figure out what // it's supposed to do. - // It says that this fires an WINDOW_CLOSING like event. + // It says that this fires an WINDOW_CLOSING like event. // So the closest thing is some kind of InternalFrameEvent. // But none is fired. // Can't see it called or anything. diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java index 87c5268c8c7..da37e2bd810 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java @@ -170,10 +170,10 @@ public class BasicInternalFrameUI extends InternalFrameUI implements SwingConstants { /** - * The current shape of the cursor. + * The current shape of the cursor. */ transient int showingCursor; - + /** FIXME: Use for something. */ protected final int RESIZE_NONE = 0; @@ -188,7 +188,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** Cache rectangle that can be reused. */ private transient Rectangle cacheRect = new Rectangle(); - + /** * This method is called when the mouse is clicked. * @@ -209,7 +209,7 @@ public class BasicInternalFrameUI extends InternalFrameUI { // We do nothing if the attempt has been vetoed. } - + // There is nothing to do when the mouse is clicked // on the border. } @@ -288,7 +288,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse exits the JInternalFrame. - * + * * @param e The MouseEvent. */ public void mouseExited(MouseEvent e) @@ -302,7 +302,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is moved inside the JInternalFrame. - * + * * @param e The MouseEvent. */ public void mouseMoved(MouseEvent e) @@ -318,10 +318,10 @@ public class BasicInternalFrameUI extends InternalFrameUI setCursor(e); } } - + /** * Set the mouse cursor, how applicable. - * + * * @param e the current mouse event. */ void setCursor(MouseEvent e) @@ -337,7 +337,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is pressed. - * + * * @param e The MouseEvent. */ public void mousePressed(MouseEvent e) @@ -381,7 +381,7 @@ public class BasicInternalFrameUI extends InternalFrameUI dm.endDraggingFrame(frame); frame.putClientProperty("bufferedDragging", null); } - + setCursor(e); } @@ -398,7 +398,7 @@ public class BasicInternalFrameUI extends InternalFrameUI { Rectangle b = frame.getBounds(); int corner = InternalFrameBorder.cornerSize; - + if (x < corner && y < corner) return Cursor.NW_RESIZE_CURSOR; else if (x > b.width - corner && y < corner) @@ -429,7 +429,7 @@ public class BasicInternalFrameUI extends InternalFrameUI { /** * This method is called when the JDesktopPane is hidden. - * + * * @param e * The ComponentEvent fired. */ @@ -440,7 +440,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the JDesktopPane is moved. - * + * * @param e * The ComponentEvent fired. */ @@ -451,7 +451,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the JDesktopPane is resized. - * + * * @param e * The ComponentEvent fired. */ @@ -469,7 +469,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the JDesktopPane is shown. - * + * * @param e * The ComponentEvent fired. */ @@ -487,7 +487,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the given Component is added to the * JInternalFrame. - * + * * @param name * The name of the Component. * @param c @@ -501,7 +501,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is used to set the bounds of the children of the * JInternalFrame. - * + * * @param c * The Container to lay out. */ @@ -562,7 +562,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method returns the minimum layout size. - * + * * @param c * The Container to find a minimum layout size for. * @return The minimum dimensions for the JInternalFrame. @@ -574,7 +574,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * Th8is method returns the preferred layout size. - * + * * @param c * The Container to find a preferred layout size for. * @return The preferred dimensions for the JInternalFrame. @@ -586,7 +586,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * DOCUMENT ME! - * + * * @param c * DOCUMENT ME! * @param min @@ -694,7 +694,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse enters the glass pane. - * + * * @param e * The MouseEvent. */ @@ -705,7 +705,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is clicked on the glass pane. - * + * * @param e * The MouseEvent. */ @@ -716,7 +716,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is dragged in the glass pane. - * + * * @param e * The MouseEvent. */ @@ -727,7 +727,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse exits the glass pane. - * + * * @param e * The MouseEvent. */ @@ -738,7 +738,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is moved in the glass pane. - * + * * @param e * The MouseEvent. */ @@ -749,7 +749,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is pressed in the glass pane. - * + * * @param e * The MouseEvent. */ @@ -764,7 +764,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when the mouse is released in the glass pane. - * + * * @param e * The MouseEvent. */ @@ -776,7 +776,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This is a helper method that dispatches the GlassPane MouseEvents to the * proper component. - * + * * @param e the mouse event to be dispatched */ private void handleEvent(MouseEvent e) @@ -885,7 +885,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method is called when one of the JInternalFrame's properties change. - * + * * @param evt * The PropertyChangeEvent. */ @@ -971,8 +971,8 @@ public class BasicInternalFrameUI extends InternalFrameUI class InternalFrameBorder extends AbstractBorder implements UIResource { - /** - * The width of the border. + /** + * The width of the border. */ static final int bSize = 5; @@ -983,7 +983,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method returns whether the border is opaque. - * + * * @return Whether the border is opaque. */ public boolean isBorderOpaque() @@ -993,7 +993,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method returns the insets of the border. - * + * * @param c * The Component to find border insets for. * @return The border insets. @@ -1005,7 +1005,7 @@ public class BasicInternalFrameUI extends InternalFrameUI /** * This method paints the border. - * + * * @param c * The Component that owns the border. * @param g @@ -1051,9 +1051,9 @@ public class BasicInternalFrameUI extends InternalFrameUI g.fill3DRect(0, cornerSize, bSize, b.height - 2 * cornerSize, false); g.fill3DRect(cornerSize, 0, b.width - 2 * cornerSize, bSize, false); - g.fill3DRect(cornerSize, b.height - bSize, b.width - 2 * cornerSize, + g.fill3DRect(cornerSize, b.height - bSize, b.width - 2 * cornerSize, bSize, false); - g.fill3DRect(b.width - bSize, cornerSize, bSize, + g.fill3DRect(b.width - bSize, cornerSize, bSize, b.height - 2 * cornerSize, false); g.translate(-x, -y); @@ -1595,7 +1595,7 @@ public class BasicInternalFrameUI extends InternalFrameUI replacePane(northPane, c); northPane = c; // the following is needed to make internal frames draggable when using - // the JGoodies PlasticLookAndFeel, because it overrides the + // the JGoodies PlasticLookAndFeel, because it overrides the // createNorthPane() method and doesn't assign anything to the titlePane // field. It is possible there is another way to make this work, but // I didn't find it... diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java index 045740df609..9469b5695e7 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java @@ -114,7 +114,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener /** * Returns the preferred size of this component as calculated by the - * {@link #layoutCL(JLabel, FontMetrics, String, Icon, Rectangle, Rectangle, + * {@link #layoutCL(JLabel, FontMetrics, String, Icon, Rectangle, Rectangle, * Rectangle)} method. * * @param c This {@link JComponent} to get a preferred size for. @@ -188,7 +188,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener /** * The method that paints the label according to its current state. - * + * * @param g The {@link Graphics} object to paint with. * @param c The {@link JComponent} to paint. */ @@ -217,7 +217,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener text = layoutCL(b, fm, text, icon, vr, ir, tr); if (icon != null) - icon.paintIcon(b, g, ir.x, ir.y); + icon.paintIcon(b, g, ir.x, ir.y); if (text != null && ! text.equals("")) { @@ -239,7 +239,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener /** * This method is simply calls SwingUtilities's layoutCompoundLabel. - * + * * @param label The label to lay out. * @param fontMetrics The FontMetrics for the font used. * @param text The text to paint. @@ -247,7 +247,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener * @param viewR The entire viewable rectangle. * @param iconR The icon bounds rectangle. * @param textR The text bounds rectangle. - * + * * @return A possibly clipped version of the text. */ protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, @@ -421,11 +421,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener { // add a keystroke for the given mnemonic mapping to 'press'; InputMap keyMap = new InputMap(); - keyMap.put(KeyStroke.getKeyStroke(mnemonic, KeyEvent.VK_ALT), + keyMap.put(KeyStroke.getKeyStroke(mnemonic, KeyEvent.VK_ALT), "press"); - SwingUtilities.replaceUIInputMap(l, + SwingUtilities.replaceUIInputMap(l, JComponent.WHEN_IN_FOCUSED_WINDOW, keyMap); - + // add an action to focus the component when 'press' happens ActionMap map = new ActionMap(); map.put("press", new AbstractAction() { @@ -439,7 +439,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener }); SwingUtilities.replaceUIActionMap(l, map); } - } + } } /** @@ -450,7 +450,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener protected void uninstallKeyboardActions(JLabel l) { SwingUtilities.replaceUIActionMap(l, null); - SwingUtilities.replaceUIInputMap(l, JComponent.WHEN_IN_FOCUSED_WINDOW, + SwingUtilities.replaceUIInputMap(l, JComponent.WHEN_IN_FOCUSED_WINDOW, null); } @@ -500,9 +500,9 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener int newMnemonic = ((Integer) e.getNewValue()).intValue(); InputMap keyMap = label.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW); - keyMap.put(KeyStroke.getKeyStroke(oldMnemonic, + keyMap.put(KeyStroke.getKeyStroke(oldMnemonic, KeyEvent.ALT_DOWN_MASK), null); - keyMap.put(KeyStroke.getKeyStroke(newMnemonic, + keyMap.put(KeyStroke.getKeyStroke(newMnemonic, KeyEvent.ALT_DOWN_MASK), "press"); } } @@ -512,8 +512,8 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener InputMap keyMap = label.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); int mnemonic = label.getDisplayedMnemonic(); if (mnemonic > 0) - keyMap.put(KeyStroke.getKeyStroke(mnemonic, KeyEvent.ALT_DOWN_MASK), - "press"); + keyMap.put(KeyStroke.getKeyStroke(mnemonic, KeyEvent.ALT_DOWN_MASK), + "press"); } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java index befc227364a..0e33957f43e 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java @@ -78,7 +78,7 @@ import javax.swing.plaf.ListUI; import javax.swing.plaf.UIResource; /** - * The Basic Look and Feel UI delegate for the + * The Basic Look and Feel UI delegate for the * JList. */ public class BasicListUI extends ListUI @@ -111,7 +111,7 @@ public class BasicListUI extends ListUI } /** - * Helper method to repaint the focused cell's + * Helper method to repaint the focused cell's * lost or acquired focus state. */ protected void repaintCellFocus() @@ -170,7 +170,7 @@ public class BasicListUI extends ListUI public class ListSelectionHandler implements ListSelectionListener { /** - * Called when the list selection changes. + * Called when the list selection changes. * * @param e The event representing the change */ @@ -197,7 +197,7 @@ public class BasicListUI extends ListUI ActionListener target; String bindingCommandName; - public ActionListenerProxy(ActionListener li, + public ActionListenerProxy(ActionListener li, String cmd) { target = li; @@ -237,13 +237,13 @@ public class BasicListUI extends ListUI { int lead = list.getLeadSelectionIndex(); int max = list.getModel().getSize() - 1; - DefaultListSelectionModel selModel + DefaultListSelectionModel selModel = (DefaultListSelectionModel) list.getSelectionModel(); String command = e.getActionCommand(); // Do nothing if list is empty if (max == -1) return; - + if (command.equals("selectNextRow")) { selectNextIndex(); @@ -265,7 +265,7 @@ public class BasicListUI extends ListUI } else if (command.equals("selectLastRow")) { - list.setSelectedIndex(list.getModel().getSize() - 1); + list.setSelectedIndex(list.getModel().getSize() - 1); } else if (command.equals("selectLastRowChangeLead")) { @@ -276,7 +276,7 @@ public class BasicListUI extends ListUI int target; if (lead == list.getLastVisibleIndex()) { - target = Math.min(max, lead + (list.getLastVisibleIndex() + target = Math.min(max, lead + (list.getLastVisibleIndex() - list.getFirstVisibleIndex() + 1)); } else @@ -288,7 +288,7 @@ public class BasicListUI extends ListUI int target; if (lead == list.getLastVisibleIndex()) { - target = Math.min(max, lead + (list.getLastVisibleIndex() + target = Math.min(max, lead + (list.getLastVisibleIndex() - list.getFirstVisibleIndex() + 1)); } else @@ -300,7 +300,7 @@ public class BasicListUI extends ListUI int target; if (lead == list.getFirstVisibleIndex()) { - target = Math.max(0, lead - (list.getLastVisibleIndex() + target = Math.max(0, lead - (list.getLastVisibleIndex() - list.getFirstVisibleIndex() + 1)); } else @@ -312,7 +312,7 @@ public class BasicListUI extends ListUI int target; if (lead == list.getFirstVisibleIndex()) { - target = Math.max(0, lead - (list.getLastVisibleIndex() + target = Math.max(0, lead - (list.getLastVisibleIndex() - list.getFirstVisibleIndex() + 1)); } else @@ -344,12 +344,12 @@ public class BasicListUI extends ListUI int target; if (lead == list.getFirstVisibleIndex()) { - target = Math.max(0, lead - (list.getLastVisibleIndex() + target = Math.max(0, lead - (list.getLastVisibleIndex() - list.getFirstVisibleIndex() + 1)); } else target = list.getFirstVisibleIndex(); - list.setSelectedIndex(target); + list.setSelectedIndex(target); } else if (command.equals("selectLastRowExtendSelection")) { @@ -360,7 +360,7 @@ public class BasicListUI extends ListUI int target; if (lead == list.getLastVisibleIndex()) { - target = Math.min(max, lead + (list.getLastVisibleIndex() + target = Math.min(max, lead + (list.getLastVisibleIndex() - list.getFirstVisibleIndex() + 1)); } else @@ -384,7 +384,7 @@ public class BasicListUI extends ListUI { selModel.moveLeadSelectionIndex(Math.max(0, lead - 1)); } - } + } else if (command.equals("addToSelection")) { list.addSelectionInterval(lead, lead); @@ -402,20 +402,20 @@ public class BasicListUI extends ListUI list.removeSelectionInterval(lead, lead); selModel.setAnchorSelectionIndex(lead); } - else + else { - // DEBUG: uncomment the following line to print out + // DEBUG: uncomment the following line to print out // key bindings that aren't implemented yet - + // System.out.println ("not implemented: "+e.getActionCommand()); } - + list.ensureIndexIsVisible(list.getLeadSelectionIndex()); } } /** - * A helper class which listens for {@link MouseEvent}s + * A helper class which listens for {@link MouseEvent}s * from the {@link JList}. */ public class MouseInputHandler implements MouseInputListener @@ -436,20 +436,20 @@ public class BasicListUI extends ListUI { if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) list.setSelectedIndex(index); - else if (list.getSelectionMode() == + else if (list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) // COMPAT: the IBM VM is compatible with the following line of code. - // However, compliance with Sun's VM would correspond to replacing - // getAnchorSelectionIndex() with getLeadSelectionIndex().This is - // both unnatural and contradictory to the way they handle other + // However, compliance with Sun's VM would correspond to replacing + // getAnchorSelectionIndex() with getLeadSelectionIndex().This is + // both unnatural and contradictory to the way they handle other // similar UI interactions. list.setSelectionInterval(list.getAnchorSelectionIndex(), index); else // COMPAT: both Sun and IBM are compatible instead with: // list.setSelectionInterval // (list.getLeadSelectionIndex(),index); - // Note that for IBM this is contradictory to what they did in - // the above situation for SINGLE_INTERVAL_SELECTION. + // Note that for IBM this is contradictory to what they did in + // the above situation for SINGLE_INTERVAL_SELECTION. // The most natural thing to do is the following: if (list.isSelectedIndex(list.getAnchorSelectionIndex())) list.getSelectionModel().setLeadSelectionIndex(index); @@ -467,7 +467,7 @@ public class BasicListUI extends ListUI } else list.setSelectedIndex(index); - + list.ensureIndexIsVisible(list.getLeadSelectionIndex()); } @@ -530,7 +530,7 @@ public class BasicListUI extends ListUI return; if (!event.isShiftDown() && !event.isControlDown()) list.setSelectedIndex(index); - + list.ensureIndexIsVisible(list.getLeadSelectionIndex()); } @@ -664,7 +664,7 @@ public class BasicListUI extends ListUI /** The width of a single cell in the list. */ protected int cellWidth; - /** + /** * An array of varying heights of cells in the list, in cases where each * cell might have a different height. This field is used when the * <code>fixedCellHeight</code> property of the list is not set. Otherwise @@ -692,7 +692,7 @@ public class BasicListUI extends ListUI * The {@link CellRendererPane} that is used for painting. */ protected CellRendererPane rendererPane; - + /** The action bound to KeyStrokes. */ ListAction action; @@ -729,7 +729,7 @@ public class BasicListUI extends ListUI * @param index1 The first row to include in the bounds * @param index2 The last row to incude in the bounds * - * @return A rectangle encompassing the range of rows between + * @return A rectangle encompassing the range of rows between * <code>index1</code> and <code>index2</code> inclusive, or null * such a rectangle couldn't be calculated for the given indexes. */ @@ -953,7 +953,7 @@ public class BasicListUI extends ListUI } /** - * Resets to <code>null</code> those defaults which were installed in + * Resets to <code>null</code> those defaults which were installed in * {@link #installDefaults} */ protected void uninstallDefaults() @@ -1002,7 +1002,7 @@ public class BasicListUI extends ListUI list.removeMouseMotionListener(mouseInputListener); list.removePropertyChangeListener(propertyChangeListener); } - + /** * Installs keyboard actions for this UI in the {@link JList}. */ @@ -1125,7 +1125,7 @@ public class BasicListUI extends ListUI * Gets the size this list would prefer to assume. This is calculated by * calling {@link #getCellBounds} over the entire list. * - * @param c Ignored; uses the saved {@link JList} reference + * @param c Ignored; uses the saved {@link JList} reference * * @return DOCUMENT ME! */ @@ -1150,7 +1150,7 @@ public class BasicListUI extends ListUI { // We cast to double here to force double divisions. double modelSize = size; - int neededColumns = (int) Math.ceil(modelSize / visibleRows); + int neededColumns = (int) Math.ceil(modelSize / visibleRows); int adjustedRows = (int) Math.ceil(modelSize / neededColumns); h = maxCellHeight * adjustedRows; w = cellWidth * neededColumns; @@ -1220,7 +1220,7 @@ public class BasicListUI extends ListUI * cell in the list. * * @param g The graphics context to paint with - * @param c Ignored; uses the saved {@link JList} reference + * @param c Ignored; uses the saved {@link JList} reference */ public void paint(Graphics g, JComponent c) { @@ -1238,7 +1238,7 @@ public class BasicListUI extends ListUI int startIndex = locationToIndex(list, new Point(clip.x, clip.y)); int endIndex = locationToIndex(list, new Point(clip.x + clip.width, clip.y + clip.height)); - + for (int row = startIndex; row <= endIndex; ++row) { Rectangle bounds = getCellBounds(list, row, row); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java index 15430945468..9a1f544f68a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java @@ -96,7 +96,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel * are targetted at a menu/submenu/menubar or not. If not, * the MenuSelectionManager is messaged to close the currently opened menus, * if any. - * + * * @author Roman Kennke (kennke@aicas.com) */ private class PopupHelper implements AWTEventListener @@ -227,9 +227,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel } /** - * Creates and returns a new instance of the default resources for this look + * Creates and returns a new instance of the default resources for this look * and feel. - * + * * @return The UI defaults. */ public UIDefaults getDefaults() @@ -247,9 +247,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel } /** - * Populates the <code>defaults</code> table with mappings between class IDs + * Populates the <code>defaults</code> table with mappings between class IDs * and fully qualified class names for the UI delegates. - * + * * @param defaults the defaults table (<code>null</code> not permitted). */ protected void initClassDefaults(UIDefaults defaults) @@ -314,7 +314,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel * {@link #loadSystemColors(UIDefaults, String[], boolean)}. If the * look and feel is a native look and feel, these defaults may be overridden * by the corresponding SystemColor constants. - * + * * @param defaults the defaults table (<code>null</code> not permitted). */ protected void initSystemColorDefaults(UIDefaults defaults) @@ -365,7 +365,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel * <code>false</code> * @param useNative when <code>true</code>, installs the values of the * SystemColor constants, when <code>false</code>, install the values - * from <code>systemColors</code> + * from <code>systemColors</code> */ protected void loadSystemColors(UIDefaults defaults, String[] systemColors, boolean useNative) @@ -479,19 +479,19 @@ public abstract class BasicLookAndFeel extends LookAndFeel protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; - + Color highLight = new Color(249, 247, 246); Color light = new Color(239, 235, 231); Color shadow = new Color(139, 136, 134); Color darkShadow = new Color(16, 16, 16); - + uiDefaults = new Object[] { "AbstractUndoableEdit.undoText", "Undo", "AbstractUndoableEdit.redoText", "Redo", "Button.background", new ColorUIResource(Color.LIGHT_GRAY), "Button.border", - new UIDefaults.LazyValue() + new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { @@ -528,7 +528,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel return BasicIconFactory.getCheckBoxIcon(); } }, - "CheckBox.checkIcon", + "CheckBox.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) @@ -549,7 +549,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel "CheckBoxMenuItem.background", new ColorUIResource(light), "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), "CheckBoxMenuItem.borderPainted", Boolean.FALSE, - "CheckBoxMenuItem.checkIcon", + "CheckBoxMenuItem.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) @@ -637,7 +637,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "EditorPane.foreground", new ColorUIResource(Color.black), "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), - "EditorPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { + "EditorPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { KeyStroke.getKeyStroke("shift UP"), "selection-up", KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-next-word", KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-previous-word", @@ -782,21 +782,21 @@ public abstract class BasicLookAndFeel extends LookAndFeel "InternalFrame.border", new UIDefaults.LazyValue() { - public Object createValue(UIDefaults table) - { - Color lineColor = new Color(238, 238, 238); - Border inner = BorderFactory.createLineBorder(lineColor, 1); - Color shadowInner = new Color(184, 207, 229); - Color shadowOuter = new Color(122, 138, 153); - Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, - Color.WHITE, - Color.WHITE, - shadowOuter, - shadowInner); - Border border = new BorderUIResource.CompoundBorderUIResource(outer, - inner); - return border; - } + public Object createValue(UIDefaults table) + { + Color lineColor = new Color(238, 238, 238); + Border inner = BorderFactory.createLineBorder(lineColor, 1); + Color shadowInner = new Color(184, 207, 229); + Color shadowOuter = new Color(122, 138, 153); + Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, + Color.WHITE, + Color.WHITE, + shadowOuter, + shadowInner); + Border border = new BorderUIResource.CompoundBorderUIResource(outer, + inner); + return border; + } }, "InternalFrame.borderColor", new ColorUIResource(light), "InternalFrame.borderDarkShadow", new ColorUIResource(Color.BLACK), @@ -1459,60 +1459,60 @@ public abstract class BasicLookAndFeel extends LookAndFeel "TextPane.foreground", new ColorUIResource(Color.black), "TextPane.inactiveForeground", new ColorUIResource(Color.gray), "TextPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { - KeyStroke.getKeyStroke("shift UP"), "selection-up", - KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-next-word", - KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-previous-word", - KeyStroke.getKeyStroke("shift KP_UP"), "selection-up", - KeyStroke.getKeyStroke("DOWN"), "caret-down", - KeyStroke.getKeyStroke("shift ctrl T"), "previous-link-action", - KeyStroke.getKeyStroke("ctrl LEFT"), "caret-previous-word", - KeyStroke.getKeyStroke("CUT"), "cut-to-clipboard", - KeyStroke.getKeyStroke("END"), "caret-end-line", - KeyStroke.getKeyStroke("shift PAGE_UP"), "selection-page-up", - KeyStroke.getKeyStroke("KP_UP"), "caret-up", - KeyStroke.getKeyStroke("DELETE"), "delete-next", - KeyStroke.getKeyStroke("ctrl HOME"), "caret-begin", - KeyStroke.getKeyStroke("shift LEFT"), "selection-backward", - KeyStroke.getKeyStroke("ctrl END"), "caret-end", - KeyStroke.getKeyStroke("BACK_SPACE"), "delete-previous", - KeyStroke.getKeyStroke("shift ctrl RIGHT"), "selection-next-word", - KeyStroke.getKeyStroke("LEFT"), "caret-backward", - KeyStroke.getKeyStroke("KP_LEFT"), "caret-backward", - KeyStroke.getKeyStroke("shift KP_RIGHT"), "selection-forward", - KeyStroke.getKeyStroke("ctrl SPACE"), "activate-link-action", - KeyStroke.getKeyStroke("ctrl H"), "delete-previous", - KeyStroke.getKeyStroke("ctrl BACK_SLASH"), "unselect", - KeyStroke.getKeyStroke("ENTER"), "insert-break", - KeyStroke.getKeyStroke("shift HOME"), "selection-begin-line", - KeyStroke.getKeyStroke("RIGHT"), "caret-forward", - KeyStroke.getKeyStroke("shift ctrl PAGE_UP"), "selection-page-left", - KeyStroke.getKeyStroke("shift DOWN"), "selection-down", - KeyStroke.getKeyStroke("PAGE_DOWN"), "page-down", - KeyStroke.getKeyStroke("shift KP_LEFT"), "selection-backward", - KeyStroke.getKeyStroke("shift ctrl O"), "toggle-componentOrientation", - KeyStroke.getKeyStroke("ctrl X"), "cut-to-clipboard", - KeyStroke.getKeyStroke("shift ctrl PAGE_DOWN"), "selection-page-right", - KeyStroke.getKeyStroke("ctrl C"), "copy-to-clipboard", - KeyStroke.getKeyStroke("ctrl KP_RIGHT"), "caret-next-word", - KeyStroke.getKeyStroke("shift END"), "selection-end-line", - KeyStroke.getKeyStroke("ctrl KP_LEFT"), "caret-previous-word", - KeyStroke.getKeyStroke("HOME"), "caret-begin-line", - KeyStroke.getKeyStroke("ctrl V"), "paste-from-clipboard", - KeyStroke.getKeyStroke("KP_DOWN"), "caret-down", - KeyStroke.getKeyStroke("ctrl A"), "select-all", - KeyStroke.getKeyStroke("shift RIGHT"), "selection-forward", - KeyStroke.getKeyStroke("shift ctrl END"), "selection-end", - KeyStroke.getKeyStroke("COPY"), "copy-to-clipboard", - KeyStroke.getKeyStroke("shift ctrl KP_LEFT"), "selection-previous-word", - KeyStroke.getKeyStroke("ctrl T"), "next-link-action", - KeyStroke.getKeyStroke("shift KP_DOWN"), "selection-down", - KeyStroke.getKeyStroke("TAB"), "insert-tab", - KeyStroke.getKeyStroke("UP"), "caret-up", - KeyStroke.getKeyStroke("shift ctrl HOME"), "selection-begin", - KeyStroke.getKeyStroke("shift PAGE_DOWN"), "selection-page-down", - KeyStroke.getKeyStroke("KP_RIGHT"), "caret-forward", - KeyStroke.getKeyStroke("shift ctrl KP_RIGHT"), "selection-next-word", - KeyStroke.getKeyStroke("PAGE_UP"), "page-up", + KeyStroke.getKeyStroke("shift UP"), "selection-up", + KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-next-word", + KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-previous-word", + KeyStroke.getKeyStroke("shift KP_UP"), "selection-up", + KeyStroke.getKeyStroke("DOWN"), "caret-down", + KeyStroke.getKeyStroke("shift ctrl T"), "previous-link-action", + KeyStroke.getKeyStroke("ctrl LEFT"), "caret-previous-word", + KeyStroke.getKeyStroke("CUT"), "cut-to-clipboard", + KeyStroke.getKeyStroke("END"), "caret-end-line", + KeyStroke.getKeyStroke("shift PAGE_UP"), "selection-page-up", + KeyStroke.getKeyStroke("KP_UP"), "caret-up", + KeyStroke.getKeyStroke("DELETE"), "delete-next", + KeyStroke.getKeyStroke("ctrl HOME"), "caret-begin", + KeyStroke.getKeyStroke("shift LEFT"), "selection-backward", + KeyStroke.getKeyStroke("ctrl END"), "caret-end", + KeyStroke.getKeyStroke("BACK_SPACE"), "delete-previous", + KeyStroke.getKeyStroke("shift ctrl RIGHT"), "selection-next-word", + KeyStroke.getKeyStroke("LEFT"), "caret-backward", + KeyStroke.getKeyStroke("KP_LEFT"), "caret-backward", + KeyStroke.getKeyStroke("shift KP_RIGHT"), "selection-forward", + KeyStroke.getKeyStroke("ctrl SPACE"), "activate-link-action", + KeyStroke.getKeyStroke("ctrl H"), "delete-previous", + KeyStroke.getKeyStroke("ctrl BACK_SLASH"), "unselect", + KeyStroke.getKeyStroke("ENTER"), "insert-break", + KeyStroke.getKeyStroke("shift HOME"), "selection-begin-line", + KeyStroke.getKeyStroke("RIGHT"), "caret-forward", + KeyStroke.getKeyStroke("shift ctrl PAGE_UP"), "selection-page-left", + KeyStroke.getKeyStroke("shift DOWN"), "selection-down", + KeyStroke.getKeyStroke("PAGE_DOWN"), "page-down", + KeyStroke.getKeyStroke("shift KP_LEFT"), "selection-backward", + KeyStroke.getKeyStroke("shift ctrl O"), "toggle-componentOrientation", + KeyStroke.getKeyStroke("ctrl X"), "cut-to-clipboard", + KeyStroke.getKeyStroke("shift ctrl PAGE_DOWN"), "selection-page-right", + KeyStroke.getKeyStroke("ctrl C"), "copy-to-clipboard", + KeyStroke.getKeyStroke("ctrl KP_RIGHT"), "caret-next-word", + KeyStroke.getKeyStroke("shift END"), "selection-end-line", + KeyStroke.getKeyStroke("ctrl KP_LEFT"), "caret-previous-word", + KeyStroke.getKeyStroke("HOME"), "caret-begin-line", + KeyStroke.getKeyStroke("ctrl V"), "paste-from-clipboard", + KeyStroke.getKeyStroke("KP_DOWN"), "caret-down", + KeyStroke.getKeyStroke("ctrl A"), "select-all", + KeyStroke.getKeyStroke("shift RIGHT"), "selection-forward", + KeyStroke.getKeyStroke("shift ctrl END"), "selection-end", + KeyStroke.getKeyStroke("COPY"), "copy-to-clipboard", + KeyStroke.getKeyStroke("shift ctrl KP_LEFT"), "selection-previous-word", + KeyStroke.getKeyStroke("ctrl T"), "next-link-action", + KeyStroke.getKeyStroke("shift KP_DOWN"), "selection-down", + KeyStroke.getKeyStroke("TAB"), "insert-tab", + KeyStroke.getKeyStroke("UP"), "caret-up", + KeyStroke.getKeyStroke("shift ctrl HOME"), "selection-begin", + KeyStroke.getKeyStroke("shift PAGE_DOWN"), "selection-page-down", + KeyStroke.getKeyStroke("KP_RIGHT"), "caret-forward", + KeyStroke.getKeyStroke("shift ctrl KP_RIGHT"), "selection-next-word", + KeyStroke.getKeyStroke("PAGE_UP"), "page-up", KeyStroke.getKeyStroke("PASTE"), "paste-from-clipboard" }), "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java index cd25a3baf77..b9e29128abe 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java @@ -109,20 +109,20 @@ public class BasicMenuBarUI extends MenuBarUI defaultManager.setSelectedPath(me); } } - + } protected ChangeListener changeListener; /*ContainerListener that listens to the ContainerEvents fired from menu bar*/ protected ContainerListener containerListener; - + /*Property change listeners that listener to PropertyChangeEvent from menu bar*/ private PropertyChangeListener propertyChangeListener; /* menu bar for which this UI delegate is for*/ protected JMenuBar menuBar; - + /* MouseListener that listens to the mouseEvents fired from menu bar*/ private MouseInputListener mouseListener; @@ -398,7 +398,7 @@ public class BasicMenuBarUI extends MenuBarUI menuBar.repaint(); } } - + private class MouseInputHandler implements MouseInputListener { /** @@ -409,7 +409,7 @@ public class BasicMenuBarUI extends MenuBarUI public void mouseClicked(MouseEvent e) { MenuElement[] me = menuBar.getSubElements(); - + for (int i = 0; i < me.length; i++) { JMenu menu = menuBar.getMenu(i); @@ -417,7 +417,7 @@ public class BasicMenuBarUI extends MenuBarUI menu.setSelected(false); } } - + /** * Handles mouse pressed event * @@ -427,7 +427,7 @@ public class BasicMenuBarUI extends MenuBarUI { // TODO: What should be done here, if anything? } - + /** * Handles mouse released event * @@ -437,7 +437,7 @@ public class BasicMenuBarUI extends MenuBarUI { // TODO: What should be done here, if anything? } - + /** * Handles mouse exited event * @@ -447,7 +447,7 @@ public class BasicMenuBarUI extends MenuBarUI { // TODO: What should be done here, if anything? } - + /** * Handles mouse dragged event * @@ -457,7 +457,7 @@ public class BasicMenuBarUI extends MenuBarUI { // TODO: What should be done here, if anything? } - + /** * Handles mouse moved event * @@ -467,7 +467,7 @@ public class BasicMenuBarUI extends MenuBarUI { // TODO: What should be done here, if anything? } - + /** * Handles mouse entered event * diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java index 5fafb4108b2..40b539378ca 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -128,7 +128,7 @@ public class BasicMenuItemUI extends MenuItemUI * Number of spaces between icon and text. */ protected int defaultTextIconGap = 4; - + /** * Color of the text when menu item is disabled */ @@ -222,14 +222,14 @@ public class BasicMenuItemUI extends MenuItemUI /** * A class to handle PropertChangeEvents for the JMenuItem - * @author Anthony Balkissoon abalkiss at redhat dot com. + * @author Anthony Balkissoon abalkiss at redhat dot com. */ class PropertyChangeHandler implements PropertyChangeListener { /** * This method is called when a property of the menuItem is changed. * Currently it is only used to update the accelerator key bindings. - * + * * @param e * the PropertyChangeEvent */ @@ -238,7 +238,7 @@ public class BasicMenuItemUI extends MenuItemUI String property = e.getPropertyName(); if (property.equals("accelerator")) { - InputMap map = SwingUtilities.getUIInputMap(menuItem, + InputMap map = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW); if (map != null) map.remove((KeyStroke) e.getOldValue()); @@ -266,7 +266,7 @@ public class BasicMenuItemUI extends MenuItemUI } } } - + /** * A class to handle accelerator keys. This is the Action we will * perform when the accelerator key for this JMenuItem is pressed. @@ -282,9 +282,9 @@ public class BasicMenuItemUI extends MenuItemUI public void actionPerformed(ActionEvent event) { doClick(MenuSelectionManager.defaultManager()); - } + } } - + /** * Creates a new BasicMenuItemUI object. */ @@ -308,7 +308,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Create MenuDragMouseListener to listen for mouse dragged events. - * + * * @param c * menu item to listen to * @return The MenuDragMouseListener @@ -321,7 +321,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Creates MenuKeyListener to listen to key events occuring when menu item is * visible on the screen. - * + * * @param c * menu item to listen to * @return The MenuKeyListener @@ -333,7 +333,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Handles mouse input events occuring for this menu item - * + * * @param c * menu item to listen to * @return The MouseInputListener @@ -346,7 +346,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Factory method to create a BasicMenuItemUI for the given {@link * JComponent}, which should be a {@link JMenuItem}. - * + * * @param c * The {@link JComponent} a UI is being created for. * @return A BasicMenuItemUI for the {@link JComponent}. @@ -358,7 +358,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Programatically clicks menu item. - * + * * @param msm * MenuSelectionManager for the menu hierarchy */ @@ -370,7 +370,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Returns maximum size for the specified menu item - * + * * @param c * component for which to get maximum size * @return Maximum size for the specified menu item. @@ -382,7 +382,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Returns minimum size for the specified menu item - * + * * @param c * component for which to get minimum size * @return Minimum size for the specified menu item. @@ -394,7 +394,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Returns path to this menu item. - * + * * @return $MenuElement[]$ Returns array of menu elements that constitute a * path to this menu item. */ @@ -420,7 +420,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Returns preferred size for the given menu item. - * + * * @param c * menu item for which to get preferred size * @param checkIcon @@ -504,20 +504,20 @@ public class BasicMenuItemUI extends MenuItemUI /** * Returns preferred size of the given component - * + * * @param c * component for which to return preferred size * @return $Dimension$ preferred size for the given component */ public Dimension getPreferredSize(JComponent c) { - return getPreferredMenuItemSize(c, checkIcon, arrowIcon, + return getPreferredMenuItemSize(c, checkIcon, arrowIcon, defaultTextIconGap); } /** * Returns the prefix for entries in the {@link UIDefaults} table. - * + * * @return "MenuItem" */ protected String getPropertyPrefix() @@ -527,7 +527,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method installs the components for this {@link JMenuItem}. - * + * * @param menuItem * The {@link JMenuItem} to install components for. */ @@ -548,15 +548,15 @@ public class BasicMenuItemUI extends MenuItemUI prefix + ".foreground", prefix + ".font"); menuItem.setMargin(UIManager.getInsets(prefix + ".margin")); acceleratorFont = UIManager.getFont(prefix + ".acceleratorFont"); - acceleratorForeground = UIManager.getColor(prefix + acceleratorForeground = UIManager.getColor(prefix + ".acceleratorForeground"); - acceleratorSelectionForeground = UIManager.getColor(prefix + acceleratorSelectionForeground = UIManager.getColor(prefix + ".acceleratorSelectionForeground"); selectionBackground = UIManager.getColor(prefix + ".selectionBackground"); selectionForeground = UIManager.getColor(prefix + ".selectionForeground"); acceleratorDelimiter = UIManager.getString(prefix + ".acceleratorDelimiter"); checkIcon = UIManager.getIcon(prefix + ".checkIcon"); - + menuItem.setHorizontalTextPosition(SwingConstants.TRAILING); menuItem.setHorizontalAlignment(SwingConstants.LEADING); } @@ -566,16 +566,16 @@ public class BasicMenuItemUI extends MenuItemUI */ protected void installKeyboardActions() { - InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, + InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW); if (focusedWindowMap == null) focusedWindowMap = new ComponentInputMapUIResource(menuItem); KeyStroke accelerator = menuItem.getAccelerator(); if (accelerator != null) focusedWindowMap.put(accelerator, "doClick"); - SwingUtilities.replaceUIInputMap(menuItem, + SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap); - + ActionMap UIActionMap = SwingUtilities.getUIActionMap(menuItem); if (UIActionMap == null) UIActionMap = new ActionMapUIResource(); @@ -605,7 +605,7 @@ public class BasicMenuItemUI extends MenuItemUI * Installs and initializes all fields for this UI delegate. Any properties of * the UI that need to be initialized and/or set to defaults will be done now. * It will also install any listeners necessary. - * + * * @param c * The {@link JComponent} that is having this UI installed. */ @@ -621,7 +621,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Paints given menu item using specified graphics context - * + * * @param g * The graphics context used to paint this menu item * @param c @@ -635,7 +635,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Paints background of the menu item - * + * * @param g * The graphics context used to paint this menu item * @param menuItem @@ -664,7 +664,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Paints specified menu item - * + * * @param g * The graphics context used to paint this menu item * @param c @@ -808,7 +808,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Paints label for the given menu item - * + * * @param g * The graphics context used to paint this menu item * @param menuItem @@ -864,7 +864,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method uninstalls the components for this {@link JMenuItem}. - * + * * @param menuItem * The {@link JMenuItem} to uninstall components for. */ @@ -901,7 +901,7 @@ public class BasicMenuItemUI extends MenuItemUI * Uninstalls any keyboard actions. */ protected void uninstallKeyboardActions() - { + { SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, null); } @@ -922,7 +922,7 @@ public class BasicMenuItemUI extends MenuItemUI * Performs the opposite of installUI. Any properties or resources that need * to be cleaned up will be done now. It will also uninstall any listeners it * has. In addition, any properties of this UI will be nulled. - * + * * @param c * The {@link JComponent} that is having this UI uninstalled. */ @@ -937,7 +937,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method calls paint. - * + * * @param g * The graphics context used to paint this menu item * @param c @@ -966,7 +966,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is called when mouse is clicked on the menu item. It forwards * this event to MenuSelectionManager. - * + * * @param e * A {@link MouseEvent}. */ @@ -979,7 +979,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is called when mouse is dragged inside the menu item. It * forwards this event to MenuSelectionManager. - * + * * @param e * A {@link MouseEvent}. */ @@ -994,7 +994,7 @@ public class BasicMenuItemUI extends MenuItemUI * item is considered to be selected and selection path in * MenuSelectionManager is set. This event is also forwarded to * MenuSelection Manager for further processing. - * + * * @param e * A {@link MouseEvent}. */ @@ -1012,7 +1012,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is called when mouse exits menu item. The event is forwarded * to MenuSelectionManager for processing. - * + * * @param e * A {@link MouseEvent}. */ @@ -1025,7 +1025,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is called when mouse is inside the menu item. This event is * forwarder to MenuSelectionManager for further processing. - * + * * @param e * A {@link MouseEvent}. */ @@ -1038,7 +1038,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is called when mouse is pressed. This event is forwarded to * MenuSelectionManager for further processing. - * + * * @param e * A {@link MouseEvent}. */ @@ -1052,7 +1052,7 @@ public class BasicMenuItemUI extends MenuItemUI * This method is called when mouse is released. If the mouse is released * inside this menuItem, then this menu item is considered to be chosen and * the menu hierarchy should be closed. - * + * * @param e * A {@link MouseEvent}. */ @@ -1078,7 +1078,7 @@ public class BasicMenuItemUI extends MenuItemUI { /** * Tbis method is invoked when mouse is dragged over the menu item. - * + * * @param e * The MenuDragMouseEvent */ @@ -1091,7 +1091,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Tbis method is invoked when mouse enters the menu item while it is being * dragged. - * + * * @param e * The MenuDragMouseEvent */ @@ -1104,7 +1104,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Tbis method is invoked when mouse exits the menu item while it is being * dragged - * + * * @param e the MenuDragMouseEvent */ public void menuDragMouseExited(MenuDragMouseEvent e) @@ -1115,7 +1115,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * Tbis method is invoked when mouse was dragged and released inside the * menu item. - * + * * @param e * The MenuDragMouseEvent */ @@ -1140,7 +1140,7 @@ public class BasicMenuItemUI extends MenuItemUI { /** * This method is invoked when key has been pressed - * + * * @param e * A {@link MenuKeyEvent}. */ @@ -1151,7 +1151,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is invoked when key has been pressed - * + * * @param e * A {@link MenuKeyEvent}. */ @@ -1163,7 +1163,7 @@ public class BasicMenuItemUI extends MenuItemUI /** * This method is invoked when key has been typed It handles the mnemonic * key for the menu item. - * + * * @param e * A {@link MenuKeyEvent}. */ @@ -1172,7 +1172,7 @@ public class BasicMenuItemUI extends MenuItemUI // TODO: What should be done here, if anything? } } - + /** * Helper class that listens for item changes to the properties of the {@link * JMenuItem}. diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java index 355e0435ec8..4897ee4a067 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java @@ -98,7 +98,7 @@ public class BasicMenuUI extends BasicMenuItemUI defaultManager.setSelectedPath(newPath); } } - + } protected ChangeListener changeListener; @@ -233,7 +233,7 @@ public class BasicMenuUI extends BasicMenuItemUI */ protected void installDefaults() { - + LookAndFeel.installBorder(menuItem, "Menu.border"); LookAndFeel.installColorsAndFont(menuItem, "Menu.background", "Menu.foreground", "Menu.font"); @@ -502,9 +502,9 @@ public class BasicMenuUI extends BasicMenuItemUI { JMenu menu = (JMenu) menuItem; if (menu.isTopLevelMenu()) - ((JMenuBar) menu.getParent()).setSelected(menu); + ((JMenuBar) menu.getParent()).setSelected(menu); else - ((JPopupMenu) menu.getParent()).setSelected(menu); + ((JPopupMenu) menu.getParent()).setSelected(menu); } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java index e2380858098..a03d224d21f 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -100,7 +100,7 @@ public class BasicOptionPaneUI extends OptionPaneUI JOptionPane op = (JOptionPane) event.getSource(); op.setValue(new Integer(JOptionPane.CLOSED_OPTION)); } - + } /** @@ -136,18 +136,18 @@ public class BasicOptionPaneUI extends OptionPaneUI Object value = new Integer(JOptionPane.CLOSED_OPTION); Object[] options = optionPane.getOptions(); if (options != null) - value = new Integer(buttonIndex); + value = new Integer(buttonIndex); else { - String text = ((JButton) e.getSource()).getText(); - if (text.equals(OK_STRING)) - value = new Integer(JOptionPane.OK_OPTION); - if (text.equals(CANCEL_STRING)) - value = new Integer(JOptionPane.CANCEL_OPTION); - if (text.equals(YES_STRING)) - value = new Integer(JOptionPane.YES_OPTION); - if (text.equals(NO_STRING)) - value = new Integer(JOptionPane.NO_OPTION); + String text = ((JButton) e.getSource()).getText(); + if (text.equals(OK_STRING)) + value = new Integer(JOptionPane.OK_OPTION); + if (text.equals(CANCEL_STRING)) + value = new Integer(JOptionPane.CANCEL_OPTION); + if (text.equals(YES_STRING)) + value = new Integer(JOptionPane.YES_OPTION); + if (text.equals(NO_STRING)) + value = new Integer(JOptionPane.NO_OPTION); } optionPane.setValue(value); resetInputValue(); @@ -155,7 +155,7 @@ public class BasicOptionPaneUI extends OptionPaneUI Window owner = SwingUtilities.windowForComponent(optionPane); if (owner instanceof JDialog) - ((JDialog) owner).dispose(); + ((JDialog) owner).dispose(); //else we probably have some kind of internal frame. JInternalFrame inf = (JInternalFrame) SwingUtilities.getAncestorOfClass( @@ -265,21 +265,21 @@ public class BasicOptionPaneUI extends OptionPaneUI Component[] buttonList = container.getComponents(); int x = container.getInsets().left; if (getCentersChildren()) - x += (int) ((double) (container.getSize().width) / 2 - - (double) (buttonRowLength(container)) / 2); + x += (int) ((double) (container.getSize().width) / 2 + - (double) (buttonRowLength(container)) / 2); for (int i = 0; i < buttonList.length; i++) { - Dimension dims = buttonList[i].getPreferredSize(); - if (syncAllWidths) - { - buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); - x += widthOfWidestButton + getPadding(); - } - else - { - buttonList[i].setBounds(x, 0, dims.width, dims.height); - x += dims.width + getPadding(); - } + Dimension dims = buttonList[i].getPreferredSize(); + if (syncAllWidths) + { + buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); + x += widthOfWidestButton + getPadding(); + } + else + { + buttonList[i].setBounds(x, 0, dims.width, dims.height); + x += dims.width + getPadding(); + } } } @@ -301,10 +301,10 @@ public class BasicOptionPaneUI extends OptionPaneUI for (int i = 0; i < buttonList.length; i++) { - Dimension dims = buttonList[i].getPreferredSize(); - buttonLength += dims.width + getPadding(); - widest = Math.max(widest, dims.width); - tallest = Math.max(tallest, dims.height); + Dimension dims = buttonList[i].getPreferredSize(); + buttonLength += dims.width + getPadding(); + widest = Math.max(widest, dims.width); + tallest = Math.max(tallest, dims.height); } widthOfWidestButton = widest; @@ -312,10 +312,10 @@ public class BasicOptionPaneUI extends OptionPaneUI int width; if (getSyncAllWidths()) - width = widest * buttonList.length - + getPadding() * (buttonList.length - 1); + width = widest * buttonList.length + + getPadding() * (buttonList.length - 1); else - width = buttonLength; + width = buttonLength; Insets insets = c.getInsets(); width += insets.left + insets.right; @@ -438,10 +438,10 @@ public class BasicOptionPaneUI extends OptionPaneUI /** Whether the JOptionPane contains custom components. */ protected boolean hasCustomComponents; - // The initialFocusComponent seems to always be set to a button (even if - // I try to set initialSelectionValue). This is different from what the - // javadocs state (which should switch this reference to the input component - // if one is present since that is what's going to get focus). + // The initialFocusComponent seems to always be set to a button (even if + // I try to set initialSelectionValue). This is different from what the + // javadocs state (which should switch this reference to the input component + // if one is present since that is what's going to get focus). /** * The button that will receive focus based on initialValue when no input @@ -531,20 +531,20 @@ public class BasicOptionPaneUI extends OptionPaneUI { public void paintIcon(Component c, Graphics g, int x, int y) { - Polygon oct = new Polygon(new int[] { 0, 0, 9, 27, 36, 36, 27, 9 }, - new int[] { 9, 27, 36, 36, 27, 9, 0, 0 }, 8); - g.translate(x, y); + Polygon oct = new Polygon(new int[] { 0, 0, 9, 27, 36, 36, 27, 9 }, + new int[] { 9, 27, 36, 36, 27, 9, 0, 0 }, 8); + g.translate(x, y); - Color saved = g.getColor(); - g.setColor(Color.RED); + Color saved = g.getColor(); + g.setColor(Color.RED); - g.fillPolygon(oct); + g.fillPolygon(oct); - g.setColor(Color.BLACK); - g.drawRect(13, 16, 10, 4); + g.setColor(Color.BLACK); + g.drawRect(13, 16, 10, 4); - g.setColor(saved); - g.translate(-x, -y); + g.setColor(saved); + g.translate(-x, -y); } }; @@ -553,24 +553,24 @@ public class BasicOptionPaneUI extends OptionPaneUI { public void paintIcon(Component c, Graphics g, int x, int y) { - g.translate(x, y); - Color saved = g.getColor(); + g.translate(x, y); + Color saved = g.getColor(); - // Should be purple. - g.setColor(Color.RED); + // Should be purple. + g.setColor(Color.RED); - g.fillOval(0, 0, ICON_SIZE, ICON_SIZE); + g.fillOval(0, 0, ICON_SIZE, ICON_SIZE); - g.setColor(Color.BLACK); - g.drawOval(16, 6, 4, 4); + g.setColor(Color.BLACK); + g.drawOval(16, 6, 4, 4); - Polygon bottomI = new Polygon(new int[] { 15, 15, 13, 13, 23, 23, 21, 21 }, - new int[] { 12, 28, 28, 30, 30, 28, 28, 12 }, - 8); - g.drawPolygon(bottomI); + Polygon bottomI = new Polygon(new int[] { 15, 15, 13, 13, 23, 23, 21, 21 }, + new int[] { 12, 28, 28, 30, 30, 28, 28, 12 }, + 8); + g.drawPolygon(bottomI); - g.setColor(saved); - g.translate(-x, -y); + g.setColor(saved); + g.translate(-x, -y); } }; @@ -579,23 +579,23 @@ public class BasicOptionPaneUI extends OptionPaneUI { public void paintIcon(Component c, Graphics g, int x, int y) { - g.translate(x, y); - Color saved = g.getColor(); - g.setColor(Color.YELLOW); + g.translate(x, y); + Color saved = g.getColor(); + g.setColor(Color.YELLOW); - Polygon triangle = new Polygon(new int[] { 0, 18, 36 }, - new int[] { 36, 0, 36 }, 3); - g.fillPolygon(triangle); + Polygon triangle = new Polygon(new int[] { 0, 18, 36 }, + new int[] { 36, 0, 36 }, 3); + g.fillPolygon(triangle); - g.setColor(Color.BLACK); + g.setColor(Color.BLACK); - Polygon excl = new Polygon(new int[] { 15, 16, 20, 21 }, - new int[] { 8, 26, 26, 8 }, 4); - g.drawPolygon(excl); - g.drawOval(16, 30, 4, 4); + Polygon excl = new Polygon(new int[] { 15, 16, 20, 21 }, + new int[] { 8, 26, 26, 8 }, 4); + g.drawPolygon(excl); + g.drawOval(16, 30, 4, 4); - g.setColor(saved); - g.translate(-x, -y); + g.setColor(saved); + g.translate(-x, -y); } }; @@ -604,32 +604,32 @@ public class BasicOptionPaneUI extends OptionPaneUI { public void paintIcon(Component c, Graphics g, int x, int y) { - g.translate(x, y); - Color saved = g.getColor(); - g.setColor(Color.GREEN); + g.translate(x, y); + Color saved = g.getColor(); + g.setColor(Color.GREEN); - g.fillRect(0, 0, ICON_SIZE, ICON_SIZE); + g.fillRect(0, 0, ICON_SIZE, ICON_SIZE); - g.setColor(Color.BLACK); + g.setColor(Color.BLACK); - g.drawOval(11, 2, 16, 16); - g.drawOval(14, 5, 10, 10); + g.drawOval(11, 2, 16, 16); + g.drawOval(14, 5, 10, 10); - g.setColor(Color.GREEN); - g.fillRect(0, 10, ICON_SIZE, ICON_SIZE - 10); + g.setColor(Color.GREEN); + g.fillRect(0, 10, ICON_SIZE, ICON_SIZE - 10); - g.setColor(Color.BLACK); + g.setColor(Color.BLACK); - g.drawLine(11, 10, 14, 10); + g.drawLine(11, 10, 14, 10); - g.drawLine(24, 10, 17, 22); - g.drawLine(27, 10, 20, 22); - g.drawLine(17, 22, 20, 22); + g.drawLine(24, 10, 17, 22); + g.drawLine(27, 10, 20, 22); + g.drawLine(17, 22, 20, 22); - g.drawOval(17, 25, 3, 3); + g.drawOval(17, 25, 3, 3); - g.setColor(saved); - g.translate(-x, -y); + g.setColor(saved); + g.translate(-x, -y); } }; @@ -659,25 +659,25 @@ public class BasicOptionPaneUI extends OptionPaneUI return; for (int i = 0; i < buttons.length; i++) { - if (buttons[i] != null) - { - Component toAdd; - if (buttons[i] instanceof Component) - toAdd = (Component) buttons[i]; - else - { - if (buttons[i] instanceof Icon) - toAdd = new JButton((Icon) buttons[i]); - else - toAdd = new JButton(buttons[i].toString()); - hasCustomComponents = true; - } - if (toAdd instanceof JButton) - ((JButton) toAdd).addActionListener(createButtonActionListener(i)); - if (i == initialIndex) - initialFocusComponent = toAdd; - container.add(toAdd); - } + if (buttons[i] != null) + { + Component toAdd; + if (buttons[i] instanceof Component) + toAdd = (Component) buttons[i]; + else + { + if (buttons[i] instanceof Icon) + toAdd = new JButton((Icon) buttons[i]); + else + toAdd = new JButton(buttons[i].toString()); + hasCustomComponents = true; + } + if (toAdd instanceof JButton) + ((JButton) toAdd).addActionListener(createButtonActionListener(i)); + if (i == initialIndex) + initialFocusComponent = toAdd; + container.add(toAdd); + } } selectInitialValue(optionPane); } @@ -693,9 +693,9 @@ public class BasicOptionPaneUI extends OptionPaneUI Icon icon = getIcon(); if (icon != null) { - iconLabel = new JLabel(icon); + iconLabel = new JLabel(icon); configureLabel(iconLabel); - top.add(iconLabel, BorderLayout.WEST); + top.add(iconLabel, BorderLayout.WEST); } } @@ -743,38 +743,38 @@ public class BasicOptionPaneUI extends OptionPaneUI hasCustomComponents = internallyCreated; if (msg instanceof Object[]) { - Object[] arr = (Object[]) msg; - for (int i = 0; i < arr.length; i++) - addMessageComponents(container, cons, arr[i], maxll, - internallyCreated); - return; + Object[] arr = (Object[]) msg; + for (int i = 0; i < arr.length; i++) + addMessageComponents(container, cons, arr[i], maxll, + internallyCreated); + return; } else if (msg instanceof Component) { - container.add((Component) msg, cons); - cons.gridy++; + container.add((Component) msg, cons); + cons.gridy++; } else if (msg instanceof Icon) { JLabel label = new JLabel((Icon) msg); configureLabel(label); - container.add(label, cons); - cons.gridy++; + container.add(label, cons); + cons.gridy++; } else { - // Undocumented behaviour. - // if msg.toString().length greater than maxll - // it will create a box and burst the string. - // otherwise, it will just create a label and re-call - // this method with the label o.O - if (msg.toString().length() > maxll || msg.toString().contains("\n")) - { - Box tmp = new Box(BoxLayout.Y_AXIS); - burstStringInto(tmp, msg.toString(), maxll); - addMessageComponents(container, cons, tmp, maxll, true); - } - else + // Undocumented behaviour. + // if msg.toString().length greater than maxll + // it will create a box and burst the string. + // otherwise, it will just create a label and re-call + // this method with the label o.O + if (msg.toString().length() > maxll || msg.toString().contains("\n")) + { + Box tmp = new Box(BoxLayout.Y_AXIS); + burstStringInto(tmp, msg.toString(), maxll); + addMessageComponents(container, cons, tmp, maxll, true); + } + else { JLabel label = new JLabel(msg.toString()); configureLabel(label); @@ -817,7 +817,7 @@ public class BasicOptionPaneUI extends OptionPaneUI if (remainder.length() == 0) return; - // Recursively call ourselves to burst the remainder of the string, + // Recursively call ourselves to burst the remainder of the string, if (remainder.length() > maxll || remainder.contains("\n")) burstStringInto(c, remainder, maxll); else @@ -901,27 +901,27 @@ public class BasicOptionPaneUI extends OptionPaneUI rightSide.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); rightSide.setLayout(new GridBagLayout()); GridBagConstraints con = createConstraints(); - + addMessageComponents(rightSide, con, getMessage(), getMaxCharactersPerLineCount(), false); if (optionPane.getWantsInput()) { - Object[] selection = optionPane.getSelectionValues(); + Object[] selection = optionPane.getSelectionValues(); - if (selection == null) + if (selection == null) inputComponent = new JTextField(15); - else if (selection.length < 20) + else if (selection.length < 20) inputComponent = new JComboBox(selection); - else - inputComponent = new JList(selection); - if (inputComponent != null) - { - addMessageComponents(rightSide, con, inputComponent, + else + inputComponent = new JList(selection); + if (inputComponent != null) + { + addMessageComponents(rightSide, con, inputComponent, getMaxCharactersPerLineCount(), false); - resetSelectedValue(); - selectInitialValue(optionPane); - } + resetSelectedValue(); + selectInitialValue(optionPane); + } } messageArea.add(rightSide, BorderLayout.CENTER); @@ -979,11 +979,11 @@ public class BasicOptionPaneUI extends OptionPaneUI switch (optionPane.getOptionType()) { case JOptionPane.YES_NO_OPTION: - return new Object[] { YES_STRING, NO_STRING }; + return new Object[] { YES_STRING, NO_STRING }; case JOptionPane.YES_NO_CANCEL_OPTION: - return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING }; + return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING }; case JOptionPane.OK_CANCEL_OPTION: - return new Object[] { OK_STRING, CANCEL_STRING }; + return new Object[] { OK_STRING, CANCEL_STRING }; case JOptionPane.DEFAULT_OPTION: return (optionPane.getWantsInput()) ? new Object[] { OK_STRING, CANCEL_STRING } : @@ -1022,17 +1022,17 @@ public class BasicOptionPaneUI extends OptionPaneUI switch (messageType) { case JOptionPane.ERROR_MESSAGE: - tmp = errorIcon; - break; + tmp = errorIcon; + break; case JOptionPane.INFORMATION_MESSAGE: - tmp = infoIcon; - break; + tmp = infoIcon; + break; case JOptionPane.WARNING_MESSAGE: - tmp = warningIcon; - break; + tmp = warningIcon; + break; case JOptionPane.QUESTION_MESSAGE: - tmp = questionIcon; - break; + tmp = questionIcon; + break; } return tmp; // FIXME: Don't cast till the default icons are in. @@ -1055,8 +1055,8 @@ public class BasicOptionPaneUI extends OptionPaneUI for (int i = 0; i < buttons.length; i++) { - if (select == buttons[i]) - return i; + if (select == buttons[i]) + return i; } return 0; } @@ -1251,12 +1251,12 @@ public class BasicOptionPaneUI extends OptionPaneUI { if (c instanceof JOptionPane) { - optionPane = (JOptionPane) c; + optionPane = (JOptionPane) c; - installDefaults(); - installComponents(); - installListeners(); - installKeyboardActions(); + installDefaults(); + installComponents(); + installListeners(); + installKeyboardActions(); } } @@ -1268,16 +1268,16 @@ public class BasicOptionPaneUI extends OptionPaneUI { if (optionPane.getWantsInput() && inputComponent != null) { - Object output = null; - if (inputComponent instanceof JTextField) - output = ((JTextField) inputComponent).getText(); - else if (inputComponent instanceof JComboBox) - output = ((JComboBox) inputComponent).getSelectedItem(); - else if (inputComponent instanceof JList) - output = ((JList) inputComponent).getSelectedValue(); - - if (output != null) - optionPane.setInputValue(output); + Object output = null; + if (inputComponent instanceof JTextField) + output = ((JTextField) inputComponent).getText(); + else if (inputComponent instanceof JComboBox) + output = ((JComboBox) inputComponent).getSelectedItem(); + else if (inputComponent instanceof JList) + output = ((JList) inputComponent).getSelectedValue(); + + if (output != null) + optionPane.setInputValue(output); } } @@ -1291,8 +1291,8 @@ public class BasicOptionPaneUI extends OptionPaneUI { if (inputComponent != null) { - inputComponent.requestFocus(); - return; + inputComponent.requestFocus(); + return; } if (initialFocusComponent != null) initialFocusComponent.requestFocus(); @@ -1307,17 +1307,17 @@ public class BasicOptionPaneUI extends OptionPaneUI { if (inputComponent != null) { - Object init = optionPane.getInitialSelectionValue(); - if (init == null) - return; - if (inputComponent instanceof JTextField) - ((JTextField) inputComponent).setText((String) init); - else if (inputComponent instanceof JComboBox) - ((JComboBox) inputComponent).setSelectedItem(init); - else if (inputComponent instanceof JList) - { - // ((JList) inputComponent).setSelectedValue(init, true); - } + Object init = optionPane.getInitialSelectionValue(); + if (init == null) + return; + if (inputComponent instanceof JTextField) + ((JTextField) inputComponent).setText((String) init); + else if (inputComponent instanceof JComboBox) + ((JComboBox) inputComponent).setSelectedItem(init); + else if (inputComponent instanceof JList) + { + // ((JList) inputComponent).setSelectedValue(init, true); + } } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java index 458f10204f0..959462a783c 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java @@ -54,13 +54,13 @@ public class BasicPanelUI extends PanelUI * stateless). */ static BasicPanelUI sharedUI; - + /** * Returns a UI delegate for the specified component. - * + * * @param panel the panel. */ - public static ComponentUI createUI(JComponent panel) + public static ComponentUI createUI(JComponent panel) { if (sharedUI == null) sharedUI = new BasicPanelUI(); @@ -69,7 +69,7 @@ public class BasicPanelUI extends PanelUI /** * Installs this UI delegate in the specified component. - * + * * @param c the component (should be a {@link JPanel}, <code>null</code> not * permitted). */ @@ -85,19 +85,19 @@ public class BasicPanelUI extends PanelUI /** * Installs the defaults for this UI delegate in the specified panel. - * + * * @param p the panel (<code>null</code> not permitted). */ protected void installDefaults(JPanel p) { LookAndFeel.installColorsAndFont(p, "Panel.background", "Panel.foreground", "Panel.font"); - + // A test against the reference implementation shows that this method will // install a border if one is defined in the UIDefaults table (even though // the BasicLookAndFeel doesn't actually define a "Panel.border"). This - // test was written after discovering that a null argument to - // uninstallDefaults throws a NullPointerException in + // test was written after discovering that a null argument to + // uninstallDefaults throws a NullPointerException in // LookAndFeel.uninstallBorder()... LookAndFeel.installBorder(p, "Panel.border"); } @@ -123,10 +123,10 @@ public class BasicPanelUI extends PanelUI // (1) doesn't actually remove the installed colors and font installed // by installDefaults(), it isn't necessary; // (2) throws a NullPointerException in LookAndFeel.uninstallBorder() if - // p is null. Strangely, no border is installed by the + // p is null. Strangely, no border is installed by the // BasicLookAndFeel - perhaps this is needed by another LAF? - + LookAndFeel.uninstallBorder(p); } - + } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java index 76dcfc43559..cc839179fc2 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java @@ -56,7 +56,7 @@ public class BasicPasswordFieldUI extends BasicTextFieldUI { return new PasswordView(elem); } - + public static ComponentUI createUI(JComponent c) { return new BasicPasswordFieldUI(); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java index 8c0fe6757e3..6cd433b334a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java @@ -255,7 +255,7 @@ public class BasicPopupMenuUI extends PopupMenuUI /** * Finds the next child element that is enabled and visible. - * + * * @param children the children to search through * @param start the start index * @param end the end index @@ -282,7 +282,7 @@ public class BasicPopupMenuUI extends PopupMenuUI /** * Finds the previous child element that is enabled and visible. - * + * * @param children the children to search through * @param start the start index * @param end the end index @@ -349,7 +349,7 @@ public class BasicPopupMenuUI extends PopupMenuUI else { int popupIndex = len-1; - if (len > 2 + if (len > 2 && (path[popupIndex] instanceof JPopupMenu || path[--popupIndex] instanceof JPopupMenu) && ! ((JMenu) path[popupIndex - 1]).isTopLevelMenu()) @@ -773,7 +773,7 @@ public class BasicPopupMenuUI extends PopupMenuUI am.put(action.getValue(Action.NAME), action); action = new NavigateAction("cancel"); am.put(action.getValue(Action.NAME), action); - + return am; } @@ -916,7 +916,7 @@ public class BasicPopupMenuUI extends PopupMenuUI */ public void popupMenuWillBecomeInvisible(PopupMenuEvent event) { - // remove listener that listens to component events fired + // remove listener that listens to component events fired // by the top - level window that this popup belongs to. Component invoker = popupMenu.getInvoker(); Component rootContainer = SwingUtilities.getRoot(invoker); @@ -931,30 +931,30 @@ public class BasicPopupMenuUI extends PopupMenuUI */ public void popupMenuWillBecomeVisible(PopupMenuEvent event) { - // Adds topWindowListener to top-level window to listener to + // Adds topWindowListener to top-level window to listener to // ComponentEvents fired by it. We need to cancel this popup menu // if topWindow to which this popup belongs was resized or moved. - Component invoker = popupMenu.getInvoker(); + Component invoker = popupMenu.getInvoker(); Component rootContainer = SwingUtilities.getRoot(invoker); if (rootContainer != null) rootContainer.addComponentListener(topWindowListener); // if this popup menu is a free floating popup menu, // then by default its first element should be always selected when - // this popup menu becomes visible. + // this popup menu becomes visible. MenuSelectionManager manager = MenuSelectionManager.defaultManager(); if (manager.getSelectedPath().length == 0) { - // Set selected path to point to the first item in the popup menu - MenuElement[] path = new MenuElement[2]; - path[0] = popupMenu; - Component[] comps = popupMenu.getComponents(); - if (comps.length != 0 && comps[0] instanceof MenuElement) - { - path[1] = (MenuElement) comps[0]; - manager.setSelectedPath(path); - } + // Set selected path to point to the first item in the popup menu + MenuElement[] path = new MenuElement[2]; + path[0] = popupMenu; + Component[] comps = popupMenu.getComponents(); + if (comps.length != 0 && comps[0] instanceof MenuElement) + { + path[1] = (MenuElement) comps[0]; + manager.setSelectedPath(path); + } } } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java index 12bbe013c5e..bff6385ea6e 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java @@ -71,13 +71,13 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ProgressBarUI; /** - * The Basic Look and Feel UI delegate for the + * The Basic Look and Feel UI delegate for the * JProgressBar. */ public class BasicProgressBarUI extends ProgressBarUI { /** - * A helper class that listens for ChangeEvents + * A helper class that listens for ChangeEvents * from the progressBar's model. * * @specnote Apparently this class was intended to be protected, @@ -99,13 +99,13 @@ public class BasicProgressBarUI extends ProgressBarUI } /** - * This helper class is used to listen for + * This helper class is used to listen for * PropertyChangeEvents from the progressBar. */ private class PropertyChangeHandler implements PropertyChangeListener { /** - * Called every time the properties of the + * Called every time the properties of the * progressBar change. * * @param e The PropertyChangeEvent given by the progressBar. @@ -163,11 +163,11 @@ public class BasicProgressBarUI extends ProgressBarUI { // Nothing to do here. } - + } /** - * This helper class is used to listen for + * This helper class is used to listen for * the animationTimer's intervals. On every interval, * the bouncing box should move. */ @@ -215,7 +215,7 @@ public class BasicProgressBarUI extends ProgressBarUI * Holds the value of the bouncing box that is returned by {@link #getBox}. * * @since 1.5 - */ + */ protected Rectangle boxRect; /** The timer used to move the bouncing box. */ @@ -230,7 +230,7 @@ public class BasicProgressBarUI extends ProgressBarUI // | frame0 | frame1 | frame2 | frame 3 | frame 4 | // | | frame7 | frame6 | frame 5 | | // +-----------------------------------------------+ - + /** The current animation index. */ private transient int animationIndex; @@ -260,7 +260,7 @@ public class BasicProgressBarUI extends ProgressBarUI /** * The size of the box returned by {@link #getBox} against the orientation * direction of the progress bar. This is package private to avoid accessor - * method. + * method. */ transient int boxIndependent = - 1; @@ -346,7 +346,7 @@ public class BasicProgressBarUI extends ProgressBarUI /** * This method returns the size and position of the bouncing box - * for the current animation index. It stores the values in the + * for the current animation index. It stores the values in the * given rectangle and returns it. It returns null if no box should * be drawn. * @@ -487,7 +487,7 @@ public class BasicProgressBarUI extends ProgressBarUI * rectangle (the bounds without the insets) if the * progressBar is horizontal. * - * @return The preferred size of the progressBar minus + * @return The preferred size of the progressBar minus * insets if it's horizontal. */ protected Dimension getPreferredInnerHorizontal() @@ -512,7 +512,7 @@ public class BasicProgressBarUI extends ProgressBarUI /** * This method returns the preferred size of the inner - * rectangle (the bounds without insets) if the + * rectangle (the bounds without insets) if the * progressBar is vertical. * * @return The preferred size of the progressBar minus @@ -539,7 +539,7 @@ public class BasicProgressBarUI extends ProgressBarUI } /** - * This method returns the preferred size of the + * This method returns the preferred size of the * given JComponent. If it returns null, then it * is up to the LayoutManager to give it a size. * @@ -585,7 +585,7 @@ public class BasicProgressBarUI extends ProgressBarUI /** * This method returns the point (the top left of the bounding box) - * where the text should be painted. + * where the text should be painted. * * @param g The Graphics object to measure FontMetrics with. * @param progressString The string to paint. @@ -602,7 +602,7 @@ public class BasicProgressBarUI extends ProgressBarUI Rectangle tr = new Rectangle(); Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); - + if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) vr.setBounds(x, y, width, height); else @@ -616,7 +616,7 @@ public class BasicProgressBarUI extends ProgressBarUI SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); - + if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) return new Point(tr.x, tr.y); else @@ -651,7 +651,7 @@ public class BasicProgressBarUI extends ProgressBarUI } /** - * This method is called if the painting to be done is + * This method is called if the painting to be done is * for a determinate progressBar. * * @param g The Graphics object to paint with. @@ -672,17 +672,17 @@ public class BasicProgressBarUI extends ProgressBarUI int amountFull = getAmountFull(insets, or.width, or.height); - if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) - { - g.setColor(c.getForeground()); - g.fillRect(vr.x, vr.y, amountFull, vr.height); - } - else - { - g.setColor(c.getForeground()); - g.fillRect(vr.x, vr.y + vr.height - amountFull, vr.width, + if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) + { + g.setColor(c.getForeground()); + g.fillRect(vr.x, vr.y, amountFull, vr.height); + } + else + { + g.setColor(c.getForeground()); + g.fillRect(vr.x, vr.y + vr.height - amountFull, vr.width, amountFull); - } + } if (progressBar.isStringPainted() && !progressBar.getString().equals("")) paintString(g, 0, 0, or.width, or.height, amountFull, insets); @@ -739,13 +739,13 @@ public class BasicProgressBarUI extends ProgressBarUI String str = progressBar.getString(); int full = getAmountFull(b, width, height); Point placement = getStringPlacement(g, progressBar.getString(), - x + b.left, y + b.top, + x + b.left, y + b.top, width - b.left - b.right, height - b.top - b.bottom); Color savedColor = g.getColor(); Shape savedClip = g.getClip(); FontMetrics fm = g.getFontMetrics(progressBar.getFont()); - + if (progressBar.getOrientation() == JProgressBar.VERTICAL) { AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2); @@ -756,7 +756,7 @@ public class BasicProgressBarUI extends ProgressBarUI { placement.y += fm.getAscent(); } - + g.setColor(getSelectionForeground()); g.setClip(0, 0, full + b.left, height); g.drawString(str, placement.x, placement.y); @@ -770,7 +770,7 @@ public class BasicProgressBarUI extends ProgressBarUI /** * This method sets the current animation index. If the index is greater than * the number of frames, it resets to 0. - * + * * @param newValue The new animation index. */ protected void setAnimationIndex(int newValue) @@ -849,10 +849,10 @@ public class BasicProgressBarUI extends ProgressBarUI if (cycleTime % repaintInterval != 0 && (cycleTime / repaintInterval) % 2 != 0) { - int div = (cycleTime / repaintInterval) + 2; - div /= 2; - div *= 2; - cycleTime = div * repaintInterval; + int div = (cycleTime / repaintInterval) + 2; + div /= 2; + div *= 2; + cycleTime = div * repaintInterval; } setAnimationIndex(0); numFrames = cycleTime / repaintInterval; @@ -874,7 +874,7 @@ public class BasicProgressBarUI extends ProgressBarUI } /** - * This method registers listeners to all the + * This method registers listeners to all the * components that this UI delegate needs to listen to. */ protected void installListeners() @@ -895,7 +895,7 @@ public class BasicProgressBarUI extends ProgressBarUI } /** - * This method unregisters listeners to all the + * This method unregisters listeners to all the * components that were listened to. */ protected void uninstallListeners() @@ -930,13 +930,13 @@ public class BasicProgressBarUI extends ProgressBarUI super.installUI(c); if (c instanceof JProgressBar) { - progressBar = (JProgressBar) c; + progressBar = (JProgressBar) c; - animationTimer = new Timer(200, null); - animationTimer.setRepeats(true); + animationTimer = new Timer(200, null); + animationTimer.setRepeats(true); - installDefaults(); - installListeners(); + installDefaults(); + installListeners(); } if (progressBar.isIndeterminate()) startAnimationTimer(); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java index 3cea0d926d2..ff374d1ab8b 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java @@ -72,7 +72,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI * * @return a new instance of <code>BasicRadioButtonUI</code> */ - public static ComponentUI createUI(final JComponent c) + public static ComponentUI createUI(final JComponent c) { return new BasicRadioButtonUI(); } @@ -158,7 +158,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI Icon currentIcon = getCurrentIcon(b); // Do the layout. - String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), + String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), b.getText(), currentIcon == null ? getDefaultIcon() : currentIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), @@ -184,13 +184,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI paintFocus(g, textR, size); } } - - /** - * Determines the icon to be displayed for the specified radio button. - * - * @param b the radio button - * - * @return the icon + + /** + * Determines the icon to be displayed for the specified radio button. + * + * @param b the radio button + * + * @return the icon */ private Icon getCurrentIcon(AbstractButton b) { @@ -246,14 +246,14 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI // one will be used for layout calculations and painting instead. // The other icon properties are ignored. AbstractButton b = (AbstractButton) c; - + Insets insets = b.getInsets(); String text = b.getText(); Icon i = b.getIcon(); if (i == null) - i = getDefaultIcon(); - + i = getDefaultIcon(); + textR.x = 0; textR.y = 0; textR.width = 0; @@ -269,7 +269,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI SwingUtilities.layoutCompoundLabel(b, // for the component orientation b.getFontMetrics(b.getFont()), - text, i, b.getVerticalAlignment(), + text, i, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java index e20bc2bb3db..26c7a532dcc 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java @@ -130,7 +130,7 @@ public class BasicRootPaneUI extends RootPaneUI } } - public static ComponentUI createUI(JComponent x) + public static ComponentUI createUI(JComponent x) { return new BasicRootPaneUI(); } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java index 400ede03ce9..9f24f8acae0 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java @@ -85,7 +85,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, */ protected class ArrowButtonListener extends MouseAdapter { - + /** * Move the thumb in the direction specified by the button's arrow. If * this button is held down, then it should keep moving the thumb. @@ -285,13 +285,13 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, currentMouseY = e.getY(); if (scrollbar.getValueIsAdjusting()) { - int value; - if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) - value = valueForXPosition(currentMouseX) - offset; - else - value = valueForYPosition(currentMouseY) - offset; + int value; + if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) + value = valueForXPosition(currentMouseX) - offset; + else + value = valueForYPosition(currentMouseY) - offset; - scrollbar.setValue(value); + scrollbar.setValue(value); } } @@ -321,38 +321,38 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) - value = valueForXPosition(currentMouseX); + value = valueForXPosition(currentMouseX); else - value = valueForYPosition(currentMouseY); + value = valueForYPosition(currentMouseY); if (! thumbRect.contains(e.getPoint())) { - scrollTimer.stop(); - scrollListener.setScrollByBlock(true); - if (value > scrollbar.getValue()) - { - trackHighlight = INCREASE_HIGHLIGHT; - scrollListener.setDirection(POSITIVE_SCROLL); - } - else - { - trackHighlight = DECREASE_HIGHLIGHT; - scrollListener.setDirection(NEGATIVE_SCROLL); - } + scrollTimer.stop(); + scrollListener.setScrollByBlock(true); + if (value > scrollbar.getValue()) + { + trackHighlight = INCREASE_HIGHLIGHT; + scrollListener.setDirection(POSITIVE_SCROLL); + } + else + { + trackHighlight = DECREASE_HIGHLIGHT; + scrollListener.setDirection(NEGATIVE_SCROLL); + } scrollTimer.setDelay(100); - scrollTimer.start(); + scrollTimer.start(); } else { - // We'd like to keep track of where the cursor - // is inside the thumb. - // This works because the scrollbar's value represents - // "lower" edge of the thumb. The value at which - // the cursor is at must be greater or equal - // to that value. + // We'd like to keep track of where the cursor + // is inside the thumb. + // This works because the scrollbar's value represents + // "lower" edge of the thumb. The value at which + // the cursor is at must be greater or equal + // to that value. scrollListener.setScrollByBlock(false); - scrollbar.setValueIsAdjusting(true); + scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); @@ -394,17 +394,17 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, { int value; if (scrollbar.getOrientation() == HORIZONTAL) - value = valueForXPosition(currentMouseX); + value = valueForXPosition(currentMouseX); else - value = valueForYPosition(currentMouseY); + value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; - + if (direction == POSITIVE_SCROLL) - return value > scrollbar.getValue(); + return value > scrollbar.getValue(); else - return value < scrollbar.getValue(); + return value < scrollbar.getValue(); } } @@ -488,7 +488,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, /** The scrollbar this UI is acting for. */ protected JScrollBar scrollbar; - + /** True if the mouse is over the thumb. */ boolean thumbRollover; @@ -767,7 +767,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, } /** - * Installs the input map from the look and feel defaults, and a + * Installs the input map from the look and feel defaults, and a * corresponding action map. Note the the keyboard bindings will only * work when the {@link JScrollBar} component has the focus, which is rare. */ @@ -775,7 +775,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, { InputMap keyMap = getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - SwingUtilities.replaceUIInputMap(scrollbar, + SwingUtilities.replaceUIInputMap(scrollbar, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, keyMap); ActionMap map = getActionMap(); SwingUtilities.replaceUIActionMap(scrollbar, map); @@ -788,25 +788,25 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, protected void uninstallKeyboardActions() { SwingUtilities.replaceUIActionMap(scrollbar, null); - SwingUtilities.replaceUIInputMap(scrollbar, + SwingUtilities.replaceUIInputMap(scrollbar, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null); } - InputMap getInputMap(int condition) + InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) return (InputMap) UIManager.get("ScrollBar.focusInputMap"); return null; } - + /** - * Returns the action map for the {@link JScrollBar}. All scroll bars - * share a single action map which is created the first time this method is + * Returns the action map for the {@link JScrollBar}. All scroll bars + * share a single action map which is created the first time this method is * called, then stored in the UIDefaults table for subsequent access. - * + * * @return The shared action map. */ - ActionMap getActionMap() + ActionMap getActionMap() { ActionMap map = (ActionMap) UIManager.get("ScrollBar.actionMap"); @@ -821,23 +821,23 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, /** * Creates the action map shared by all {@link JSlider} instances. - * This method is called once by {@link #getActionMap()} when it - * finds no action map in the UIDefaults table...after the map is - * created, it gets added to the defaults table so that subsequent - * calls to {@link #getActionMap()} will return the same shared + * This method is called once by {@link #getActionMap()} when it + * finds no action map in the UIDefaults table...after the map is + * created, it gets added to the defaults table so that subsequent + * calls to {@link #getActionMap()} will return the same shared * instance. - * + * * @return The action map. */ ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); - map.put("positiveUnitIncrement", + map.put("positiveUnitIncrement", new AbstractAction("positiveUnitIncrement") { public void actionPerformed(ActionEvent event) { JScrollBar sb = (JScrollBar) event.getSource(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getUnitIncrement(1); sb.setValue(sb.getValue() + delta); @@ -845,12 +845,12 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, } } ); - map.put("positiveBlockIncrement", + map.put("positiveBlockIncrement", new AbstractAction("positiveBlockIncrement") { public void actionPerformed(ActionEvent event) { JScrollBar sb = (JScrollBar) event.getSource(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getBlockIncrement(1); sb.setValue(sb.getValue() + delta); @@ -858,12 +858,12 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, } } ); - map.put("negativeUnitIncrement", + map.put("negativeUnitIncrement", new AbstractAction("negativeUnitIncrement") { public void actionPerformed(ActionEvent event) { JScrollBar sb = (JScrollBar) event.getSource(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getUnitIncrement(-1); sb.setValue(sb.getValue() + delta); @@ -871,12 +871,12 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, } } ); - map.put("negativeBlockIncrement", + map.put("negativeBlockIncrement", new AbstractAction("negativeBlockIncrement") { public void actionPerformed(ActionEvent event) { JScrollBar sb = (JScrollBar) event.getSource(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getBlockIncrement(-1); sb.setValue(sb.getValue() + delta); @@ -884,24 +884,24 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, } } ); - map.put("minScroll", + map.put("minScroll", new AbstractAction("minScroll") { public void actionPerformed(ActionEvent event) { JScrollBar sb = (JScrollBar) event.getSource(); - if (sb.isVisible()) + if (sb.isVisible()) { sb.setValue(sb.getMinimum()); } } } ); - map.put("maxScroll", + map.put("maxScroll", new AbstractAction("maxScroll") { public void actionPerformed(ActionEvent event) { JScrollBar sb = (JScrollBar) event.getSource(); - if (sb.isVisible()) + if (sb.isVisible()) { sb.setValue(sb.getMaximum()); } @@ -910,7 +910,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, ); return map; } - + /** * This method installs any listeners for the scrollbar. This method also * installs listeners for things such as the JButtons and the timer. @@ -973,10 +973,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, { if (scrollbarContainer instanceof JScrollBar) { - if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) - layoutHScrollbar((JScrollBar) scrollbarContainer); - else - layoutVScrollbar((JScrollBar) scrollbarContainer); + if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) + layoutHScrollbar((JScrollBar) scrollbarContainer); + else + layoutVScrollbar((JScrollBar) scrollbarContainer); } } @@ -992,7 +992,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, Dimension incrDims = incrButton.getPreferredSize(); Dimension decrDims = decrButton.getPreferredSize(); - + // calculate and update the track bounds SwingUtilities.calculateInnerArea(scrollbar, trackRect); trackRect.width -= incrDims.getWidth(); @@ -1000,7 +1000,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, trackRect.x += decrDims.getWidth(); updateThumbRect(); - + decrButton.setBounds(vr.x, vr.y, decrDims.width, trackRect.height); incrButton.setBounds(trackRect.x + trackRect.width, vr.y, incrDims.width, trackRect.height); @@ -1018,13 +1018,13 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, Dimension incrDims = incrButton.getPreferredSize(); Dimension decrDims = decrButton.getPreferredSize(); - + // Update rectangles SwingUtilities.calculateInnerArea(scrollbar, trackRect); trackRect.height -= incrDims.getHeight(); trackRect.height -= decrDims.getHeight(); trackRect.y += decrDims.getHeight(); - + updateThumbRect(); decrButton.setBounds(vr.x, vr.y, trackRect.width, decrDims.height); @@ -1076,14 +1076,14 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); int availableHeight = trackRect.height - thumbRect.height; - thumbRect.y = trackRect.y + thumbRect.y = trackRect.y + (value - min) * availableHeight / (max - min - extent); thumbRect.width = trackRect.width; } } } - + /** * This method returns the minimum size required for the layout. * @@ -1367,7 +1367,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, decrButton.removeMouseListener(buttonListener); if (incrButton != null) incrButton.removeMouseListener(buttonListener); - + propertyChangeListener = null; modelListener = null; buttonListener = null; @@ -1469,39 +1469,39 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, value = min; return value; } - + /** * Returns true if the mouse is over the thumb. - * + * * @return true if the mouse is over the thumb. - * + * * @since 1.5 */ public boolean isThumbRollover() { - return thumbRollover; + return thumbRollover; } - + /** * Set thumbRollover to active. This indicates * whether or not the mouse is over the thumb. - * + * * @param active - true if the mouse is over the thumb. - * + * * @since 1.5 */ protected void setThumbRollover(boolean active) { thumbRollover = active; } - + /** - * Indicates whether the user can position the thumb with + * Indicates whether the user can position the thumb with * a mouse click (i.e. middle button). - * + * * @return true if the user can position the thumb with a mouse * click. - * + * * @since 1.5 */ public boolean getSupportsAbsolutePositioning() diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java index a7194284050..712394830cc 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -127,7 +127,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI viewPosition.y = vsb.getValue(); vp.setViewPosition(viewPosition); } - + } /** @@ -144,7 +144,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI * changes. When the extents size has changed, this method calls * {@link BasicScrollPaneUI#syncScrollPaneWithViewport()} to adjust the * scrollbars extents as well. - * + * * @param event the change event */ public void stateChanged(ChangeEvent event) @@ -221,7 +221,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI /** * Scroll with the mouse wheel. - * + * * @author Audrius Meskauskas (audriusa@Bioinformatics.org) */ public void mouseWheelMoved(MouseWheelEvent e) @@ -245,11 +245,11 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } } - + /** * Adds/removes the mouse wheel listener when the component is added/removed * to/from the scroll pane view port. - * + * * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ class ViewportContainerListener implements ContainerListener @@ -261,7 +261,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI { e.getChild().addMouseWheelListener(mouseWheelListener); } - + /** * Remove the mouse wheel listener. */ @@ -270,18 +270,18 @@ public class BasicScrollPaneUI extends ScrollPaneUI e.getChild().removeMouseWheelListener(mouseWheelListener); } } - + /** * The number of pixels by that we should scroll the content that does * not implement Scrollable. */ static int SCROLL_NON_SCROLLABLES = 10; - + /** * The number of rows to scroll per mouse wheel click. From impression, * Sun seems using the value 3. */ - static int ROWS_PER_WHEEL_CLICK = 3; + static int ROWS_PER_WHEEL_CLICK = 3; /** The Scrollpane for which the UI is provided by this class. */ protected JScrollPane scrollpane; @@ -310,14 +310,14 @@ public class BasicScrollPaneUI extends ScrollPaneUI * The mousewheel listener for the scrollpane. */ MouseWheelListener mouseWheelListener; - + /** * The listener to add and remove the mouse wheel listener to/from * the component container. */ ContainerListener containerListener; - public static ComponentUI createUI(final JComponent c) + public static ComponentUI createUI(final JComponent c) { return new BasicScrollPaneUI(); } @@ -348,8 +348,8 @@ public class BasicScrollPaneUI extends ScrollPaneUI if (vpBorder != null && vpBorder instanceof UIResource) p.setViewportBorder(null); } - - public void installUI(final JComponent c) + + public void installUI(final JComponent c) { super.installUI(c); installDefaults((JScrollPane) c); @@ -371,31 +371,31 @@ public class BasicScrollPaneUI extends ScrollPaneUI if (hsbChangeListener == null) hsbChangeListener = createHSBChangeListener(); sp.getHorizontalScrollBar().getModel().addChangeListener(hsbChangeListener); - + if (vsbChangeListener == null) vsbChangeListener = createVSBChangeListener(); sp.getVerticalScrollBar().getModel().addChangeListener(vsbChangeListener); if (viewportChangeListener == null) viewportChangeListener = createViewportChangeListener(); - + if (mouseWheelListener == null) mouseWheelListener = createMouseWheelListener(); - + if (containerListener == null) containerListener = new ViewportContainerListener(); - + JViewport v = sp.getViewport(); v.addChangeListener(viewportChangeListener); v.addContainerListener(containerListener); - + // Add mouse wheel listeners to the componets that are probably already // in the view port. for (int i = 0; i < v.getComponentCount(); i++) v.getComponent(i).addMouseWheelListener(mouseWheelListener); } - InputMap getInputMap(int condition) + InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) return (InputMap) UIManager.get("ScrollPane.ancestorInputMap"); @@ -403,13 +403,13 @@ public class BasicScrollPaneUI extends ScrollPaneUI } /** - * Returns the action map for the {@link JScrollPane}. All scroll panes - * share a single action map which is created the first time this method is + * Returns the action map for the {@link JScrollPane}. All scroll panes + * share a single action map which is created the first time this method is * called, then stored in the UIDefaults table for subsequent access. - * + * * @return The shared action map. */ - ActionMap getActionMap() + ActionMap getActionMap() { ActionMap map = (ActionMap) UIManager.get("ScrollPane.actionMap"); @@ -424,24 +424,24 @@ public class BasicScrollPaneUI extends ScrollPaneUI /** * Creates the action map shared by all {@link JSlider} instances. - * This method is called once by {@link #getActionMap()} when it - * finds no action map in the UIDefaults table...after the map is - * created, it gets added to the defaults table so that subsequent - * calls to {@link #getActionMap()} will return the same shared + * This method is called once by {@link #getActionMap()} when it + * finds no action map in the UIDefaults table...after the map is + * created, it gets added to the defaults table so that subsequent + * calls to {@link #getActionMap()} will return the same shared * instance. - * + * * @return The action map. */ ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); - map.put("scrollLeft", + map.put("scrollLeft", new AbstractAction("scrollLeft") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getHorizontalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getBlockIncrement(-1); sb.setValue(sb.getValue() + delta); @@ -449,31 +449,31 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("scrollEnd", + map.put("scrollEnd", new AbstractAction("scrollEnd") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb1 = sp.getHorizontalScrollBar(); - if (sb1.isVisible()) + if (sb1.isVisible()) { sb1.setValue(sb1.getMaximum()); } JScrollBar sb2 = sp.getVerticalScrollBar(); - if (sb2.isVisible()) + if (sb2.isVisible()) { sb2.setValue(sb2.getMaximum()); } } } ); - map.put("unitScrollUp", + map.put("unitScrollUp", new AbstractAction("unitScrollUp") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getVerticalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getUnitIncrement(-1); sb.setValue(sb.getValue() + delta); @@ -481,13 +481,13 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("unitScrollLeft", + map.put("unitScrollLeft", new AbstractAction("unitScrollLeft") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getHorizontalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getUnitIncrement(-1); sb.setValue(sb.getValue() + delta); @@ -495,13 +495,13 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("scrollUp", + map.put("scrollUp", new AbstractAction("scrollUp") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getVerticalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getBlockIncrement(-1); sb.setValue(sb.getValue() + delta); @@ -509,13 +509,13 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("scrollRight", + map.put("scrollRight", new AbstractAction("scrollRight") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getHorizontalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getBlockIncrement(1); sb.setValue(sb.getValue() + delta); @@ -523,31 +523,31 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("scrollHome", + map.put("scrollHome", new AbstractAction("scrollHome") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb1 = sp.getHorizontalScrollBar(); - if (sb1.isVisible()) + if (sb1.isVisible()) { sb1.setValue(sb1.getMinimum()); } JScrollBar sb2 = sp.getVerticalScrollBar(); - if (sb2.isVisible()) + if (sb2.isVisible()) { sb2.setValue(sb2.getMinimum()); } } } ); - map.put("scrollDown", + map.put("scrollDown", new AbstractAction("scrollDown") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getVerticalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getBlockIncrement(1); sb.setValue(sb.getValue() + delta); @@ -555,13 +555,13 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("unitScrollDown", + map.put("unitScrollDown", new AbstractAction("unitScrollDown") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getVerticalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getUnitIncrement(1); sb.setValue(sb.getValue() + delta); @@ -569,13 +569,13 @@ public class BasicScrollPaneUI extends ScrollPaneUI } } ); - map.put("unitScrollRight", + map.put("unitScrollRight", new AbstractAction("unitScrollRight") { public void actionPerformed(ActionEvent event) { JScrollPane sp = (JScrollPane) event.getSource(); JScrollBar sb = sp.getHorizontalScrollBar(); - if (sb.isVisible()) + if (sb.isVisible()) { int delta = sb.getUnitIncrement(1); sb.setValue(sb.getValue() + delta); @@ -585,7 +585,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI ); return map; } - + /** * Installs additional keyboard actions on the scrollpane. This is a hook * method provided to subclasses in order to install their own keyboard @@ -597,7 +597,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI { InputMap keyMap = getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - SwingUtilities.replaceUIInputMap(sp, + SwingUtilities.replaceUIInputMap(sp, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, keyMap); ActionMap map = getActionMap(); SwingUtilities.replaceUIActionMap(sp, map); @@ -613,10 +613,10 @@ public class BasicScrollPaneUI extends ScrollPaneUI protected void uninstallKeyboardActions(JScrollPane sp) { SwingUtilities.replaceUIActionMap(sp, null); - SwingUtilities.replaceUIInputMap(sp, + SwingUtilities.replaceUIInputMap(sp, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null); } - + /** * Creates and returns the change listener for the horizontal scrollbar. * @@ -661,7 +661,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI * Creates and returns the mouse wheel listener for the scrollpane. * * @return the mouse wheel listener for the scrollpane - * + * * @since 1.4 */ protected MouseWheelListener createMouseWheelListener() @@ -669,7 +669,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI return new MouseWheelHandler(); } - public void uninstallUI(final JComponent c) + public void uninstallUI(final JComponent c) { uninstallDefaults((JScrollPane) c); uninstallListeners(c); @@ -680,7 +680,7 @@ public class BasicScrollPaneUI extends ScrollPaneUI * Uninstalls all the listeners that have been installed in * {@link #installListeners(JScrollPane)}. * - * @param c the scrollpane from which to uninstall the listeners + * @param c the scrollpane from which to uninstall the listeners */ protected void uninstallListeners(JComponent c) { @@ -690,17 +690,17 @@ public class BasicScrollPaneUI extends ScrollPaneUI .removeChangeListener(hsbChangeListener); sp.getVerticalScrollBar().getModel() .removeChangeListener(vsbChangeListener); - + JViewport v = sp.getViewport(); v.removeChangeListener(viewportChangeListener); v.removeContainerListener(containerListener); - + for (int i = 0; i < v.getComponentCount(); i++) v.getComponent(i).removeMouseWheelListener(mouseWheelListener); } - public Dimension getMinimumSize(JComponent c) + public Dimension getMinimumSize(JComponent c) { JScrollPane p = (JScrollPane) c; ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout(); @@ -821,15 +821,3 @@ public class BasicScrollPaneUI extends ScrollPaneUI syncScrollPaneWithViewport(); } } - - - - - - - - - - - - diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java index 97caa3af7bd..2c80822a486 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java @@ -86,10 +86,10 @@ public class BasicSeparatorUI extends SeparatorUI if (c instanceof JSeparator) { - JSeparator s = (JSeparator) c; + JSeparator s = (JSeparator) c; - installDefaults(s); - installListeners(s); + installDefaults(s); + installListeners(s); } } @@ -104,10 +104,10 @@ public class BasicSeparatorUI extends SeparatorUI { if (c instanceof JSeparator) { - JSeparator s = (JSeparator) c; + JSeparator s = (JSeparator) c; - uninstallListeners(s); - uninstallDefaults(s); + uninstallListeners(s); + uninstallDefaults(s); } } @@ -138,7 +138,7 @@ public class BasicSeparatorUI extends SeparatorUI /** * This method installs any listeners that need - * to be attached to the JSeparator or any of its + * to be attached to the JSeparator or any of its * components. * * @param s The JSeparator that is being installed. @@ -156,15 +156,15 @@ public class BasicSeparatorUI extends SeparatorUI */ protected void uninstallListeners(JSeparator s) { - // Separators don't receive events. + // Separators don't receive events. } /** - * The separator is made of two lines. The top line will be - * the shadow color (or left line if it's vertical). The bottom - * or right line will be the highlight color. The two lines will - * be centered inside the bounds box. If the separator is horizontal, - * then it will be vertically centered, or if it's vertical, it will + * The separator is made of two lines. The top line will be + * the shadow color (or left line if it's vertical). The bottom + * or right line will be the highlight color. The two lines will + * be centered inside the bounds box. If the separator is horizontal, + * then it will be vertically centered, or if it's vertical, it will * be horizontally centered. * * @param g The Graphics object to paint with @@ -175,15 +175,15 @@ public class BasicSeparatorUI extends SeparatorUI Rectangle r = new Rectangle(); SwingUtilities.calculateInnerArea(c, r); Color saved = g.getColor(); - + JSeparator s; if (c instanceof JSeparator) s = (JSeparator) c; else return; - + if (s.getOrientation() == JSeparator.HORIZONTAL) - { + { int midAB = r.height / 2; g.setColor(shadow); g.drawLine(r.x, r.y + midAB - 1, r.x + r.width, r.y + midAB - 1); @@ -204,7 +204,7 @@ public class BasicSeparatorUI extends SeparatorUI } /** - * This method returns the preferred size of the + * This method returns the preferred size of the * JComponent. * * @param c The JComponent to measure. @@ -216,8 +216,8 @@ public class BasicSeparatorUI extends SeparatorUI Dimension pref = new Dimension(2, 0); if (c instanceof JSeparator) { - JSeparator s = (JSeparator) c; - if (s.getOrientation() == JSeparator.HORIZONTAL) + JSeparator s = (JSeparator) c; + if (s.getOrientation() == JSeparator.HORIZONTAL) pref = new Dimension(0, 2); } return pref; diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java index 474a4225640..b9d5643725a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java @@ -81,12 +81,12 @@ import javax.swing.plaf.SliderUI; * BasicSliderUI.java This is the UI delegate in the Basic look and feel that * paints JSliders. * </p> - * + * * <p> * The UI delegate keeps track of 6 rectangles that place the various parts of * the JSlider inside the component. * </p> - * + * * <p> * The rectangles are organized as follows: * </p> @@ -110,27 +110,27 @@ import javax.swing.plaf.SliderUI; * | | | | | | * | | | | | * </pre> - * + * * <p> * The space between the contentRect and the focusRect are the FocusInsets. * </p> - * + * * <p> * The space between the focusRect and the component bounds is the insetCache * which are the component's insets. * </p> - * + * * <p> * The top of the thumb is the top of the contentRect. The trackRect has to be * as tall as the thumb. * </p> - * + * * <p> * The trackRect and tickRect do not start from the left edge of the * focusRect. They are trackBuffer away from each side of the focusRect. This * is so that the thumb has room to move. * </p> - * + * * <p> * The labelRect does start right against the contentRect's left and right * edges and it gets all remaining space. @@ -420,8 +420,8 @@ public class BasicSliderUI extends SliderUI if (slider.getSnapToTicks()) value = findClosestTick(value); - // If the thumb is hit, then we don't need to set the timers to - // move it. + // If the thumb is hit, then we don't need to set the timers to + // move it. if (! thumbRect.contains(e.getPoint())) { // The mouse has hit some other part of the slider. @@ -605,16 +605,16 @@ public class BasicSliderUI extends SliderUI /** * Returns true if the user is dragging the slider. - * + * * @return true if the slider is being dragged. - * + * * @since 1.5 */ protected boolean isDragging() { return dragging; } - + /** * Gets the shadow color to be used for this slider. The shadow color is the * color used for drawing the top and left edges of the track. @@ -1099,15 +1099,15 @@ public class BasicSliderUI extends SliderUI } /** - * Updates the <code>contentRect</code> field to an area inside the - * <code>focusRect</code>. This method does not need to be called if the + * Updates the <code>contentRect</code> field to an area inside the + * <code>focusRect</code>. This method does not need to be called if the * orientation changes. */ protected void calculateContentRect() { contentRect.x = focusRect.x + focusInsets.left; contentRect.y = focusRect.y + focusInsets.top; - + contentRect.width = focusRect.width - focusInsets.left - focusInsets.right; contentRect.height = focusRect.height - focusInsets.top - focusInsets.bottom; @@ -1134,9 +1134,9 @@ public class BasicSliderUI extends SliderUI } /** - * Calculates the gap size between the edge of the <code>contentRect</code> + * Calculates the gap size between the edge of the <code>contentRect</code> * and the edge of the <code>trackRect</code>, storing the result in the - * <code>trackBuffer</code> field. Sufficient space needs to be reserved + * <code>trackBuffer</code> field. Sufficient space needs to be reserved * for the slider thumb and/or the labels at each end of the slider track. */ protected void calculateTrackBuffer() @@ -1145,11 +1145,11 @@ public class BasicSliderUI extends SliderUI { int w = Math.max(getWidthOfLowValueLabel(), getWidthOfHighValueLabel()); trackBuffer = Math.max(thumbRect.width / 2, w / 2); - + } else { - int h = Math.max(getHeightOfLowValueLabel(), + int h = Math.max(getHeightOfLowValueLabel(), getHeightOfHighValueLabel()); trackBuffer = Math.max(thumbRect.height / 2, h / 2); } @@ -1157,10 +1157,10 @@ public class BasicSliderUI extends SliderUI /** * Returns the size of the slider's thumb. The size is hard coded to - * <code>11 x 20</code> for horizontal sliders, and <code>20 x 11</code> for - * vertical sliders. Note that a new instance of {@link Dimension} is - * returned for every call to this method (this seems wasteful, but - * {@link Dimension} instances are not immutable, so this is probably + * <code>11 x 20</code> for horizontal sliders, and <code>20 x 11</code> for + * vertical sliders. Note that a new instance of {@link Dimension} is + * returned for every call to this method (this seems wasteful, but + * {@link Dimension} instances are not immutable, so this is probably * unavoidable). * * @return The size of the slider's thumb. @@ -1232,7 +1232,7 @@ public class BasicSliderUI extends SliderUI tickRect.y = trackRect.y + trackRect.height; tickRect.width = trackRect.width; tickRect.height = getTickLength(); - + // this makes our Mauve tests pass...can't explain it! if (!slider.getPaintTicks()) { @@ -1257,7 +1257,7 @@ public class BasicSliderUI extends SliderUI } /** - * Calculates the <code>labelRect</code> field, taking into account the + * Calculates the <code>labelRect</code> field, taking into account the * orientation of the slider. */ protected void calculateLabelRect() @@ -1353,7 +1353,7 @@ public class BasicSliderUI extends SliderUI * there are no labels. * * @return The width of the label whose key has the highest value. - * + * * @see #getHighestValueLabel() */ protected int getWidthOfHighValueLabel() @@ -1370,7 +1370,7 @@ public class BasicSliderUI extends SliderUI * there are no labels. * * @return The width of the label whose key has the lowest value. - * + * * @see #getLowestValueLabel() */ protected int getWidthOfLowValueLabel() @@ -1455,7 +1455,7 @@ public class BasicSliderUI extends SliderUI /** * Returns the label whose key has the highest value. * - * @return The label whose key has the highest value or <code>null</code> if + * @return The label whose key has the highest value or <code>null</code> if * no label table exists. */ protected Component getHighestValueLabel() @@ -1527,7 +1527,7 @@ public class BasicSliderUI extends SliderUI protected void recalculateIfOrientationChanged() { // Examining a test program shows that either Sun calls private - // methods that we don't know about, or these don't do anything. + // methods that we don't know about, or these don't do anything. calculateThumbSize(); calculateTrackBuffer(); calculateTrackRect(); @@ -1549,7 +1549,7 @@ public class BasicSliderUI extends SliderUI Color saved_color = g.getColor(); g.setColor(getFocusColor()); - + g.drawRect(focusRect.x, focusRect.y, focusRect.width, focusRect.height); g.setColor(saved_color); @@ -1564,16 +1564,16 @@ public class BasicSliderUI extends SliderUI * with the highlight color. * </p> * <pre> - * a---d - * | | + * a---d + * | | * | | a------------------------d * | | | | * | | b------------------------c * | | - * | | + * | | * b---c * </pre> - * + * * <p> * The b-a-d path needs to be drawn with the shadow color and the b-c-d path * needs to be drawn with the highlight color. @@ -1676,7 +1676,7 @@ public class BasicSliderUI extends SliderUI } } - /* Minor ticks start at 1/4 of the height (or width) of the tickRect and + /* Minor ticks start at 1/4 of the height (or width) of the tickRect and extend to 1/2 of the tickRect. Major ticks start at 1/4 of the height and extend to 3/4. @@ -1849,7 +1849,7 @@ public class BasicSliderUI extends SliderUI * \ / | / * d e-----d * </pre> - * + * * <p> * In the case of vertical thumbs, we highlight the path b-a-e-d and shadow * the path b-c-d. In the case of horizontal thumbs, we highlight the path @@ -1958,10 +1958,10 @@ public class BasicSliderUI extends SliderUI /** * Moves the thumb one block in the direction specified (a block is 1/10th - * of the slider range). If the slider snaps to ticks, this method is + * of the slider range). If the slider snaps to ticks, this method is * responsible for snapping it to a tick after the thumb has been moved. * - * @param direction the direction (positive values increment the thumb + * @param direction the direction (positive values increment the thumb * position by one block, zero/negative values decrement the thumb position * by one block). */ @@ -1981,11 +1981,11 @@ public class BasicSliderUI extends SliderUI } /** - * Moves the thumb one unit in the specified direction. If the slider snaps - * to ticks, this method is responsible for snapping it to a tick after the + * Moves the thumb one unit in the specified direction. If the slider snaps + * to ticks, this method is responsible for snapping it to a tick after the * thumb has been moved. * - * @param direction the direction (positive values increment the thumb + * @param direction the direction (positive values increment the thumb * position by one, zero/negative values decrement the thumb position by * one). */ @@ -2021,7 +2021,7 @@ public class BasicSliderUI extends SliderUI } /** - * Returns the x-coordinate (relative to the component) for the given slider + * Returns the x-coordinate (relative to the component) for the given slider * value. This method assumes that the <code>trackRect</code> field is * set up. * @@ -2049,8 +2049,8 @@ public class BasicSliderUI extends SliderUI } /** - * Returns the y-coordinate (relative to the component) for the given slider - * value. This method assumes that the <code>trackRect</code> field is + * Returns the y-coordinate (relative to the component) for the given slider + * value. This method assumes that the <code>trackRect</code> field is * set up. * * @param value the slider value. @@ -2093,8 +2093,8 @@ public class BasicSliderUI extends SliderUI int value; - // If the length is 0, you shouldn't be able to even see where the slider - // is. This really shouldn't ever happen, but just in case, we'll return + // If the length is 0, you shouldn't be able to even see where the slider + // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return (max - min) / 2; @@ -2129,8 +2129,8 @@ public class BasicSliderUI extends SliderUI int value; - // If the length is 0, you shouldn't be able to even see where the slider - // is. This really shouldn't ever happen, but just in case, we'll return + // If the length is 0, you shouldn't be able to even see where the slider + // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return (max - min) / 2; @@ -2164,14 +2164,14 @@ public class BasicSliderUI extends SliderUI int minorSpace = slider.getMinorTickSpacing(); // The default value to return is value + minor or - // value + major. + // value + major. // Initializing at min - value leaves us with a default // return value of min, which always has tick marks // (if ticks are painted). int minor = min - value; int major = min - value; - // If there are no major tick marks or minor tick marks + // If there are no major tick marks or minor tick marks // e.g. snap is set to true but no ticks are set, then // we can just return the value. if (majorSpace <= 0 && minorSpace <= 0) @@ -2208,8 +2208,8 @@ public class BasicSliderUI extends SliderUI else return value + minor; } - - InputMap getInputMap(int condition) + + InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_FOCUSED) return (InputMap) UIManager.get("Slider.focusInputMap"); @@ -2218,12 +2218,12 @@ public class BasicSliderUI extends SliderUI /** * Returns the action map for the {@link JSlider}. All sliders share - * a single action map which is created the first time this method is + * a single action map which is created the first time this method is * called, then stored in the UIDefaults table for subsequent access. - * + * * @return The shared action map. */ - ActionMap getActionMap() + ActionMap getActionMap() { ActionMap map = (ActionMap) UIManager.get("Slider.actionMap"); @@ -2238,18 +2238,18 @@ public class BasicSliderUI extends SliderUI /** * Creates the action map shared by all {@link JSlider} instances. - * This method is called once by {@link #getActionMap()} when it - * finds no action map in the UIDefaults table...after the map is - * created, it gets added to the defaults table so that subsequent - * calls to {@link #getActionMap()} will return the same shared + * This method is called once by {@link #getActionMap()} when it + * finds no action map in the UIDefaults table...after the map is + * created, it gets added to the defaults table so that subsequent + * calls to {@link #getActionMap()} will return the same shared * instance. - * + * * @return The action map. */ ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); - map.put("positiveUnitIncrement", + map.put("positiveUnitIncrement", new AbstractAction("positiveUnitIncrement") { public void actionPerformed(ActionEvent event) { @@ -2262,7 +2262,7 @@ public class BasicSliderUI extends SliderUI } } ); - map.put("negativeUnitIncrement", + map.put("negativeUnitIncrement", new AbstractAction("negativeUnitIncrement") { public void actionPerformed(ActionEvent event) { @@ -2275,7 +2275,7 @@ public class BasicSliderUI extends SliderUI } } ); - map.put("positiveBlockIncrement", + map.put("positiveBlockIncrement", new AbstractAction("positiveBlockIncrement") { public void actionPerformed(ActionEvent event) { @@ -2288,7 +2288,7 @@ public class BasicSliderUI extends SliderUI } } ); - map.put("negativeBlockIncrement", + map.put("negativeBlockIncrement", new AbstractAction("negativeBlockIncrement") { public void actionPerformed(ActionEvent event) { @@ -2301,7 +2301,7 @@ public class BasicSliderUI extends SliderUI } } ); - map.put("minScroll", + map.put("minScroll", new AbstractAction("minScroll") { public void actionPerformed(ActionEvent event) { @@ -2309,11 +2309,11 @@ public class BasicSliderUI extends SliderUI if (slider.getInverted()) slider.setValue(slider.getMaximum()); else - slider.setValue(slider.getMinimum()); + slider.setValue(slider.getMinimum()); } } ); - map.put("maxScroll", + map.put("maxScroll", new AbstractAction("maxScroll") { public void actionPerformed(ActionEvent event) { @@ -2321,7 +2321,7 @@ public class BasicSliderUI extends SliderUI if (slider.getInverted()) slider.setValue(slider.getMinimum()); else - slider.setValue(slider.getMaximum()); + slider.setValue(slider.getMaximum()); } } ); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java index 254a9a4fa2b..00c8537cce6 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java @@ -173,7 +173,7 @@ public class BasicSpinnerUI extends SpinnerUI if (e instanceof JSpinner.DefaultEditor) { JSpinner.DefaultEditor de = (JSpinner.DefaultEditor) e; - de.getTextField().setBorder(null); + de.getTextField().setBorder(null); } spinner.setLayout(createLayout()); spinner.setOpaque(true); @@ -199,36 +199,36 @@ public class BasicSpinnerUI extends SpinnerUI { c.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent evt) - { - if (! spinner.isEnabled()) - return; - increment(); - timer.setInitialDelay(500); - timer.start(); - } - - public void mouseReleased(MouseEvent evt) - { - timer.stop(); - } - - void increment() - { - Object next = BasicSpinnerUI.this.spinner.getNextValue(); - if (next != null) - BasicSpinnerUI.this.spinner.getModel().setValue(next); - } - - volatile boolean mouseDown; - Timer timer = new Timer(50, - new ActionListener() - { - public void actionPerformed(ActionEvent event) - { - increment(); - } - }); + public void mousePressed(MouseEvent evt) + { + if (! spinner.isEnabled()) + return; + increment(); + timer.setInitialDelay(500); + timer.start(); + } + + public void mouseReleased(MouseEvent evt) + { + timer.stop(); + } + + void increment() + { + Object next = BasicSpinnerUI.this.spinner.getNextValue(); + if (next != null) + BasicSpinnerUI.this.spinner.getModel().setValue(next); + } + + volatile boolean mouseDown; + Timer timer = new Timer(50, + new ActionListener() + { + public void actionPerformed(ActionEvent event) + { + increment(); + } + }); }); } @@ -239,36 +239,36 @@ public class BasicSpinnerUI extends SpinnerUI { c.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent evt) - { - if (! spinner.isEnabled()) - return; - decrement(); - timer.setInitialDelay(500); - timer.start(); - } - - public void mouseReleased(MouseEvent evt) - { - timer.stop(); - } - - void decrement() - { - Object prev = BasicSpinnerUI.this.spinner.getPreviousValue(); - if (prev != null) - BasicSpinnerUI.this.spinner.getModel().setValue(prev); - } - - volatile boolean mouseDown; - Timer timer = new Timer(50, - new ActionListener() - { - public void actionPerformed(ActionEvent event) - { - decrement(); - } - }); + public void mousePressed(MouseEvent evt) + { + if (! spinner.isEnabled()) + return; + decrement(); + timer.setInitialDelay(500); + timer.start(); + } + + public void mouseReleased(MouseEvent evt) + { + timer.stop(); + } + + void decrement() + { + Object prev = BasicSpinnerUI.this.spinner.getPreviousValue(); + if (prev != null) + BasicSpinnerUI.this.spinner.getModel().setValue(prev); + } + + volatile boolean mouseDown; + Timer timer = new Timer(50, + new ActionListener() + { + public void actionPerformed(ActionEvent event) + { + decrement(); + } + }); }); } @@ -384,7 +384,7 @@ public class BasicSpinnerUI extends SpinnerUI Dimension e = prefSize(editor); Dimension n = prefSize(next); Dimension p = prefSize(previous); - Dimension s = parent.getSize(); + Dimension s = parent.getSize(); int x = l2r ? i.left : i.right; int y = i.top; diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java index 95468caa972..53f7db6e794 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java @@ -61,7 +61,7 @@ import javax.swing.border.Border; /** * The divider that separates the two parts of a JSplitPane in the Basic look * and feel. - * + * * <p> * Implementation status: We do not have a real implementation yet. Currently, * it is mostly a stub to allow compiling other parts of the @@ -138,62 +138,62 @@ public class BasicSplitPaneDivider extends Container public void paint(Graphics g) { if (splitPane != null) - { - // Fill background. - g.setColor(splitPane.getBackground()); - g.fillRect(0, 0, getWidth(), getHeight()); - - // Draw arrow. - int size; - if (direction == LEFT) - { - if (orientation == JSplitPane.VERTICAL_SPLIT) - { - size = Math.min(getHeight(), ONE_TOUCH_SIZE); - xpoints[0] = 0; - xpoints[1] = size / 2; - xpoints[2] = size; - ypoints[0] = size; - ypoints[1] = 0; - ypoints[2] = size; - } - else - { - size = Math.min(getWidth(), ONE_TOUCH_SIZE); - xpoints[0] = size; - xpoints[1] = 0; - xpoints[2] = size; - ypoints[0] = 0; - ypoints[1] = size / 2; - ypoints[2] = size; - } - } - else - { - if (orientation == JSplitPane.VERTICAL_SPLIT) - { - size = Math.min(getHeight(), ONE_TOUCH_SIZE); - xpoints[0] = 0; - xpoints[1] = size / 2; - xpoints[2] = size; - ypoints[0] = 0; - ypoints[1] = size; - ypoints[2] = 0; - } - else - { - size = Math.min(getWidth(), ONE_TOUCH_SIZE); - xpoints[0] = 0; - xpoints[1] = size; - xpoints[2] = 0; - ypoints[0] = 0; - ypoints[1] = size / 2; - ypoints[2] = size; - } - } - g.setColor(Color.BLACK); - g.fillPolygon(xpoints, ypoints, 3); - } + { + // Fill background. + g.setColor(splitPane.getBackground()); + g.fillRect(0, 0, getWidth(), getHeight()); + + // Draw arrow. + int size; + if (direction == LEFT) + { + if (orientation == JSplitPane.VERTICAL_SPLIT) + { + size = Math.min(getHeight(), ONE_TOUCH_SIZE); + xpoints[0] = 0; + xpoints[1] = size / 2; + xpoints[2] = size; + ypoints[0] = size; + ypoints[1] = 0; + ypoints[2] = size; + } + else + { + size = Math.min(getWidth(), ONE_TOUCH_SIZE); + xpoints[0] = size; + xpoints[1] = 0; + xpoints[2] = size; + ypoints[0] = 0; + ypoints[1] = size / 2; + ypoints[2] = size; + } + } + else + { + if (orientation == JSplitPane.VERTICAL_SPLIT) + { + size = Math.min(getHeight(), ONE_TOUCH_SIZE); + xpoints[0] = 0; + xpoints[1] = size / 2; + xpoints[2] = size; + ypoints[0] = 0; + ypoints[1] = size; + ypoints[2] = 0; + } + else + { + size = Math.min(getWidth(), ONE_TOUCH_SIZE); + xpoints[0] = 0; + xpoints[1] = size; + xpoints[2] = 0; + ypoints[0] = 0; + ypoints[1] = size / 2; + ypoints[2] = size; + } + } + g.setColor(Color.BLACK); + g.fillPolygon(xpoints, ypoints, 3); + } } } @@ -212,66 +212,66 @@ public class BasicSplitPaneDivider extends Container int newLoc; if (ev.getSource() == leftButton) - { - if (orientation == JSplitPane.VERTICAL_SPLIT) - { - if (currentLoc - >= splitPane.getHeight() - insets.bottom - getHeight()) - { - newLoc = Math.min(splitPane.getMaximumDividerLocation(), - lastLoc); - } - else - { - newLoc = insets.top; - } - } - else - { - if (currentLoc - >= splitPane.getWidth() - insets.right - getWidth()) - { - newLoc = Math.min(splitPane.getMaximumDividerLocation(), - lastLoc); - } - else - { - newLoc = insets.left; - } - } - } + { + if (orientation == JSplitPane.VERTICAL_SPLIT) + { + if (currentLoc + >= splitPane.getHeight() - insets.bottom - getHeight()) + { + newLoc = Math.min(splitPane.getMaximumDividerLocation(), + lastLoc); + } + else + { + newLoc = insets.top; + } + } + else + { + if (currentLoc + >= splitPane.getWidth() - insets.right - getWidth()) + { + newLoc = Math.min(splitPane.getMaximumDividerLocation(), + lastLoc); + } + else + { + newLoc = insets.left; + } + } + } else - { - if (orientation == JSplitPane.VERTICAL_SPLIT) - { - if (currentLoc == insets.top) - { - newLoc = Math.min(splitPane.getMaximumDividerLocation(), - lastLoc); - } - else - { - newLoc = splitPane.getHeight() - insets.top - getHeight(); - } - } - else - { - if (currentLoc == insets.left) - { - newLoc = Math.min(splitPane.getMaximumDividerLocation(), - lastLoc); - } - else - { - newLoc = splitPane.getWidth() - insets.left - getWidth(); - } - } - } + { + if (orientation == JSplitPane.VERTICAL_SPLIT) + { + if (currentLoc == insets.top) + { + newLoc = Math.min(splitPane.getMaximumDividerLocation(), + lastLoc); + } + else + { + newLoc = splitPane.getHeight() - insets.top - getHeight(); + } + } + else + { + if (currentLoc == insets.left) + { + newLoc = Math.min(splitPane.getMaximumDividerLocation(), + lastLoc); + } + else + { + newLoc = splitPane.getWidth() - insets.left - getWidth(); + } + } + } if (currentLoc != newLoc) - { - splitPane.setDividerLocation(newLoc); - splitPane.setLastDividerLocation(currentLoc); - } + { + splitPane.setDividerLocation(newLoc); + splitPane.setLastDividerLocation(currentLoc); + } } } @@ -315,7 +315,7 @@ public class BasicSplitPaneDivider extends Container /** * The listener for handling mouse events from both the divider and the * containing <code>JSplitPane</code>. - * + * * <p> * The reason for also handling MouseEvents from the containing * <code>JSplitPane</code> is that users should be able to start a drag @@ -398,11 +398,11 @@ public class BasicSplitPaneDivider extends Container /* Remove the connection to the existing JSplitPane. */ if (splitPane != null) { - splitPane.removePropertyChangeListener(this); - removeMouseListener(mouseHandler); - removeMouseMotionListener(mouseHandler); - splitPane = null; - hiddenDivider = null; + splitPane.removePropertyChangeListener(this); + removeMouseListener(mouseHandler); + removeMouseMotionListener(mouseHandler); + splitPane = null; + hiddenDivider = null; } /* Establish the connection to the new JSplitPane. */ @@ -411,11 +411,11 @@ public class BasicSplitPaneDivider extends Container splitPane = newUI.getSplitPane(); if (splitPane != null) { - splitPane.addPropertyChangeListener(this); - addMouseListener(mouseHandler); - addMouseMotionListener(mouseHandler); - hiddenDivider = splitPaneUI.getNonContinuousLayoutDivider(); - orientation = splitPane.getOrientation(); + splitPane.addPropertyChangeListener(this); + addMouseListener(mouseHandler); + addMouseMotionListener(mouseHandler); + hiddenDivider = splitPaneUI.getNonContinuousLayoutDivider(); + orientation = splitPane.getOrientation(); if (splitPane.isOneTouchExpandable()) oneTouchExpandableChanged(); } @@ -465,9 +465,9 @@ public class BasicSplitPaneDivider extends Container { if (border != this.border) { - Border oldValue = this.border; - this.border = border; - firePropertyChange("border", oldValue, border); + Border oldValue = this.border; + this.border = border; + firePropertyChange("border", oldValue, border); } } @@ -539,7 +539,7 @@ public class BasicSplitPaneDivider extends Container oneTouchExpandableChanged(); else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY)) { - orientation = splitPane.getOrientation(); + orientation = splitPane.getOrientation(); invalidate(); if (splitPane != null) splitPane.revalidate(); @@ -560,8 +560,8 @@ public class BasicSplitPaneDivider extends Container super.paint(g); if (border != null) { - dividerSize = getSize(); - border.paintBorder(this, g, 0, 0, dividerSize.width, dividerSize.height); + dividerSize = getSize(); + border.paintBorder(this, g, 0, 0, dividerSize.width, dividerSize.height); } } @@ -573,20 +573,20 @@ public class BasicSplitPaneDivider extends Container { if (splitPane.isOneTouchExpandable()) { - leftButton = createLeftOneTouchButton(); - if (leftButton != null) - leftButton.addActionListener(new OneTouchAction()); + leftButton = createLeftOneTouchButton(); + if (leftButton != null) + leftButton.addActionListener(new OneTouchAction()); - rightButton = createRightOneTouchButton(); - if (rightButton != null) - rightButton.addActionListener(new OneTouchAction()); + rightButton = createRightOneTouchButton(); + if (rightButton != null) + rightButton.addActionListener(new OneTouchAction()); - // Only add them when both are non-null. - if (leftButton != null && rightButton != null) + // Only add them when both are non-null. + if (leftButton != null && rightButton != null) { add(leftButton); add(rightButton); - } + } } invalidate(); if (splitPane != null) @@ -678,28 +678,28 @@ public class BasicSplitPaneDivider extends Container switch (locationIndex) { case 1: - splitPane.setDividerLocation(splitPane.getLastDividerLocation()); - break; + splitPane.setDividerLocation(splitPane.getLastDividerLocation()); + break; case 0: - int top = (orientation == JSplitPane.HORIZONTAL_SPLIT) ? insets.left - : insets.top; - splitPane.setDividerLocation(top); - break; + int top = (orientation == JSplitPane.HORIZONTAL_SPLIT) ? insets.left + : insets.top; + splitPane.setDividerLocation(top); + break; case 2: - int bottom; - if (orientation == JSplitPane.HORIZONTAL_SPLIT) - bottom = splitPane.getBounds().width - insets.right - dividerSize; - else - bottom = splitPane.getBounds().height - insets.bottom - dividerSize; - splitPane.setDividerLocation(bottom); - break; + int bottom; + if (orientation == JSplitPane.HORIZONTAL_SPLIT) + bottom = splitPane.getBounds().width - insets.right - dividerSize; + else + bottom = splitPane.getBounds().height - insets.bottom - dividerSize; + splitPane.setDividerLocation(bottom); + break; } } /** * The listener for handling mouse events from both the divider and the * containing <code>JSplitPane</code>. - * + * * <p> * The reason for also handling MouseEvents from the containing * <code>JSplitPane</code> is that users should be able to start a drag @@ -724,9 +724,9 @@ public class BasicSplitPaneDivider extends Container isDragging = true; currentDividerLocation = 1; if (orientation == JSplitPane.HORIZONTAL_SPLIT) - dragger = new DragController(e); + dragger = new DragController(e); else - dragger = new VerticalDragController(e); + dragger = new VerticalDragController(e); prepareForDragging(); } @@ -836,7 +836,7 @@ public class BasicSplitPaneDivider extends Container protected void continueDrag(int newX, int newY) { if (isValid()) - dragDividerTo(adjust(newX, newY)); + dragDividerTo(adjust(newX, newY)); } /** @@ -848,7 +848,7 @@ public class BasicSplitPaneDivider extends Container protected void continueDrag(MouseEvent e) { if (isValid()) - dragDividerTo(positionForMouseEvent(e)); + dragDividerTo(positionForMouseEvent(e)); } /** @@ -1000,7 +1000,7 @@ public class BasicSplitPaneDivider extends Container x = insets.left; y = 0; } - + leftButton.setBounds(x, y + ONE_TOUCH_OFFSET, size, size * 2); rightButton.setBounds(x, y + ONE_TOUCH_OFFSET diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java index b7cc425482d..ca960751538 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java @@ -89,7 +89,7 @@ public class BasicSplitPaneUI extends SplitPaneUI // 3 components at a time. // LEFT/TOP = 0 // RIGHT/BOTTOM = 1 - // DIVIDER = 2 + // DIVIDER = 2 /** * This array contains the components in the JSplitPane. The left/top @@ -338,7 +338,7 @@ public class BasicSplitPaneUI extends SplitPaneUI // Layout divider. loc += sizes[0]; setComponentToSize(components[2], sizes[2], loc, insets, dims); - // Layout component#2. + // Layout component#2. loc += sizes[2]; setComponentToSize(components[1], sizes[1], loc, insets, dims); } @@ -483,7 +483,7 @@ public class BasicSplitPaneUI extends SplitPaneUI */ protected void setComponentToSize(Component c, int size, int location, Insets insets, Dimension containerSize) - { + { if (insets != null) { if (axis == SwingConstants.HORIZONTAL) @@ -752,7 +752,7 @@ public class BasicSplitPaneUI extends SplitPaneUI tmpSizes[0] += newSpace / 2; tmpSizes[1] += newSpace / 2; - + layoutManager.setSizes(tmpSizes); } else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY)) @@ -986,12 +986,12 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the input map for the specified condition. - * + * * @param condition the condition. - * + * * @return The input map. */ - InputMap getInputMap(int condition) + InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) return (InputMap) UIManager.get("SplitPane.ancestorInputMap"); @@ -1000,12 +1000,12 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the action map for the {@link JSplitPane}. All sliders share - * a single action map which is created the first time this method is + * a single action map which is created the first time this method is * called, then stored in the UIDefaults table for subsequent access. - * + * * @return The shared action map. */ - ActionMap getActionMap() + ActionMap getActionMap() { ActionMap map = (ActionMap) UIManager.get("SplitPane.actionMap"); @@ -1020,18 +1020,18 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Creates the action map shared by all {@link JSlider} instances. - * This method is called once by {@link #getActionMap()} when it - * finds no action map in the UIDefaults table...after the map is - * created, it gets added to the defaults table so that subsequent - * calls to {@link #getActionMap()} will return the same shared + * This method is called once by {@link #getActionMap()} when it + * finds no action map in the UIDefaults table...after the map is + * created, it gets added to the defaults table so that subsequent + * calls to {@link #getActionMap()} will return the same shared * instance. - * + * * @return The action map. */ ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); - map.put("toggleFocus", + map.put("toggleFocus", new AbstractAction("toggleFocus") { public void actionPerformed(ActionEvent event) { @@ -1039,7 +1039,7 @@ public class BasicSplitPaneUI extends SplitPaneUI } } ); - map.put("startResize", + map.put("startResize", new AbstractAction("startResize") { public void actionPerformed(ActionEvent event) { @@ -1047,7 +1047,7 @@ public class BasicSplitPaneUI extends SplitPaneUI } } ); - map.put("selectMax", + map.put("selectMax", new AbstractAction("selectMax") { public void actionPerformed(ActionEvent event) { @@ -1055,7 +1055,7 @@ public class BasicSplitPaneUI extends SplitPaneUI } } ); - map.put("selectMin", + map.put("selectMin", new AbstractAction("selectMin") { public void actionPerformed(ActionEvent event) { @@ -1063,7 +1063,7 @@ public class BasicSplitPaneUI extends SplitPaneUI } } ); - map.put("negativeIncrement", + map.put("negativeIncrement", new AbstractAction("negativeIncrement") { public void actionPerformed(ActionEvent event) { @@ -1074,7 +1074,7 @@ public class BasicSplitPaneUI extends SplitPaneUI } } ); - map.put("positiveIncrement", + map.put("positiveIncrement", new AbstractAction("positiveIncrement") { public void actionPerformed(ActionEvent event) { @@ -1092,7 +1092,7 @@ public class BasicSplitPaneUI extends SplitPaneUI // FIXME: implement this } } - ); + ); map.put("focusOutForward", new AbstractAction("focusOutForward") { public void actionPerformed(ActionEvent event) @@ -1100,7 +1100,7 @@ public class BasicSplitPaneUI extends SplitPaneUI // FIXME: implement this } } - ); + ); return map; } @@ -1112,7 +1112,7 @@ public class BasicSplitPaneUI extends SplitPaneUI { InputMap keyMap = getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - SwingUtilities.replaceUIInputMap(splitPane, + SwingUtilities.replaceUIInputMap(splitPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, keyMap); ActionMap map = getActionMap(); SwingUtilities.replaceUIActionMap(splitPane, map); @@ -1124,7 +1124,7 @@ public class BasicSplitPaneUI extends SplitPaneUI protected void uninstallKeyboardActions() { SwingUtilities.replaceUIActionMap(splitPane, null); - SwingUtilities.replaceUIInputMap(splitPane, + SwingUtilities.replaceUIInputMap(splitPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null); } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java index fe360214c2f..c42f9caed99 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -82,7 +82,7 @@ import javax.swing.text.View; /** * This is the Basic Look and Feel's UI delegate for JTabbedPane. - * + * * @author Lillian Angel (langel@redhat.com) * @author Kim Ho (kho@redhat.com) * @author Roman Kennke (kennke@aicas.com) @@ -90,11 +90,11 @@ import javax.swing.text.View; */ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { - + static class NavigateAction extends AbstractAction { int direction; - + NavigateAction(String name, int dir) { super(name); @@ -108,9 +108,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants ui.navigateSelectedTab(direction); } - + } - + static class NavigatePageDownAction extends AbstractAction { @@ -123,17 +123,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { JTabbedPane tp = (JTabbedPane) event.getSource(); BasicTabbedPaneUI ui = (BasicTabbedPaneUI) tp.getUI(); - + int i = tp.getSelectedIndex(); - + if (i < 0) i = 0; - + ui.selectNextTabInRun(i); } - + } - + static class NavigatePageUpAction extends AbstractAction { @@ -146,17 +146,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { JTabbedPane tp = (JTabbedPane) event.getSource(); BasicTabbedPaneUI ui = (BasicTabbedPaneUI) tp.getUI(); - + int i = tp.getSelectedIndex(); - + if (i < 0) i = 0; - + ui.selectPreviousTabInRun(i); - } + } } - + static class RequestFocusAction extends AbstractAction { @@ -169,7 +169,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { ((JTabbedPane) event.getSource()).requestFocus(); } - + } static class RequestFocusForVisibleComponentAction extends AbstractAction @@ -183,18 +183,18 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants public void actionPerformed(ActionEvent event) { JTabbedPane tp = (JTabbedPane) event.getSource(); - + // FIXME: This should select a suitable component within // the tab content. However I dont know whether we have // to search for this component or wether the called is // supposed to do that. tp.getSelectedComponent().requestFocus(); } - + } /** - * A helper class that handles focus. + * A helper class that handles focus. * <p>The purpose of this class is to implement a more flexible focus * handling for the tabbed pane, which is used to determine whether the * focus indicator should be painted or not. When in scrolling layout @@ -262,7 +262,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants e.setSource(s); } } - + /** * This method is called when the mouse is pressed. The index cannot * change to a tab that is not enabled. @@ -281,9 +281,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants redispatchEvent(e); e.setSource(s); } - + int placement = tabPane.getTabPlacement(); - + if (s == incrButton) { if(!incrButton.isEnabled()) @@ -294,7 +294,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants switch (placement) { case JTabbedPane.TOP: - case JTabbedPane.BOTTOM: + case JTabbedPane.BOTTOM: currentScrollOffset = getTabAreaInsets(placement).left; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].width; @@ -305,30 +305,30 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants currentScrollOffset += rects[i].height; break; } - + updateViewPosition(); updateButtons(); - + tabPane.repaint(); } else if (s == decrButton) { if(!decrButton.isEnabled()) return; - + // The scroll location may be zero but the offset // greater than zero because of an adjustement to // make a partially visible tab completely visible. if (currentScrollLocation > 0) currentScrollLocation--; - + // Set the offset back to 0 and recompute it. currentScrollOffset = 0; switch (placement) { case JTabbedPane.TOP: - case JTabbedPane.BOTTOM: + case JTabbedPane.BOTTOM: // Take the tab area inset into account. if (currentScrollLocation > 0) currentScrollOffset = getTabAreaInsets(placement).left; @@ -340,14 +340,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants // Take the tab area inset into account. if (currentScrollLocation > 0) currentScrollOffset = getTabAreaInsets(placement).top; - + for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].height; - } - + } + updateViewPosition(); updateButtons(); - + tabPane.repaint(); } else if (tabPane.isEnabled()) @@ -355,12 +355,12 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants int index = tabForCoordinate(tabPane, e.getX(), e.getY()); if (!tabPane.isEnabledAt(index)) return; - + if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT && s == panel) { scrollTab(index, placement); - + tabPane.setSelectedIndex(index); tabPane.repaint(); } @@ -370,9 +370,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants tabPane.revalidate(); tabPane.repaint(); } - + } - + } /** @@ -393,7 +393,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants redispatchEvent(e); e.setSource(s); } - + int tabIndex = tabForCoordinate(tabPane, e.getX(), e.getY()); setRolloverTab(tabIndex); } @@ -416,7 +416,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants redispatchEvent(e); e.setSource(s); } - + setRolloverTab(-1); } @@ -434,17 +434,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { ev.setSource(tabPane); tabPane.dispatchEvent(ev); - + ev.setSource(s); } int tabIndex = tabForCoordinate(tabPane, ev.getX(), ev.getY()); setRolloverTab(tabIndex); } - - /** Modifies the mouse event to originate from + + /** Modifies the mouse event to originate from * the tabbed pane and redispatches it. - * + * * @param me */ void redispatchEvent(MouseEvent me) @@ -455,10 +455,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants viewPos.y -= viewport.getY(); me.translatePoint(-viewPos.x, -viewPos.y); tabPane.dispatchEvent(me); - + me.translatePoint(viewPos.x, viewPos.y); } - + } /** @@ -483,18 +483,18 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants if (e.getPropertyName().equals("tabLayoutPolicy")) { currentScrollLocation = currentScrollOffset = 0; - + layoutManager = createLayoutManager(); - + tabPane.setLayout(layoutManager); } else if (e.getPropertyName().equals("tabPlacement") - && tabPane.getTabLayoutPolicy() + && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) { incrButton = createIncreaseButton(); decrButton = createDecreaseButton(); - + // If the tab placement value was changed of a tabbed pane // in SCROLL_TAB_LAYOUT mode we investigate the change to // implement the following behavior which was observed in @@ -502,7 +502,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants // The scrolling offset will be reset if we change to // a direction which is orthogonal to the current // direction and stays the same if it is parallel. - + int oldPlacement = ((Integer) e.getOldValue()).intValue(); int newPlacement = ((Integer) e.getNewValue()).intValue(); switch (newPlacement) @@ -512,22 +512,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants if (oldPlacement == JTabbedPane.TOP || oldPlacement == JTabbedPane.BOTTOM) break out; - + currentScrollOffset = getTabAreaInsets(newPlacement).left; break; default: if (oldPlacement == JTabbedPane.LEFT || oldPlacement == JTabbedPane.RIGHT) break out; - + currentScrollOffset = getTabAreaInsets(newPlacement).top; } - + updateViewPosition(); updateButtons(); } } - + tabPane.revalidate(); tabPane.repaint(); } @@ -592,7 +592,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants c = tabPane.getComponentAt(i); if (c == null) continue; - dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); + dims = minimum ? c.getMinimumSize() : c.getPreferredSize(); if (dims != null) { height = Math.max(height, dims.height); @@ -605,7 +605,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants || tabPlacement == SwingConstants.BOTTOM) { width = Math.max(calculateMaxTabWidth(tabPlacement), width); - + height += preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right); @@ -613,7 +613,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants else { height = Math.max(calculateMaxTabHeight(tabPlacement), height); - + width += preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom); @@ -648,7 +648,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants Insets insets = tabPane.getInsets(); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Dimension size = tabPane.getSize(); - + // The coordinates of the upper left corner of the tab area. int x; int y; @@ -787,11 +787,11 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants rotateTabRuns(tabPlacement, selectedRun); } } - + // Suppress padding if we have only one tab run. if (runCount == 1) return; - + // Pad the runs. int tabRunOverlay = getTabRunOverlay(tabPlacement); for (int i = runCount - 1; i >= 0; --i) @@ -838,7 +838,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants x -= maxTabWidth - tabRunOverlay; else x += maxTabWidth - tabRunOverlay; - + } } padSelectedTab(tabPlacement, selectedIndex); @@ -859,13 +859,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants Insets insets = tabPane.getInsets(); int selectedIndex = tabPane.getSelectedIndex(); - + Component selectedComponent = null; if (selectedIndex >= 0) selectedComponent = tabPane.getComponentAt(selectedIndex); // The RI doesn't seem to change the component if the new selected // component == null. This is probably so that applications can add - // one single component for every tab. + // one single component for every tab. if (selectedComponent != null) { setVisibleComponent(selectedComponent); @@ -892,7 +892,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; - case BOTTOM: + case BOTTOM: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; @@ -902,7 +902,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants default: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); - + compX = insets.left + contentBorderInsets.left; compY = tabAreaHeight + insets.top + contentBorderInsets.top; } @@ -938,9 +938,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants // If there is more free space in an adjacent run AND the tab // in the run can fit in the adjacent run, move it. This method // is not perfect, it is merely an approximation. - // If you play around with Sun's JTabbedPane, you'll see that - // it does do some pretty strange things with regards to not moving tabs - // that should be moved. + // If you play around with Sun's JTabbedPane, you'll see that + // it does do some pretty strange things with regards to not moving tabs + // that should be moved. // start = the x position where the tabs will begin // max = the maximum position of where the tabs can go to // (tabAreaInsets.left + the width of the tab area) @@ -1046,7 +1046,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants int runWidth = rects[end].x + rects[end].width; int spaceRemaining = max - runWidth; int numTabs = end - start + 1; - + // now divvy up the space. int spaceAllocated = spaceRemaining / numTabs; int currX = rects[start].x; @@ -1054,13 +1054,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { rects[i].x = currX; rects[i].width += spaceAllocated; - + currX += rects[i].width; - // This is used because since the spaceAllocated + // This is used because since the spaceAllocated // variable is an int, it rounds down. Sometimes, // we don't fill an entire row, so we make it do // so now. - + if (i == end && rects[i].x + rects[i].width != max) rects[i].width = max - rects[i].x; } @@ -1332,11 +1332,11 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants for (int i = 0; i < tabCount; i++) { width = calculateTabWidth(tabPlacement, i, fm); - + // The proper instances should exists because // assureRectsCreated() was being run already. rects[i].setBounds(runWidth, top, width, maxHeight); - + runWidth += width; } tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right; @@ -1396,7 +1396,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants tabAreaRect.x = contentRect.x + contentRect.width; } } - + // Unlike the behavior in the WRAP_TAB_LAYOUT the selected // tab is not padded specially. } @@ -1415,7 +1415,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants if (tabCount == 0) return; int tabPlacement = tabPane.getTabPlacement(); - + if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { @@ -1452,11 +1452,11 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants - incrDims.height, incrDims.width, incrDims.height); } - + tabAreaRect.width -= decrDims.width + incrDims.width; - + updateButtons(); - + incrButton.setVisible(true); decrButton.setVisible(true); } @@ -1464,7 +1464,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { incrButton.setVisible(false); decrButton.setVisible(false); - + currentScrollOffset = 0; currentScrollLocation = 0; } @@ -1524,9 +1524,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants } viewport.setBounds(tabAreaRect.x, tabAreaRect.y, tabAreaRect.width, tabAreaRect.height); - + updateViewPosition(); - + viewport.repaint(); } } @@ -1550,7 +1550,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { selectedRun = getRunForTab(tabPane.getTabCount(), tabPane.getSelectedIndex()); - + if (tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT) tabPane.revalidate(); tabPane.repaint(); @@ -1587,7 +1587,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants else g.fillRect(0, currentScrollOffset, tabAreaRect.width, tabAreaRect.height); - + paintTabArea(g, placement, tabPane.getSelectedIndex()); } } @@ -1649,7 +1649,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants /** The starting visible tab in the run in SCROLL_TAB_MODE. * This is package-private to avoid an accessor method. */ transient int currentScrollLocation; - + transient int currentScrollOffset; /** A reusable rectangle. */ @@ -1789,13 +1789,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants * The currently visible component. */ private Component visibleComponent; - + private Color selectedColor; - + private Rectangle tempTextRect = new Rectangle(); - + private Rectangle tempIconRect = new Rectangle(); - + /** * Creates a new BasicTabbedPaneUI object. */ @@ -1884,10 +1884,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants Point p = new Point(w, h); return p; } - + /** TabbedPanes in scrolling mode should use this method to * scroll properly to the tab given by the index argument. - * + * * @param index The tab to scroll to. * @param placement The tab's placement. */ @@ -1902,7 +1902,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants switch (placement) { case JTabbedPane.TOP: - case JTabbedPane.BOTTOM: + case JTabbedPane.BOTTOM: if ((diff = rects[index].x + rects[index].width - decrButton.getX() - currentScrollOffset) > 0) @@ -1930,17 +1930,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants else currentScrollOffset += diff; } - + currentScrollLocation = tabForCoordinate(tabPane, rects[index].x, currentScrollOffset); } - + updateViewPosition(); updateButtons(); } } - + /** Sets the enabled state of the increase and decrease button * according to the current scrolling offset and tab pane width * (or height in TOP/BOTTOM placement). @@ -1948,7 +1948,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants final void updateButtons() { int tc = tabPane.getTabCount(); - + // The increase button should be enabled as long as the // right/bottom border of the last tab is under the left/top // border of the decrease button. @@ -1978,7 +1978,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants final void updateViewPosition() { Point p = viewport.getViewPosition(); - + // The unneeded coordinate must be set to zero // in order to correctly handle placement changes. switch (tabPane.getTabPlacement()) @@ -1992,10 +1992,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants p.x = currentScrollOffset; p.y = 0; } - + viewport.setViewPosition(p); } - + /** * This method creates a new BasicTabbedPaneUI. * @@ -2019,12 +2019,12 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants if (c instanceof JTabbedPane) { tabPane = (JTabbedPane) c; - + installComponents(); installDefaults(); installListeners(); installKeyboardActions(); - + layoutManager = createLayoutManager(); tabPane.setLayout(layoutManager); } @@ -2063,7 +2063,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { runCount = 1; tabRuns[0] = 0; - + incrButton = createIncreaseButton(); incrButton.addMouseListener(mouseListener); @@ -2075,16 +2075,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants panel.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE); panel.addMouseListener(mouseListener); panel.addFocusListener(focusListener); - + viewport = new ScrollingViewport(); viewport.setBackground(Color.LIGHT_GRAY); viewport.setView(panel); viewport.setLayout(null); - + tabPane.add(incrButton); tabPane.add(decrButton); tabPane.add(viewport); - + return new TabbedPaneScrollLayout(); } } @@ -2104,7 +2104,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { if (incrButton != null) tabPane.remove(incrButton); - + if (decrButton != null) tabPane.remove(decrButton); @@ -2140,7 +2140,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants contentBorderInsets = UIManager.getInsets("TabbedPane.contentBorderInsets"); tabsOpaque = UIManager.getBoolean("TabbedPane.tabsOpaque"); - + // Although 'TabbedPane.contentAreaColor' is not defined in the defaults // of BasicLookAndFeel it is used by this class. selectedColor = UIManager.getColor("TabbedPane.contentAreaColor"); @@ -2162,7 +2162,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants tabAreaRect = null; contentRect = null; tabRuns = null; - + tempIconRect = null; tempTextRect = null; @@ -2176,7 +2176,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants shadow = null; lightHighlight = null; highlight = null; - + selectedColor = null; } @@ -2205,13 +2205,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants tabPane.removePropertyChangeListener(propertyChangeListener); tabPane.removeChangeListener(tabChangeListener); tabPane.removeMouseListener(mouseListener); - + if (incrButton != null) incrButton.removeMouseListener(mouseListener); - + if (decrButton != null) decrButton.removeMouseListener(mouseListener); - + if (panel != null) { panel.removeMouseListener(mouseListener); @@ -2277,7 +2277,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants .replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, keyMap); - + ActionMap map = getActionMap(); SwingUtilities.replaceUIActionMap(tabPane, map); } @@ -2332,11 +2332,11 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants if (tabPane.getTabCount() == 0) return; - + int index = tabPane.getSelectedIndex(); if (index < 0) index = 0; - + int tabPlacement = tabPane.getTabPlacement(); // Paint the tab area only in WRAP_TAB_LAYOUT Mode from this method @@ -2349,7 +2349,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants tabAreaRect.width, tabAreaRect.height); paintTabArea(g, tabPlacement, index); } - + paintContentBorder(g, tabPlacement, index); } @@ -2363,9 +2363,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants */ protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) { - // Please note: the ordering of the painting is important. + // Please note: the ordering of the painting is important. // we WANT to paint the outermost run first and then work our way in. - + // The following drawing code works for both tab layouts. int tabCount = tabPane.getTabCount(); @@ -2387,7 +2387,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants } } } - + // Paint selected tab in front of every other tab. if (selectedIndex >= 0) paintTab(g, tabPlacement, rects, selectedIndex, @@ -2430,10 +2430,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants // Paint the text. paintText(g, tabPlacement, tabPane.getFont(), fm, tabIndex, title, textRect, isSelected); - + // Paint icon if necessary. paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected); - + // Paint focus indicator. paintFocusIndicator(g, tabPlacement, rects, tabIndex, iconRect, textRect, isSelected); @@ -2675,7 +2675,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants w = rect.width - 6; h = rect.height - 5; } - + BasicGraphicsUtils.drawDashedRect(g, x, y, w, h); } } @@ -2707,44 +2707,44 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(darkShadow); // Outer right line. g.drawLine(x + w - 1, y + 2, x + w - 1, y + h); - + // Upper right corner. g.drawLine(x + w - 2, y + 1, x + w - 1, y + 2); - + g.setColor(lightHighlight); - + // Left line. g.drawLine(x, y + 3, x, y + h); - + // Upper line. g.drawLine(x + 3, y, x + w - 3, y); - + // Upper left corner. g.drawLine(x, y + 2, x + 2, y); - + break; case SwingConstants.LEFT: g.setColor(lightHighlight); // Top line. g.drawLine(x + 3, y, x + w - 1, y); - + // Top left border. g.drawLine(x + 2, y, x, y + 2); - + // Left line. g.drawLine(x, y + 3, x, y + h - 4); - + // Bottom left corner. g.drawLine(x, y + h - 3, x + 1, y + h - 2); - + g.setColor(darkShadow); // Outer bottom line. g.drawLine(x + 2, y + h - 1, x + w - 1, y + h - 1); - + g.setColor(shadow); // Inner bottom line. g.drawLine(x + 2, y + h - 2, x + w - 1, y + h - 2); - + break; case SwingConstants.BOTTOM: g.setColor(shadow); @@ -2757,17 +2757,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(darkShadow); // Outer right line. g.drawLine(x + w - 1, y, x + w - 1, y + h - 3); - + // Bottom right corner. g.drawLine(x + w - 1, y + h - 2, x + w - 3, y + h); - + // Bottom line. g.drawLine(x + 2, y + h, x + w - 4, y + h); - + g.setColor(lightHighlight); // Left line. g.drawLine(x, y, x, y + h - 3); - + // Bottom left corner. g.drawLine(x, y + h - 2, x + 1, y + h - 1); break; @@ -2775,31 +2775,31 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(lightHighlight); // Top line. g.drawLine(x, y, x + w - 3, y); - + g.setColor(darkShadow); // Top right corner. g.drawLine(x + w - 2, y + 1, x + w - 1, y + 2); - + // Outer right line. g.drawLine(x + w - 1, y + 3, x + w - 1, y + h - 3); - + // Bottom right corner. g.drawLine(x + w - 2, y + h - 2, x + w - 3, y + h - 1); - + // Bottom line. g.drawLine(x, y + h - 1, x + w - 4, y + h - 1); - + g.setColor(shadow); - + // Inner right line. g.drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); - + // Inner bottom line. g.drawLine(x, y + h - 2, x + w - 3, y + h - 2); - + break; } - + g.setColor(saved); } @@ -2820,7 +2820,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants boolean isSelected) { Color saved = g.getColor(); - + if (isSelected) g.setColor(selectedColor); else @@ -2931,17 +2931,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { g.drawLine(x, y, startgap, y); g.drawLine(endgap, y, x + w - 1, y); - + g.setColor(selectedColor); g.drawLine(startgap, y, endgap - 1, y); } else g.drawLine(x, y, x + w, y); - + g.setColor(selectedColor); g.drawLine(x, y + 1, x + w - 1, y + 1); g.drawLine(x, y + 2, x + w - 1, y + 2); - + g.setColor(saved); } @@ -2971,13 +2971,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { g.drawLine(x, y, x, startgap); g.drawLine(x, endgap, x, y + h - 1); - + g.setColor(selectedColor); g.drawLine(x, startgap, x, endgap - 1); } else g.drawLine(x, y, x, y + h - 1); - + g.setColor(selectedColor); g.drawLine(x + 1, y + 1, x + 1, y + h - 4); @@ -3014,7 +3014,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(darkShadow); g.drawLine(x, y + h - 1, startgap , y + h - 1); g.drawLine(endgap, y + h - 1, x + w - 1, y + h - 1); - + g.setColor(selectedColor); g.drawLine(startgap, y + h - 1, endgap - 1, y + h - 1); g.drawLine(startgap, y + h - 2, endgap - 1, y + h - 2); @@ -3026,7 +3026,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(darkShadow); g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); } - + g.setColor(selectedColor); g.drawLine(x + 1, y + h - 3, x + w - 2, y + h - 3); @@ -3062,7 +3062,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(darkShadow); g.drawLine(x + w - 1, y, x + w - 1, startgap); g.drawLine(x + w - 1, endgap, x + w - 1, y + h - 2); - + g.setColor(selectedColor); g.drawLine(x + w - 2, startgap, x + w - 2, endgap - 1); g.drawLine(x + w - 1, startgap, x + w - 1, endgap - 1); @@ -3074,7 +3074,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants g.setColor(darkShadow); g.drawLine(x + w - 1, y, x + w - 1, y + h - 2); } - + g.setColor(selectedColor); g.drawLine(x + w - 3, y + 1, x + w - 3, y + h - 4); @@ -3085,10 +3085,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants * <p>This method returns the bounds of a tab for the given index * and shifts it by the current scrolling offset if the tabbed * pane is in scrolling tab layout mode.</p> - * + * * <p>Subclassses should retrievs a tab's bounds by this method * if they want to find out whether the tab is currently visible.</p> - * + * * @param pane The JTabbedPane. * @param i The index to look for. * @@ -3099,13 +3099,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants // Need to re-layout container if tab does not exist. if (i >= rects.length) layoutManager.layoutContainer(pane); - + // Properly shift coordinates if scrolling has taken // place. if (pane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) { Rectangle r = new Rectangle(rects[i]); - + switch(pane.getTabPlacement()) { case SwingConstants.TOP: @@ -3115,10 +3115,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants default: r.y -= currentScrollOffset; } - + return r; } - + return rects[i]; } @@ -3148,9 +3148,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants // Note: This code is tab layout mode agnostic. if (! tabPane.isValid()) tabPane.validate(); - + int tabCount = tabPane.getTabCount(); - + // If the user clicked outside of any tab rect the // selection should not change. int index = tabPane.getSelectedIndex(); @@ -3168,7 +3168,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants /** * <p>This method returns the tab bounds in the given rectangle.</p> - * + * * <p>The returned rectangle will be shifted by the current scroll * offset if the tabbed pane is in scrolling tab layout mode.</p>. * @@ -3652,7 +3652,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { current = getNextTabIndexInRun(tabPane.getTabCount(), current); - + if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); @@ -3668,7 +3668,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { current = getPreviousTabIndexInRun(tabPane.getTabCount(), current); - + if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); @@ -3698,7 +3698,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants protected void selectPreviousTab(int current) { current = getPreviousTabIndex(current); - + if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); @@ -3825,10 +3825,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants int index = getNextTabIndex(base); int run = getRunForTab(tabCount, base); if (base == lastTabInRun(tabCount, run)) - index = (run > 0) + index = (run > 0) ? lastTabInRun(tabCount, getPreviousTabRun(run)) + 1 : 0; - + return index; } @@ -3847,7 +3847,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants int run = getRunForTab(tabCount, base); if (index == lastTabInRun(tabCount, getPreviousTabRun(run))) index = lastTabInRun(tabCount, run); - + return index; } @@ -3933,8 +3933,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants break; } } - - ActionMap getActionMap() + + ActionMap getActionMap() { ActionMap map = (ActionMap) UIManager.get("TabbedPane.actionMap"); @@ -3950,25 +3950,25 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); - + map.put("navigatePageDown", new NavigatePageDownAction()); map.put("navigatePageUp", new NavigatePageUpAction()); map.put("navigateDown", new NavigateAction("navigateDown", SwingConstants.SOUTH)); - + map.put("navigateUp", new NavigateAction("navigateUp", SwingConstants.NORTH)); - + map.put("navigateLeft", new NavigateAction("navigateLeft", SwingConstants.WEST)); - + map.put("navigateRight", new NavigateAction("navigateRight", SwingConstants.EAST)); - + map.put("requestFocusForVisibleComponent", new RequestFocusForVisibleComponentAction()); map.put("requestFocus", new RequestFocusAction()); - + return map; } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java index 8a8eeb837fe..7ff234e6d44 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java @@ -71,28 +71,28 @@ public class BasicTableHeaderUI extends TableHeaderUI * where mouse cursor changes shape into "resize" */ static int COLUMN_BOUNDARY_TOLERANCE = 3; - + public static ComponentUI createUI(JComponent h) { return new BasicTableHeaderUI(); } - + /** * The table header that is using this interface. */ protected JTableHeader header; - + /** * The mouse input listener, responsible for mouse manipulations with * the table header. */ protected MouseInputListener mouseInputListener; - + /** * Paint the header cell. */ protected CellRendererPane rendererPane; - + /** * The header cell border. */ @@ -102,12 +102,12 @@ public class BasicTableHeaderUI extends TableHeaderUI * Original mouse cursor prior to resizing. */ private Cursor originalCursor; - + /** * If not null, one of the columns is currently being dragged. */ Rectangle draggingHeaderRect; - + /** * Handles column movement and rearrangement by mouse. The same instance works * both as mouse listener and the mouse motion listner. @@ -117,7 +117,7 @@ public class BasicTableHeaderUI extends TableHeaderUI { /** * If true, the cursor is being already shown in the alternative "resize" - * shape. + * shape. */ boolean showingResizeCursor; @@ -127,11 +127,11 @@ public class BasicTableHeaderUI extends TableHeaderUI * column dragging). */ int draggingFrom = - 1; - + /** * The number of the column being dragged. */ - int draggingColumnNumber; + int draggingColumnNumber; /** * The previous preferred width of the column. @@ -245,7 +245,7 @@ public class BasicTableHeaderUI extends TableHeaderUI if (onBoundary) { - originalCursor = header.getCursor(); + originalCursor = header.getCursor(); if (p < x) header.setCursor(Cursor.getPredefinedCursor( Cursor.W_RESIZE_CURSOR)); @@ -351,7 +351,7 @@ public class BasicTableHeaderUI extends TableHeaderUI /** * Stop the dragging session. - * + * * @param e the "mouse release" mouse event, needed to determing the final * location for the dragged column. */ @@ -365,11 +365,11 @@ public class BasicTableHeaderUI extends TableHeaderUI // Find where have we dragged the column. int x = e.getX(); int p = 0; - + int col = model.getColumnCount() - 1; int n = model.getColumnCount(); - // This loop does not find the column if the mouse if out of the + // This loop does not find the column if the mouse if out of the // right boundary of the table header. Then we make this column the // rightmost column. Scan: for (int i = 0; i < n; i++) @@ -385,17 +385,17 @@ public class BasicTableHeaderUI extends TableHeaderUI header.getTable().moveColumn(draggingColumnNumber, col); } } - + /** * Create and return the mouse input listener. - * + * * @return the mouse listener ({@link MouseInputHandler}, if not overridden. */ protected MouseInputListener createMouseInputListener() { return new MouseInputHandler(); } - + /** * Construct a new BasicTableHeaderUI, create mouse listeners. */ @@ -448,7 +448,7 @@ public class BasicTableHeaderUI extends TableHeaderUI { // AFAICS, the RI does nothing here. } - + /** * Remove the previously installed listeners. */ @@ -464,9 +464,9 @@ public class BasicTableHeaderUI extends TableHeaderUI uninstallKeyboardActions(); uninstallDefaults(); } - + /** - * Repaint the table header. + * Repaint the table header. */ public void paint(Graphics gfx, JComponent c) { @@ -474,7 +474,7 @@ public class BasicTableHeaderUI extends TableHeaderUI int ncols = cmod.getColumnCount(); if (ncols == 0) return; - + Rectangle clip = gfx.getClipBounds(); TableCellRenderer defaultRend = header.getDefaultRenderer(); @@ -505,38 +505,38 @@ public class BasicTableHeaderUI extends TableHeaderUI bounds.width, bounds.height); } } - + // This displays a running rectangle that is much simplier than the total // animation, as it is seen in Sun's application. // TODO animate the collumn dragging like in Sun's jre. if (draggingHeaderRect != null) { - gfx.setColor(header.getForeground()); + gfx.setColor(header.getForeground()); gfx.drawRect(draggingHeaderRect.x, draggingHeaderRect.y + 2, draggingHeaderRect.width - 1, draggingHeaderRect.height - 6); } } - + /** * Get the preferred header size. - * + * * @param ignored unused - * + * * @return the preferred size of the associated header. */ public Dimension getPreferredSize(JComponent ignored) { TableColumnModel cmod = header.getColumnModel(); TableCellRenderer defaultRend = header.getDefaultRenderer(); - int ncols = cmod.getColumnCount(); + int ncols = cmod.getColumnCount(); Dimension ret = new Dimension(0, 0); int spacing = 0; - if (header.getTable() != null + if (header.getTable() != null && header.getTable().getIntercellSpacing() != null) spacing = header.getTable().getIntercellSpacing().width; - - for (int i = 0; i < ncols; ++i) + + for (int i = 0; i < ncols; ++i) { TableColumn col = cmod.getColumn(i); TableCellRenderer rend = col.getHeaderRenderer(); @@ -556,11 +556,11 @@ public class BasicTableHeaderUI extends TableHeaderUI Dimension d = comp.getPreferredSize(); ret.width += spacing; - ret.height = Math.max(d.height, ret.height); + ret.height = Math.max(d.height, ret.height); } ret.width = cmod.getTotalColumnWidth(); return ret; } - - + + } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java index a672173c725..f5a4bcb670d 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java @@ -82,15 +82,15 @@ import javax.swing.table.TableModel; public class BasicTableUI extends TableUI { - public static ComponentUI createUI(JComponent comp) + public static ComponentUI createUI(JComponent comp) { return new BasicTableUI(); } - protected FocusListener focusListener; - protected KeyListener keyListener; - protected MouseInputListener mouseInputListener; - protected CellRendererPane rendererPane; + protected FocusListener focusListener; + protected KeyListener keyListener; + protected MouseInputListener mouseInputListener; + protected CellRendererPane rendererPane; protected JTable table; /** The normal cell border. */ @@ -108,7 +108,7 @@ public class BasicTableUI extends TableUI * Handles key events for the JTable. Key events should be handled through * the InputMap/ActionMap mechanism since JDK1.3. This class is only there * for backwards compatibility. - * + * * @author Roman Kennke (kennke@aicas.com) */ public class KeyHandler implements KeyListener @@ -125,7 +125,7 @@ public class BasicTableUI extends TableUI { // Key events should be handled through the InputMap/ActionMap mechanism // since JDK1.3. This class is only there for backwards compatibility. - + // Editor activation is a specific kind of response to ''any'' // character key. Hence it is handled here. if (!table.isEditing() && table.isEnabled()) @@ -208,13 +208,13 @@ public class BasicTableUI extends TableUI ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) { - if (controlPressed && rowModel.getSelectionMode() + if (controlPressed && rowModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) rowModel.addSelectionInterval(lo_row, hi_row); else rowModel.setSelectionInterval(lo_row, hi_row); } - + // Update the columns int lo_col = table.columnAtPoint(begin); int hi_col = table.columnAtPoint(curr); @@ -222,14 +222,14 @@ public class BasicTableUI extends TableUI getSelectionModel(); if (lo_col != -1 && hi_col != -1) { - if (controlPressed && colModel.getSelectionMode() != + if (controlPressed && colModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) colModel.addSelectionInterval(lo_col, hi_col); else colModel.setSelectionInterval(lo_col, hi_col); } } - + /** * For the double click, start the cell editor. */ @@ -254,7 +254,7 @@ public class BasicTableUI extends TableUI } } - public void mouseDragged(MouseEvent e) + public void mouseDragged(MouseEvent e) { if (table.isEnabled()) { @@ -278,7 +278,7 @@ public class BasicTableUI extends TableUI // Nothing to do here. } - public void mousePressed(MouseEvent e) + public void mousePressed(MouseEvent e) { if (table.isEnabled()) { @@ -292,12 +292,12 @@ public class BasicTableUI extends TableUI //if control is pressed and the cell is already selected, deselect it if (e.isControlDown() && table.isCellSelected( table.rowAtPoint(begin), table.columnAtPoint(begin))) - { + { table.getSelectionModel(). - removeSelectionInterval(table.rowAtPoint(begin), + removeSelectionInterval(table.rowAtPoint(begin), table.rowAtPoint(begin)); table.getColumnModel().getSelectionModel(). - removeSelectionInterval(table.columnAtPoint(begin), + removeSelectionInterval(table.columnAtPoint(begin), table.columnAtPoint(begin)); } else @@ -314,7 +314,7 @@ public class BasicTableUI extends TableUI } } - public void mouseReleased(MouseEvent e) + public void mouseReleased(MouseEvent e) { if (table.isEnabled()) { @@ -374,12 +374,12 @@ public class BasicTableUI extends TableUI } } - protected FocusListener createFocusListener() + protected FocusListener createFocusListener() { return new FocusHandler(); } - protected MouseInputListener createMouseInputListener() + protected MouseInputListener createMouseInputListener() { return new MouseInputHandler(); } @@ -396,16 +396,16 @@ public class BasicTableUI extends TableUI } /** - * Return the maximum size of the table. The maximum height is the row - * height times the number of rows. The maximum width is the sum of + * Return the maximum size of the table. The maximum height is the row + * height times the number of rows. The maximum width is the sum of * the maximum widths of each column. - * + * * @param comp the component whose maximum size is being queried, * this is ignored. * @return a Dimension object representing the maximum size of the table, * or null if the table has no elements. */ - public Dimension getMaximumSize(JComponent comp) + public Dimension getMaximumSize(JComponent comp) { int maxTotalColumnWidth = 0; for (int i = 0; i < table.getColumnCount(); i++) @@ -415,16 +415,16 @@ public class BasicTableUI extends TableUI } /** - * Return the minimum size of the table. The minimum height is the row - * height times the number of rows. The minimum width is the sum of + * Return the minimum size of the table. The minimum height is the row + * height times the number of rows. The minimum width is the sum of * the minimum widths of each column. - * + * * @param comp the component whose minimum size is being queried, * this is ignored. * @return a Dimension object representing the minimum size of the table, * or null if the table has no elements. */ - public Dimension getMinimumSize(JComponent comp) + public Dimension getMinimumSize(JComponent comp) { int minTotalColumnWidth = 0; for (int i = 0; i < table.getColumnCount(); i++) @@ -440,7 +440,7 @@ public class BasicTableUI extends TableUI * * @return the preferred size for the table of that UI */ - public Dimension getPreferredSize(JComponent comp) + public Dimension getPreferredSize(JComponent comp) { int prefTotalColumnWidth = 0; TableColumnModel tcm = table.getColumnModel(); @@ -458,13 +458,13 @@ public class BasicTableUI extends TableUI * Returns the table height. This helper method is used by * {@link #getMinimumSize(JComponent)}, {@link #getPreferredSize(JComponent)} * and {@link #getMaximumSize(JComponent)} to determine the table height. - * + * * @return the table height */ private int getHeight() { int height = 0; - int rowCount = table.getRowCount(); + int rowCount = table.getRowCount(); if (rowCount > 0 && table.getColumnCount() > 0) { Rectangle r = table.getCellRect(rowCount - 1, 0, true); @@ -473,7 +473,7 @@ public class BasicTableUI extends TableUI return height; } - protected void installDefaults() + protected void installDefaults() { LookAndFeel.installColorsAndFont(table, "Table.background", "Table.foreground", "Table.font"); @@ -486,7 +486,7 @@ public class BasicTableUI extends TableUI /** * Installs keyboard actions on the table. */ - protected void installKeyboardActions() + protected void installKeyboardActions() { // Install the input map. InputMap inputMap = @@ -597,14 +597,14 @@ public class BasicTableUI extends TableUI { JTable table = (JTable) e.getSource(); - DefaultListSelectionModel rowModel + DefaultListSelectionModel rowModel = (DefaultListSelectionModel) table.getSelectionModel(); - DefaultListSelectionModel colModel + DefaultListSelectionModel colModel = (DefaultListSelectionModel) table.getColumnModel().getSelectionModel(); int rowLead = rowModel.getLeadSelectionIndex(); int rowMax = table.getModel().getRowCount() - 1; - + int colLead = colModel.getLeadSelectionIndex(); int colMax = table.getModel().getColumnCount() - 1; @@ -626,7 +626,7 @@ public class BasicTableUI extends TableUI table.editCellAt(rowLead, colLead); } else if (command.equals("selectFirstRowExtendSelection")) - { + { rowModel.setLeadSelectionIndex(0); } else if (command.equals("selectFirstColumn")) @@ -636,7 +636,7 @@ public class BasicTableUI extends TableUI else if (command.equals("selectFirstColumnExtendSelection")) { colModel.setLeadSelectionIndex(0); - } + } else if (command.equals("selectLastRow")) { rowModel.setSelectionInterval(rowMax, rowMax); @@ -670,11 +670,11 @@ public class BasicTableUI extends TableUI { int target; if (rowLead == getFirstVisibleRowIndex(table)) - target = Math.max(0, rowLead - (getLastVisibleRowIndex(table) + target = Math.max(0, rowLead - (getLastVisibleRowIndex(table) - getFirstVisibleRowIndex(table) + 1)); else target = getFirstVisibleRowIndex(table); - + rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); } @@ -692,7 +692,7 @@ public class BasicTableUI extends TableUI - getFirstVisibleColumnIndex(table) + 1)); else target = getLastVisibleColumnIndex(table); - + colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } @@ -705,11 +705,11 @@ public class BasicTableUI extends TableUI { int target; if (colLead == getFirstVisibleColumnIndex(table)) - target = Math.max(0, colLead - (getLastVisibleColumnIndex(table) + target = Math.max(0, colLead - (getLastVisibleColumnIndex(table) - getFirstVisibleColumnIndex(table) + 1)); else target = getFirstVisibleColumnIndex(table); - + colModel.setSelectionInterval(target, target); rowModel.setSelectionInterval(rowLead, rowLead); } @@ -731,71 +731,71 @@ public class BasicTableUI extends TableUI || command.equals("selectPreviousColumnCell")) { // If nothing is selected, select the first cell in the table - if (table.getSelectedRowCount() == 0 && + if (table.getSelectedRowCount() == 0 && table.getSelectedColumnCount() == 0) { rowModel.setSelectionInterval(0, 0); colModel.setSelectionInterval(0, 0); return; } - + // If the lead selection index isn't selected (ie a remove operation // happened, then set the lead to the first selected cell in the // table if (!table.isCellSelected(rowLead, colLead)) { - rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), + rowModel.addSelectionInterval(rowModel.getMinSelectionIndex(), rowModel.getMinSelectionIndex()); - colModel.addSelectionInterval(colModel.getMinSelectionIndex(), + colModel.addSelectionInterval(colModel.getMinSelectionIndex(), colModel.getMinSelectionIndex()); return; } - + // multRowsSelected and multColsSelected tell us if multiple rows or // columns are selected, respectively boolean multRowsSelected, multColsSelected; multRowsSelected = table.getSelectedRowCount() > 1 && table.getRowSelectionAllowed(); - + multColsSelected = table.getSelectedColumnCount() > 1 && table.getColumnSelectionAllowed(); - + // If there is just one selection, select the next cell, and wrap // when you get to the edges of the table. if (!multColsSelected && !multRowsSelected) { - if (command.indexOf("Column") != -1) - advanceSingleSelection(colModel, colMax, rowModel, rowMax, + if (command.indexOf("Column") != -1) + advanceSingleSelection(colModel, colMax, rowModel, rowMax, command.equals("selectPreviousColumnCell")); else - advanceSingleSelection(rowModel, rowMax, colModel, colMax, + advanceSingleSelection(rowModel, rowMax, colModel, colMax, command.equals("selectPreviousRowCell")); return; } - - + + // rowMinSelected and rowMaxSelected are the minimum and maximum // values respectively of selected cells in the row selection model // Similarly for colMinSelected and colMaxSelected. - int rowMaxSelected = table.getRowSelectionAllowed() ? + int rowMaxSelected = table.getRowSelectionAllowed() ? rowModel.getMaxSelectionIndex() : table.getModel().getRowCount() - 1; - int rowMinSelected = table.getRowSelectionAllowed() ? - rowModel.getMinSelectionIndex() : 0; - int colMaxSelected = table.getColumnSelectionAllowed() ? - colModel.getMaxSelectionIndex() : + int rowMinSelected = table.getRowSelectionAllowed() ? + rowModel.getMinSelectionIndex() : 0; + int colMaxSelected = table.getColumnSelectionAllowed() ? + colModel.getMaxSelectionIndex() : table.getModel().getColumnCount() - 1; - int colMinSelected = table.getColumnSelectionAllowed() ? + int colMinSelected = table.getColumnSelectionAllowed() ? colModel.getMinSelectionIndex() : 0; - + // If there are multiple rows and columns selected, select the next - // cell and wrap at the edges of the selection. - if (command.indexOf("Column") != -1) + // cell and wrap at the edges of the selection. + if (command.indexOf("Column") != -1) advanceMultipleSelection(table, colModel, colMinSelected, colMaxSelected, rowModel, rowMinSelected, rowMaxSelected, command.equals("selectPreviousColumnCell"), true); - + else advanceMultipleSelection(table, rowModel, rowMinSelected, rowMaxSelected, colModel, colMinSelected, @@ -812,11 +812,11 @@ public class BasicTableUI extends TableUI { int target; if (colLead == getFirstVisibleColumnIndex(table)) - target = Math.max(0, colLead - (getLastVisibleColumnIndex(table) + target = Math.max(0, colLead - (getLastVisibleColumnIndex(table) - getFirstVisibleColumnIndex(table) + 1)); else target = getFirstVisibleColumnIndex(table); - + colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } @@ -828,7 +828,7 @@ public class BasicTableUI extends TableUI - getFirstVisibleRowIndex(table) + 1)); else target = getLastVisibleRowIndex(table); - + rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } @@ -836,11 +836,11 @@ public class BasicTableUI extends TableUI { int target; if (colLead == getLastVisibleColumnIndex(table)) - target = Math.min(colMax, colLead + (getLastVisibleColumnIndex(table) + target = Math.min(colMax, colLead + (getLastVisibleColumnIndex(table) - getFirstVisibleColumnIndex(table) + 1)); else target = getLastVisibleColumnIndex(table); - + colModel.setLeadSelectionIndex(target); rowModel.setLeadSelectionIndex(rowLead); } @@ -857,29 +857,29 @@ public class BasicTableUI extends TableUI { int target; if (rowLead == getLastVisibleRowIndex(table)) - target = Math.min(rowMax, rowLead + (getLastVisibleRowIndex(table) + target = Math.min(rowMax, rowLead + (getLastVisibleRowIndex(table) - getFirstVisibleRowIndex(table) + 1)); else target = getLastVisibleRowIndex(table); - + rowModel.setLeadSelectionIndex(target); colModel.setLeadSelectionIndex(colLead); - } + } else if (command.equals("scrollUpChangeSelection")) { int target; if (rowLead == getFirstVisibleRowIndex(table)) - target = Math.max(0, rowLead - (getLastVisibleRowIndex(table) + target = Math.max(0, rowLead - (getLastVisibleRowIndex(table) - getFirstVisibleRowIndex(table) + 1)); else target = getFirstVisibleRowIndex(table); - + rowModel.setSelectionInterval(target, target); colModel.setSelectionInterval(colLead, colLead); } else if (command.equals("selectNextRowChangeLead")) { - if (rowModel.getSelectionMode() + if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { // just "selectNextRow" @@ -892,7 +892,7 @@ public class BasicTableUI extends TableUI } else if (command.equals("selectPreviousRowChangeLead")) { - if (rowModel.getSelectionMode() + if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { // just selectPreviousRow @@ -905,8 +905,8 @@ public class BasicTableUI extends TableUI } else if (command.equals("selectNextColumnChangeLead")) { - if (colModel.getSelectionMode() - != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) + if (colModel.getSelectionMode() + != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { // just selectNextColumn rowModel.setSelectionInterval(rowLead, rowLead); @@ -918,14 +918,14 @@ public class BasicTableUI extends TableUI } else if (command.equals("selectPreviousColumnChangeLead")) { - if (colModel.getSelectionMode() - != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) + if (colModel.getSelectionMode() + != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { // just selectPreviousColumn rowModel.setSelectionInterval(rowLead, rowLead); colModel.setSelectionInterval(Math.max(colLead - 1, 0), Math.max(colLead - 1, 0)); - + } else colModel.moveLeadSelectionIndex(Math.max(colLead - 1, 0)); @@ -955,12 +955,12 @@ public class BasicTableUI extends TableUI rowModel.removeSelectionInterval(rowLead, rowLead); else rowModel.addSelectionInterval(rowLead, rowLead); - + if (colModel.isSelectedIndex(colLead)) colModel.removeSelectionInterval(colLead, colLead); else colModel.addSelectionInterval(colLead, colLead); - + rowModel.setAnchorSelectionIndex(rowLead); colModel.setAnchorSelectionIndex(colLead); } @@ -968,31 +968,31 @@ public class BasicTableUI extends TableUI { table.editingStopped(new ChangeEvent(command)); } - else + else { // If we're here that means we bound this TableAction class // to a keyboard input but we either want to ignore that input // or we just haven't implemented its action yet. - + // Uncomment the following line to print the names of unused bindings // when their keys are pressed - + // System.out.println ("not implemented: "+e.getActionCommand()); } // Any commands whose keyStrokes should be used by the Editor should not - // cause editing to be stopped: ie, the SPACE sends "addToSelection" but + // cause editing to be stopped: ie, the SPACE sends "addToSelection" but // if the table is in editing mode, the space should not cause us to stop // editing because it should be used by the Editor. if (table.isEditing() && command != "startEditing" && command != "addToSelection") table.editingStopped(new ChangeEvent("update")); - + table.scrollRectToVisible(table.getCellRect( - rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), + rowModel.getLeadSelectionIndex(), colModel.getLeadSelectionIndex(), false)); } - + /** * Returns the column index of the first visible column. * @return the column index of the first visible column. @@ -1005,7 +1005,7 @@ public class BasicTableUI extends TableUI r.translate((int) r.getWidth() - 1, 0); return table.columnAtPoint(r.getLocation()); } - + /** * Returns the column index of the last visible column. * @@ -1016,9 +1016,9 @@ public class BasicTableUI extends TableUI Rectangle r = table.getVisibleRect(); if (or.isLeftToRight()) r.translate((int) r.getWidth() - 1, 0); - return table.columnAtPoint(r.getLocation()); + return table.columnAtPoint(r.getLocation()); } - + /** * Returns the row index of the first visible row. * @@ -1031,7 +1031,7 @@ public class BasicTableUI extends TableUI r.translate((int) r.getWidth() - 1, 0); return table.rowAtPoint(r.getLocation()); } - + /** * Returns the row index of the last visible row. * @@ -1067,7 +1067,7 @@ public class BasicTableUI extends TableUI * rows (ENTER) * @param firstMin the first selected index in firstModel * @param firstMax the last selected index in firstModel - * @param secondModel the ListSelectionModel for rows (TAB) or + * @param secondModel the ListSelectionModel for rows (TAB) or * columns (ENTER) * @param secondMin the first selected index in secondModel * @param secondMax the last selected index in secondModel @@ -1076,41 +1076,41 @@ public class BasicTableUI extends TableUI */ void advanceMultipleSelection(JTable table, ListSelectionModel firstModel, int firstMin, - int firstMax, ListSelectionModel secondModel, + int firstMax, ListSelectionModel secondModel, int secondMin, int secondMax, boolean reverse, boolean eventIsTab) { - // If eventIsTab, all the "firsts" correspond to columns, otherwise, to + // If eventIsTab, all the "firsts" correspond to columns, otherwise, to // rows "seconds" correspond to the opposite int firstLead = firstModel.getLeadSelectionIndex(); int secondLead = secondModel.getLeadSelectionIndex(); - int numFirsts = eventIsTab ? + int numFirsts = eventIsTab ? table.getModel().getColumnCount() : table.getModel().getRowCount(); - int numSeconds = eventIsTab ? + int numSeconds = eventIsTab ? table.getModel().getRowCount() : table.getModel().getColumnCount(); // check if we have to wrap the "firsts" around, going to the other side - if ((firstLead == firstMax && !reverse) || + if ((firstLead == firstMax && !reverse) || (reverse && firstLead == firstMin)) { - firstModel.addSelectionInterval(reverse ? firstMax : firstMin, + firstModel.addSelectionInterval(reverse ? firstMax : firstMin, reverse ? firstMax : firstMin); - + // check if we have to wrap the "seconds" - if ((secondLead == secondMax && !reverse) || + if ((secondLead == secondMax && !reverse) || (reverse && secondLead == secondMin)) - secondModel.addSelectionInterval(reverse ? secondMax : secondMin, + secondModel.addSelectionInterval(reverse ? secondMax : secondMin, reverse ? secondMax : secondMin); // if we're not wrapping the seconds, we have to find out where we - // are within the secondModel and advance to the next cell (or + // are within the secondModel and advance to the next cell (or // go back to the previous cell if reverse == true) else { int[] secondsSelected; - if (eventIsTab && table.getRowSelectionAllowed() || + if (eventIsTab && table.getRowSelectionAllowed() || !eventIsTab && table.getColumnSelectionAllowed()) - secondsSelected = eventIsTab ? + secondsSelected = eventIsTab ? table.getSelectedRows() : table.getSelectedColumns(); else { @@ -1129,9 +1129,9 @@ public class BasicTableUI extends TableUI else while (secondsSelected[secondIndex] >= secondLead) secondIndex--; - + // and select it - updating the lead selection index - secondModel.addSelectionInterval(secondsSelected[secondIndex], + secondModel.addSelectionInterval(secondsSelected[secondIndex], secondsSelected[secondIndex]); } } @@ -1140,9 +1140,9 @@ public class BasicTableUI extends TableUI else { int[] firstsSelected; - if (eventIsTab && table.getColumnSelectionAllowed() || + if (eventIsTab && table.getColumnSelectionAllowed() || !eventIsTab && table.getRowSelectionAllowed()) - firstsSelected = eventIsTab ? + firstsSelected = eventIsTab ? table.getSelectedColumns() : table.getSelectedRows(); else { @@ -1155,16 +1155,16 @@ public class BasicTableUI extends TableUI if (!reverse) while (firstsSelected[firstIndex] <= firstLead) firstIndex++; - else + else while (firstsSelected[firstIndex] >= firstLead) firstIndex--; - firstModel.addSelectionInterval(firstsSelected[firstIndex], + firstModel.addSelectionInterval(firstsSelected[firstIndex], firstsSelected[firstIndex]); secondModel.addSelectionInterval(secondLead, secondLead); } } - - /** + + /** * A helper method for the key bindings. Used because the actions * for TAB, SHIFT-TAB, ENTER, and SHIFT-ENTER are very similar. * @@ -1180,15 +1180,15 @@ public class BasicTableUI extends TableUI * @param reverse true if SHIFT was pressed for the event */ - void advanceSingleSelection(ListSelectionModel firstModel, int firstMax, - ListSelectionModel secondModel, int secondMax, + void advanceSingleSelection(ListSelectionModel firstModel, int firstMax, + ListSelectionModel secondModel, int secondMax, boolean reverse) { // for TABs, "first" corresponds to columns and "seconds" to rows. // the opposite is true for ENTERs int firstLead = firstModel.getLeadSelectionIndex(); int secondLead = secondModel.getLeadSelectionIndex(); - + // if we are going backwards subtract 2 because we later add 1 // for a net change of -1 if (reverse && (firstLead == 0)) @@ -1198,15 +1198,15 @@ public class BasicTableUI extends TableUI secondLead += secondMax + 1; secondLead -= 2; } - + // do we have to wrap the "seconds"? if (reverse && (firstLead == 0) || !reverse && (firstLead == firstMax)) - secondModel.setSelectionInterval((secondLead + 1) % (secondMax + 1), + secondModel.setSelectionInterval((secondLead + 1) % (secondMax + 1), (secondLead + 1) % (secondMax + 1)); // if not, just reselect the current lead else secondModel.setSelectionInterval(secondLead, secondLead); - + // if we are going backwards, subtract 2 because we add 1 later // for net change of -1 if (reverse) @@ -1217,12 +1217,12 @@ public class BasicTableUI extends TableUI firstLead -= 2; } // select the next "first" - firstModel.setSelectionInterval((firstLead + 1) % (firstMax + 1), + firstModel.setSelectionInterval((firstLead + 1) % (firstMax + 1), (firstLead + 1) % (firstMax + 1)); } } - protected void installListeners() + protected void installListeners() { if (focusListener == null) focusListener = createFocusListener(); @@ -1232,7 +1232,7 @@ public class BasicTableUI extends TableUI table.addKeyListener(keyListener); if (mouseInputListener == null) mouseInputListener = createMouseInputListener(); - table.addMouseListener(mouseInputListener); + table.addMouseListener(mouseInputListener); table.addMouseMotionListener(mouseInputListener); if (propertyChangeListener == null) propertyChangeListener = new PropertyChangeHandler(); @@ -1259,17 +1259,17 @@ public class BasicTableUI extends TableUI SwingUtilities.replaceUIActionMap(table, null); } - protected void uninstallListeners() + protected void uninstallListeners() { - table.removeFocusListener(focusListener); + table.removeFocusListener(focusListener); table.removeKeyListener(keyListener); - table.removeMouseListener(mouseInputListener); + table.removeMouseListener(mouseInputListener); table.removeMouseMotionListener(mouseInputListener); table.removePropertyChangeListener(propertyChangeListener); propertyChangeListener = null; } - public void installUI(JComponent comp) + public void installUI(JComponent comp) { table = (JTable) comp; rendererPane = new CellRendererPane(); @@ -1280,11 +1280,11 @@ public class BasicTableUI extends TableUI installListeners(); } - public void uninstallUI(JComponent c) + public void uninstallUI(JComponent c) { uninstallListeners(); uninstallKeyboardActions(); - uninstallDefaults(); + uninstallDefaults(); table.remove(rendererPane); rendererPane = null; @@ -1308,11 +1308,11 @@ public class BasicTableUI extends TableUI Component comp = table.prepareRenderer(rend, row, col); rendererPane.paintComponent(g, comp, table, bounds); } - + /** * Paint the associated table. */ - public void paint(Graphics gfx, JComponent ignored) + public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); @@ -1346,19 +1346,19 @@ public class BasicTableUI extends TableUI { widths[i] = cmodel.getColumn(i).getWidth() - columnMargin; } - + Rectangle bounds = table.getCellRect(r0, c0, false); // The left boundary of the area being repainted. int left = bounds.x; - + // The top boundary of the area being repainted. int top = bounds.y; - + // The bottom boundary of the area being repainted. int bottom; - + // paint the cell contents - Color grid = table.getGridColor(); + Color grid = table.getGridColor(); for (int r = r0; r <= rn; ++r) { for (int c = c0; c <= cn; ++c) @@ -1372,18 +1372,18 @@ public class BasicTableUI extends TableUI // Update row height for tables with custom heights. bounds.height = table.getRowHeight(r + 1) - rowMargin; } - + bottom = bounds.y - rowMargin; // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) - { + { Color save = gfx.getColor(); gfx.setColor(grid); int x = left - columnMargin; for (int c = c0; c <= cn; ++c) { - // The vertical grid is draw right from the cells, so we + // The vertical grid is draw right from the cells, so we // add before drawing. x += widths[c] + columnMargin; gfx.drawLine(x, top, x, bottom); @@ -1391,15 +1391,15 @@ public class BasicTableUI extends TableUI gfx.setColor(save); } - // paint horizontal grid lines + // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) - { + { Color save = gfx.getColor(); gfx.setColor(grid); int y = top - rowMargin; for (int r = r0; r <= rn; ++r) { - // The horizontal grid is draw below the cells, so we + // The horizontal grid is draw below the cells, so we // add before drawing. y += table.getRowHeight(r); gfx.drawLine(left, y, p2.x, y); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java index 3f5aa27cf40..b2541b453c6 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java @@ -1,4 +1,4 @@ -/* BasicTextAreaUI.java -- +/* BasicTextAreaUI.java -- Copyright (C) 2004, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -65,9 +65,9 @@ public class BasicTextAreaUI extends BasicTextUI /** * Create the view. Returns a WrappedPlainView if the text area * has lineWrap set to true, otherwise returns a PlainView. If - * lineWrap is true has to check whether the wrap style is word + * lineWrap is true has to check whether the wrap style is word * or character and return an appropriate WrappedPlainView. - * + * * @param elem the element to create a View for * @return an appropriate View for the element */ @@ -94,11 +94,11 @@ public class BasicTextAreaUI extends BasicTextUI { return "TextArea"; } - + /** * Receives notification whenever one of the text component's bound * properties changes. This changes the view to WrappedPlainView - * if setLineWrap(true) is called, and back to PlainView if + * if setLineWrap(true) is called, and back to PlainView if * setLineWrap(false) is called. * * @param ev the property change event diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java index 6792aa065da..5f6a9275788 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java @@ -60,7 +60,7 @@ public class BasicTextFieldUI extends BasicTextUI { return new FieldView(elem); } - + public static ComponentUI createUI(JComponent c) { return new BasicTextFieldUI(); @@ -85,7 +85,7 @@ public class BasicTextFieldUI extends BasicTextUI * Receives notification whenever one of the text component's bound * properties changes. Here we check for the editable and enabled * properties and adjust the background color accordingly. - * + * * <p>The colors are only changed if they are not a * <code>ColorUIResource</code>.</p> * diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java index a988c5a63c8..507e0a1697a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java @@ -1,4 +1,4 @@ -/* BasicTextPaneUI.java -- +/* BasicTextPaneUI.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java index e152a3034d5..bd7cc48b94e 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java @@ -126,7 +126,7 @@ public abstract class BasicTextUI extends TextUI private static class FocusHandler implements FocusListener { - public void focusGained(FocusEvent e) + public void focusGained(FocusEvent e) { // Nothing to do here. } @@ -147,7 +147,7 @@ public abstract class BasicTextUI extends TextUI { if (sm != null) sm.checkSystemClipboardAccess(); - + Clipboard cb = Toolkit.getDefaultToolkit().getSystemSelection(); if (cb != null) { @@ -291,7 +291,7 @@ public abstract class BasicTextUI extends TextUI EditorKit editorKit = BasicTextUI.this.getEditorKit(getComponent()); factory = editorKit.getViewFactory(); if (factory == null) - factory = BasicTextUI.this; + factory = BasicTextUI.this; return factory; } @@ -317,7 +317,7 @@ public abstract class BasicTextUI extends TextUI { if (view != null) view.setParent(null); - + if (v != null) v.setParent(this); @@ -718,7 +718,7 @@ public abstract class BasicTextUI extends TextUI if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); - textComponent.setSelectionColor(color); + textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); @@ -756,7 +756,7 @@ public abstract class BasicTextUI extends TextUI */ protected void installListeners() { - // + // if (SystemProperties.getProperty("gnu.swing.text.no-xlike-clipboard") == null) { @@ -768,11 +768,11 @@ public abstract class BasicTextUI extends TextUI /** * Returns the name of the keymap for this type of TextUI. - * + * * This is implemented so that the classname of this TextUI * without the package prefix is returned. This way subclasses * don't have to override this method. - * + * * @return the name of the keymap for this TextUI */ protected String getKeymapName() @@ -822,10 +822,10 @@ public abstract class BasicTextUI extends TextUI getInputMap()); SwingUtilities.replaceUIActionMap(textComponent, getActionMap()); } - + /** * Creates an ActionMap to be installed on the text component. - * + * * @return an ActionMap to be installed on the text component */ private ActionMap getActionMap() @@ -963,7 +963,7 @@ public abstract class BasicTextUI extends TextUI */ protected void uninstallKeyboardActions() { - SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED, + SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED, null); SwingUtilities.replaceUIActionMap(textComponent, null); } @@ -1150,7 +1150,7 @@ public abstract class BasicTextUI extends TextUI highlighter.paint(g); g.setColor(oldColor); } - + rootView.paint(g, getVisibleEditorRect()); if (caret != null && textComponent.hasFocus()) @@ -1482,11 +1482,11 @@ public abstract class BasicTextUI extends TextUI // Return null if the component has no valid size. if (width <= 0 || height <= 0) return null; - + Insets insets = textComponent.getInsets(cachedInsets); return new Rectangle(insets.left, insets.top, - width - insets.left - insets.right, - height - insets.top - insets.bottom); + width - insets.left - insets.right, + height - insets.top - insets.bottom); } /** @@ -1507,10 +1507,10 @@ public abstract class BasicTextUI extends TextUI */ protected void modelChanged() { - if (textComponent == null || rootView == null) + if (textComponent == null || rootView == null) return; ViewFactory factory = rootView.getViewFactory(); - if (factory == null) + if (factory == null) return; Document doc = textComponent.getDocument(); if (doc == null) diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java index 921648670df..4550f08e6dd 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java @@ -54,22 +54,22 @@ import javax.swing.plaf.ComponentUI; */ public class BasicToggleButtonUI extends BasicButtonUI { - + /** * Returns a UI delegate for the specified component. - * - * @param component the component (should be an instance of + * + * @param component the component (should be an instance of * {@link JToggleButton}). - * + * * @return An instance of <code>BasicToggleButtonUI</code>. */ public static ComponentUI createUI(JComponent component) { return new BasicToggleButtonUI(); - } + } /** - * Returns the prefix for entries in the {@link UIManager} defaults table + * Returns the prefix for entries in the {@link UIManager} defaults table * (<code>"ToggleButton."</code> in this case). * * @return <code>"ToggleButton."</code> @@ -80,14 +80,14 @@ public class BasicToggleButtonUI extends BasicButtonUI } /** - * Paint the component, which is an {@link AbstractButton}, according to + * Paint the component, which is an {@link AbstractButton}, according to * its current state. * * @param g The graphics context to paint with * @param c The component to paint the state of */ public void paint(Graphics g, JComponent c) - { + { AbstractButton b = (AbstractButton) c; Rectangle tr = new Rectangle(); @@ -102,13 +102,13 @@ public class BasicToggleButtonUI extends BasicButtonUI SwingUtilities.calculateInnerArea(b, vr); else vr = SwingUtilities.getLocalBounds(b); - String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), - b.getText(), currentIcon(b), b.getVerticalAlignment(), - b.getHorizontalAlignment(), b.getVerticalTextPosition(), - b.getHorizontalTextPosition(), vr, ir, tr, b.getIconTextGap() + String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), + b.getText(), currentIcon(b), b.getVerticalAlignment(), + b.getHorizontalAlignment(), b.getVerticalTextPosition(), + b.getHorizontalTextPosition(), vr, ir, tr, b.getIconTextGap() + defaultTextShiftOffset); - if ((b.getModel().isArmed() && b.getModel().isPressed()) + if ((b.getModel().isArmed() && b.getModel().isPressed()) || b.isSelected()) paintButtonPressed(g, b); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java index 7be69ec2576..f5b2b2d1e01 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java @@ -345,7 +345,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants protected Border createNonRolloverBorder() { Border b = UIManager.getBorder("ToolBar.nonrolloverBorder"); - + if (b == null) { b = new CompoundBorder( @@ -355,7 +355,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants UIManager.getColor("Button.highlight")), BasicBorders.getMarginBorder()); } - + return b; } /** @@ -377,7 +377,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants protected Border createRolloverBorder() { Border b = UIManager.getBorder("ToolBar.rolloverBorder"); - + if (b == null) { b = new CompoundBorder( @@ -387,7 +387,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants UIManager.getColor("Button.highlight")), BasicBorders.getMarginBorder()); } - + return b; } @@ -438,13 +438,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants if (loc != -1) { - dragWindow.setBorderColor(dockingBorderColor); - dragWindow.setBackground(dockingColor); + dragWindow.setBorderColor(dockingBorderColor); + dragWindow.setBackground(dockingColor); } else { - dragWindow.setBorderColor(floatingBorderColor); - dragWindow.setBackground(floatingColor); + dragWindow.setBorderColor(floatingBorderColor); + dragWindow.setBackground(floatingColor); } int w = 0; @@ -458,13 +458,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp) || ((cachedOrientation == VERTICAL) && ! tmp)) { - w = cachedBounds.width; - h = cachedBounds.height; + w = cachedBounds.width; + h = cachedBounds.height; } else { - w = cachedBounds.height; - h = cachedBounds.width; + w = cachedBounds.height; + h = cachedBounds.width; } Point p = dragWindow.getOffset(); @@ -507,28 +507,28 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants newParent = ((RootPaneContainer) floatFrame).getContentPane(); else { - floatFrame.hide(); - newParent = origParent; + floatFrame.hide(); + newParent = origParent; } String constraint; switch (aoc) { case SwingConstants.EAST: - constraint = BorderLayout.EAST; - break; + constraint = BorderLayout.EAST; + break; case SwingConstants.NORTH: - constraint = BorderLayout.NORTH; - break; + constraint = BorderLayout.NORTH; + break; case SwingConstants.SOUTH: - constraint = BorderLayout.SOUTH; - break; + constraint = BorderLayout.SOUTH; + break; case SwingConstants.WEST: - constraint = BorderLayout.WEST; - break; + constraint = BorderLayout.WEST; + break; default: - constraint = BorderLayout.CENTER; - break; + constraint = BorderLayout.CENTER; + break; } int newOrientation = SwingConstants.HORIZONTAL; @@ -538,8 +538,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants if (aoc != -1) { - constraintBeforeFloating = constraint; - lastGoodOrientation = newOrientation; + constraintBeforeFloating = constraint; + lastGoodOrientation = newOrientation; } newParent.add(toolBar, constraint); @@ -557,10 +557,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants if (aoc == -1) { - floatFrame.pack(); - floatFrame.setSize(dims.width + insets.left + insets.right, - dims.height + insets.top + insets.bottom); - floatFrame.show(); + floatFrame.pack(); + floatFrame.setSize(dims.width + insets.left + insets.right, + dims.height + insets.top + insets.bottom); + floatFrame.show(); } newParent.invalidate(); @@ -776,14 +776,14 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants for (int i = 0; i < c.length; i++) { - if (c[i] instanceof JButton) - { - // Don't really care about anything other than JButtons - JButton b = (JButton) c[i]; - - if (b.getBorder() != null) - borders.put(b, b.getBorder()); - } + if (c[i] instanceof JButton) + { + // Don't really care about anything other than JButtons + JButton b = (JButton) c[i]; + + if (b.getBorder() != null) + borders.put(b, b.getBorder()); + } } } @@ -798,11 +798,11 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants if (c instanceof JToolBar) { - toolBar = (JToolBar) c; + toolBar = (JToolBar) c; installDefaults(); installComponents(); - installListeners(); - installKeyboardActions(); + installListeners(); + installKeyboardActions(); } } @@ -894,14 +894,14 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants { if (c instanceof AbstractButton) { - AbstractButton b = (AbstractButton) c; - b.setRolloverEnabled(false); + AbstractButton b = (AbstractButton) c; + b.setRolloverEnabled(false); // Save old border in hashtable. - if (b.getBorder() != null) + if (b.getBorder() != null) borders.put(b, b.getBorder()); - - b.setBorder(nonRolloverBorder); + + b.setBorder(nonRolloverBorder); } } @@ -931,11 +931,11 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants { AbstractButton b = (AbstractButton) c; b.setRolloverEnabled(false); - + // Save old border in hashtable. if (b.getBorder() != null) - borders.put(b, b.getBorder()); - + borders.put(b, b.getBorder()); + b.setBorder(rolloverBorder); } } @@ -1139,7 +1139,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants public void mouseDragged(MouseEvent e) { if (isDragging) - dragTo(e.getPoint(), origin); + dragTo(e.getPoint(), origin); } /** @@ -1182,7 +1182,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) - return; + return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); @@ -1190,13 +1190,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { - if (e.getX() > insets.left) - return; + if (e.getX() > insets.left) + return; } else { - if (e.getY() > insets.top) - return; + if (e.getY() > insets.top) + return; } origin = new Point(0, 0); @@ -1204,16 +1204,16 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) - // Need to know who keeps the toolBar if it gets dragged back into it. - origParent = toolBar.getParent(); - + // Need to know who keeps the toolBar if it gets dragged back into it. + origParent = toolBar.getParent(); + if (toolBar.isShowing()) SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) - dragWindow.setOffset(new Point(cachedBounds.width / 2, + dragWindow.setOffset(new Point(cachedBounds.width / 2, cachedBounds.height / 2)); dragTo(e.getPoint(), origin); @@ -1227,7 +1227,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants public void mouseReleased(MouseEvent e) { if (! isDragging || ! toolBar.isFloatable()) - return; + return; isDragging = false; floatAt(e.getPoint(), origin); @@ -1267,7 +1267,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants public Color getBorderColor() { if (borderColor == null) - return Color.BLACK; + return Color.BLACK; return borderColor; } @@ -1341,7 +1341,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants public void setOrientation(int o) { toolBar.setOrientation(o); - if (dragWindow != null) + if (dragWindow != null) dragWindow.setOrientation(o); } } @@ -1364,10 +1364,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants if (origParent != null) { - origParent.add(toolBar, - (constraintBeforeFloating != null) - ? constraintBeforeFloating : BorderLayout.NORTH); - toolBar.setOrientation(lastGoodOrientation); + origParent.add(toolBar, + (constraintBeforeFloating != null) + ? constraintBeforeFloating : BorderLayout.NORTH); + toolBar.setOrientation(lastGoodOrientation); } origParent.invalidate(); @@ -1410,16 +1410,16 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants { if (e.getChild() instanceof JButton) { - JButton b = (JButton) e.getChild(); + JButton b = (JButton) e.getChild(); - if (b.getBorder() != null) - borders.put(b, b.getBorder()); + if (b.getBorder() != null) + borders.put(b, b.getBorder()); } if (isRolloverBorders()) - setBorderToRollover(e.getChild()); + setBorderToRollover(e.getChild()); else - setBorderToNonRollover(e.getChild()); + setBorderToNonRollover(e.getChild()); cachedBounds = toolBar.getPreferredSize(); cachedOrientation = toolBar.getOrientation(); @@ -1479,7 +1479,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants /** * Receives notification when the toolbar or one of it's component * receives the keyboard input focus. - * + * * @param e the focus event */ public void focusGained(FocusEvent e) @@ -1491,7 +1491,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants /** * Receives notification when the toolbar or one of it's component * looses the keyboard input focus. - * + * * @param e the focus event */ public void focusLost(FocusEvent e) @@ -1522,15 +1522,15 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants { if (c instanceof JToolBar) { - JToolBar tb = (JToolBar) c; - int orientation = tb.getOrientation(); - - if (! tb.isFloatable()) - return new Insets(regular, regular, regular, regular); - else if (orientation == SwingConstants.HORIZONTAL) - return new Insets(regular, offset, regular, regular); - else - return new Insets(offset, regular, regular, regular); + JToolBar tb = (JToolBar) c; + int orientation = tb.getOrientation(); + + if (! tb.isFloatable()) + return new Insets(regular, regular, regular, regular); + else if (orientation == SwingConstants.HORIZONTAL) + return new Insets(regular, offset, regular, regular); + else + return new Insets(offset, regular, regular, regular); } return new Insets(0, 0, 0, 0); @@ -1568,9 +1568,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants int count = 0; for (int i = x; i < (w + x); i += hgap) - for (int j = ((count++ % 2) == 0) ? y : (y + (2 * size)); j < (h + y); - j += vgap) - g.fillRect(i, j, size, size); + for (int j = ((count++ % 2) == 0) ? y : (y + (2 * size)); j < (h + y); + j += vgap) + g.fillRect(i, j, size, size); g.setColor(saved); } @@ -1590,20 +1590,20 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants { if (c instanceof JToolBar) { - JToolBar tb = (JToolBar) c; - - int orientation = tb.getOrientation(); - - if (orientation == SwingConstants.HORIZONTAL) - { - paintBumps(g, x, y, offset, height, 1, Color.WHITE); - paintBumps(g, x + 1, y + 1, offset - 1, height - 1, 1, Color.GRAY); - } - else - { - paintBumps(g, x, y, width, offset, 1, Color.WHITE); - paintBumps(g, x + 1, y + 1, width - 1, offset - 1, 1, Color.GRAY); - } + JToolBar tb = (JToolBar) c; + + int orientation = tb.getOrientation(); + + if (orientation == SwingConstants.HORIZONTAL) + { + paintBumps(g, x, y, offset, height, 1, Color.WHITE); + paintBumps(g, x + 1, y + 1, offset - 1, height - 1, 1, Color.GRAY); + } + else + { + paintBumps(g, x, y, width, offset, 1, Color.WHITE); + paintBumps(g, x + 1, y + 1, width - 1, offset - 1, 1, Color.GRAY); + } } } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java index 94e7bc322f6..37c084bb89f 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java @@ -80,7 +80,7 @@ public class BasicToolTipUI extends ToolTipUI BasicHTML.updateRenderer(tip, text); } } - + } /** The shared instance of BasicToolTipUI used for all ToolTips. */ @@ -103,7 +103,7 @@ public class BasicToolTipUI extends ToolTipUI } /** - * This method creates a new BasicToolTip UI for the given + * This method creates a new BasicToolTip UI for the given * JComponent. * * @param c The JComponent to create a UI for. @@ -245,10 +245,10 @@ public class BasicToolTipUI extends ToolTipUI if (view != null) view.paint(g, paintR); else - g.drawString(text, paintR.x + 3, paintR.y + ascent); + g.drawString(text, paintR.x + 3, paintR.y + ascent); g.setFont(oldFont); - g.setColor(saved); + g.setColor(saved); } /** diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java index 1c28a5f961d..af61a422a5f 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java @@ -109,7 +109,7 @@ import javax.swing.tree.VariableHeightLayoutCache; /** * A delegate providing the user interface for <code>JTree</code> according to * the Basic look and feel. - * + * * @see javax.swing.JTree * @author Lillian Angel (langel@redhat.com) * @author Sascha Brawer (brawer@dandelis.ch) @@ -174,7 +174,7 @@ public class BasicTreeUI * Set to false when editing and shouldSelectCall() returns true meaning the * node should be selected before editing, used in completeEditing. * GNU Classpath editing is implemented differently, so this value is not - * actually read anywhere. However it is always set correctly to maintain + * actually read anywhere. However it is always set correctly to maintain * interoperability with the derived classes that read this field. */ protected boolean stopEditingInCompleteEditing; @@ -248,7 +248,7 @@ public class BasicTreeUI /** The max height of the nodes in the tree. */ int maxHeight; - + /** The hash color. */ Color hashColor; @@ -294,7 +294,7 @@ public class BasicTreeUI /** * Returns an instance of the UI delegate for the specified component. - * + * * @param c the <code>JComponent</code> for which we need a UI delegate for. * @return the <code>ComponentUI</code> for c. */ @@ -305,7 +305,7 @@ public class BasicTreeUI /** * Returns the Hash color. - * + * * @return the <code>Color</code> of the Hash. */ protected Color getHashColor() @@ -315,7 +315,7 @@ public class BasicTreeUI /** * Sets the Hash color. - * + * * @param color the <code>Color</code> to set the Hash to. */ protected void setHashColor(Color color) @@ -325,7 +325,7 @@ public class BasicTreeUI /** * Sets the left child's indent value. - * + * * @param newAmount is the new indent value for the left child. */ public void setLeftChildIndent(int newAmount) @@ -335,7 +335,7 @@ public class BasicTreeUI /** * Returns the indent value for the left child. - * + * * @return the indent value for the left child. */ public int getLeftChildIndent() @@ -345,7 +345,7 @@ public class BasicTreeUI /** * Sets the right child's indent value. - * + * * @param newAmount is the new indent value for the right child. */ public void setRightChildIndent(int newAmount) @@ -355,7 +355,7 @@ public class BasicTreeUI /** * Returns the indent value for the right child. - * + * * @return the indent value for the right child. */ public int getRightChildIndent() @@ -365,7 +365,7 @@ public class BasicTreeUI /** * Sets the expanded icon. - * + * * @param newG is the new expanded icon. */ public void setExpandedIcon(Icon newG) @@ -375,7 +375,7 @@ public class BasicTreeUI /** * Returns the current expanded icon. - * + * * @return the current expanded icon. */ public Icon getExpandedIcon() @@ -385,7 +385,7 @@ public class BasicTreeUI /** * Sets the collapsed icon. - * + * * @param newG is the new collapsed icon. */ public void setCollapsedIcon(Icon newG) @@ -395,7 +395,7 @@ public class BasicTreeUI /** * Returns the current collapsed icon. - * + * * @return the current collapsed icon. */ public Icon getCollapsedIcon() @@ -405,7 +405,7 @@ public class BasicTreeUI /** * Updates the componentListener, if necessary. - * + * * @param largeModel sets this.largeModel to it. */ protected void setLargeModel(boolean largeModel) @@ -421,7 +421,7 @@ public class BasicTreeUI /** * Returns true if largeModel is set - * + * * @return true if largeModel is set, otherwise false. */ protected boolean isLargeModel() @@ -431,7 +431,7 @@ public class BasicTreeUI /** * Sets the row height. - * + * * @param rowHeight is the height to set this.rowHeight to. */ protected void setRowHeight(int rowHeight) @@ -444,7 +444,7 @@ public class BasicTreeUI /** * Returns the current row height. - * + * * @return current row height. */ protected int getRowHeight() @@ -455,7 +455,7 @@ public class BasicTreeUI /** * Sets the TreeCellRenderer to <code>tcr</code>. This invokes * <code>updateRenderer</code>. - * + * * @param tcr is the new TreeCellRenderer. */ protected void setCellRenderer(TreeCellRenderer tcr) @@ -469,15 +469,15 @@ public class BasicTreeUI // Refresh the layout if necessary. if (treeState != null) { - treeState.invalidateSizes(); - updateSize(); + treeState.invalidateSizes(); + updateSize(); } } /** * Return currentCellRenderer, which will either be the trees renderer, or * defaultCellRenderer, which ever was not null. - * + * * @return the current Cell Renderer */ protected TreeCellRenderer getCellRenderer() @@ -490,7 +490,7 @@ public class BasicTreeUI /** * Sets the tree's model. - * + * * @param model to set the treeModel to. */ protected void setModel(TreeModel model) @@ -515,7 +515,7 @@ public class BasicTreeUI /** * Returns the tree's model - * + * * @return treeModel */ protected TreeModel getModel() @@ -525,7 +525,7 @@ public class BasicTreeUI /** * Sets the root to being visible. - * + * * @param newValue sets the visibility of the root */ protected void setRootVisible(boolean newValue) @@ -536,7 +536,7 @@ public class BasicTreeUI /** * Returns true if the root is visible. - * + * * @return true if the root is visible. */ protected boolean isRootVisible() @@ -546,7 +546,7 @@ public class BasicTreeUI /** * Determines whether the node handles are to be displayed. - * + * * @param newValue sets whether or not node handles should be displayed. */ protected void setShowsRootHandles(boolean newValue) @@ -562,7 +562,7 @@ public class BasicTreeUI /** * Returns true if the node handles are to be displayed. - * + * * @return true if the node handles are to be displayed. */ protected boolean getShowsRootHandles() @@ -572,7 +572,7 @@ public class BasicTreeUI /** * Sets the cell editor. - * + * * @param editor to set the cellEditor to. */ protected void setCellEditor(TreeCellEditor editor) @@ -582,7 +582,7 @@ public class BasicTreeUI /** * Returns the <code>TreeCellEditor</code> for this tree. - * + * * @return the cellEditor for this tree. */ protected TreeCellEditor getCellEditor() @@ -592,7 +592,7 @@ public class BasicTreeUI /** * Configures the receiver to allow, or not allow, editing. - * + * * @param newValue sets the receiver to allow editing if true. */ protected void setEditable(boolean newValue) @@ -602,7 +602,7 @@ public class BasicTreeUI /** * Returns true if the receiver allows editing. - * + * * @return true if the receiver allows editing. */ protected boolean isEditable() @@ -613,7 +613,7 @@ public class BasicTreeUI /** * Resets the selection model. The appropriate listeners are installed on the * model. - * + * * @param newLSM resets the selection model. */ protected void setSelectionModel(TreeSelectionModel newLSM) @@ -628,7 +628,7 @@ public class BasicTreeUI /** * Returns the current selection model. - * + * * @return the current selection model. */ protected TreeSelectionModel getSelectionModel() @@ -640,7 +640,7 @@ public class BasicTreeUI * Returns the Rectangle enclosing the label portion that the last item in * path will be drawn to. Will return null if any component in path is * currently valid. - * + * * @param tree is the current tree the path will be drawn to. * @param path is the current path the tree to draw to. * @return the Rectangle enclosing the label portion that the last item in the @@ -664,7 +664,7 @@ public class BasicTreeUI /** * Returns the max height of all the nodes in the tree. - * + * * @param tree - the current tree * @return the max height. */ @@ -690,11 +690,11 @@ public class BasicTreeUI maxHeight = Math.max(maxHeight, iconHeight + gap); } - + treeState.setRowHeight(maxHeight); return maxHeight; } - + /** * Get the tree node icon. */ @@ -711,7 +711,7 @@ public class BasicTreeUI /** * Returns the path for passed in row. If row is not visible null is returned. - * + * * @param tree is the current tree to return path for. * @param row is the row number of the row to return. * @return the path for passed in row. If row is not visible null is returned. @@ -724,7 +724,7 @@ public class BasicTreeUI /** * Returns the row that the last item identified in path is visible at. Will * return -1 if any of the elments in the path are not currently visible. - * + * * @param tree is the current tree to return the row for. * @param path is the path used to find the row. * @return the row that the last item identified in path is visible at. Will @@ -738,7 +738,7 @@ public class BasicTreeUI /** * Returns the number of rows that are being displayed. - * + * * @param tree is the current tree to return the number of rows for. * @return the number of rows being displayed. */ @@ -752,7 +752,7 @@ public class BasicTreeUI * currently visible this will return null, otherwise it'll always return a * valid path. If you need to test if the returned object is exactly at x,y * you should get the bounds for the returned path and test x,y against that. - * + * * @param tree the tree to search for the closest path * @param x is the x coordinate of the location to search * @param y is the y coordinate of the location to search @@ -766,7 +766,7 @@ public class BasicTreeUI /** * Returns true if the tree is being edited. The item that is being edited can * be returned by getEditingPath(). - * + * * @param tree is the tree to check for editing. * @return true if the tree is being edited. */ @@ -779,7 +779,7 @@ public class BasicTreeUI * Stops the current editing session. This has no effect if the tree is not * being edited. Returns true if the editor allows the editing session to * stop. - * + * * @param tree is the tree to stop the editing on * @return true if the editor allows the editing session to stop. */ @@ -796,7 +796,7 @@ public class BasicTreeUI /** * Cancels the current editing session. - * + * * @param tree is the tree to cancel the editing session on. */ public void cancelEditing(JTree tree) @@ -811,7 +811,7 @@ public class BasicTreeUI /** * Selects the last item in path and tries to edit it. Editing will fail if * the CellEditor won't allow it for the selected item. - * + * * @param tree is the tree to edit on. * @param path is the path in tree to edit on. */ @@ -824,7 +824,7 @@ public class BasicTreeUI /** * Returns the path to the element that is being editted. - * + * * @param tree is the tree to get the editing path from. * @return the path that is being edited. */ @@ -858,7 +858,7 @@ public class BasicTreeUI updateDepthOffset(); setSelectionModel(tree.getSelectionModel()); configureLayoutCache(); - treeState.setRootVisible(tree.isRootVisible()); + treeState.setRootVisible(tree.isRootVisible()); treeSelectionModel.setRowMapper(treeState); updateSize(); } @@ -887,7 +887,7 @@ public class BasicTreeUI * Creates an instance of NodeDimensions that is able to determine the size of * a given node in the tree. The node dimensions must be created before * configuring the layout cache. - * + * * @return the NodeDimensions of a given node in the tree */ protected AbstractLayoutCache.NodeDimensions createNodeDimensions() @@ -898,7 +898,7 @@ public class BasicTreeUI /** * Creates a listener that is reponsible for the updates the UI based on how * the tree changes. - * + * * @return the PropertyChangeListener that is reposnsible for the updates */ protected PropertyChangeListener createPropertyChangeListener() @@ -909,7 +909,7 @@ public class BasicTreeUI /** * Creates the listener responsible for updating the selection based on mouse * events. - * + * * @return the MouseListener responsible for updating. */ protected MouseListener createMouseListener() @@ -920,7 +920,7 @@ public class BasicTreeUI /** * Creates the listener that is responsible for updating the display when * focus is lost/grained. - * + * * @return the FocusListener responsible for updating. */ protected FocusListener createFocusListener() @@ -930,7 +930,7 @@ public class BasicTreeUI /** * Creates the listener reponsible for getting key events from the tree. - * + * * @return the KeyListener responsible for getting key events. */ protected KeyListener createKeyListener() @@ -941,7 +941,7 @@ public class BasicTreeUI /** * Creates the listener responsible for getting property change events from * the selection model. - * + * * @returns the PropertyChangeListener reponsible for getting property change * events from the selection model. */ @@ -953,7 +953,7 @@ public class BasicTreeUI /** * Creates the listener that updates the display based on selection change * methods. - * + * * @return the TreeSelectionListener responsible for updating. */ protected TreeSelectionListener createTreeSelectionListener() @@ -963,7 +963,7 @@ public class BasicTreeUI /** * Creates a listener to handle events from the current editor - * + * * @return the CellEditorListener that handles events from the current editor */ protected CellEditorListener createCellEditorListener() @@ -975,7 +975,7 @@ public class BasicTreeUI * Creates and returns a new ComponentHandler. This is used for the large * model to mark the validCachedPreferredSize as invalid when the component * moves. - * + * * @return a new ComponentHandler. */ protected ComponentListener createComponentListener() @@ -986,7 +986,7 @@ public class BasicTreeUI /** * Creates and returns the object responsible for updating the treestate when * a nodes expanded state changes. - * + * * @return the TreeExpansionListener responsible for updating the treestate */ protected TreeExpansionListener createTreeExpansionListener() @@ -997,7 +997,7 @@ public class BasicTreeUI /** * Creates the object responsible for managing what is expanded, as well as * the size of nodes. - * + * * @return the object responsible for managing what is expanded. */ protected AbstractLayoutCache createLayoutCache() @@ -1007,7 +1007,7 @@ public class BasicTreeUI /** * Returns the renderer pane that renderer components are placed in. - * + * * @return the rendererpane that render components are placed in. */ protected CellRendererPane createCellRendererPane() @@ -1017,7 +1017,7 @@ public class BasicTreeUI /** * Creates a default cell editor. - * + * * @return the default cell editor. */ protected TreeCellEditor createDefaultCellEditor() @@ -1035,7 +1035,7 @@ public class BasicTreeUI /** * Returns the default cell renderer that is used to do the stamping of each * node. - * + * * @return the default cell renderer that is used to do the stamping of each * node. */ @@ -1046,7 +1046,7 @@ public class BasicTreeUI /** * Returns a listener that can update the tree when the model changes. - * + * * @return a listener that can update the tree when the model changes. */ protected TreeModelListener createTreeModelListener() @@ -1099,7 +1099,7 @@ public class BasicTreeUI /** * The vertical element of legs between nodes starts at the bottom of the * parent node by default. This method makes the leg start below that. - * + * * @return the vertical leg buffer */ protected int getVerticalLegBuffer() @@ -1111,7 +1111,7 @@ public class BasicTreeUI * The horizontal element of legs between nodes starts at the right of the * left-hand side of the child node by default. This method makes the leg end * before that. - * + * * @return the horizontal leg buffer */ protected int getHorizontalLegBuffer() @@ -1133,7 +1133,7 @@ public class BasicTreeUI * Updates the expanded state of all the descendants of the <code>path</code> * by getting the expanded descendants from the tree and forwarding to the * tree state. - * + * * @param path the path used to update the expanded states */ protected void updateExpandedDescendants(TreePath path) @@ -1146,7 +1146,7 @@ public class BasicTreeUI /** * Returns a path to the last child of <code>parent</code> - * + * * @param parent is the topmost path to specified * @return a path to the last child of parent */ @@ -1206,24 +1206,24 @@ public class BasicTreeUI { if (tree != null) { - TreeCellRenderer rend = tree.getCellRenderer(); - if (rend != null) - { - createdRenderer = false; - currentCellRenderer = rend; - if (createdCellEditor) - tree.setCellEditor(null); - } - else - { - tree.setCellRenderer(createDefaultCellRenderer()); - createdRenderer = true; - } + TreeCellRenderer rend = tree.getCellRenderer(); + if (rend != null) + { + createdRenderer = false; + currentCellRenderer = rend; + if (createdCellEditor) + tree.setCellEditor(null); + } + else + { + tree.setCellRenderer(createDefaultCellRenderer()); + createdRenderer = true; + } } else { - currentCellRenderer = null; - createdRenderer = false; + currentCellRenderer = null; + createdRenderer = false; } updateCellEditor(); @@ -1262,7 +1262,7 @@ public class BasicTreeUI /** * Messaged from the VisibleTreeNode after it has been expanded. - * + * * @param path is the path that has been expanded. */ protected void pathWasExpanded(TreePath path) @@ -1289,11 +1289,11 @@ public class BasicTreeUI { LookAndFeel.installColorsAndFont(tree, "Tree.background", "Tree.foreground", "Tree.font"); - + hashColor = UIManager.getColor("Tree.hash"); if (hashColor == null) hashColor = Color.black; - + tree.setOpaque(true); rightChildIndent = UIManager.getInt("Tree.rightChildIndent"); @@ -1383,7 +1383,7 @@ public class BasicTreeUI am.put(action.getValue(Action.NAME), action); action = new TreeTraverseAction(1, "selectChild"); am.put(action.getValue(Action.NAME), action); - + // TreeToggleAction. action = new TreeToggleAction("toggleAndAnchor"); am.put(action.getValue(Action.NAME), action); @@ -1401,20 +1401,20 @@ public class BasicTreeUI am.put(action.getValue(Action.NAME), action); action = new TreePageAction(1, "scrollDownChangeLead"); am.put(action.getValue(Action.NAME), action); - + // Tree editing actions action = new TreeStartEditingAction("startEditing"); am.put(action.getValue(Action.NAME), action); action = new TreeCancelEditingAction("cancel"); am.put(action.getValue(Action.NAME), action); - + return am; } /** * Converts the modifiers. - * + * * @param mod - modifier to convert * @returns the new modifier */ @@ -1492,7 +1492,7 @@ public class BasicTreeUI /** * Install the UI for the component - * + * * @param c the component to install UI for */ public void installUI(JComponent c) @@ -1506,7 +1506,7 @@ public class BasicTreeUI installListeners(); completeUIInstall(); } - + /** * Uninstall the defaults for the tree */ @@ -1519,7 +1519,7 @@ public class BasicTreeUI /** * Uninstall the UI for the component - * + * * @param c the component to uninstall UI for */ public void uninstallUI(JComponent c) @@ -1539,7 +1539,7 @@ public class BasicTreeUI * method is invoked from the ComponentUI.update method when the specified * component is being painted. Subclasses should override this method and use * the specified Graphics object to render the content of the component. - * + * * @param g the Graphics context in which to paint * @param c the component being painted; this argument is often ignored, but * might be used if the UI object is stateless and shared by multiple @@ -1548,9 +1548,9 @@ public class BasicTreeUI public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; - + int rows = treeState.getRowCount(); - + if (rows == 0) // There is nothing to do if the tree is empty. return; @@ -1639,7 +1639,7 @@ public class BasicTreeUI /** * Ensures that the rows identified by beginRow through endRow are visible. - * + * * @param beginRow is the first row * @param endRow is the last row */ @@ -1662,7 +1662,7 @@ public class BasicTreeUI /** * Sets the preferred minimum size. - * + * * @param newSize is the new preferred minimum size. */ public void setPreferredMinSize(Dimension newSize) @@ -1672,7 +1672,7 @@ public class BasicTreeUI /** * Gets the preferred minimum size. - * + * * @returns the preferred minimum size. */ public Dimension getPreferredMinSize() @@ -1686,7 +1686,7 @@ public class BasicTreeUI /** * Returns the preferred size to properly display the tree, this is a cover * method for getPreferredSize(c, false). - * + * * @param c the component whose preferred size is being queried; this argument * is often ignored but might be used if the UI object is stateless * and shared by multiple components @@ -1700,7 +1700,7 @@ public class BasicTreeUI /** * Returns the preferred size to represent the tree in c. If checkConsistancy * is true, checkConsistancy is messaged first. - * + * * @param c the component whose preferred size is being queried. * @param checkConsistancy if true must check consistancy * @return the preferred size @@ -1721,7 +1721,7 @@ public class BasicTreeUI /** * Returns the minimum size for this component. Which will be the min * preferred size or (0,0). - * + * * @param c the component whose min size is being queried. * @returns the preferred size or null */ @@ -1733,7 +1733,7 @@ public class BasicTreeUI /** * Returns the maximum size for the component, which will be the preferred * size if the instance is currently in JTree or (0,0). - * + * * @param c the component whose preferred size is being queried * @return the max size or null */ @@ -1763,7 +1763,7 @@ public class BasicTreeUI * with stopEditing, if messageCancel is true the editor is messaged with * cancelEditing. If messageTree is true, the treeModel is messaged with * valueForPathChanged. - * + * * @param messageStop message to stop editing * @param messageCancel message to cancel editing * @param messageTree message to treeModel @@ -1808,7 +1808,7 @@ public class BasicTreeUI /** * Will start editing for node if there is a cellEditor and shouldSelectCall * returns true. This assumes that path is valid and visible. - * + * * @param path is the path to start editing * @param event is the MouseEvent performed on the path * @return true if successful @@ -1826,7 +1826,7 @@ public class BasicTreeUI { if (ed.isCellEditable(event)) { - editingRow = getRowForPath(tree, path); + editingRow = getRowForPath(tree, path); Object value = path.getLastPathComponent(); boolean isSelected = tree.isPathSelected(path); boolean isExpanded = tree.isExpanded(editingPath); @@ -1852,7 +1852,7 @@ public class BasicTreeUI } else editorHasDifferentSize = false; - + // The editing component must be added to its container. We add the // container, not the editing component itself. tree.add(editingComponent); @@ -1880,7 +1880,7 @@ public class BasicTreeUI if (active != null) { MouseInputHandler ih = new MouseInputHandler(tree, active, event); - + } } @@ -1910,13 +1910,13 @@ public class BasicTreeUI } else if (c.isFocusable()) c.requestFocus(); - + } /** * If the <code>mouseX</code> and <code>mouseY</code> are in the expand or * collapse region of the row, this will toggle the row. - * + * * @param path the path we are concerned with * @param mouseX is the cursor's x position * @param mouseY is the cursor's y position @@ -1932,7 +1932,7 @@ public class BasicTreeUI * Returns true if the <code>mouseX</code> and <code>mouseY</code> fall in * the area of row that is used to expand/collpse the node and the node at row * does not represent a leaf. - * + * * @param path the path we are concerned with * @param mouseX is the cursor's x position * @param mouseY is the cursor's y position @@ -1956,13 +1956,13 @@ public class BasicTreeUI width = 18; Insets i = tree.getInsets(); - + int depth; if (isRootVisible()) depth = path.getPathCount()-1; else depth = path.getPathCount()-2; - + int left = getRowX(tree.getRowForPath(path), depth) - width + i.left; cntlClick = mouseX >= left && mouseX <= left + width; @@ -1973,7 +1973,7 @@ public class BasicTreeUI /** * Messaged when the user clicks the particular row, this invokes * toggleExpandState. - * + * * @param path the path we are concerned with * @param mouseX is the cursor's x position * @param mouseY is the cursor's y position @@ -1988,7 +1988,7 @@ public class BasicTreeUI * expanding a path and JTree scroll on expand, ensureRowsAreVisible is * invoked to scroll as many of the children to visible as possible (tries to * scroll to last visible descendant of path). - * + * * @param path the path we are concerned with */ protected void toggleExpandState(TreePath path) @@ -2006,17 +2006,17 @@ public class BasicTreeUI * event as "toggle selection event" if the CTRL button was pressed while * clicking. The event is not counted as toggle event if the associated * tree does not support the multiple selection. - * + * * @param event is the MouseEvent performed on the row. * @return true signifies a mouse event on the node should toggle the * selection of only the row under the mouse. */ protected boolean isToggleSelectionEvent(MouseEvent event) { - return - (tree.getSelectionModel().getSelectionMode() != + return + (tree.getSelectionModel().getSelectionMode() != TreeSelectionModel.SINGLE_TREE_SELECTION) && - ((event.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0); + ((event.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0); } /** @@ -2025,24 +2025,24 @@ public class BasicTreeUI * event" if the SHIFT button was pressed while clicking. The event is not * counted as multiple selection event if the associated tree does not support * the multiple selection. - * + * * @param event is the MouseEvent performed on the node. * @return true signifies a mouse event on the node should select from the * anchor point. */ protected boolean isMultiSelectEvent(MouseEvent event) { - return - (tree.getSelectionModel().getSelectionMode() != + return + (tree.getSelectionModel().getSelectionMode() != TreeSelectionModel.SINGLE_TREE_SELECTION) && - ((event.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0); + ((event.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0); } /** * Returning true indicates the row under the mouse should be toggled based on * the event. This is invoked after checkForClickInExpandControl, implying the * location is not in the expand (toggle) control. - * + * * @param event is the MouseEvent performed on the row. * @return true indicates the row under the mouse should be toggled based on * the event. @@ -2065,10 +2065,10 @@ public class BasicTreeUI * or deselected. If the event identifies a multi selection event, the * selection is updated from the anchor point. Otherwise, the row is selected, * and the previous selection is cleared.</p> - * + * * @param path is the path selected for an event * @param event is the MouseEvent performed on the path. - * + * * @see #isToggleSelectionEvent(MouseEvent) * @see #isMultiSelectEvent(MouseEvent) */ @@ -2108,7 +2108,7 @@ public class BasicTreeUI /** * Returns true if the node at <code>row</code> is a leaf. - * + * * @param row is the row we are concerned with. * @return true if the node at <code>row</code> is a leaf. */ @@ -2121,7 +2121,7 @@ public class BasicTreeUI Object node = pathForRow.getLastPathComponent(); return treeModel.isLeaf(node); } - + /** * The action to start editing at the current lead selection path. */ @@ -2130,26 +2130,26 @@ public class BasicTreeUI { /** * Creates the new tree cancel editing action. - * + * * @param name the name of the action (used in toString). */ public TreeStartEditingAction(String name) { super(name); - } - + } + /** * Start editing at the current lead selection path. - * + * * @param e the ActionEvent that caused this action. */ public void actionPerformed(ActionEvent e) { TreePath lead = tree.getLeadSelectionPath(); - if (!tree.isEditing()) + if (!tree.isEditing()) tree.startEditingAtPath(lead); } - } + } /** * Updates the preferred size when scrolling, if necessary. @@ -2176,7 +2176,7 @@ public class BasicTreeUI /** * Invoked when the component's position changes. - * + * * @param e the event that occurs when moving the component */ public void componentMoved(ComponentEvent e) @@ -2225,7 +2225,7 @@ public class BasicTreeUI /** * Returns the JScrollPane housing the JTree, or null if one isn't found. - * + * * @return JScrollPane housing the JTree, or null if one isn't found. */ protected JScrollPane getScrollPane() @@ -2242,7 +2242,7 @@ public class BasicTreeUI /** * Public as a result of Timer. If the scrollBar is null, or not adjusting, * this stops the timer and updates the sizing. - * + * * @param ae is the action performed */ public void actionPerformed(ActionEvent ae) @@ -2276,7 +2276,7 @@ public class BasicTreeUI /** * Messaged when editing has stopped in the tree. Tells the listeners * editing has stopped. - * + * * @param e is the notification event */ public void editingStopped(ChangeEvent e) @@ -2287,7 +2287,7 @@ public class BasicTreeUI /** * Messaged when editing has been canceled in the tree. This tells the * listeners the editor has canceled editing. - * + * * @param e is the notification event */ public void editingCanceled(ChangeEvent e) @@ -2315,7 +2315,7 @@ public class BasicTreeUI * row. Invoked when a component gains the keyboard focus. The method * repaints the lead row that is shown differently when the tree is in * focus. - * + * * @param e is the focus event that is activated */ public void focusGained(FocusEvent e) @@ -2328,7 +2328,7 @@ public class BasicTreeUI * row. Invoked when a component loses the keyboard focus. The method * repaints the lead row that is shown differently when the tree is in * focus. - * + * * @param e is the focus event that is deactivated */ public void focusLost(FocusEvent e) @@ -2373,7 +2373,7 @@ public class BasicTreeUI * element whose first letter matches the alphanumeric key pressed by the * user. Subsequent same key presses move the keyboard focus to the next * object that starts with the same letter. - * + * * @param e the key typed */ public void keyTyped(KeyEvent e) @@ -2389,22 +2389,22 @@ public class BasicTreeUI return; } } - + // Not found below, search above: for (int row = 0; row < tree.getLeadSelectionRow(); row++) { if (checkMatch(row, typed)) { tree.setSelectionRow(row); - tree.scrollRowToVisible(row); + tree.scrollRowToVisible(row); return; } } } - + /** * Check if the given tree row starts with this character - * + * * @param row the tree row * @param typed the typed char, must be converted to lowercase * @return true if the given tree row starts with this character @@ -2424,7 +2424,7 @@ public class BasicTreeUI /** * Invoked when a key has been pressed. - * + * * @param e the key pressed */ public void keyPressed(KeyEvent e) @@ -2434,7 +2434,7 @@ public class BasicTreeUI /** * Invoked when a key has been released - * + * * @param e the key released */ public void keyReleased(KeyEvent e) @@ -2451,7 +2451,7 @@ public class BasicTreeUI extends MouseAdapter implements MouseMotionListener { - + /** * If the cell has been selected on mouse press. */ @@ -2467,7 +2467,7 @@ public class BasicTreeUI /** * Invoked when a mouse button has been pressed on a component. - * + * * @param e is the mouse event that occured */ public void mousePressed(MouseEvent e) @@ -2488,7 +2488,7 @@ public class BasicTreeUI * MOUSE_DRAGGED events will continue to be delivered to the component where * the drag originated until the mouse button is released (regardless of * whether the mouse position is within the bounds of the component). - * + * * @param e is the mouse event that occured */ public void mouseDragged(MouseEvent e) @@ -2499,7 +2499,7 @@ public class BasicTreeUI /** * Invoked when the mouse button has been moved on a component (with no * buttons no down). - * + * * @param e the mouse event that occured */ public void mouseMoved(MouseEvent e) @@ -2509,7 +2509,7 @@ public class BasicTreeUI /** * Invoked when a mouse button has been released on a component. - * + * * @param e is the mouse event that occured */ public void mouseReleased(MouseEvent e) @@ -2572,7 +2572,7 @@ public class BasicTreeUI /** * Constructor - * + * * @param source that events are coming from * @param destination that receives all events * @param e is the event received @@ -2590,7 +2590,7 @@ public class BasicTreeUI /** * Invoked when the mouse button has been clicked (pressed and released) on * a component. - * + * * @param e mouse event that occured */ public void mouseClicked(MouseEvent e) @@ -2600,7 +2600,7 @@ public class BasicTreeUI /** * Invoked when a mouse button has been pressed on a component. - * + * * @param e mouse event that occured */ public void mousePressed(MouseEvent e) @@ -2610,7 +2610,7 @@ public class BasicTreeUI /** * Invoked when a mouse button has been released on a component. - * + * * @param e mouse event that occured */ public void mouseReleased(MouseEvent e) @@ -2621,7 +2621,7 @@ public class BasicTreeUI /** * Invoked when the mouse enters a component. - * + * * @param e mouse event that occured */ public void mouseEntered(MouseEvent e) @@ -2632,7 +2632,7 @@ public class BasicTreeUI /** * Invoked when the mouse exits a component. - * + * * @param e mouse event that occured */ public void mouseExited(MouseEvent e) @@ -2646,7 +2646,7 @@ public class BasicTreeUI * MOUSE_DRAGGED events will continue to be delivered to the component where * the drag originated until the mouse button is released (regardless of * whether the mouse position is within the bounds of the component). - * + * * @param e mouse event that occured */ public void mouseDragged(MouseEvent e) @@ -2657,7 +2657,7 @@ public class BasicTreeUI /** * Invoked when the mouse cursor has been moved onto a component but no * buttons have been pushed. - * + * * @param e mouse event that occured */ public void mouseMoved(MouseEvent e) @@ -2716,7 +2716,7 @@ public class BasicTreeUI * The calling method is responsible for determining the Y location. If * bounds is null, a newly created Rectangle should be returned, otherwise * the value should be placed in bounds and returned. - * + * * @param cell the value to be represented * @param row row being queried * @param depth the depth of the row @@ -2762,13 +2762,13 @@ public class BasicTreeUI // FIXME: The y should be handled by the layout cache. size = new Rectangle(getRowX(row, depth), prefSize.height * row, prefSize.width, prefSize.height); - + return size; } /** * Returns the amount to indent the given row - * + * * @return amount to indent the given row. */ protected int getRowX(int row, int depth) @@ -2795,7 +2795,7 @@ public class BasicTreeUI /** * This method gets called when a bound property is changed. - * + * * @param event A PropertyChangeEvent object describing the event source and * the property that has changed. */ @@ -2826,7 +2826,7 @@ public class BasicTreeUI } else if (property.equals(JTree.EDITABLE_PROPERTY)) setEditable(((Boolean) event.getNewValue()).booleanValue()); - + } } @@ -2848,7 +2848,7 @@ public class BasicTreeUI /** * This method gets called when a bound property is changed. - * + * * @param event A PropertyChangeEvent object describing the event source and * the property that has changed. */ @@ -2866,7 +2866,7 @@ public class BasicTreeUI { /** * Creates the new tree cancel editing action. - * + * * @param name the name of the action (used in toString). */ public TreeCancelEditingAction(String name) @@ -2876,8 +2876,8 @@ public class BasicTreeUI /** * Invoked when an action occurs, cancels the cell editing (if the - * tree cell is being edited). - * + * tree cell is being edited). + * * @param e event that occured */ public void actionPerformed(ActionEvent e) @@ -2904,7 +2904,7 @@ public class BasicTreeUI /** * Called whenever an item in the tree has been expanded. - * + * * @param event is the event that occured */ public void treeExpanded(TreeExpansionEvent event) @@ -2919,7 +2919,7 @@ public class BasicTreeUI /** * Called whenever an item in the tree has been collapsed. - * + * * @param event is the event that occured */ public void treeCollapsed(TreeExpansionEvent event) @@ -2947,7 +2947,7 @@ public class BasicTreeUI /** * Creates a new TreeHomeAction instance. - * + * * @param dir the direction to go to, <code>-1</code> for home, * <code>1</code> for end * @param name the name of the action @@ -2960,7 +2960,7 @@ public class BasicTreeUI /** * Invoked when an action occurs. - * + * * @param e is the event that occured */ public void actionPerformed(ActionEvent e) @@ -3027,7 +3027,7 @@ public class BasicTreeUI /** * Returns true if the action is enabled. - * + * * @return true if the action is enabled. */ public boolean isEnabled() @@ -3051,7 +3051,7 @@ public class BasicTreeUI /** * Creates a new TreeIncrementAction. - * + * * @param dir up or down, <code>-1</code> for up, <code>1</code> for down * @param name is the name of the direction */ @@ -3063,7 +3063,7 @@ public class BasicTreeUI /** * Invoked when an action occurs. - * + * * @param e is the event that occured */ public void actionPerformed(ActionEvent e) @@ -3138,14 +3138,14 @@ public class BasicTreeUI tree.setAnchorSelectionPath(newPath); tree.setLeadSelectionPath(newPath); } - + // Ensure that the lead path is visible after the increment action. tree.scrollPathToVisible(tree.getLeadSelectionPath()); } /** * Returns true if the action is enabled. - * + * * @return true if the action is enabled. */ public boolean isEnabled() @@ -3177,7 +3177,7 @@ public class BasicTreeUI * children will be null. Use e.getPath() to get the parent of the changed * node(s). e.getChildIndices() returns the index(es) of the changed * node(s). - * + * * @param e is the event that occured */ public void treeNodesChanged(TreeModelEvent e) @@ -3191,7 +3191,7 @@ public class BasicTreeUI * Invoked after nodes have been inserted into the tree. Use e.getPath() to * get the parent of the new node(s). e.getChildIndices() returns the * index(es) of the new node(s) in ascending order. - * + * * @param e is the event that occured */ public void treeNodesInserted(TreeModelEvent e) @@ -3208,7 +3208,7 @@ public class BasicTreeUI * siblings removed. Use e.getPath() to get the former parent of the deleted * node(s). e.getChildIndices() returns, in ascending order, the index(es) * the node(s) had before being deleted. - * + * * @param e is the event that occured */ public void treeNodesRemoved(TreeModelEvent e) @@ -3224,7 +3224,7 @@ public class BasicTreeUI * first element does not identify the current root node the first element * should become the new root of the tree. Use e.getPath() to get the path * to the node. e.getChildIndices() returns null. - * + * * @param e is the event that occured */ public void treeStructureChanged(TreeModelEvent e) @@ -3249,7 +3249,7 @@ public class BasicTreeUI /** * Constructor - * + * * @param direction up or down * @param name is the name of the direction */ @@ -3261,7 +3261,7 @@ public class BasicTreeUI /** * Invoked when an action occurs. - * + * * @param e is the event that occured */ public void actionPerformed(ActionEvent e) @@ -3358,7 +3358,7 @@ public class BasicTreeUI /** * Returns true if the action is enabled. - * + * * @return true if the action is enabled. */ public boolean isEnabled() @@ -3385,7 +3385,7 @@ public class BasicTreeUI /** * Messaged when the selection changes in the tree we're displaying for. * Stops editing, messages super and displays the changed paths. - * + * * @param event the event that characterizes the change. */ public void valueChanged(TreeSelectionEvent event) @@ -3394,15 +3394,15 @@ public class BasicTreeUI TreePath op = event.getOldLeadSelectionPath(); TreePath np = event.getNewLeadSelectionPath(); - + // Repaint of the changed lead selection path. if (op != np) { - Rectangle o = treeState.getBounds(event.getOldLeadSelectionPath(), + Rectangle o = treeState.getBounds(event.getOldLeadSelectionPath(), new Rectangle()); - Rectangle n = treeState.getBounds(event.getNewLeadSelectionPath(), + Rectangle n = treeState.getBounds(event.getNewLeadSelectionPath(), new Rectangle()); - + if (o != null) tree.repaint(o); if (n != null) @@ -3419,7 +3419,7 @@ public class BasicTreeUI { /** * Creates a new TreeToggleAction. - * + * * @param name is the name of <code>Action</code> field */ public TreeToggleAction(String name) @@ -3429,7 +3429,7 @@ public class BasicTreeUI /** * Invoked when an action occurs. - * + * * @param e the event that occured */ public void actionPerformed(ActionEvent e) @@ -3452,7 +3452,7 @@ public class BasicTreeUI /** * Returns true if the action is enabled. - * + * * @return true if the action is enabled, false otherwise */ public boolean isEnabled() @@ -3475,7 +3475,7 @@ public class BasicTreeUI /** * Constructor - * + * * @param direction to traverse * @param name is the name of the direction */ @@ -3487,7 +3487,7 @@ public class BasicTreeUI /** * Invoked when an action occurs. - * + * * @param e the event that occured */ public void actionPerformed(ActionEvent e) @@ -3512,7 +3512,7 @@ public class BasicTreeUI // we just select the parent. We do not select the root if it // is not visible. TreePath parent = current.getParentPath(); - if (parent != null && + if (parent != null && ! (parent.getPathCount() == 1 && ! tree.isRootVisible())) tree.setSelectionPath(parent); } @@ -3534,14 +3534,14 @@ public class BasicTreeUI tree.expandPath(current); } } - + // Ensure that the lead path is visible after the increment action. tree.scrollPathToVisible(tree.getLeadSelectionPath()); } /** * Returns true if the action is enabled. - * + * * @return true if the action is enabled, false otherwise */ public boolean isEnabled() @@ -3553,7 +3553,7 @@ public class BasicTreeUI /** * Returns true if the LookAndFeel implements the control icons. Package * private for use in inner classes. - * + * * @returns true if there are control icons */ boolean hasControlIcons() @@ -3566,7 +3566,7 @@ public class BasicTreeUI /** * Returns control icon. It is null if the LookAndFeel does not implements the * control icons. Package private for use in inner classes. - * + * * @return control icon if it exists. */ Icon getCurrentControlIcon(TreePath path) @@ -3604,7 +3604,7 @@ public class BasicTreeUI /** * Returns the parent of the current node - * + * * @param root is the root of the tree * @param node is the current node * @return is the parent of the current node @@ -3621,7 +3621,7 @@ public class BasicTreeUI /** * Recursively checks the tree for the specified node, starting at the root. - * + * * @param root is starting node to start searching at. * @param node is the node to search for * @return the parent node of node @@ -3648,7 +3648,7 @@ public class BasicTreeUI /** * Selects the specified path in the tree depending on modes. Package private * for use in inner classes. - * + * * @param tree is the tree we are selecting the path in * @param path is the path we are selecting */ @@ -3657,7 +3657,7 @@ public class BasicTreeUI if (path != null) { tree.setSelectionPath(path); - tree.setLeadSelectionPath(path); + tree.setLeadSelectionPath(path); tree.makeVisible(path); tree.scrollPathToVisible(path); } @@ -3666,7 +3666,7 @@ public class BasicTreeUI /** * Returns the path from node to the root. Package private for use in inner * classes. - * + * * @param node the node to get the path to * @param depth the depth of the tree to return a path for * @return an array of tree nodes that represent the path to node. @@ -3689,7 +3689,7 @@ public class BasicTreeUI /** * Draws a vertical line using the given graphic context - * + * * @param g is the graphic context * @param c is the component the new line will belong to * @param x is the horizonal position @@ -3706,7 +3706,7 @@ public class BasicTreeUI /** * Draws a horizontal line using the given graphic context - * + * * @param g is the graphic context * @param c is the component the new line will belong to * @param y is the vertical position @@ -3723,7 +3723,7 @@ public class BasicTreeUI /** * Draws an icon at around a specific position - * + * * @param c is the component the new line will belong to * @param g is the graphic context * @param icon is the icon which will be drawn @@ -3745,7 +3745,7 @@ public class BasicTreeUI /** * Draws a dashed horizontal line. - * + * * @param g - the graphics configuration. * @param y - the y location to start drawing at * @param x1 - the x location to start drawing at @@ -3760,7 +3760,7 @@ public class BasicTreeUI /** * Draws a dashed vertical line. - * + * * @param g - the graphics configuration. * @param x - the x location to start drawing at * @param y1 - the y location to start drawing at @@ -3776,7 +3776,7 @@ public class BasicTreeUI /** * Paints the expand (toggle) part of a row. The receiver should NOT modify * clipBounds, or insets. - * + * * @param g - the graphics configuration * @param clipBounds - * @param insets - @@ -3806,7 +3806,7 @@ public class BasicTreeUI * Paints the horizontal part of the leg. The receiver should NOT modify * clipBounds, or insets. NOTE: parentRow can be -1 if the root is not * visible. - * + * * @param g - the graphics configuration * @param clipBounds - * @param insets - @@ -3834,7 +3834,7 @@ public class BasicTreeUI /** * Paints the vertical part of the leg. The receiver should NOT modify * clipBounds, insets. - * + * * @param g - the graphics configuration. * @param clipBounds - * @param insets - @@ -3845,7 +3845,7 @@ public class BasicTreeUI { Rectangle bounds = getPathBounds(tree, path); TreePath parent = path.getParentPath(); - + boolean paintLine; if (isRootVisible()) paintLine = parent != null; @@ -3854,7 +3854,7 @@ public class BasicTreeUI if (paintLine) { Rectangle parentBounds = getPathBounds(tree, parent); - paintVerticalLine(g, tree, parentBounds.x + 2 * gap, + paintVerticalLine(g, tree, parentBounds.x + 2 * gap, parentBounds.y + parentBounds.height / 2, bounds.y + bounds.height / 2); } @@ -3863,7 +3863,7 @@ public class BasicTreeUI /** * Paints the renderer part of a row. The receiver should NOT modify * clipBounds, or insets. - * + * * @param g - the graphics configuration * @param clipBounds - * @param insets - @@ -3911,7 +3911,7 @@ public class BasicTreeUI /** * Returns true if the expand (toggle) control should be drawn for the * specified row. - * + * * @param path - current path to check for. * @param row - current row to check for. * @param isExpanded - true if the path is expanded @@ -3929,7 +3929,7 @@ public class BasicTreeUI /** * Returns the amount to indent the given row - * + * * @return amount to indent the given row. */ protected int getRowX(int row, int depth) diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java index 51b902d6443..11c7d639084 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java @@ -43,7 +43,7 @@ import javax.swing.LookAndFeel; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ViewportUI; -public class BasicViewportUI extends ViewportUI +public class BasicViewportUI extends ViewportUI { protected void installDefaults(JComponent c) { @@ -61,13 +61,13 @@ public class BasicViewportUI extends ViewportUI return new BasicViewportUI(); } - public void installUI(JComponent c) + public void installUI(JComponent c) { super.installUI(c); installDefaults(c); } - public void uninstallUI(JComponent c) + public void uninstallUI(JComponent c) { super.uninstallUI(c); uninstallDefaults(c); |