8352638: Enhance code consistency: java.desktop/windows

Reviewed-by: prr
This commit is contained in:
Sergey Bylokhov 2025-04-22 15:50:58 +00:00
parent a4c5ed8144
commit 477da161e6
109 changed files with 743 additions and 200 deletions

View File

@ -62,7 +62,7 @@ import sun.awt.AppContext;
*
* @author Igor Kushnirskiy
*/
class AnimationController implements ActionListener, PropertyChangeListener {
final class AnimationController implements ActionListener, PropertyChangeListener {
private static final boolean VISTA_ANIMATION_DISABLED =
Boolean.getBoolean("swing.disablevistaanimation");
@ -253,6 +253,7 @@ class AnimationController implements ActionListener, PropertyChangeListener {
}
}
@Override
public synchronized void propertyChange(PropertyChangeEvent e) {
if ("lookAndFeel" == e.getPropertyName()
&& ! (e.getNewValue() instanceof WindowsLookAndFeel) ) {
@ -260,6 +261,7 @@ class AnimationController implements ActionListener, PropertyChangeListener {
}
}
@Override
public synchronized void actionPerformed(ActionEvent e) {
java.util.List<JComponent> componentsToRemove = null;
java.util.List<Part> partsToRemove = null;
@ -319,7 +321,7 @@ class AnimationController implements ActionListener, PropertyChangeListener {
}
}
private static class AnimationState {
private static final class AnimationState {
private final State startState;
//animation duration in nanoseconds
@ -407,7 +409,7 @@ class AnimationController implements ActionListener, PropertyChangeListener {
}
}
private static class PartUIClientPropertyKey
private static final class PartUIClientPropertyKey
implements UIClientPropertyKey {
private static final Map<Part, PartUIClientPropertyKey> map =
@ -426,6 +428,7 @@ class AnimationController implements ActionListener, PropertyChangeListener {
private PartUIClientPropertyKey(Part part) {
this.part = part;
}
@Override
public String toString() {
return part.toString();
}

View File

@ -221,6 +221,7 @@ public final class TMSchema {
return str + control.toString();
}
@Override
public String toString() {
return control.toString()+"."+name();
}
@ -531,6 +532,7 @@ public final class TMSchema {
return value;
}
@Override
public String toString() {
return name()+"["+type.getName()+"] = "+value;
}
@ -559,6 +561,7 @@ public final class TMSchema {
private final String enumName;
private final int value;
@Override
public String toString() {
return prop+"="+enumName+"="+value;
}

View File

@ -43,7 +43,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
* @author Rich Schiavi
*/
public class WindowsBorders {
public final class WindowsBorders {
/**
* Returns a border instance for a Windows Progress Bar
@ -115,7 +115,7 @@ public class WindowsBorders {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class ProgressBarBorder extends AbstractBorder implements UIResource {
public static final class ProgressBarBorder extends AbstractBorder implements UIResource {
protected Color shadow;
protected Color highlight;
@ -124,6 +124,7 @@ public class WindowsBorders {
this.shadow = shadow;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y,
int width, int height) {
g.setColor(shadow);
@ -134,6 +135,7 @@ public class WindowsBorders {
g.drawLine(width-1,y, width-1,height-1); // draw right
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
insets.set(1,1,1,1);
return insets;
@ -146,7 +148,7 @@ public class WindowsBorders {
* @since 1.4
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants {
public static final class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants {
protected Color shadow;
protected Color highlight;
@ -155,6 +157,7 @@ public class WindowsBorders {
this.shadow = shadow;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y,
int width, int height) {
if (!(c instanceof JToolBar)) {
@ -224,6 +227,7 @@ public class WindowsBorders {
g.translate(-x, -y);
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
insets.set(1,1,1,1);
if (!(c instanceof JToolBar)) {
@ -259,6 +263,7 @@ public class WindowsBorders {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Color oldColor = g.getColor();
int i;
@ -276,7 +281,7 @@ public class WindowsBorders {
* of the component's background color.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
static class ComplementDashedBorder extends LineBorder implements UIResource {
static final class ComplementDashedBorder extends LineBorder implements UIResource {
private Color origColor;
private Color paintColor;
@ -284,6 +289,7 @@ public class WindowsBorders {
super(null);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Color color = c.getBackground();
@ -302,7 +308,7 @@ public class WindowsBorders {
* @since 1.4
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class InternalFrameLineBorder extends LineBorder implements
public static final class InternalFrameLineBorder extends LineBorder implements
UIResource {
protected Color activeColor;
protected Color inactiveColor;
@ -315,6 +321,7 @@ public class WindowsBorders {
inactiveColor = inactiveBorderColor;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y,
int width, int height) {

View File

@ -58,7 +58,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
*
* @author Jeff Dinkins
*/
public class WindowsButtonUI extends BasicButtonUI
public final class WindowsButtonUI extends BasicButtonUI
{
protected int dashedRectGapX;
protected int dashedRectGapY;
@ -89,6 +89,7 @@ public class WindowsButtonUI extends BasicButtonUI
// ********************************
// Defaults
// ********************************
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
@ -108,6 +109,7 @@ public class WindowsButtonUI extends BasicButtonUI
}
}
@Override
protected void uninstallDefaults(AbstractButton b) {
super.uninstallDefaults(b);
defaults_initialized = false;
@ -124,10 +126,12 @@ public class WindowsButtonUI extends BasicButtonUI
/**
* Overridden method to render the text without the mnemonic
*/
@Override
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
WindowsGraphicsUtils.paintText(g, b, textRect, text, getTextShiftOffset());
}
@Override
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){
// focus painted same color as text on Basic??
@ -138,6 +142,7 @@ public class WindowsButtonUI extends BasicButtonUI
width - dashedRectGapWidth, height - dashedRectGapHeight);
}
@Override
protected void paintButtonPressed(Graphics g, AbstractButton b){
setTextShiftOffset();
}
@ -145,6 +150,7 @@ public class WindowsButtonUI extends BasicButtonUI
// ********************************
// Layout Methods
// ********************************
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension d = super.getPreferredSize(c);
@ -167,6 +173,7 @@ public class WindowsButtonUI extends BasicButtonUI
*/
private Rectangle viewRect = new Rectangle();
@Override
public void paint(Graphics g, JComponent c) {
if (XPStyle.getXP() != null) {
WindowsButtonUI.paintXPButtonBackground(g, c);

View File

@ -41,11 +41,12 @@ import com.sun.java.swing.plaf.windows.TMSchema.State;
/**
* Windows check box menu item.
*/
public class WindowsCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
public final class WindowsCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
final WindowsMenuItemUIAccessor accessor =
new WindowsMenuItemUIAccessor() {
@Override
public JMenuItem getMenuItem() {
return menuItem;
}
@ -54,6 +55,7 @@ public class WindowsCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
return WindowsMenuItemUI.getState(this, menuItem);
}
@Override
public Part getPart(JMenuItem menuItem) {
return WindowsMenuItemUI.getPart(this, menuItem);
}
@ -80,6 +82,7 @@ public class WindowsCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
* @param text String to render
* @since 1.4
*/
@Override
protected void paintText(Graphics g, JMenuItem menuItem,
Rectangle textRect, String text) {
if (WindowsMenuItemUI.isVistaPainting()) {

View File

@ -37,7 +37,7 @@ import sun.awt.AppContext;
*
* @author Jeff Dinkins
*/
public class WindowsCheckBoxUI extends WindowsRadioButtonUI
public final class WindowsCheckBoxUI extends WindowsRadioButtonUI
{
// NOTE: WindowsCheckBoxUI inherits from WindowsRadioButtonUI instead
// of BasicCheckBoxUI because we want to pick up all the
@ -64,6 +64,7 @@ public class WindowsCheckBoxUI extends WindowsRadioButtonUI
}
@Override
public String getPropertyPrefix() {
return propertyPrefix;
}
@ -71,6 +72,7 @@ public class WindowsCheckBoxUI extends WindowsRadioButtonUI
// ********************************
// Defaults
// ********************************
@Override
public void installDefaults(AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
@ -79,6 +81,7 @@ public class WindowsCheckBoxUI extends WindowsRadioButtonUI
}
}
@Override
public void uninstallDefaults(AbstractButton b) {
super.uninstallDefaults(b);
defaults_initialized = false;

View File

@ -31,7 +31,8 @@ package com.sun.java.swing.plaf.windows;
* @since 1.5
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class WindowsClassicLookAndFeel extends WindowsLookAndFeel {
public final class WindowsClassicLookAndFeel extends WindowsLookAndFeel {
@Override
public String getName() {
return "Windows Classic";
}

View File

@ -75,7 +75,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
* @author Tom Santos
* @author Igor Kushnirskiy
*/
public class WindowsComboBoxUI extends BasicComboBoxUI {
public final class WindowsComboBoxUI extends BasicComboBoxUI {
private static final MouseListener rolloverListener =
new MouseAdapter() {
@ -162,6 +162,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
return new WindowsComboBoxUI();
}
@Override
public void installUI( JComponent c ) {
super.installUI( c );
isRollover = false;
@ -176,6 +177,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
}
}
@Override
public void uninstallUI(JComponent c ) {
comboBox.removeMouseListener(rolloverListener);
if(arrowButton != null) {
@ -215,6 +217,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* {@inheritDoc}
* @since 1.6
*/
@Override
protected void configureEditor() {
super.configureEditor();
if (XPStyle.getXP() != null) {
@ -226,6 +229,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* {@inheritDoc}
* @since 1.6
*/
@Override
protected void unconfigureEditor() {
super.unconfigureEditor();
editor.removeMouseListener(rolloverListener);
@ -235,6 +239,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* {@inheritDoc}
* @since 1.6
*/
@Override
public void paint(Graphics g, JComponent c) {
if (XPStyle.getXP() != null) {
paintXPComboBoxBackground(g, c);
@ -283,6 +288,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* @throws NullPointerException if any of the arguments are null.
* @since 1.5
*/
@Override
public void paintCurrentValue(Graphics g, Rectangle bounds,
boolean hasFocus) {
XPStyle xp = XPStyle.getXP();
@ -347,6 +353,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* {@inheritDoc}
* @since 1.6
*/
@Override
public void paintCurrentValueBackground(Graphics g, Rectangle bounds,
boolean hasFocus) {
if (XPStyle.getXP() == null) {
@ -354,6 +361,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
}
}
@Override
public Dimension getMinimumSize( JComponent c ) {
Dimension d = super.getMinimumSize(c);
if (XPStyle.getXP() != null) {
@ -380,6 +388,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
*
* @return an instance of a layout manager
*/
@Override
protected LayoutManager createLayoutManager() {
return new BasicComboBoxUI.ComboBoxLayoutManager() {
public void layoutContainer(Container parent) {
@ -407,10 +416,12 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
};
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
}
@Override
protected ComboPopup createPopup() {
return new WinComboPopUp(comboBox);
}
@ -423,6 +434,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* @return a <code>ComboBoxEditor</code> used for the combo box
* @see javax.swing.JComboBox#setEditor
*/
@Override
protected ComboBoxEditor createEditor() {
return new WindowsComboBoxEditor();
}
@ -447,6 +459,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
*
* @return a button which represents the popup control
*/
@Override
protected JButton createArrowButton() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -457,7 +470,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class XPComboBoxButton extends XPStyle.GlyphButton {
private final class XPComboBoxButton extends XPStyle.GlyphButton {
private State prevState = null;
public XPComboBoxButton(XPStyle xp) {
@ -504,6 +517,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
return rv;
}
@Override
public Dimension getPreferredSize() {
return new Dimension(17, 21);
}
@ -518,7 +532,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
}
@SuppressWarnings("serial") // Same-version serialization only
protected class WinComboPopUp extends BasicComboPopup {
protected final class WinComboPopUp extends BasicComboPopup {
private Skin listBoxBorder = null;
private XPStyle xp;
@ -531,16 +545,18 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
}
}
@Override
protected KeyListener createKeyListener() {
return new InvocationKeyHandler();
}
protected class InvocationKeyHandler extends BasicComboPopup.InvocationKeyHandler {
protected final class InvocationKeyHandler extends BasicComboPopup.InvocationKeyHandler {
protected InvocationKeyHandler() {
WinComboPopUp.this.super();
}
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (this.listBoxBorder != null) {
@ -554,13 +570,14 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
/**
* Subclassed to highlight selected item in an editable combo box.
*/
public static class WindowsComboBoxEditor
public static final class WindowsComboBoxEditor
extends BasicComboBoxEditor.UIResource {
/**
* {@inheritDoc}
* @since 1.6
*/
@Override
protected JTextField createEditorComponent() {
JTextField editor = super.createEditorComponent();
Border border = (Border)UIManager.get("ComboBox.editorBorder");
@ -572,6 +589,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
return editor;
}
@Override
public void setItem(Object item) {
super.setItem(item);
Object focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
@ -586,14 +604,14 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
* and to show border for focused cells.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
private static class WindowsComboBoxRenderer
private static final class WindowsComboBoxRenderer
extends BasicComboBoxRenderer.UIResource {
private static final Object BORDER_KEY
= new StringUIClientPropertyKey("BORDER_KEY");
private static final Border NULL_BORDER = new EmptyBorder(0, 0, 0, 0);
// Create own version of DashedBorder with more space on left side
private static class WindowsComboBoxDashedBorder extends DashedBorder {
private static final class WindowsComboBoxDashedBorder extends DashedBorder {
public WindowsComboBoxDashedBorder(Color color, int thickness) {
super(color, thickness);

View File

@ -36,18 +36,20 @@ import javax.swing.plaf.basic.BasicDesktopIconUI;
/**
* Windows icon for a minimized window on the desktop.
*/
public class WindowsDesktopIconUI extends BasicDesktopIconUI {
public final class WindowsDesktopIconUI extends BasicDesktopIconUI {
private int width;
public static ComponentUI createUI(JComponent c) {
return new WindowsDesktopIconUI();
}
@Override
public void installDefaults() {
super.installDefaults();
width = UIManager.getInt("DesktopIcon.width");
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
@ -55,6 +57,7 @@ public class WindowsDesktopIconUI extends BasicDesktopIconUI {
}
// Uninstall the listeners added by the WindowsInternalFrameTitlePane
@Override
public void uninstallUI(JComponent c) {
WindowsInternalFrameTitlePane thePane =
(WindowsInternalFrameTitlePane)iconPane;
@ -62,6 +65,7 @@ public class WindowsDesktopIconUI extends BasicDesktopIconUI {
thePane.uninstallListeners();
}
@Override
protected void installComponents() {
iconPane = new WindowsInternalFrameTitlePane(frame);
desktopIcon.setLayout(new BorderLayout());
@ -72,6 +76,7 @@ public class WindowsDesktopIconUI extends BasicDesktopIconUI {
}
}
@Override
public Dimension getPreferredSize(JComponent c) {
// Windows desktop icons can not be resized. Therefore, we should
// always return the minimum size of the desktop icon. See
@ -83,6 +88,7 @@ public class WindowsDesktopIconUI extends BasicDesktopIconUI {
* Windows desktop icons are restricted to a width of 160 pixels by
* default. This value is retrieved by the DesktopIcon.width property.
*/
@Override
public Dimension getMinimumSize(JComponent c) {
Dimension dim = super.getMinimumSize(c);
dim.width = width;

View File

@ -52,7 +52,7 @@ import java.lang.ref.WeakReference;
* @author Thomas Ball
*/
@SuppressWarnings("serial") // JDK-implementation class
public class WindowsDesktopManager extends DefaultDesktopManager
public final class WindowsDesktopManager extends DefaultDesktopManager
implements java.io.Serializable, javax.swing.plaf.UIResource {
/* The frame which is currently selected/activated.
@ -60,6 +60,7 @@ public class WindowsDesktopManager extends DefaultDesktopManager
*/
private WeakReference<JInternalFrame> currentFrameRef;
@Override
public void activateFrame(JInternalFrame f) {
JInternalFrame currentFrame = currentFrameRef != null ?
currentFrameRef.get() : null;

View File

@ -34,12 +34,13 @@ import javax.swing.plaf.basic.BasicDesktopPaneUI;
*
* @author David Kloba
*/
public class WindowsDesktopPaneUI extends BasicDesktopPaneUI
public final class WindowsDesktopPaneUI extends BasicDesktopPaneUI
{
public static ComponentUI createUI(JComponent c) {
return new WindowsDesktopPaneUI();
}
@Override
protected void installDesktopManager() {
desktopManager = desktop.getDesktopManager();
if(desktopManager == null) {
@ -48,10 +49,12 @@ public class WindowsDesktopPaneUI extends BasicDesktopPaneUI
}
}
@Override
protected void installDefaults() {
super.installDefaults();
}
@Override
@SuppressWarnings("deprecation")
protected void installKeyboardActions() {
super.installKeyboardActions();

View File

@ -33,7 +33,7 @@ import javax.swing.text.Caret;
/**
* Windows rendition of the component.
*/
public class WindowsEditorPaneUI extends BasicEditorPaneUI
public final class WindowsEditorPaneUI extends BasicEditorPaneUI
{
/**
@ -54,6 +54,7 @@ public class WindowsEditorPaneUI extends BasicEditorPaneUI
*
* @return the caret object
*/
@Override
protected Caret createCaret() {
return new WindowsTextUI.WindowsCaret();
}

View File

@ -101,7 +101,7 @@ import sun.swing.WindowsPlacesBar;
*
* @author Jeff Dinkins
*/
public class WindowsFileChooserUI extends BasicFileChooserUI {
public final class WindowsFileChooserUI extends BasicFileChooserUI {
// The following are private because the implementation of the
// Windows FileChooser L&F is not complete yet.
@ -194,61 +194,75 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
super(filechooser);
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
}
@Override
public void uninstallComponents(JFileChooser fc) {
fc.removeAll();
}
private class WindowsFileChooserUIAccessor implements FilePane.FileChooserUIAccessor {
private final class WindowsFileChooserUIAccessor implements FilePane.FileChooserUIAccessor {
@Override
public JFileChooser getFileChooser() {
return WindowsFileChooserUI.this.getFileChooser();
}
@Override
public BasicDirectoryModel getModel() {
return WindowsFileChooserUI.this.getModel();
}
@Override
public JPanel createList() {
return WindowsFileChooserUI.this.createList(getFileChooser());
}
@Override
public JPanel createDetailsView() {
return WindowsFileChooserUI.this.createDetailsView(getFileChooser());
}
@Override
public boolean isDirectorySelected() {
return WindowsFileChooserUI.this.isDirectorySelected();
}
@Override
public File getDirectory() {
return WindowsFileChooserUI.this.getDirectory();
}
@Override
public Action getChangeToParentDirectoryAction() {
return WindowsFileChooserUI.this.getChangeToParentDirectoryAction();
}
@Override
public Action getApproveSelectionAction() {
return WindowsFileChooserUI.this.getApproveSelectionAction();
}
@Override
public Action getNewFolderAction() {
return WindowsFileChooserUI.this.getNewFolderAction();
}
@Override
public MouseListener createDoubleClickListener(JList<?> list) {
return WindowsFileChooserUI.this.createDoubleClickListener(getFileChooser(),
list);
}
@Override
public ListSelectionListener createListSelectionListener() {
return WindowsFileChooserUI.this.createListSelectionListener(getFileChooser());
}
}
@Override
public void installComponents(JFileChooser fc) {
filePane = new FilePane(new WindowsFileChooserUIAccessor());
fc.addPropertyChangeListener(filePane);
@ -584,6 +598,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
return bottomPanel;
}
@Override
protected void installStrings(JFileChooser fc) {
super.installStrings(fc);
@ -615,6 +630,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
return SwingUtilities2.getUIDefaultsInt(key, l);
}
@Override
protected void installListeners(JFileChooser fc) {
super.installListeners(fc);
ActionMap actionMap = getActionMap();
@ -645,10 +661,12 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* @param fc a <code>JFileChooser</code>
* @return a <code>ListSelectionListener</code>
*/
@Override
public ListSelectionListener createListSelectionListener(JFileChooser fc) {
return super.createListSelectionListener(fc);
}
@Override
public void uninstallUI(JComponent c) {
// Remove listeners
c.removePropertyChangeListener(filterComboBoxModel);
@ -859,6 +877,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* Listen for filechooser property changes, such as
* the selected file changing, or the type of the dialog changing.
*/
@Override
public PropertyChangeListener createPropertyChangeListener(JFileChooser fc) {
return new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
@ -913,14 +932,17 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
getBottomPanel().add(getButtonPanel());
}
@Override
public void ensureFileIsVisible(JFileChooser fc, File f) {
filePane.ensureFileIsVisible(fc, f);
}
@Override
public void rescanCurrentDirectory(JFileChooser fc) {
filePane.rescanCurrentDirectory();
}
@Override
public String getFileName() {
if(filenameTextField != null) {
return filenameTextField.getText();
@ -929,6 +951,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
@Override
public void setFileName(String filename) {
if(filenameTextField != null) {
filenameTextField.setText(filename);
@ -942,6 +965,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* @param directorySelected if a directory is currently selected.
* @since 1.4
*/
@Override
protected void setDirectorySelected(boolean directorySelected) {
super.setDirectorySelected(directorySelected);
JFileChooser chooser = getFileChooser();
@ -956,11 +980,13 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
@Override
public String getDirectoryName() {
// PENDING(jeff) - get the name from the directory combobox
return null;
}
@Override
public void setDirectoryName(String dirname) {
// PENDING(jeff) - set the name in the directory combobox
}
@ -1032,8 +1058,9 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
// Renderer for DirectoryComboBox
//
@SuppressWarnings("serial") // Superclass is not serializable across versions
class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
final class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
IndentIcon ii = new IndentIcon();
@Override
public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
@ -1056,11 +1083,12 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
static final int space = 10;
static class IndentIcon implements Icon {
static final class IndentIcon implements Icon {
Icon icon = null;
int depth = 0;
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (c.getComponentOrientation().isLeftToRight()) {
icon.paintIcon(c, g, x+depth*space, y);
@ -1069,10 +1097,12 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
@Override
public int getIconWidth() {
return icon.getIconWidth() + depth*space;
}
@Override
public int getIconHeight() {
return icon.getIconHeight();
}
@ -1090,7 +1120,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* Data model for a type-face selection combo-box.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
protected final class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
Vector<File> directories = new Vector<File>();
int[] depths = null;
File selectedDirectory = null;
@ -1187,19 +1217,23 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
return (depths != null && i >= 0 && i < depths.length) ? depths[i] : 0;
}
@Override
public void setSelectedItem(Object selectedDirectory) {
this.selectedDirectory = (File)selectedDirectory;
fireContentsChanged(this, -1, -1);
}
@Override
public Object getSelectedItem() {
return selectedDirectory;
}
@Override
public int getSize() {
return directories.size();
}
@Override
public File getElementAt(int index) {
return directories.elementAt(index);
}
@ -1216,7 +1250,8 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* Render different type sizes and styles.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
public final class FilterComboBoxRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList<?> list,
Object value, int index, boolean isSelected,
boolean cellHasFocus) {
@ -1242,7 +1277,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* Data model for a type-face selection combo-box.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
protected final class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
PropertyChangeListener {
protected FileFilter[] filters;
protected FilterComboBoxModel() {
@ -1250,6 +1285,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
filters = getFileChooser().getChoosableFileFilters();
}
@Override
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
@ -1260,6 +1296,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
@Override
public void setSelectedItem(Object filter) {
if(filter != null) {
getFileChooser().setFileFilter((FileFilter) filter);
@ -1267,6 +1304,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
@Override
public Object getSelectedItem() {
// Ensure that the current filter is in the list.
// NOTE: we shouldn't have to do this, since JFileChooser adds
@ -1288,6 +1326,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
return getFileChooser().getFileFilter();
}
@Override
public int getSize() {
if(filters != null) {
return filters.length;
@ -1296,6 +1335,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
@Override
public FileFilter getElementAt(int index) {
if(index > getSize() - 1) {
// This shouldn't happen. Try to recover gracefully.
@ -1320,21 +1360,24 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
/**
* Acts when DirectoryComboBox has changed the selected item.
*/
protected class DirectoryComboBoxAction implements ActionListener {
protected final class DirectoryComboBoxAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
File f = (File)directoryComboBox.getSelectedItem();
getFileChooser().setCurrentDirectory(f);
}
}
@Override
protected JButton getApproveButton(JFileChooser fc) {
return approveButton;
}
@Override
public FileView getFileView(JFileChooser fc) {
return fileView;
}
@ -1342,9 +1385,10 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
// ***********************
// * FileView operations *
// ***********************
protected class WindowsFileView extends BasicFileView {
protected final class WindowsFileView extends BasicFileView {
/* FileView type descriptions */
@Override
public Icon getIcon(File f) {
Icon icon = getCachedIcon(f);
if (icon != null) {

View File

@ -58,7 +58,7 @@ import static com.sun.java.swing.plaf.windows.TMSchema.TypeEnum;
* @author Mark Davidson
* @since 1.4
*/
public class WindowsGraphicsUtils {
public final class WindowsGraphicsUtils {
/**
* Renders a text String in Windows without the mnemonic.

View File

@ -63,7 +63,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
* @author Rich Schiavi
*/
@SuppressWarnings("serial") // Same-version serialization only
public class WindowsIconFactory implements Serializable
public final class WindowsIconFactory implements Serializable
{
private static Icon frame_closeIcon;
private static Icon frame_iconifyIcon;
@ -173,13 +173,14 @@ public class WindowsIconFactory implements Serializable
@SuppressWarnings("serial") // Same-version serialization only
private static class FrameButtonIcon implements Icon, Serializable {
private static final class FrameButtonIcon implements Icon, Serializable {
private final Part part;
private FrameButtonIcon(Part part) {
this.part = part;
}
@Override
public void paintIcon(Component c, Graphics g, int x0, int y0) {
int width = getIconWidth();
int height = getIconHeight();
@ -281,6 +282,7 @@ public class WindowsIconFactory implements Serializable
}
}
@Override
public int getIconWidth() {
int width;
if (XPStyle.getXP() != null) {
@ -293,6 +295,7 @@ public class WindowsIconFactory implements Serializable
return width;
}
@Override
public int getIconHeight() {
int height = UIManager.getInt("InternalFrame.titleButtonHeight")-4;
return height;
@ -302,7 +305,8 @@ public class WindowsIconFactory implements Serializable
@SuppressWarnings("serial") // Same-version serialization only
private static class ResizeIcon implements Icon, Serializable {
private static final class ResizeIcon implements Icon, Serializable {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(UIManager.getColor("InternalFrame.resizeIconHighlight"));
g.drawLine(0, 11, 11, 0);
@ -317,14 +321,17 @@ public class WindowsIconFactory implements Serializable
g.drawLine(9, 11, 11, 9);
g.drawLine(10, 11, 11, 10);
}
@Override
public int getIconWidth() { return 13; }
@Override
public int getIconHeight() { return 13; }
}
@SuppressWarnings("serial") // Same-version serialization only
private static class CheckBoxIcon implements Icon, Serializable
private static final class CheckBoxIcon implements Icon, Serializable
{
static final int csize = 13;
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
JCheckBox cb = (JCheckBox) c;
ButtonModel model = cb.getModel();
@ -425,6 +432,7 @@ public class WindowsIconFactory implements Serializable
}
}
@Override
public int getIconWidth() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -434,6 +442,7 @@ public class WindowsIconFactory implements Serializable
}
}
@Override
public int getIconHeight() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -445,8 +454,9 @@ public class WindowsIconFactory implements Serializable
}
@SuppressWarnings("serial") // Same-version serialization only
private static class RadioButtonIcon implements Icon, UIResource, Serializable
private static final class RadioButtonIcon implements Icon, UIResource, Serializable
{
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
@ -579,6 +589,7 @@ public class WindowsIconFactory implements Serializable
}
}
@Override
public int getIconWidth() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -588,6 +599,7 @@ public class WindowsIconFactory implements Serializable
}
}
@Override
public int getIconHeight() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -600,8 +612,9 @@ public class WindowsIconFactory implements Serializable
@SuppressWarnings("serial") // Same-version serialization only
private static class CheckBoxMenuItemIcon implements Icon, UIResource, Serializable
private static final class CheckBoxMenuItemIcon implements Icon, UIResource, Serializable
{
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
@ -619,15 +632,18 @@ public class WindowsIconFactory implements Serializable
g.drawLine(x+3, y+6, x+4, y+6);
}
}
@Override
public int getIconWidth() { return 9; }
@Override
public int getIconHeight() { return 9; }
} // End class CheckBoxMenuItemIcon
@SuppressWarnings("serial") // Same-version serialization only
private static class RadioButtonMenuItemIcon implements Icon, UIResource, Serializable
private static final class RadioButtonMenuItemIcon implements Icon, UIResource, Serializable
{
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
@ -636,14 +652,17 @@ public class WindowsIconFactory implements Serializable
4, 4);
}
}
@Override
public int getIconWidth() { return 12; }
@Override
public int getIconHeight() { return 12; }
} // End class RadioButtonMenuItemIcon
@SuppressWarnings("serial") // Same-version serialization only
private static class MenuItemCheckIcon implements Icon, UIResource, Serializable{
private static final class MenuItemCheckIcon implements Icon, UIResource, Serializable{
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
/* For debugging:
Color oldColor = g.getColor();
@ -652,13 +671,16 @@ public class WindowsIconFactory implements Serializable
g.setColor(oldColor);
*/
}
@Override
public int getIconWidth() { return 9; }
@Override
public int getIconHeight() { return 9; }
} // End class MenuItemCheckIcon
@SuppressWarnings("serial") // Same-version serialization only
private static class MenuItemArrowIcon implements Icon, UIResource, Serializable {
private static final class MenuItemArrowIcon implements Icon, UIResource, Serializable {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
/* For debugging:
Color oldColor = g.getColor();
@ -667,13 +689,16 @@ public class WindowsIconFactory implements Serializable
g.setColor(oldColor);
*/
}
@Override
public int getIconWidth() { return 4; }
@Override
public int getIconHeight() { return 8; }
} // End class MenuItemArrowIcon
@SuppressWarnings("serial") // Same-version serialization only
private static class MenuArrowIcon implements Icon, UIResource, Serializable {
private static final class MenuArrowIcon implements Icon, UIResource, Serializable {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
XPStyle xp = XPStyle.getXP();
if (WindowsMenuItemUI.isVistaPainting(xp)) {
@ -708,6 +733,7 @@ public class WindowsIconFactory implements Serializable
g.translate(-x,-y);
}
}
@Override
public int getIconWidth() {
XPStyle xp = XPStyle.getXP();
if (WindowsMenuItemUI.isVistaPainting(xp)) {
@ -717,6 +743,7 @@ public class WindowsIconFactory implements Serializable
return 4;
}
}
@Override
public int getIconHeight() {
XPStyle xp = XPStyle.getXP();
if (WindowsMenuItemUI.isVistaPainting(xp)) {
@ -728,14 +755,16 @@ public class WindowsIconFactory implements Serializable
}
} // End class MenuArrowIcon
static class VistaMenuItemCheckIconFactory
static final class VistaMenuItemCheckIconFactory
implements MenuItemCheckIconFactory {
private static final int OFFSET = 3;
@Override
public Icon getIcon(JMenuItem component) {
return new VistaMenuItemCheckIcon(component);
}
@Override
public boolean isCompatible(Object icon, String prefix) {
return icon instanceof VistaMenuItemCheckIcon
&& ((VistaMenuItemCheckIcon) icon).type == getType(prefix);
@ -788,7 +817,7 @@ public class WindowsIconFactory implements Serializable
* Note: to be used on Vista only.
*/
@SuppressWarnings("serial") // Same-version serialization only
private static class VistaMenuItemCheckIcon
private static final class VistaMenuItemCheckIcon
implements Icon, UIResource, Serializable {
private final JMenuItem menuItem;
@ -803,6 +832,7 @@ public class WindowsIconFactory implements Serializable
this.menuItem = null;
}
@Override
public int getIconHeight() {
Icon lafIcon = getLaFIcon();
if (lafIcon != null) {
@ -825,6 +855,7 @@ public class WindowsIconFactory implements Serializable
return height;
}
@Override
public int getIconWidth() {
Icon lafIcon = getLaFIcon();
if (lafIcon != null) {
@ -840,6 +871,7 @@ public class WindowsIconFactory implements Serializable
return width;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Icon lafIcon = getLaFIcon();
if (lafIcon != null) {

View File

@ -83,6 +83,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
super(f);
}
@Override
protected void addSubComponents() {
add(systemLabel);
add(iconButton);
@ -90,6 +91,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
add(closeButton);
}
@Override
protected void installDefaults() {
super.installDefaults();
@ -117,11 +119,13 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
@Override
protected void uninstallListeners() {
// Get around protected method in superclass
super.uninstallListeners();
}
@Override
protected void createButtons() {
super.createButtons();
if (XPStyle.getXP() != null) {
@ -131,6 +135,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
@Override
protected void setButtonIcons() {
super.setButtonIcons();
@ -142,6 +147,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
@Override
public void paintComponent(Graphics g) {
XPStyle xp = XPStyle.getXP();
@ -224,10 +230,12 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
@Override
public Dimension getPreferredSize() {
return getMinimumSize();
}
@Override
public Dimension getMinimumSize() {
Dimension d = new Dimension(super.getMinimumSize());
d.height = titlePaneHeight + 2;
@ -245,6 +253,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
return d;
}
@Override
protected void paintTitleBackground(Graphics g) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -285,6 +294,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
@Override
protected void assembleSystemMenu() {
systemPopupMenu = new JPopupMenu();
addSystemMenuItems(systemPopupMenu);
@ -372,6 +382,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
@Override
protected void showSystemMenu(){
showSystemPopupMenu(systemLabel);
}
@ -397,15 +408,17 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
@Override
protected PropertyChangeListener createPropertyChangeListener() {
return new WindowsPropertyChangeHandler();
}
@Override
protected LayoutManager createLayout() {
return new WindowsTitlePaneLayout();
}
public class WindowsTitlePaneLayout extends BasicInternalFrameTitlePane.TitlePaneLayout {
public final class WindowsTitlePaneLayout extends BasicInternalFrameTitlePane.TitlePaneLayout {
private Insets captionMargin = null;
private Insets contentMargin = null;
private XPStyle xp = XPStyle.getXP();
@ -439,6 +452,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
return x;
}
@Override
public void layoutContainer(Container c) {
boolean leftToRight = WindowsGraphicsUtils.isLeftToRight(frame);
int x, y;
@ -492,7 +506,8 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
} // end WindowsTitlePaneLayout
public class WindowsPropertyChangeHandler extends PropertyChangeHandler {
public final class WindowsPropertyChangeHandler extends PropertyChangeHandler {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String prop = evt.getPropertyName();
@ -515,7 +530,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
* <p>
* Note: We assume here that icons are square.
*/
public static class ScalableIconUIResource implements Icon, UIResource {
public static final class ScalableIconUIResource implements Icon, UIResource {
// We can use an arbitrary size here because we scale to it in paintIcon()
private static final int SIZE = 16;
@ -562,6 +577,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D)g.create();
// Calculate how big our drawing area is in pixels
@ -580,10 +596,12 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
g2d.dispose();
}
@Override
public int getIconWidth() {
return SIZE;
}
@Override
public int getIconHeight() {
return SIZE;
}

View File

@ -45,10 +45,11 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
* Windows rendition of the component.
*/
public class WindowsInternalFrameUI extends BasicInternalFrameUI
public final class WindowsInternalFrameUI extends BasicInternalFrameUI
{
XPStyle xp = XPStyle.getXP();
@Override
public void installDefaults() {
super.installDefaults();
@ -59,6 +60,7 @@ public class WindowsInternalFrameUI extends BasicInternalFrameUI
}
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
@ -66,6 +68,7 @@ public class WindowsInternalFrameUI extends BasicInternalFrameUI
xp == null? Boolean.TRUE : Boolean.FALSE);
}
@Override
public void uninstallDefaults() {
frame.setBorder(null);
super.uninstallDefaults();
@ -79,17 +82,19 @@ public class WindowsInternalFrameUI extends BasicInternalFrameUI
super(w);
}
@Override
protected DesktopManager createDesktopManager(){
return new WindowsDesktopManager();
}
@Override
protected JComponent createNorthPane(JInternalFrame w) {
titlePane = new WindowsInternalFrameTitlePane(w);
return titlePane;
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class XPBorder extends AbstractBorder {
private final class XPBorder extends AbstractBorder {
private Skin leftSkin = xp.getSkin(frame, Part.WP_FRAMELEFT);
private Skin rightSkin = xp.getSkin(frame, Part.WP_FRAMERIGHT);
private Skin bottomSkin = xp.getSkin(frame, Part.WP_FRAMEBOTTOM);
@ -100,6 +105,7 @@ public class WindowsInternalFrameUI extends BasicInternalFrameUI
* @param width the width of the painted border
* @param height the height of the painted border
*/
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
State state = ((JInternalFrame)c).isSelected() ? State.ACTIVE : State.INACTIVE;
int topBorderHeight = (titlePane != null) ? titlePane.getSize().height : 0;
@ -118,6 +124,7 @@ public class WindowsInternalFrameUI extends BasicInternalFrameUI
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
insets.top = 4;
insets.left = leftSkin.getWidth();
@ -127,6 +134,7 @@ public class WindowsInternalFrameUI extends BasicInternalFrameUI
return insets;
}
@Override
public boolean isBorderOpaque() {
return true;
}

View File

@ -41,7 +41,7 @@ import sun.swing.SwingUtilities2;
/**
* Windows rendition of the component.
*/
public class WindowsLabelUI extends BasicLabelUI {
public final class WindowsLabelUI extends BasicLabelUI {
private static final Object WINDOWS_LABEL_UI_KEY = new Object();
@ -59,6 +59,7 @@ public class WindowsLabelUI extends BasicLabelUI {
return windowsLabelUI;
}
@Override
protected void paintEnabledText(JLabel l, Graphics g, String s,
int textX, int textY) {
int mnemonicIndex = l.getDisplayedMnemonicIndex();
@ -72,6 +73,7 @@ public class WindowsLabelUI extends BasicLabelUI {
textX, textY);
}
@Override
protected void paintDisabledText(JLabel l, Graphics g, String s,
int textX, int textY) {
int mnemonicIndex = l.getDisplayedMnemonicIndex();

View File

@ -145,26 +145,32 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
*/
private int baseUnitY;
@Override
public String getName() {
return "Windows";
}
@Override
public String getDescription() {
return "The Microsoft Windows Look and Feel";
}
@Override
public String getID() {
return "Windows";
}
@Override
public boolean isNativeLookAndFeel() {
return OSInfo.getOSType() == OSInfo.OSType.WINDOWS;
}
@Override
public boolean isSupportedLookAndFeel() {
return isNativeLookAndFeel();
}
@Override
public void initialize() {
super.initialize();
@ -206,6 +212,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
*
* @see BasicLookAndFeel#getDefaults
*/
@Override
protected void initClassDefaults(UIDefaults table)
{
super.initClassDefaults(table);
@ -260,6 +267,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* values, otherwise we create color objects whose values match
* the defaults Windows95 colors.
*/
@Override
protected void initSystemColorDefaults(UIDefaults table)
{
String[] defaultSystemColors = {
@ -310,6 +318,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
// XXX - there are probably a lot of redundant values that could be removed.
// ie. Take a look at RadioButtonBorder, etc...
@Override
protected void initComponentDefaults(UIDefaults table)
{
super.initComponentDefaults( table );
@ -1893,6 +1902,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
return lazyDefaults;
}
@Override
public void uninitialize() {
super.uninitialize();
@ -1944,6 +1954,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
*
* @see javax.swing.LookAndFeel#provideErrorFeedback
*/
@Override
public void provideErrorFeedback(Component component) {
super.provideErrorFeedback(component);
}
@ -1951,6 +1962,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
/**
* {@inheritDoc}
*/
@Override
public LayoutStyle getLayoutStyle() {
LayoutStyle style = this.style;
if (style == null) {
@ -1981,6 +1993,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* @see #playSound(Action)
* @since 1.4
*/
@Override
protected Action createAudioAction(Object key) {
if (key != null) {
String audioKey = (String)key;
@ -2018,7 +2031,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* @since 1.4
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
private static class AudioAction extends AbstractAction {
private static final class AudioAction extends AbstractAction {
private Runnable audioRunnable;
private String audioResource;
/**
@ -2029,6 +2042,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
super(name);
audioResource = resource;
}
@Override
public void actionPerformed(ActionEvent e) {
if (audioRunnable == null) {
audioRunnable = (Runnable)Toolkit.getDefaultToolkit().getDesktopProperty(audioResource);
@ -2045,7 +2059,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* Gets an <code>Icon</code> from the native libraries if available,
* otherwise gets it from an image resource file.
*/
private static class LazyWindowsIcon implements UIDefaults.LazyValue {
private static final class LazyWindowsIcon implements UIDefaults.LazyValue {
private String nativeImage;
private String resource;
@ -2054,6 +2068,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
this.resource = resource;
}
@Override
public Object createValue(UIDefaults table) {
if (nativeImage != null) {
Image image = (Image)ShellFolder.get(nativeImage);
@ -2072,7 +2087,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* Gets an <code>Icon</code> from the native libraries if available.
* A desktop property is used to trigger reloading the icon when needed.
*/
private static class ActiveWindowsIcon implements UIDefaults.ActiveValue {
private static final class ActiveWindowsIcon implements UIDefaults.ActiveValue {
private Icon icon;
private String nativeImageName;
private String fallbackName;
@ -2117,7 +2132,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
/**
* Icon backed-up by XP Skin.
*/
private static class SkinIcon implements Icon, UIResource {
private static final class SkinIcon implements Icon, UIResource {
private final Part part;
private final State state;
SkinIcon(Part part, State state) {
@ -2130,6 +2145,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* may use the Component argument to get properties useful for
* painting, e.g. the foreground or background color.
*/
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
XPStyle xp = XPStyle.getXP();
assert xp != null;
@ -2144,6 +2160,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
*
* @return an int specifying the fixed width of the icon.
*/
@Override
public int getIconWidth() {
int width = 0;
XPStyle xp = XPStyle.getXP();
@ -2160,6 +2177,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
*
* @return an int specifying the fixed height of the icon.
*/
@Override
public int getIconHeight() {
int height = 0;
XPStyle xp = XPStyle.getXP();
@ -2176,11 +2194,12 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* WindowsDesktopProperty for fonts. If a font with the name 'MS Sans Serif'
* is returned, it is mapped to 'Microsoft Sans Serif'.
*/
private static class WindowsFontProperty extends WindowsDesktopProperty {
private static final class WindowsFontProperty extends WindowsDesktopProperty {
WindowsFontProperty(String key, Object backup) {
super(key, backup);
}
@Override
public void invalidate(LookAndFeel laf) {
if ("win.defaultGUI.font.height".equals(getKey())) {
((WindowsLookAndFeel)laf).style = null;
@ -2188,6 +2207,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
super.invalidate(laf);
}
@Override
protected Object configureValue(Object value) {
if (value instanceof Font) {
Font font = (Font)value;
@ -2236,7 +2256,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* WindowsDesktopProperty for fonts that only gets sizes from the desktop,
* font name and style are passed into the constructor
*/
private static class WindowsFontSizeProperty extends
private static final class WindowsFontSizeProperty extends
WindowsDesktopProperty {
private String fontName;
private int fontSize;
@ -2250,6 +2270,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
this.fontStyle = fontStyle;
}
@Override
protected Object configureValue(Object value) {
if (value == null) {
value = new FontUIResource(fontName, fontStyle, fontSize);
@ -2278,6 +2299,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
this.classicValue = classicValue;
}
@Override
public Object createValue(UIDefaults table) {
Object value = null;
if (XPStyle.getXP() != null) {
@ -2313,7 +2335,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
}
}
private static class XPBorderValue extends XPValue {
private static final class XPBorderValue extends XPValue {
private final Border extraMargin;
XPBorderValue(Part xpValue, Object classicValue) {
@ -2325,6 +2347,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
this.extraMargin = extraMargin;
}
@Override
public Object getXPValue(UIDefaults table) {
XPStyle xp = XPStyle.getXP();
Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
@ -2337,18 +2360,19 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
}
}
private static class XPColorValue extends XPValue {
private static final class XPColorValue extends XPValue {
XPColorValue(Part part, State state, Prop prop, Object classicValue) {
super(new XPColorValueKey(part, state, prop), classicValue);
}
@Override
public Object getXPValue(UIDefaults table) {
XPColorValueKey key = (XPColorValueKey)xpValue;
XPStyle xp = XPStyle.getXP();
return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
}
private static class XPColorValueKey {
private static final class XPColorValueKey {
Skin skin;
Prop prop;
@ -2359,7 +2383,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
}
}
private class XPDLUValue extends XPValue {
private final class XPDLUValue extends XPValue {
private int direction;
XPDLUValue(int xpdlu, int classicdlu, int direction) {
@ -2367,11 +2391,13 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
this.direction = direction;
}
@Override
public Object getXPValue(UIDefaults table) {
int px = dluToPixels(((Integer)xpValue).intValue(), direction);
return Integer.valueOf(px);
}
@Override
public Object getClassicValue(UIDefaults table) {
int px = dluToPixels(((Integer)classicValue).intValue(), direction);
return Integer.valueOf(px);
@ -2387,6 +2413,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
getValueFromDesktop();
}
@Override
protected void updateUI() {
super.updateUI();
@ -2395,11 +2422,12 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
}
}
private static class FontDesktopProperty extends TriggerDesktopProperty {
private static final class FontDesktopProperty extends TriggerDesktopProperty {
FontDesktopProperty(String key) {
super(key);
}
@Override
protected void updateUI() {
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
SwingUtilities2.putAATextInfo(true, defaults);
@ -2410,7 +2438,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
// Windows LayoutStyle. From:
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
@SuppressWarnings("fallthrough")
private class WindowsLayoutStyle extends DefaultLayoutStyle {
private final class WindowsLayoutStyle extends DefaultLayoutStyle {
@Override
public int getPreferredGap(JComponent component1,
JComponent component2, ComponentPlacement type, int position,
@ -2504,6 +2532,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
*
* @since 1.6
*/
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
// if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
// client property set to Boolean.TRUE, then use the new
@ -2525,10 +2554,11 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
return super.getDisabledIcon(component, icon);
}
private static class RGBGrayFilter extends RGBImageFilter {
private static final class RGBGrayFilter extends RGBImageFilter {
public RGBGrayFilter() {
canFilterIndexColorModel = true;
}
@Override
public int filterRGB(int x, int y, int rgb) {
// find the average of red, green, and blue
float avg = (((rgb >> 16) & 0xff) / 255f +
@ -2547,7 +2577,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
}
}
private static class FocusColorProperty extends WindowsDesktopProperty {
private static final class FocusColorProperty extends WindowsDesktopProperty {
public FocusColorProperty () {
// Fallback value is never used because of the configureValue method doesn't return null
super("win.3d.backgroundColor", Color.BLACK);

View File

@ -57,7 +57,7 @@ import sun.swing.MnemonicHandler;
/**
* Windows rendition of the component.
*/
public class WindowsMenuBarUI extends BasicMenuBarUI
public final class WindowsMenuBarUI extends BasicMenuBarUI
{
/* to be accessed on the EDT only */
private WindowListener windowListener = null;
@ -125,6 +125,7 @@ public class WindowsMenuBarUI extends BasicMenuBarUI
super.installListeners();
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
ActionMap map = SwingUtilities.getUIActionMap(menuBar);
@ -140,7 +141,7 @@ public class WindowsMenuBarUI extends BasicMenuBarUI
* Unlike BasicMenuBarUI.TakeFocus, this Action will not show menu popup.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
private static class TakeFocus extends AbstractAction {
private static final class TakeFocus extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
JMenuBar menuBar = (JMenuBar)e.getSource();

View File

@ -54,7 +54,7 @@ import sun.swing.SwingUtilities2;
*
* @author Igor Kushnirskiy
*/
public class WindowsMenuItemUI extends BasicMenuItemUI {
public final class WindowsMenuItemUI extends BasicMenuItemUI {
/**
* The instance of {@code PropertyChangeListener}.
*/
@ -63,6 +63,7 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
final WindowsMenuItemUIAccessor accessor =
new WindowsMenuItemUIAccessor() {
@Override
public JMenuItem getMenuItem() {
return menuItem;
}
@ -71,6 +72,7 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
return WindowsMenuItemUI.getState(this, menuItem);
}
@Override
public Part getPart(JMenuItem menuItem) {
return WindowsMenuItemUI.getPart(this, menuItem);
}
@ -141,6 +143,7 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
* @param textRect Bounding rectangle to render the text.
* @param text String to render
*/
@Override
protected void paintText(Graphics g, JMenuItem menuItem,
Rectangle textRect, String text) {
if (WindowsMenuItemUI.isVistaPainting()) {

View File

@ -50,13 +50,14 @@ import com.sun.java.swing.plaf.windows.TMSchema.State;
/**
* Windows rendition of the component.
*/
public class WindowsMenuUI extends BasicMenuUI {
public final class WindowsMenuUI extends BasicMenuUI {
protected Integer menuBarHeight;
protected boolean hotTrackingOn;
final WindowsMenuItemUIAccessor accessor =
new WindowsMenuItemUIAccessor() {
@Override
public JMenuItem getMenuItem() {
return menuItem;
}
@ -106,6 +107,7 @@ public class WindowsMenuUI extends BasicMenuUI {
return state;
}
@Override
public Part getPart(JMenuItem menuItem) {
return ((JMenu) menuItem).isTopLevelMenu() ? Part.MP_BARITEM
: Part.MP_POPUPITEM;
@ -115,6 +117,7 @@ public class WindowsMenuUI extends BasicMenuUI {
return new WindowsMenuUI();
}
@Override
protected void installDefaults() {
super.installDefaults();
if (!WindowsLookAndFeel.isClassicWindows()) {
@ -131,6 +134,7 @@ public class WindowsMenuUI extends BasicMenuUI {
* Draws the background of the menu.
* @since 1.4
*/
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
if (WindowsMenuItemUI.isVistaPainting()) {
WindowsMenuItemUI.paintBackground(accessor, g, menuItem, bgColor);
@ -210,6 +214,7 @@ public class WindowsMenuUI extends BasicMenuUI {
* @param text String to render
* @since 1.4
*/
@Override
protected void paintText(Graphics g, JMenuItem menuItem,
Rectangle textRect, String text) {
if (WindowsMenuItemUI.isVistaPainting()) {
@ -245,6 +250,7 @@ public class WindowsMenuUI extends BasicMenuUI {
g.setColor(oldColor);
}
@Override
protected MouseInputListener createMouseInputListener(JComponent c) {
return new WindowsMouseInputHandler();
}
@ -254,7 +260,8 @@ public class WindowsMenuUI extends BasicMenuUI {
* true when the mouse enters the menu and false when it exits.
* @since 1.4
*/
protected class WindowsMouseInputHandler extends BasicMenuUI.MouseInputHandler {
protected final class WindowsMouseInputHandler extends BasicMenuUI.MouseInputHandler {
@Override
public void mouseEntered(MouseEvent evt) {
super.mouseEntered(evt);
@ -265,6 +272,7 @@ public class WindowsMenuUI extends BasicMenuUI {
}
}
@Override
public void mouseExited(MouseEvent evt) {
super.mouseExited(evt);
@ -277,6 +285,7 @@ public class WindowsMenuUI extends BasicMenuUI {
}
}
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,

View File

@ -30,5 +30,5 @@ import javax.swing.plaf.basic.BasicOptionPaneUI;
/**
* Windows rendition of the component.
*/
public class WindowsOptionPaneUI extends BasicOptionPaneUI {
public final class WindowsOptionPaneUI extends BasicOptionPaneUI {
}

View File

@ -33,7 +33,7 @@ import javax.swing.text.Caret;
/**
* Windows rendition of the component.
*/
public class WindowsPasswordFieldUI extends BasicPasswordFieldUI {
public final class WindowsPasswordFieldUI extends BasicPasswordFieldUI {
/**
* Creates a UI for a JPasswordField
@ -54,6 +54,7 @@ public class WindowsPasswordFieldUI extends BasicPasswordFieldUI {
*
* @return the caret object
*/
@Override
protected Caret createCaret() {
return new WindowsTextUI.WindowsCaret();
}

View File

@ -42,12 +42,13 @@ import com.sun.java.swing.plaf.windows.XPStyle.Skin;
* @author Igor Kushnirskiy
*/
public class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
public final class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
public static ComponentUI createUI(JComponent c) {
return new WindowsPopupMenuSeparatorUI();
}
@Override
public void paint(Graphics g, JComponent c) {
Dimension s = c.getSize();
XPStyle xp = XPStyle.getXP();
@ -82,6 +83,7 @@ public class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
}
}
@Override
public Dimension getPreferredSize(JComponent c) {
int fontHeight = 0;
Font font = c.getFont();

View File

@ -57,7 +57,7 @@ import static sun.swing.SwingUtilities2.BASICMENUITEMUI_MAX_TEXT_OFFSET;
*
* @author Igor Kushnirskiy
*/
public class WindowsPopupMenuUI extends BasicPopupMenuUI {
public final class WindowsPopupMenuUI extends BasicPopupMenuUI {
static MnemonicListener mnemonicListener = null;
static final Object GUTTER_OFFSET_KEY =
@ -67,6 +67,7 @@ public class WindowsPopupMenuUI extends BasicPopupMenuUI {
return new WindowsPopupMenuUI();
}
@Override
public void installListeners() {
super.installListeners();
if (! UIManager.getBoolean("Button.showMnemonics") &&
@ -88,14 +89,16 @@ public class WindowsPopupMenuUI extends BasicPopupMenuUI {
* @return Popup that will show the JPopupMenu
* @since 1.4
*/
@Override
public Popup getPopup(JPopupMenu popupMenu, int x, int y) {
PopupFactory popupFactory = PopupFactory.getSharedInstance();
return popupFactory.getPopup(popupMenu.getInvoker(), popupMenu, x, y);
}
static class MnemonicListener implements ChangeListener {
static final class MnemonicListener implements ChangeListener {
JRootPane repaintRoot = null;
@Override
public void stateChanged(ChangeEvent ev) {
MenuSelectionManager msm = (MenuSelectionManager)ev.getSource();
MenuElement[] path = msm.getSelectedPath();

View File

@ -45,7 +45,7 @@ import javax.swing.JWindow;
* @author Amy Fowler
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
class WindowsPopupWindow extends JWindow {
final class WindowsPopupWindow extends JWindow {
static final int UNDEFINED_WINDOW_TYPE = 0;
static final int TOOLTIP_WINDOW_TYPE = 1;
@ -69,10 +69,12 @@ class WindowsPopupWindow extends JWindow {
return windowType;
}
@Override
public void update(Graphics g) {
paint(g);
}
@Override
@SuppressWarnings("deprecation")
public void hide() {
super.hide();
@ -85,6 +87,7 @@ class WindowsPopupWindow extends JWindow {
removeNotify();
}
@Override
@SuppressWarnings("deprecation")
public void show() {
super.show();

View File

@ -51,7 +51,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
*
* @author Michael C. Albers
*/
public class WindowsProgressBarUI extends BasicProgressBarUI
public final class WindowsProgressBarUI extends BasicProgressBarUI
{
private Rectangle previousFullBox;
@ -62,6 +62,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
}
@Override
protected void installDefaults() {
super.installDefaults();
@ -80,6 +81,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
@Override
public int getBaseline(JComponent c, int width, int height) {
int baseline = super.getBaseline(c, width, height);
if (XPStyle.getXP() != null && progressBar.isStringPainted() &&
@ -102,6 +104,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
return baseline;
}
@Override
protected Dimension getPreferredInnerHorizontal() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -113,6 +116,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
return super.getPreferredInnerHorizontal();
}
@Override
protected Dimension getPreferredInnerVertical() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -124,6 +128,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
return super.getPreferredInnerVertical();
}
@Override
protected void paintDeterminate(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -218,6 +223,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
* {@inheritDoc}
* @since 1.6
*/
@Override
protected void setAnimationIndex(int newValue) {
super.setAnimationIndex(newValue);
XPStyle xp = XPStyle.getXP();
@ -241,6 +247,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
* {@inheritDoc}
* @since 1.6
*/
@Override
protected int getBoxLength(int availableLength, int otherDimension) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -253,6 +260,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
* {@inheritDoc}
* @since 1.6
*/
@Override
protected Rectangle getBox(Rectangle r) {
Rectangle rect = super.getBox(r);
@ -298,6 +306,7 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
}
@Override
protected void paintIndeterminate(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {

View File

@ -41,11 +41,12 @@ import com.sun.java.swing.plaf.windows.TMSchema.State;
/**
* Windows rendition of the component.
*/
public class WindowsRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI {
public final class WindowsRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI {
final WindowsMenuItemUIAccessor accessor =
new WindowsMenuItemUIAccessor() {
@Override
public JMenuItem getMenuItem() {
return menuItem;
}
@ -54,6 +55,7 @@ public class WindowsRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI {
return WindowsMenuItemUI.getState(this, menuItem);
}
@Override
public Part getPart(JMenuItem menuItem) {
return WindowsMenuItemUI.getPart(this, menuItem);
}
@ -81,6 +83,7 @@ public class WindowsRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI {
* @param text String to render
* @since 1.4
*/
@Override
protected void paintText(Graphics g, JMenuItem menuItem,
Rectangle textRect, String text) {
if (WindowsMenuItemUI.isVistaPainting()) {

View File

@ -73,6 +73,7 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI
// ********************************
// Defaults
// ********************************
@Override
public void installDefaults(AbstractButton b) {
super.installDefaults(b);
if(!initialized) {
@ -88,6 +89,7 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI
}
}
@Override
protected void uninstallDefaults(AbstractButton b) {
super.uninstallDefaults(b);
initialized = false;
@ -104,11 +106,13 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI
/**
* Overridden method to render the text without the mnemonic
*/
@Override
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
WindowsGraphicsUtils.paintText(g, b, textRect, text, getTextShiftOffset());
}
@Override
protected void paintFocus(Graphics g, Rectangle textRect, Dimension d){
g.setColor(getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, textRect.x, textRect.y, textRect.width, textRect.height);
@ -117,6 +121,7 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI
// ********************************
// Layout Methods
// ********************************
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension d = super.getPreferredSize(c);

View File

@ -70,7 +70,7 @@ import sun.swing.MnemonicHandler;
* @author Mark Davidson
* @since 1.4
*/
public class WindowsRootPaneUI extends BasicRootPaneUI {
public final class WindowsRootPaneUI extends BasicRootPaneUI {
private static final WindowsRootPaneUI windowsRootPaneUI = new WindowsRootPaneUI();
static final AltProcessor altProcessor = new AltProcessor();
@ -79,7 +79,7 @@ public class WindowsRootPaneUI extends BasicRootPaneUI {
return windowsRootPaneUI;
}
static class AltProcessor implements KeyEventPostProcessor {
static final class AltProcessor implements KeyEventPostProcessor {
static boolean altKeyPressed = false;
static boolean menuCanceledOnPress = false;
static JRootPane root = null;
@ -166,6 +166,7 @@ public class WindowsRootPaneUI extends BasicRootPaneUI {
}
@Override
public boolean postProcessKeyEvent(KeyEvent ev) {
if (ev.isConsumed()) {
if (ev.getKeyCode() != KeyEvent.VK_ALT) {

View File

@ -55,7 +55,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
* Windows rendition of the component.
*/
public class WindowsScrollBarUI extends BasicScrollBarUI {
public final class WindowsScrollBarUI extends BasicScrollBarUI {
private Grid thumbGrid;
private Grid highlightGrid;
private Dimension horizontalThumbSize;
@ -71,6 +71,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
return new WindowsScrollBarUI();
}
@Override
protected void installDefaults() {
super.installDefaults();
@ -100,11 +101,13 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
: verticalThumbSize;
}
@Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
thumbGrid = highlightGrid = null;
}
@Override
protected void configureScrollBarColors() {
super.configureScrollBarColors();
Color color = UIManager.getColor("ScrollBar.trackForeground");
@ -118,6 +121,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
}
}
@Override
protected JButton createDecreaseButton(int orientation) {
return new WindowsArrowButton(orientation,
UIManager.getColor("ScrollBar.thumb"),
@ -126,6 +130,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
UIManager.getColor("ScrollBar.thumbHighlight"));
}
@Override
protected JButton createIncreaseButton(int orientation) {
return new WindowsArrowButton(orientation,
UIManager.getColor("ScrollBar.thumb"),
@ -161,6 +166,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
}
}
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds){
boolean v = (scrollbar.getOrientation() == JScrollBar.VERTICAL);
@ -189,6 +195,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
}
}
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
boolean v = (scrollbar.getOrientation() == JScrollBar.VERTICAL);
@ -231,6 +238,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
}
@Override
protected void paintDecreaseHighlight(Graphics g) {
if (highlightGrid == null) {
super.paintDecreaseHighlight(g);
@ -257,6 +265,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
}
@Override
protected void paintIncreaseHighlight(Graphics g) {
if (highlightGrid == null) {
super.paintDecreaseHighlight(g);
@ -304,7 +313,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
* preferred size is always a square.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class WindowsArrowButton extends BasicArrowButton {
private final class WindowsArrowButton extends BasicArrowButton {
public WindowsArrowButton(int direction, Color background, Color shadow,
Color darkShadow, Color highlight) {
@ -315,6 +324,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
super(direction);
}
@Override
public void paint(Graphics g) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -370,6 +380,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
}
}
@Override
public Dimension getPreferredSize() {
int size = 16;
if (scrollbar != null) {
@ -398,7 +409,7 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
* a WeakRef so that it can be freed when no longer needed. As the
* Grid is rather expensive to draw, it is drawn in a BufferedImage.
*/
private static class Grid {
private static final class Grid {
private static final int BUFFER_SIZE = 64;
private static HashMap<String, WeakReference<Grid>> map;

View File

@ -30,5 +30,5 @@ import javax.swing.plaf.basic.BasicScrollPaneUI;
/**
* Windows rendition of the component.
*/
public class WindowsScrollPaneUI extends BasicScrollPaneUI
public final class WindowsScrollPaneUI extends BasicScrollPaneUI
{}

View File

@ -30,4 +30,4 @@ import javax.swing.plaf.basic.*;
/**
* Windows Separator.
*/
public class WindowsSeparatorUI extends BasicSeparatorUI { }
public final class WindowsSeparatorUI extends BasicSeparatorUI { }

View File

@ -44,7 +44,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
* Windows rendition of the component.
*/
public class WindowsSliderUI extends BasicSliderUI
public final class WindowsSliderUI extends BasicSliderUI
{
private boolean rollover = false;
private boolean pressed = false;
@ -63,32 +63,38 @@ public class WindowsSliderUI extends BasicSliderUI
* the HOT, PRESSED, and FOCUSED states.
* @since 1.6
*/
@Override
protected TrackListener createTrackListener(JSlider slider) {
return new WindowsTrackListener();
}
private class WindowsTrackListener extends TrackListener {
private final class WindowsTrackListener extends TrackListener {
@Override
public void mouseMoved(MouseEvent e) {
updateRollover(thumbRect.contains(e.getX(), e.getY()));
super.mouseMoved(e);
}
@Override
public void mouseEntered(MouseEvent e) {
updateRollover(thumbRect.contains(e.getX(), e.getY()));
super.mouseEntered(e);
}
@Override
public void mouseExited(MouseEvent e) {
updateRollover(false);
super.mouseExited(e);
}
@Override
public void mousePressed(MouseEvent e) {
updatePressed(thumbRect.contains(e.getX(), e.getY()));
super.mousePressed(e);
}
@Override
public void mouseReleased(MouseEvent e) {
updatePressed(false);
super.mouseReleased(e);
@ -119,6 +125,7 @@ public class WindowsSliderUI extends BasicSliderUI
}
@Override
public void paintTrack(Graphics g) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -141,6 +148,7 @@ public class WindowsSliderUI extends BasicSliderUI
}
@Override
protected void paintMinorTickForHorizSlider( Graphics g, Rectangle tickBounds, int x ) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -149,6 +157,7 @@ public class WindowsSliderUI extends BasicSliderUI
super.paintMinorTickForHorizSlider(g, tickBounds, x);
}
@Override
protected void paintMajorTickForHorizSlider( Graphics g, Rectangle tickBounds, int x ) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -157,6 +166,7 @@ public class WindowsSliderUI extends BasicSliderUI
super.paintMajorTickForHorizSlider(g, tickBounds, x);
}
@Override
protected void paintMinorTickForVertSlider( Graphics g, Rectangle tickBounds, int y ) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -165,6 +175,7 @@ public class WindowsSliderUI extends BasicSliderUI
super.paintMinorTickForVertSlider(g, tickBounds, y);
}
@Override
protected void paintMajorTickForVertSlider( Graphics g, Rectangle tickBounds, int y ) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -174,6 +185,7 @@ public class WindowsSliderUI extends BasicSliderUI
}
@Override
public void paintThumb(Graphics g) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -199,6 +211,7 @@ public class WindowsSliderUI extends BasicSliderUI
}
}
@Override
protected Dimension getThumbSize() {
XPStyle xp = XPStyle.getXP();
if (xp != null) {

View File

@ -37,7 +37,7 @@ import static com.sun.java.swing.plaf.windows.TMSchema.State;
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
public class WindowsSpinnerUI extends BasicSpinnerUI {
public final class WindowsSpinnerUI extends BasicSpinnerUI {
public static ComponentUI createUI(JComponent c) {
return new WindowsSpinnerUI();
}
@ -46,6 +46,7 @@ public class WindowsSpinnerUI extends BasicSpinnerUI {
* {@inheritDoc}
* @since 1.6
*/
@Override
public void paint(Graphics g, JComponent c) {
if (XPStyle.getXP() != null) {
paintXPBackground(g, c);
@ -71,6 +72,7 @@ public class WindowsSpinnerUI extends BasicSpinnerUI {
skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
}
@Override
protected Component createPreviousButton() {
if (XPStyle.getXP() != null) {
JButton xpButton = new XPStyle.GlyphButton(spinner, Part.SPNP_DOWN);
@ -83,6 +85,7 @@ public class WindowsSpinnerUI extends BasicSpinnerUI {
return super.createPreviousButton();
}
@Override
protected Component createNextButton() {
if (XPStyle.getXP() != null) {
JButton xpButton = new XPStyle.GlyphButton(spinner, Part.SPNP_UP);

View File

@ -39,7 +39,7 @@ import javax.swing.plaf.basic.BasicSplitPaneUI;
* @author Jeff Dinkins
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class WindowsSplitPaneDivider extends BasicSplitPaneDivider
public final class WindowsSplitPaneDivider extends BasicSplitPaneDivider
{
/**
@ -52,6 +52,7 @@ public class WindowsSplitPaneDivider extends BasicSplitPaneDivider
/**
* Paints the divider.
*/
@Override
public void paint(Graphics g) {
Color bgColor = (splitPane.hasFocus()) ?
UIManager.getColor("SplitPane.shadow") :

View File

@ -33,7 +33,7 @@ import javax.swing.plaf.basic.BasicSplitPaneUI;
/**
* Windows rendition of the component.
*/
public class WindowsSplitPaneUI extends BasicSplitPaneUI
public final class WindowsSplitPaneUI extends BasicSplitPaneUI
{
public WindowsSplitPaneUI() {
@ -50,6 +50,7 @@ public class WindowsSplitPaneUI extends BasicSplitPaneUI
/**
* Creates the default divider.
*/
@Override
public BasicSplitPaneDivider createDefaultDivider() {
return new WindowsSplitPaneDivider(this);
}

View File

@ -48,7 +48,7 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
/**
* Windows rendition of the component.
*/
public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
public final class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
/**
* Keys to use for forward focus traversal when the JComponent is
* managing focus.
@ -63,6 +63,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
private boolean contentOpaque = true;
@Override
@SuppressWarnings("deprecation")
protected void installDefaults() {
super.installDefaults();
@ -82,6 +83,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
}
@Override
protected void uninstallDefaults() {
// sets the focus forward and backward traversal keys to null
// to restore the defaults
@ -94,6 +96,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
return new WindowsTabbedPaneUI();
}
@Override
protected void setRolloverTab(int index) {
// Rollover is only supported on XP
if (XPStyle.getXP() != null) {
@ -119,6 +122,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
}
}
@Override
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {
XPStyle xp = XPStyle.getXP();
if (xp != null && (contentOpaque || tabPane.isOpaque())) {
@ -155,6 +159,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
super.paintContentBorder(g, tabPlacement, selectedIndex);
}
@Override
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex,
int x, int y, int w, int h, boolean isSelected ) {
if (XPStyle.getXP() == null) {
@ -162,6 +167,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
}
}
@Override
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
int x, int y, int w, int h, boolean isSelected ) {
XPStyle xp = XPStyle.getXP();

View File

@ -50,13 +50,14 @@ import static com.sun.java.swing.plaf.windows.TMSchema.Part;
import static com.sun.java.swing.plaf.windows.TMSchema.State;
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
public class WindowsTableHeaderUI extends BasicTableHeaderUI {
public final class WindowsTableHeaderUI extends BasicTableHeaderUI {
private TableCellRenderer originalHeaderRenderer;
public static ComponentUI createUI(JComponent h) {
return new WindowsTableHeaderUI();
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
@ -68,6 +69,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
}
}
@Override
public void uninstallUI(JComponent c) {
if (header.getDefaultRenderer() instanceof XPDefaultRenderer) {
header.setDefaultRenderer(originalHeaderRenderer);
@ -84,7 +86,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
}
@SuppressWarnings("serial") // JDK-implementation class
private class XPDefaultRenderer extends DefaultTableCellHeaderRenderer {
private final class XPDefaultRenderer extends DefaultTableCellHeaderRenderer {
Skin skin;
boolean isSelected, hasFocus, hasRollover;
int column;
@ -93,6 +95,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
setHorizontalAlignment(LEADING);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column) {
@ -181,6 +184,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
return this;
}
@Override
public void paint(Graphics g) {
Dimension size = getSize();
State state = State.NORMAL;
@ -227,7 +231,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
* A border with an Icon at the middle of the top side.
* Outer insets can be provided for this border.
*/
private static class IconBorder implements Border, UIResource{
private static final class IconBorder implements Border, UIResource{
private final Icon icon;
private final int top;
private final int left;
@ -246,12 +250,15 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
this.bottom = bottom;
this.right = right;
}
@Override
public Insets getBorderInsets(Component c) {
return new Insets(icon.getIconHeight() + top, left, bottom, right);
}
@Override
public boolean isBorderOpaque() {
return false;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y,
int width, int height) {
icon.paintIcon(c, g,

View File

@ -33,7 +33,7 @@ import javax.swing.text.Caret;
/**
* Windows rendition of the component.
*/
public class WindowsTextAreaUI extends BasicTextAreaUI {
public final class WindowsTextAreaUI extends BasicTextAreaUI {
/**
* Creates the object to use for a caret. By default an
* instance of WindowsCaret is created. This method
@ -42,6 +42,7 @@ public class WindowsTextAreaUI extends BasicTextAreaUI {
*
* @return the caret object
*/
@Override
protected Caret createCaret() {
return new WindowsTextUI.WindowsCaret();
}

View File

@ -62,7 +62,7 @@ import javax.swing.text.Position;
*
* @author Timothy Prinzing
*/
public class WindowsTextFieldUI extends BasicTextFieldUI
public final class WindowsTextFieldUI extends BasicTextFieldUI
{
/**
* Creates a UI for a JTextField.
@ -82,6 +82,7 @@ public class WindowsTextFieldUI extends BasicTextFieldUI
*
* @param g the graphics context
*/
@Override
protected void paintBackground(Graphics g) {
super.paintBackground(g);
}
@ -91,6 +92,7 @@ public class WindowsTextFieldUI extends BasicTextFieldUI
*
* @return the caret
*/
@Override
protected Caret createCaret() {
return new WindowsFieldCaret();
}
@ -100,7 +102,7 @@ public class WindowsTextFieldUI extends BasicTextFieldUI
* DefaultCaret.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
static class WindowsFieldCaret extends DefaultCaret implements UIResource {
static final class WindowsFieldCaret extends DefaultCaret implements UIResource {
public WindowsFieldCaret() {
super();
@ -112,6 +114,7 @@ public class WindowsTextFieldUI extends BasicTextFieldUI
* caret out into the field by about a quarter of
* a field length if not visible.
*/
@Override
protected void adjustVisibility(Rectangle r) {
SwingUtilities.invokeLater(new SafeScroller(r));
}
@ -121,16 +124,18 @@ public class WindowsTextFieldUI extends BasicTextFieldUI
*
* @return the painter
*/
@Override
protected Highlighter.HighlightPainter getSelectionPainter() {
return WindowsTextUI.WindowsPainter;
}
private class SafeScroller implements Runnable {
private final class SafeScroller implements Runnable {
SafeScroller(Rectangle r) {
this.r = r;
}
@Override
@SuppressWarnings("deprecation")
public void run() {
JTextField field = (JTextField) getComponent();

View File

@ -33,7 +33,7 @@ import javax.swing.text.Caret;
/**
* Windows rendition of the component.
*/
public class WindowsTextPaneUI extends BasicTextPaneUI
public final class WindowsTextPaneUI extends BasicTextPaneUI
{
/**
* Creates a UI for a JTextPane.
@ -53,6 +53,7 @@ public class WindowsTextPaneUI extends BasicTextPaneUI
*
* @return the caret object
*/
@Override
protected Caret createCaret() {
return new WindowsTextUI.WindowsCaret();
}

View File

@ -55,6 +55,7 @@ public abstract class WindowsTextUI extends BasicTextUI {
*
* @return the caret object
*/
@Override
protected Caret createCaret() {
return new WindowsCaret();
}
@ -64,20 +65,21 @@ public abstract class WindowsTextUI extends BasicTextUI {
/* public */
@SuppressWarnings("serial") // Superclass is not serializable across versions
static class WindowsCaret extends DefaultCaret
static final class WindowsCaret extends DefaultCaret
implements UIResource {
/**
* Gets the painter for the Highlighter.
*
* @return the painter
*/
@Override
protected Highlighter.HighlightPainter getSelectionPainter() {
return WindowsTextUI.WindowsPainter;
}
}
/* public */
static class WindowsHighlightPainter extends
static final class WindowsHighlightPainter extends
DefaultHighlighter.DefaultHighlightPainter {
WindowsHighlightPainter(Color c) {
super(c);
@ -94,6 +96,7 @@ public abstract class WindowsTextUI extends BasicTextUI {
* @param bounds the bounding box for the highlight
* @param c the editor
*/
@Override
@SuppressWarnings("deprecation")
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
Rectangle alloc = bounds.getBounds();
@ -167,6 +170,7 @@ public abstract class WindowsTextUI extends BasicTextUI {
* @param view View painting for
* @return region drawing occurred in
*/
@Override
public Shape paintLayer(Graphics g, int offs0, int offs1,
Shape bounds, JTextComponent c, View view) {
Color color = getColor();

View File

@ -45,7 +45,7 @@ import sun.awt.AppContext;
*
* @author Jeff Dinkins
*/
public class WindowsToggleButtonUI extends BasicToggleButtonUI
public final class WindowsToggleButtonUI extends BasicToggleButtonUI
{
protected int dashedRectGapX;
protected int dashedRectGapY;
@ -73,6 +73,7 @@ public class WindowsToggleButtonUI extends BasicToggleButtonUI
// ********************************
// Defaults
// ********************************
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
@ -93,6 +94,7 @@ public class WindowsToggleButtonUI extends BasicToggleButtonUI
}
}
@Override
protected void uninstallDefaults(AbstractButton b) {
super.uninstallDefaults(b);
defaults_initialized = false;
@ -112,6 +114,7 @@ public class WindowsToggleButtonUI extends BasicToggleButtonUI
private transient Color cachedBackgroundColor = null;
private transient Color cachedHighlightColor = null;
@Override
protected void paintButtonPressed(Graphics g, AbstractButton b) {
if (XPStyle.getXP() == null && b.isContentAreaFilled()) {
Color oldColor = g.getColor();
@ -135,6 +138,7 @@ public class WindowsToggleButtonUI extends BasicToggleButtonUI
}
}
@Override
public void paint(Graphics g, JComponent c) {
if (XPStyle.getXP() != null) {
WindowsButtonUI.paintXPButtonBackground(g, c);
@ -146,10 +150,12 @@ public class WindowsToggleButtonUI extends BasicToggleButtonUI
/**
* Overridden method to render the text without the mnemonic
*/
@Override
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
WindowsGraphicsUtils.paintText(g, b, textRect, text, getTextShiftOffset());
}
@Override
protected void paintFocus(Graphics g, AbstractButton b,
Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
g.setColor(getFocusColor());
@ -161,6 +167,7 @@ public class WindowsToggleButtonUI extends BasicToggleButtonUI
// ********************************
// Layout Methods
// ********************************
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension d = super.getPreferredSize(c);

View File

@ -40,12 +40,13 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
*
* @author Mark Davidson
*/
public class WindowsToolBarSeparatorUI extends BasicToolBarSeparatorUI {
public final class WindowsToolBarSeparatorUI extends BasicToolBarSeparatorUI {
public static ComponentUI createUI( JComponent c ) {
return new WindowsToolBarSeparatorUI();
}
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension size = ((JToolBar.Separator)c).getSeparatorSize();
@ -71,6 +72,7 @@ public class WindowsToolBarSeparatorUI extends BasicToolBarSeparatorUI {
return size;
}
@Override
public Dimension getMaximumSize(JComponent c) {
Dimension pref = getPreferredSize(c);
if (((JSeparator)c).getOrientation() == SwingConstants.VERTICAL) {
@ -80,6 +82,7 @@ public class WindowsToolBarSeparatorUI extends BasicToolBarSeparatorUI {
}
}
@Override
public void paint( Graphics g, JComponent c ) {
boolean vertical = ((JSeparator)c).getOrientation() == SwingConstants.VERTICAL;
Dimension size = c.getSize();

View File

@ -45,12 +45,13 @@ import javax.swing.plaf.basic.BasicToolBarUI;
import static com.sun.java.swing.plaf.windows.TMSchema.Part;
public class WindowsToolBarUI extends BasicToolBarUI {
public final class WindowsToolBarUI extends BasicToolBarUI {
public static ComponentUI createUI(JComponent c) {
return new WindowsToolBarUI();
}
@Override
protected void installDefaults() {
if (XPStyle.getXP() != null) {
setRolloverBorders(true);
@ -58,6 +59,7 @@ public class WindowsToolBarUI extends BasicToolBarUI {
super.installDefaults();
}
@Override
protected Border createRolloverBorder() {
if (XPStyle.getXP() != null) {
return new EmptyBorder(3, 3, 3, 3);
@ -66,6 +68,7 @@ public class WindowsToolBarUI extends BasicToolBarUI {
}
}
@Override
protected Border createNonRolloverBorder() {
if (XPStyle.getXP() != null) {
return new EmptyBorder(3, 3, 3, 3);
@ -74,6 +77,7 @@ public class WindowsToolBarUI extends BasicToolBarUI {
}
}
@Override
public void paint(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {
@ -88,6 +92,7 @@ public class WindowsToolBarUI extends BasicToolBarUI {
* {@inheritDoc}
* @since 1.6
*/
@Override
protected Border getRolloverBorder(AbstractButton b) {
XPStyle xp = XPStyle.getXP();
if (xp != null) {

View File

@ -60,6 +60,7 @@ public class WindowsTreeUI extends BasicTreeUI {
* Ensures that the rows identified by beginRow through endRow are
* visible.
*/
@Override
protected void ensureRowsAreVisible(int beginRow, int endRow) {
if(tree != null && beginRow >= 0 && endRow < getRowCount(tree)) {
Rectangle visRect = tree.getVisibleRect();
@ -108,6 +109,7 @@ public class WindowsTreeUI extends BasicTreeUI {
* Returns the default cell renderer that is used to do the
* stamping of each node.
*/
@Override
protected TreeCellRenderer createDefaultCellRenderer() {
return new WindowsTreeCellRenderer();
}
@ -127,6 +129,7 @@ public class WindowsTreeUI extends BasicTreeUI {
return (xp != null) ? xp.getSkin(c, Part.TVP_GLYPH) : null;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Skin skin = getSkin(c);
if (skin != null) {
@ -147,11 +150,13 @@ public class WindowsTreeUI extends BasicTreeUI {
g.drawLine(x + 2, y + HALF_SIZE, x + (SIZE - 3), y + HALF_SIZE);
}
@Override
public int getIconWidth() {
Skin skin = getSkin(null);
return (skin != null) ? skin.getWidth() : SIZE;
}
@Override
public int getIconHeight() {
Skin skin = getSkin(null);
return (skin != null) ? skin.getHeight() : SIZE;
@ -162,11 +167,12 @@ public class WindowsTreeUI extends BasicTreeUI {
* The plus sign button icon
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class CollapsedIcon extends ExpandedIcon {
public static final class CollapsedIcon extends ExpandedIcon {
public static Icon createCollapsedIcon() {
return new CollapsedIcon();
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Skin skin = getSkin(c);
if (skin != null) {
@ -179,7 +185,7 @@ public class WindowsTreeUI extends BasicTreeUI {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class WindowsTreeCellRenderer extends DefaultTreeCellRenderer {
public final class WindowsTreeCellRenderer extends DefaultTreeCellRenderer {
/**
* Configures the renderer based on the passed in components.
@ -189,6 +195,7 @@ public class WindowsTreeUI extends BasicTreeUI {
* The foreground color is set based on the selection and the icon
* is set based on on leaf and expanded.
*/
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel,
boolean expanded,

View File

@ -90,7 +90,7 @@ import static com.sun.java.swing.plaf.windows.TMSchema.TypeEnum;
*
* @author Leif Samuelsson
*/
class XPStyle {
final class XPStyle {
// Singleton instance of this class
private static XPStyle xp;
@ -331,6 +331,7 @@ class XPStyle {
super(color, thickness);
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
Insets margin = null;
//
@ -355,7 +356,7 @@ class XPStyle {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class XPStatefulFillBorder extends XPFillBorder {
private final class XPStatefulFillBorder extends XPFillBorder {
private final Part part;
private final Prop prop;
XPStatefulFillBorder(Color color, int thickness, Part part, Prop prop) {
@ -364,6 +365,7 @@ class XPStyle {
this.prop = prop;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
State state = State.NORMAL;
// special casing for comboboxes.
@ -383,18 +385,20 @@ class XPStyle {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class XPImageBorder extends AbstractBorder implements UIResource {
private final class XPImageBorder extends AbstractBorder implements UIResource {
Skin skin;
XPImageBorder(Component c, Part part) {
this.skin = getSkin(c, part);
}
@Override
public void paintBorder(Component c, Graphics g,
int x, int y, int width, int height) {
skin.paintSkin(g, x, y, width, height, null);
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
Insets margin = null;
Insets borderInsets = skin.getContentMargin();
@ -423,11 +427,12 @@ class XPStyle {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
private static class XPEmptyBorder extends EmptyBorder implements UIResource {
private static final class XPEmptyBorder extends EmptyBorder implements UIResource {
XPEmptyBorder(Insets m) {
super(m.top+2, m.left+2, m.bottom+2, m.right+2);
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
insets = super.getBorderInsets(c, insets);
@ -494,7 +499,7 @@ class XPStyle {
* (component type) and which provides methods for painting backgrounds
* and glyphs
*/
static class Skin {
static final class Skin {
final Component component;
final Part part;
final State state;
@ -566,14 +571,17 @@ class XPStyle {
return getHeight((state != null) ? state : State.NORMAL);
}
@Override
public String toString() {
return string;
}
@Override
public boolean equals(Object obj) {
return (obj instanceof Skin && ((Skin)obj).string.equals(string));
}
@Override
public int hashCode() {
return string.hashCode();
}
@ -675,16 +683,18 @@ class XPStyle {
}
}
private static class SkinPainter extends CachedPainter {
private static final class SkinPainter extends CachedPainter {
SkinPainter() {
super(30);
flush();
}
@Override
public void flush() {
super.flush();
}
@Override
protected void paintToImage(Component c, Image image, Graphics g,
int w, int h, Object[] args) {
Skin skin = (Skin)args[0];
@ -717,6 +727,7 @@ class XPStyle {
SunWritableRaster.markDirty(dbi);
}
@Override
protected Image createImage(Component c, int w, int h,
GraphicsConfiguration config, Object[] args) {
return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
@ -737,6 +748,7 @@ class XPStyle {
setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
}
@Override
@SuppressWarnings("deprecation")
public boolean isFocusTraversable() {
return false;
@ -754,6 +766,7 @@ class XPStyle {
return state;
}
@Override
public void paintComponent(Graphics g) {
if (XPStyle.getXP() == null || skin == null) {
return;
@ -769,6 +782,7 @@ class XPStyle {
repaint();
}
@Override
protected void paintBorder(Graphics g) {
}

View File

@ -30,7 +30,7 @@ import java.awt.Toolkit;
import sun.awt.windows.WToolkit;
public class PlatformGraphicsInfo {
public final class PlatformGraphicsInfo {
private static final boolean hasDisplays;

View File

@ -40,7 +40,7 @@ import java.awt.Transparency;
* in the reverse order from the base ComponentColorModel to match
* the ordering on a Windows 24-bit display.
*/
public class Win32ColorModel24 extends ComponentColorModel {
public final class Win32ColorModel24 extends ComponentColorModel {
public Win32ColorModel24() {
super(ColorSpace.getInstance(ColorSpace.CS_sRGB),
new int[] {8, 8, 8}, false, false,
@ -53,6 +53,7 @@ public class Win32ColorModel24 extends ComponentColorModel {
* @see WritableRaster
* @see SampleModel
*/
@Override
public WritableRaster createCompatibleWritableRaster (int w, int h) {
int[] bOffs = {2, 1, 0};
return Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
@ -65,6 +66,7 @@ public class Win32ColorModel24 extends ComponentColorModel {
* has a data layout compatible with this ColorModel.
* @see SampleModel
*/
@Override
public SampleModel createCompatibleSampleModel(int w, int h) {
int[] bOffs = {2, 1, 0};
return new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,

View File

@ -70,6 +70,7 @@ public final class Win32FontManager extends SunFontManager {
*/
private static native String getEUDCFontFile();
@Override
public TrueTypeFont getEUDCFont() {
return eudcFont;
}
@ -88,6 +89,7 @@ public final class Win32FontManager extends SunFontManager {
* Whether registerFontFile expects absolute or relative
* font file names.
*/
@Override
protected boolean useAbsoluteFontFileNames() {
return false;
}
@ -98,6 +100,7 @@ public final class Win32FontManager extends SunFontManager {
* class reports these back to the GraphicsEnvironment, so these
* are the componentFileNames of CompositeFonts.
*/
@Override
protected void registerFontFile(String fontFileName, String[] nativeNames,
int fontRank, boolean defer) {
@ -175,6 +178,7 @@ public final class Win32FontManager extends SunFontManager {
preferLocaleFonts,preferPropFonts);
}
@Override
protected void
populateFontFileNameMap(HashMap<String,String> fontToFileMap,
HashMap<String,String> fontToFamilyNameMap,
@ -194,6 +198,7 @@ public final class Win32FontManager extends SunFontManager {
familyToFontListMap,
Locale locale);
@Override
protected synchronized native String getFontPath(boolean noType1Fonts);
@Override

View File

@ -214,6 +214,7 @@ public class Win32GraphicsConfig extends GraphicsConfiguration
return new AffineTransform(xscale, 0.0, 0.0, yscale, 0.0, 0.0);
}
@Override
public String toString() {
return (super.toString()+"[dev="+device+",pixfmt="+visual+"]");
}

View File

@ -590,7 +590,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
* The listener restores the default display mode when window is iconified
* and sets it back to the one set by the user on de-iconification.
*/
private static class Win32FSWindowAdapter extends WindowAdapter {
private static final class Win32FSWindowAdapter extends WindowAdapter {
private Win32GraphicsDevice device;
private DisplayMode dm;

View File

@ -92,9 +92,11 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
public Win32GraphicsEnvironment() {
}
@Override
protected native int getNumScreens();
private native int getDefaultScreen();
@Override
public GraphicsDevice getDefaultScreenDevice() {
GraphicsDevice[] screens = getScreenDevices();
if (screens.length == 0) {
@ -207,6 +209,7 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
* ----END DISPLAY CHANGE SUPPORT----
*/
@Override
protected GraphicsDevice makeScreenDevice(int screennum) {
GraphicsDevice device = null;
if (WindowsFlags.isD3DEnabled()) {
@ -218,6 +221,7 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
return device;
}
@Override
public boolean isDisplayLocal() {
return true;
}

View File

@ -212,7 +212,7 @@ final class Win32ShellFolder2 extends ShellFolder {
static final List<KnownFolderDefinition> INSTANCE = getLibraries();
}
static class FolderDisposer implements sun.java2d.DisposerRecord {
static final class FolderDisposer implements sun.java2d.DisposerRecord {
/*
* This is cached as a concession to getFolderType(), which needs
* an absolute PIDL.
@ -226,6 +226,7 @@ final class Win32ShellFolder2 extends ShellFolder {
long relativePIDL;
boolean disposed;
@Override
public void dispose() {
if (disposed) return;
invoke(new Callable<Void>() {
@ -387,6 +388,7 @@ final class Win32ShellFolder2 extends ShellFolder {
* is a not a normal directory, then returns the first non-removable
* drive (normally "C:\").
*/
@Override
@Serial
protected Object writeReplace() throws java.io.ObjectStreamException {
return invoke(new Callable<File>() {
@ -541,6 +543,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* Check to see if two ShellFolder objects are the same
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Win32ShellFolder2 rhs)) {
// Short-circuit circuitous delegation path
@ -588,6 +591,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return Whether this is a file system shell folder
*/
@Override
public boolean isFileSystem() {
if (cachedIsFileSystem == null) {
cachedIsFileSystem = hasAttribute(ATTRIB_FILESYSTEM);
@ -682,10 +686,12 @@ final class Win32ShellFolder2 extends ShellFolder {
* @return The parent shell folder of this shell folder, null if
* there is no parent
*/
@Override
public File getParentFile() {
return parent;
}
@Override
public boolean isDirectory() {
if (isDir == null) {
// Folders with SFGAO_BROWSABLE have "shell extension" handlers and are
@ -742,6 +748,7 @@ final class Win32ShellFolder2 extends ShellFolder {
* object. The array will be empty if the folder is empty. Returns
* {@code null} if this shellfolder does not denote a directory.
*/
@Override
public File[] listFiles(final boolean includeHiddenFiles) {
try {
@ -851,6 +858,7 @@ final class Win32ShellFolder2 extends ShellFolder {
* symbolic links and junctions.
*/
@Override
public boolean isLink() {
if (cachedIsLink == null) {
cachedIsLink = hasAttribute(ATTRIB_LINK)
@ -864,6 +872,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return Whether this shell folder is marked as hidden
*/
@Override
public boolean isHidden() {
return hasAttribute(ATTRIB_HIDDEN);
}
@ -878,6 +887,7 @@ final class Win32ShellFolder2 extends ShellFolder {
* @return The shell folder linked to by this shell folder, or null
* if this shell folder is not a link or is a broken or invalid link
*/
@Override
public ShellFolder getLinkLocation() {
return getLinkLocation(true);
}
@ -933,6 +943,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return The name used to display this shell folder
*/
@Override
public String getDisplayName() {
if (displayName == null) {
displayName =
@ -953,6 +964,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return The type of shell folder as a string
*/
@Override
public String getFolderType() {
if (folderType == null) {
final long absolutePIDL = getAbsolutePIDL();
@ -972,6 +984,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return The executable type as a string
*/
@Override
public String getExecutableType() {
if (!isFileSystem()) {
return null;
@ -1047,6 +1060,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return The icon image used to display this shell folder
*/
@Override
public Image getIcon(final boolean getLargeIcon) {
Image icon = getLargeIcon ? largeIcon : smallIcon;
int size = getLargeIcon ? LARGE_ICON_SIZE : SMALL_ICON_SIZE;
@ -1140,6 +1154,7 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return The icon image of specified size used to display this shell folder
*/
@Override
public Image getIcon(int width, int height) {
int size = Math.max(width, height);
return invoke(() -> {
@ -1236,6 +1251,7 @@ final class Win32ShellFolder2 extends ShellFolder {
*
* @see java.io.File#getCanonicalFile
*/
@Override
public File getCanonicalFile() throws IOException {
return this;
}
@ -1252,6 +1268,7 @@ final class Win32ShellFolder2 extends ShellFolder {
*
* @see sun.awt.shell.ShellFolder#compareTo(File)
*/
@Override
public int compareTo(File file2) {
if (!(file2 instanceof Win32ShellFolder2)) {
if (isFileSystem() && !isSpecial()) {
@ -1268,6 +1285,7 @@ final class Win32ShellFolder2 extends ShellFolder {
private static final int LVCFMT_RIGHT = 1;
private static final int LVCFMT_CENTER = 2;
@Override
public ShellFolderColumnInfo[] getFolderColumns() {
ShellFolder library = resolveLibrary();
if (library != null) return library.getFolderColumns();
@ -1300,6 +1318,7 @@ final class Win32ShellFolder2 extends ShellFolder {
});
}
@Override
public Object getFolderColumnValue(final int column) {
if(!isLibrary()) {
ShellFolder library = resolveLibrary();
@ -1342,6 +1361,7 @@ final class Win32ShellFolder2 extends ShellFolder {
private static native int compareIDsByColumn(long pParentIShellFolder, long pidl1, long pidl2, int columnIdx);
@Override
public void sortChildren(final List<? extends File> files) {
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
@ -1354,7 +1374,7 @@ final class Win32ShellFolder2 extends ShellFolder {
});
}
private static class ColumnComparator implements Comparator<File> {
private static final class ColumnComparator implements Comparator<File> {
private final Win32ShellFolder2 shellFolder;
private final int columnIdx;
@ -1365,6 +1385,7 @@ final class Win32ShellFolder2 extends ShellFolder {
}
// compares 2 objects within this folder by the specified column
@Override
public int compare(final File o, final File o1) {
Integer result = invoke(new Callable<Integer>() {
public Integer call() {
@ -1405,7 +1426,7 @@ final class Win32ShellFolder2 extends ShellFolder {
});
}
static class MultiResolutionIconImage extends AbstractMultiResolutionImage {
static final class MultiResolutionIconImage extends AbstractMultiResolutionImage {
final int baseSize;
final Map<Integer, Image> resolutionVariants = new HashMap<>();

View File

@ -75,6 +75,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
sun.awt.windows.WToolkit.loadLibraries();
}
@Override
public ShellFolder createShellFolder(File file) throws FileNotFoundException {
try {
return createShellFolder(getDesktop(), file);
@ -264,6 +265,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
*
* @return An Object matching the key string.
*/
@Override
public Object get(String key) {
if (key.equals("fileChooserDefaultFolder")) {
File file = getPersonal();
@ -408,6 +410,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
* Does {@code dir} represent a "computer" such as a node on the network, or
* "My Computer" on the desktop.
*/
@Override
public boolean isComputerNode(final File dir) {
if (dir != null && dir == getDrives()) {
return true;
@ -418,6 +421,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
}
}
@Override
public boolean isFileSystemRoot(File dir) {
//Note: Removable drives don't "exist" but are listed in "My Computer"
if (dir != null) {
@ -498,7 +502,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
return new ComInvoker();
}
private static class ComInvoker extends ThreadPoolExecutor implements ThreadFactory, ShellFolder.Invoker {
private static final class ComInvoker extends ThreadPoolExecutor implements ThreadFactory, ShellFolder.Invoker {
private static Thread comThread;
private ComInvoker() {
@ -512,6 +516,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
Runtime.getRuntime().addShutdownHook(t);
}
@Override
public synchronized Thread newThread(final Runnable task) {
final Runnable comRun = new Runnable() {
public void run() {
@ -539,6 +544,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
return comThread;
}
@Override
public <T> T invoke(Callable<T> task) throws Exception {
if (Thread.currentThread() == comThread) {
// if it's already called from the COM

View File

@ -355,7 +355,7 @@ abstract class TranslucentWindowPainter {
}
}
private static class VIOptD3DWindowPainter extends VIOptWindowPainter {
private static final class VIOptD3DWindowPainter extends VIOptWindowPainter {
protected VIOptD3DWindowPainter(WWindowPeer peer) {
super(peer);
@ -370,7 +370,7 @@ abstract class TranslucentWindowPainter {
}
}
private static class VIOptWGLWindowPainter extends VIOptWindowPainter {
private static final class VIOptWGLWindowPainter extends VIOptWindowPainter {
protected VIOptWGLWindowPainter(WWindowPeer peer) {
super(peer);

View File

@ -789,6 +789,7 @@ public abstract class WComponentPeer extends WObjectPeer
// Object overrides
@Override
public String toString() {
return getClass().getName() + "[" + target + "]";
}

View File

@ -541,7 +541,7 @@ enum EHTMLReadMode {
*
* on encode: static convertToHTMLFormat is responsible for HTML clipboard header creation
*/
class HTMLCodec extends InputStream {
final class HTMLCodec extends InputStream {
public static final String VERSION = "Version:";
public static final String START_HTML = "StartHTML:";

View File

@ -46,7 +46,7 @@ final class WDefaultFontCharset extends AWTCharset
return new Encoder();
}
private class Encoder extends AWTCharset.Encoder {
private final class Encoder extends AWTCharset.Encoder {
@Override
public boolean canEncode(char c){
return canConvert(c);

View File

@ -198,7 +198,7 @@ final class WDesktopProperties {
*/
private native void playWindowsSound(String winEventName);
class WinPlaySound implements Runnable {
final class WinPlaySound implements Runnable {
String winEventName;
WinPlaySound(String winEventName) {
@ -210,10 +210,12 @@ final class WDesktopProperties {
WDesktopProperties.this.playWindowsSound(winEventName);
}
@Override
public String toString() {
return "WinPlaySound("+winEventName+")";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
@ -225,6 +227,7 @@ final class WDesktopProperties {
}
}
@Override
public int hashCode() {
return winEventName.hashCode();
}

View File

@ -54,9 +54,11 @@ import sun.awt.dnd.SunDragSourceContextPeer;
*/
final class WDragSourceContextPeer extends SunDragSourceContextPeer {
@Override
public void startSecondaryEventLoop(){
WToolkit.startSecondaryEventLoop();
}
@Override
public void quitSecondaryEventLoop(){
WToolkit.quitSecondaryEventLoop();
}
@ -168,6 +170,7 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
int imgWidth, int imgHight,
int offsetX, int offsetY);
@Override
protected native void setNativeCursor(long nativeCtxt, Cursor c, int cType);
}

View File

@ -36,7 +36,7 @@ import sun.awt.image.ByteInterleavedRaster;
import java.awt.peer.FramePeer;
@SuppressWarnings("serial") // JDK-implementation class
public class WEmbeddedFrame extends EmbeddedFrame {
public final class WEmbeddedFrame extends EmbeddedFrame {
static {
initIDs();
@ -79,6 +79,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
}
}
@Override
public void addNotify() {
if (!isDisplayable()) {
WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
@ -224,6 +225,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
public void activateEmbeddingTopLevel() {
}
@Override
public void synthesizeWindowActivation(final boolean activate) {
final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
if (!activate || EventQueue.isDispatchThread()) {
@ -241,7 +243,9 @@ public class WEmbeddedFrame extends EmbeddedFrame {
}
}
@Override
public void registerAccelerator(AWTKeyStroke stroke) {}
@Override
public void unregisterAccelerator(AWTKeyStroke stroke) {}
/**
@ -256,6 +260,7 @@ public class WEmbeddedFrame extends EmbeddedFrame {
* NOTE: This method may be called by privileged threads.
* DO NOT INVOKE CLIENT CODE ON THIS THREAD!
*/
@Override
public void notifyModalBlocked(Dialog blocker, boolean blocked) {
try {
ComponentPeer thisPeer = (ComponentPeer)WToolkit.targetToPeer(this);

View File

@ -32,7 +32,7 @@ import java.awt.Rectangle;
import sun.awt.EmbeddedFrame;
import sun.awt.Win32GraphicsEnvironment;
public class WEmbeddedFramePeer extends WFramePeer {
public final class WEmbeddedFramePeer extends WFramePeer {
public WEmbeddedFramePeer(EmbeddedFrame target) {
super(target);

View File

@ -31,6 +31,7 @@ final class WLabelPeer extends WComponentPeer implements LabelPeer {
// ComponentPeer overrides
@Override
public Dimension getMinimumSize() {
FontMetrics fm = getFontMetrics(((Label)target).getFont());
String label = ((Label)target).getText();
@ -40,6 +41,7 @@ final class WLabelPeer extends WComponentPeer implements LabelPeer {
}
native void lazyPaint();
@Override
synchronized void start() {
super.start();
// if need then paint label
@ -47,11 +49,14 @@ final class WLabelPeer extends WComponentPeer implements LabelPeer {
}
// LabelPeer implementation
@Override
public boolean shouldClearRectBeforePaint() {
return false;
}
@Override
public native void setText(String label);
@Override
public native void setAlignment(int alignment);
// Toolkit & peer internals
@ -60,8 +65,10 @@ final class WLabelPeer extends WComponentPeer implements LabelPeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
@Override
void initialize() {
Label l = (Label)target;

View File

@ -36,7 +36,7 @@ import sun.awt.OverrideNativeWindowHandle;
import sun.swing.JLightweightFrame;
import sun.swing.SwingAccessor;
public class WLightweightFramePeer extends WFramePeer implements OverrideNativeWindowHandle {
public final class WLightweightFramePeer extends WFramePeer implements OverrideNativeWindowHandle {
public WLightweightFramePeer(LightweightFrame target) {
super(target);
@ -100,6 +100,7 @@ public class WLightweightFramePeer extends WFramePeer implements OverrideNativeW
SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
@Override
public boolean isLightweightFramePeer() {
return true;
}

View File

@ -46,11 +46,13 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
// MenuItemPeer implementation
private synchronized native void _dispose();
@Override
protected void disposeImpl() {
WToolkit.targetDisposedPeer(target, this);
_dispose();
}
@Override
public void setEnabled(boolean b) {
enable(b);
}
@ -69,6 +71,7 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
}
}
@Override
public void setLabel(String label) {
//Fix for 6288578: PIT. Windows: Shortcuts displayed for the menuitems in a popup menu
readShortcutLabel();
@ -165,6 +168,7 @@ class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
private native void _setFont(Font f);
@Override
public void setFont(final Font f) {
_setFont(f);
}

View File

@ -43,8 +43,10 @@ public final class WMouseInfoPeer implements MouseInfoPeer {
WMouseInfoPeer() {
}
@Override
public native int fillPointWithCoords(Point point);
@Override
public native boolean isWindowUnderMouse(Window w);
}

View File

@ -70,6 +70,7 @@ final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
private native void createMenu(WComponentPeer parent);
@Override
@SuppressWarnings("deprecation")
public void show(Event e) {
Component origin = (Component)e.target;

View File

@ -264,7 +264,7 @@ public final class WPrinterJob extends RasterPrinterJob
/* The HandleRecord holds the native resources that need to be freed
* when this WPrinterJob is GC'd.
*/
static class HandleRecord implements DisposerRecord {
static final class HandleRecord implements DisposerRecord {
/**
* The Windows device context we will print into.
* This variable is set after the Print dialog
@ -2269,7 +2269,7 @@ public final class WPrinterJob extends RasterPrinterJob
}
@SuppressWarnings("serial") // JDK-implementation class
static class PrintToFileErrorDialog extends Dialog implements ActionListener {
static final class PrintToFileErrorDialog extends Dialog implements ActionListener {
public PrintToFileErrorDialog(Frame parent, String title, String message,
String buttonText) {
super(parent, title, true);

View File

@ -167,7 +167,7 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
* operation.
*/
@SuppressWarnings("serial") // JDK-implementation class
static class ScrollEvent extends PeerEvent {
static final class ScrollEvent extends PeerEvent {
ScrollEvent(Object source, Runnable runnable) {
super(source, runnable, 0L);
}
@ -187,7 +187,7 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
/*
* Runnable for the ScrollEvent that performs the adjustment.
*/
class Adjustor implements Runnable {
final class Adjustor implements Runnable {
int orient; // selects scrollbar
int type; // adjustment type
int pos; // new position (only used for absolute)

View File

@ -35,6 +35,7 @@ final class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
static native int getScrollbarSize(int orientation);
// ComponentPeer overrides
@Override
public Dimension getMinimumSize() {
if (((Scrollbar)target).getOrientation() == Scrollbar.VERTICAL) {
return new Dimension(getScrollbarSize(Scrollbar.VERTICAL), 50);
@ -46,9 +47,12 @@ final class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
// ScrollbarPeer implementation
@Override
public native void setValues(int value, int visible,
int minimum, int maximum);
@Override
public native void setLineIncrement(int l);
@Override
public native void setPageIncrement(int l);
@ -58,8 +62,10 @@ final class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
@Override
void initialize() {
Scrollbar sb = (Scrollbar)target;
setValues(sb.getValue(), sb.getVisibleAmount(),
@ -136,6 +142,7 @@ final class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
});
}
@Override
public boolean shouldClearRectBeforePaint() {
return false;
}

View File

@ -186,7 +186,7 @@ public final class WToolkit extends SunToolkit implements Runnable {
}
}
static class ToolkitDisposer implements sun.java2d.DisposerRecord {
static final class ToolkitDisposer implements sun.java2d.DisposerRecord {
@Override
public void dispose() {
WToolkit.postDispose();

View File

@ -199,7 +199,7 @@ final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
native void _displayMessage(String caption, String text, String messageType);
class IconObserver implements ImageObserver {
final class IconObserver implements ImageObserver {
@Override
public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
if (image != ((TrayIcon)target).getImage() || // if the image has been changed

View File

@ -849,7 +849,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* it removes the list of the active windows from the disposed AppContext and
* unregisters ActiveWindowListener listener.
*/
private static class GuiDisposedListener implements PropertyChangeListener {
private static final class GuiDisposedListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent e) {
boolean isDisposed = (Boolean)e.getNewValue();
@ -875,7 +875,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* window is always at the end of the list. The list is stored in AppContext.
*/
@SuppressWarnings("unchecked")
private static class ActiveWindowListener implements PropertyChangeListener {
private static final class ActiveWindowListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent e) {
Window w = (Window)e.getNewValue();

View File

@ -52,7 +52,7 @@ public final class WingDings extends Charset {
return cs instanceof WingDings;
}
private static class Encoder extends CharsetEncoder {
private static final class Encoder extends CharsetEncoder {
public Encoder(Charset cs) {
super(cs, 1.0f, 1.0f);
}

View File

@ -37,7 +37,7 @@ import java.awt.geom.Rectangle2D;
* and the font is ignored.
*/
public class NativeFont extends PhysicalFont {
public final class NativeFont extends PhysicalFont {
/**
* Verifies native font is accessible.
@ -53,6 +53,7 @@ public class NativeFont extends PhysicalFont {
return false;
}
@Override
public CharToGlyphMapper getMapper() {
return null;
}
@ -61,6 +62,7 @@ public class NativeFont extends PhysicalFont {
return null;
}
@Override
FontStrike createStrike(FontStrikeDesc desc) {
return null;
}
@ -69,16 +71,19 @@ public class NativeFont extends PhysicalFont {
return null;
}
@Override
StrikeMetrics getFontMetrics(long pScalerContext) {
return null;
}
@Override
public GeneralPath getGlyphOutline(long pScalerContext,
int glyphCode,
float x, float y) {
return null;
}
@Override
public GeneralPath getGlyphVectorOutline(long pScalerContext,
int[] glyphs, int numGlyphs,
float x, float y) {
@ -86,20 +91,24 @@ public class NativeFont extends PhysicalFont {
}
@Override
long getGlyphImage(long pScalerContext, int glyphCode) {
return 0L;
}
@Override
void getGlyphMetrics(long pScalerContext, int glyphCode,
Point2D.Float metrics) {
}
@Override
float getGlyphAdvance(long pScalerContext, int glyphCode) {
return 0f;
}
@Override
Rectangle2D.Float getGlyphOutlineBounds(long pScalerContext,
int glyphCode) {
return new Rectangle2D.Float(0f, 0f, 0f, 0f);

View File

@ -48,9 +48,11 @@ public class NativeStrike extends PhysicalStrike {
}
@Override
void getGlyphImagePtrs(int[] glyphCodes, long[] images,int len) {
}
@Override
long getGlyphImagePtr(int glyphCode) {
return 0L;
}
@ -59,26 +61,32 @@ public class NativeStrike extends PhysicalStrike {
return 0L;
}
@Override
void getGlyphImageBounds(int glyphcode,
Point2D.Float pt,
Rectangle result) {
}
@Override
Point2D.Float getGlyphMetrics(int glyphCode) {
return null;
}
@Override
float getGlyphAdvance(int glyphCode) {
return 0f;
}
@Override
Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
return null;
}
@Override
GeneralPath getGlyphOutline(int glyphCode, float x, float y) {
return null;
}
@Override
GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) {
return null;
}

View File

@ -38,7 +38,7 @@ import sun.java2d.opengl.WGLVolatileSurfaceManager;
* The SurfaceManagerFactory that creates VolatileSurfaceManager
* implementations for the Windows volatile images.
*/
public class WindowsSurfaceManagerFactory extends SurfaceManagerFactory {
public final class WindowsSurfaceManagerFactory extends SurfaceManagerFactory {
/**
* Creates a new instance of a VolatileSurfaceManager given any
@ -49,6 +49,7 @@ public class WindowsSurfaceManagerFactory extends SurfaceManagerFactory {
* For Windows platforms, this method returns a Windows-specific
* VolatileSurfaceManager.
*/
@Override
public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg,
Object context)
{

View File

@ -358,7 +358,7 @@ final class D3DBlitLoops {
}
}
class D3DSurfaceToSurfaceBlit extends Blit {
final class D3DSurfaceToSurfaceBlit extends Blit {
D3DSurfaceToSurfaceBlit() {
super(D3DSurfaceData.D3DSurface,
@ -366,6 +366,7 @@ class D3DSurfaceToSurfaceBlit extends Blit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
@ -380,7 +381,7 @@ class D3DSurfaceToSurfaceBlit extends Blit {
}
}
class D3DSurfaceToSurfaceScale extends ScaledBlit {
final class D3DSurfaceToSurfaceScale extends ScaledBlit {
D3DSurfaceToSurfaceScale() {
super(D3DSurfaceData.D3DSurface,
@ -388,6 +389,7 @@ class D3DSurfaceToSurfaceScale extends ScaledBlit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Scale(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx1, int sy1,
@ -405,7 +407,7 @@ class D3DSurfaceToSurfaceScale extends ScaledBlit {
}
}
class D3DSurfaceToSurfaceTransform extends TransformBlit {
final class D3DSurfaceToSurfaceTransform extends TransformBlit {
D3DSurfaceToSurfaceTransform() {
super(D3DSurfaceData.D3DSurface,
@ -413,6 +415,7 @@ class D3DSurfaceToSurfaceTransform extends TransformBlit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Transform(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform at, int hint,
@ -428,7 +431,7 @@ class D3DSurfaceToSurfaceTransform extends TransformBlit {
}
}
class D3DRTTSurfaceToSurfaceBlit extends Blit {
final class D3DRTTSurfaceToSurfaceBlit extends Blit {
D3DRTTSurfaceToSurfaceBlit() {
super(D3DSurfaceData.D3DSurfaceRTT,
@ -436,6 +439,7 @@ class D3DRTTSurfaceToSurfaceBlit extends Blit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
@ -450,7 +454,7 @@ class D3DRTTSurfaceToSurfaceBlit extends Blit {
}
}
class D3DRTTSurfaceToSurfaceScale extends ScaledBlit {
final class D3DRTTSurfaceToSurfaceScale extends ScaledBlit {
D3DRTTSurfaceToSurfaceScale() {
super(D3DSurfaceData.D3DSurfaceRTT,
@ -458,6 +462,7 @@ class D3DRTTSurfaceToSurfaceScale extends ScaledBlit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Scale(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx1, int sy1,
@ -475,7 +480,7 @@ class D3DRTTSurfaceToSurfaceScale extends ScaledBlit {
}
}
class D3DRTTSurfaceToSurfaceTransform extends TransformBlit {
final class D3DRTTSurfaceToSurfaceTransform extends TransformBlit {
D3DRTTSurfaceToSurfaceTransform() {
super(D3DSurfaceData.D3DSurfaceRTT,
@ -483,6 +488,7 @@ class D3DRTTSurfaceToSurfaceTransform extends TransformBlit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Transform(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform at, int hint,
@ -497,7 +503,7 @@ class D3DRTTSurfaceToSurfaceTransform extends TransformBlit {
}
}
class D3DSurfaceToSwBlit extends Blit {
final class D3DSurfaceToSwBlit extends Blit {
private int typeval;
private WeakReference<SurfaceData> srcTmp;
@ -567,6 +573,7 @@ class D3DSurfaceToSwBlit extends Blit {
}
}
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
@ -629,7 +636,7 @@ class D3DSurfaceToSwBlit extends Blit {
}
}
class D3DSwToSurfaceBlit extends Blit {
final class D3DSwToSurfaceBlit extends Blit {
private int typeval;
@ -640,6 +647,7 @@ class D3DSwToSurfaceBlit extends Blit {
this.typeval = typeval;
}
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
@ -653,7 +661,7 @@ class D3DSwToSurfaceBlit extends Blit {
}
}
class D3DSwToSurfaceScale extends ScaledBlit {
final class D3DSwToSurfaceScale extends ScaledBlit {
private int typeval;
@ -664,6 +672,7 @@ class D3DSwToSurfaceScale extends ScaledBlit {
this.typeval = typeval;
}
@Override
public void Scale(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx1, int sy1,
@ -680,7 +689,7 @@ class D3DSwToSurfaceScale extends ScaledBlit {
}
}
class D3DSwToSurfaceTransform extends TransformBlit {
final class D3DSwToSurfaceTransform extends TransformBlit {
private int typeval;
@ -691,6 +700,7 @@ class D3DSwToSurfaceTransform extends TransformBlit {
this.typeval = typeval;
}
@Override
public void Transform(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform at, int hint,
@ -704,7 +714,7 @@ class D3DSwToSurfaceTransform extends TransformBlit {
}
}
class D3DSwToTextureBlit extends Blit {
final class D3DSwToTextureBlit extends Blit {
private int typeval;
@ -715,6 +725,7 @@ class D3DSwToTextureBlit extends Blit {
this.typeval = typeval;
}
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
@ -728,7 +739,7 @@ class D3DSwToTextureBlit extends Blit {
}
}
class D3DTextureToSurfaceBlit extends Blit {
final class D3DTextureToSurfaceBlit extends Blit {
D3DTextureToSurfaceBlit() {
super(D3DSurfaceData.D3DTexture,
@ -736,6 +747,7 @@ class D3DTextureToSurfaceBlit extends Blit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)
@ -750,7 +762,7 @@ class D3DTextureToSurfaceBlit extends Blit {
}
}
class D3DTextureToSurfaceScale extends ScaledBlit {
final class D3DTextureToSurfaceScale extends ScaledBlit {
D3DTextureToSurfaceScale() {
super(D3DSurfaceData.D3DTexture,
@ -758,6 +770,7 @@ class D3DTextureToSurfaceScale extends ScaledBlit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Scale(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx1, int sy1,
@ -775,7 +788,7 @@ class D3DTextureToSurfaceScale extends ScaledBlit {
}
}
class D3DTextureToSurfaceTransform extends TransformBlit {
final class D3DTextureToSurfaceTransform extends TransformBlit {
D3DTextureToSurfaceTransform() {
super(D3DSurfaceData.D3DTexture,
@ -783,6 +796,7 @@ class D3DTextureToSurfaceTransform extends TransformBlit {
D3DSurfaceData.D3DSurface);
}
@Override
public void Transform(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
AffineTransform at, int hint,
@ -804,7 +818,7 @@ class D3DTextureToSurfaceTransform extends TransformBlit {
* IntArgbPre->D3DSurface/Texture loop to get the intermediate
* (premultiplied) surface down to D3D using simple blit.
*/
class D3DGeneralBlit extends Blit {
final class D3DGeneralBlit extends Blit {
private final Blit performop;
private WeakReference<SurfaceData> srcTmp;
@ -817,6 +831,7 @@ class D3DGeneralBlit extends Blit {
this.performop = performop;
}
@Override
public synchronized void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy,
@ -917,7 +932,7 @@ final class D3DGeneralTransformedBlit extends TransformBlit {
*
*/
class D3DSurfaceToGDIWindowSurfaceBlit extends Blit {
final class D3DSurfaceToGDIWindowSurfaceBlit extends Blit {
D3DSurfaceToGDIWindowSurfaceBlit() {
super(D3DSurfaceData.D3DSurface,
@ -935,7 +950,7 @@ class D3DSurfaceToGDIWindowSurfaceBlit extends Blit {
}
class D3DSurfaceToGDIWindowSurfaceScale extends ScaledBlit {
final class D3DSurfaceToGDIWindowSurfaceScale extends ScaledBlit {
D3DSurfaceToGDIWindowSurfaceScale() {
super(D3DSurfaceData.D3DSurface,
@ -955,7 +970,7 @@ class D3DSurfaceToGDIWindowSurfaceScale extends ScaledBlit {
}
}
class D3DSurfaceToGDIWindowSurfaceTransform extends TransformBlit {
final class D3DSurfaceToGDIWindowSurfaceTransform extends TransformBlit {
D3DSurfaceToGDIWindowSurfaceTransform() {
super(D3DSurfaceData.D3DSurface,

View File

@ -37,7 +37,7 @@ import sun.java2d.loops.CompositeType;
import sun.java2d.pipe.BufferedBufImgOps;
import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
class D3DBufImgOps extends BufferedBufImgOps {
final class D3DBufImgOps extends BufferedBufImgOps {
/**
* This method is called from D3DDrawImage.transformImage() only. It

View File

@ -106,7 +106,7 @@ final class D3DContext extends BufferedContext {
return device;
}
static class D3DContextCaps extends ContextCapabilities {
static final class D3DContextCaps extends ContextCapabilities {
/**
* Indicates the presence of pixel shaders (v2.0 or greater).
* This cap will only be set if the hardware supports the minimum number

View File

@ -37,7 +37,7 @@ import sun.java2d.loops.SurfaceType;
import sun.java2d.loops.TransformBlit;
import sun.java2d.pipe.DrawImage;
public class D3DDrawImage extends DrawImage {
public final class D3DDrawImage extends DrawImage {
@Override
protected void renderImageXform(SunGraphics2D sg, Image img,

View File

@ -223,7 +223,7 @@ public final class D3DGraphicsConfig
}
}
private static class D3DBufferCaps extends BufferCapabilities {
private static final class D3DBufferCaps extends BufferCapabilities {
public D3DBufferCaps() {
// REMIND: should we indicate that the front-buffer
// (the on-screen rendering) is not accelerated?
@ -244,7 +244,7 @@ public final class D3DGraphicsConfig
return bufferCaps;
}
private static class D3DImageCaps extends ImageCapabilities {
private static final class D3DImageCaps extends ImageCapabilities {
private D3DImageCaps() {
super(true);
}

View File

@ -128,7 +128,7 @@ public final class D3DGraphicsDevice extends Win32GraphicsDevice {
return d3dCaps != null ? d3dCaps : new D3DContextCaps(CAPS_EMPTY, null);
}
public final boolean isCapPresent(int cap) {
public boolean isCapPresent(int cap) {
return ((d3dCaps.getCaps() & cap) != 0);
}
@ -234,7 +234,7 @@ public final class D3DGraphicsDevice extends Win32GraphicsDevice {
* REMIND: we create an instance per each full-screen device while a single
* instance would suffice (but requires more management).
*/
private static class D3DFSWindowAdapter extends WindowAdapter {
private static final class D3DFSWindowAdapter extends WindowAdapter {
@Override
@SuppressWarnings("static")
public void windowDeactivated(WindowEvent e) {

View File

@ -36,7 +36,7 @@ import sun.java2d.pipe.BufferedMaskBlit;
import static sun.java2d.loops.CompositeType.*;
import static sun.java2d.loops.SurfaceType.*;
class D3DMaskBlit extends BufferedMaskBlit {
final class D3DMaskBlit extends BufferedMaskBlit {
static void register() {
GraphicsPrimitive[] primitives = {

View File

@ -36,7 +36,7 @@ import sun.java2d.pipe.BufferedMaskFill;
import static sun.java2d.loops.CompositeType.*;
import static sun.java2d.loops.SurfaceType.*;
class D3DMaskFill extends BufferedMaskFill {
final class D3DMaskFill extends BufferedMaskFill {
static void register() {
GraphicsPrimitive[] primitives = {

View File

@ -76,7 +76,7 @@ abstract class D3DPaints {
/************************* GradientPaint support ****************************/
private static class Gradient extends D3DPaints {
private static final class Gradient extends D3DPaints {
private Gradient() {}
/**
@ -96,7 +96,7 @@ abstract class D3DPaints {
/************************** TexturePaint support ****************************/
private static class Texture extends D3DPaints {
private static final class Texture extends D3DPaints {
private Texture() {}
/**
@ -201,7 +201,7 @@ abstract class D3DPaints {
/********************** LinearGradientPaint support *************************/
private static class LinearGradient extends MultiGradient {
private static final class LinearGradient extends MultiGradient {
private LinearGradient() {}
@Override
@ -228,7 +228,7 @@ abstract class D3DPaints {
/********************** RadialGradientPaint support *************************/
private static class RadialGradient extends MultiGradient {
private static final class RadialGradient extends MultiGradient {
private RadialGradient() {}
}
}

View File

@ -33,7 +33,7 @@ import static sun.java2d.pipe.BufferedOpCodes.*;
/**
* D3D-specific implementation of RenderQueue.
*/
public class D3DRenderQueue extends RenderQueue {
public final class D3DRenderQueue extends RenderQueue {
private static D3DRenderQueue theInstance;
private static Thread rqThread;
@ -132,11 +132,13 @@ public class D3DRenderQueue extends RenderQueue {
}
}
@Override
public void flushNow() {
// assert lock.isHeldByCurrentThread();
flushBuffer(null);
}
@Override
public void flushAndInvokeNow(Runnable r) {
// assert lock.isHeldByCurrentThread();
flushBuffer(r);

View File

@ -87,6 +87,7 @@ class D3DRenderer extends BufferedRenderPipe {
}
}
@Override
protected native void drawPoly(int[] xPoints, int[] yPoints,
int nPoints, boolean isClosed,
int transX, int transY);
@ -95,12 +96,13 @@ class D3DRenderer extends BufferedRenderPipe {
return new Tracer(this);
}
private static class Tracer extends D3DRenderer {
private static final class Tracer extends D3DRenderer {
private D3DRenderer d3dr;
Tracer(D3DRenderer d3dr) {
super(d3dr.rq);
this.d3dr = d3dr;
}
@Override
public ParallelogramPipe getAAParallelogramPipe() {
final ParallelogramPipe realpipe = d3dr.getAAParallelogramPipe();
return new ParallelogramPipe() {
@ -133,19 +135,23 @@ class D3DRenderer extends BufferedRenderPipe {
};
}
@Override
protected void validateContext(SunGraphics2D sg2d) {
d3dr.validateContext(sg2d);
}
@Override
public void drawLine(SunGraphics2D sg2d,
int x1, int y1, int x2, int y2)
{
GraphicsPrimitive.tracePrimitive("D3DDrawLine");
d3dr.drawLine(sg2d, x1, y1, x2, y2);
}
@Override
public void drawRect(SunGraphics2D sg2d, int x, int y, int w, int h) {
GraphicsPrimitive.tracePrimitive("D3DDrawRect");
d3dr.drawRect(sg2d, x, y, w, h);
}
@Override
protected void drawPoly(SunGraphics2D sg2d,
int[] xPoints, int[] yPoints,
int nPoints, boolean isClosed)
@ -153,28 +159,33 @@ class D3DRenderer extends BufferedRenderPipe {
GraphicsPrimitive.tracePrimitive("D3DDrawPoly");
d3dr.drawPoly(sg2d, xPoints, yPoints, nPoints, isClosed);
}
@Override
public void fillRect(SunGraphics2D sg2d, int x, int y, int w, int h) {
GraphicsPrimitive.tracePrimitive("D3DFillRect");
d3dr.fillRect(sg2d, x, y, w, h);
}
@Override
protected void drawPath(SunGraphics2D sg2d,
Path2D.Float p2df, int transx, int transy)
{
GraphicsPrimitive.tracePrimitive("D3DDrawPath");
d3dr.drawPath(sg2d, p2df, transx, transy);
}
@Override
protected void fillPath(SunGraphics2D sg2d,
Path2D.Float p2df, int transx, int transy)
{
GraphicsPrimitive.tracePrimitive("D3DFillPath");
d3dr.fillPath(sg2d, p2df, transx, transy);
}
@Override
protected void fillSpans(SunGraphics2D sg2d, SpanIterator si,
int transx, int transy)
{
GraphicsPrimitive.tracePrimitive("D3DFillSpans");
d3dr.fillSpans(sg2d, si, transx, transy);
}
@Override
public void fillParallelogram(SunGraphics2D sg2d,
double ux1, double uy1,
double ux2, double uy2,
@ -187,6 +198,7 @@ class D3DRenderer extends BufferedRenderPipe {
ux1, uy1, ux2, uy2,
x, y, dx1, dy1, dx2, dy2);
}
@Override
public void drawParallelogram(SunGraphics2D sg2d,
double ux1, double uy1,
double ux2, double uy2,
@ -200,6 +212,7 @@ class D3DRenderer extends BufferedRenderPipe {
ux1, uy1, ux2, uy2,
x, y, dx1, dy1, dx2, dy2, lw1, lw2);
}
@Override
public void copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{

View File

@ -58,7 +58,7 @@ import sun.java2d.windows.WindowsFlags;
* There are some restrictions to which windows we would use this for.
* @see #createScreenSurface
*/
public class D3DScreenUpdateManager extends ScreenUpdateManager
public final class D3DScreenUpdateManager extends ScreenUpdateManager
implements Runnable
{
/**
@ -401,6 +401,7 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager
}
}
@Override
public void run() {
while (!done) {
synchronized (runLock) {

View File

@ -441,6 +441,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
* Returns the D3DContext for the GraphicsConfig associated with this
* surface.
*/
@Override
public final D3DContext getContext() {
return graphicsDevice.getContext();
}
@ -448,6 +449,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
/**
* Returns one of the surface type constants defined above.
*/
@Override
public final int getType() {
return type;
}
@ -455,7 +457,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
private static native int dbGetPixelNative(long pData, int x, int y);
private static native void dbSetPixelNative(long pData, int x, int y,
int pixel);
static class D3DDataBufferNative extends DataBufferNative {
static final class D3DDataBufferNative extends DataBufferNative {
int pixel;
protected D3DDataBufferNative(SurfaceData sData,
int type, int w, int h)
@ -463,6 +465,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
super(sData, type, w, h);
}
@Override
protected int getElem(final int x, final int y,
final SurfaceData sData)
{
@ -486,6 +489,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
return retPixel;
}
@Override
protected void setElem(final int x, final int y, final int pixel,
final SurfaceData sData)
{
@ -508,6 +512,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
}
}
@Override
public synchronized Raster getRaster(int x, int y, int w, int h) {
if (wrn == null) {
DirectColorModel dcm = (DirectColorModel)getColorModel();
@ -541,6 +546,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
* - the source color is opaque
* - and the destination is opaque
*/
@Override
public boolean canRenderLCDText(SunGraphics2D sg2d) {
return
graphicsDevice.isCapPresent(CAPS_LCD_SHADER) &&
@ -564,6 +570,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
}
}
@Override
public void validatePipe(SunGraphics2D sg2d) {
TextPipe textpipe;
boolean validated = false;
@ -803,10 +810,12 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
/**
* Returns destination Image associated with this SurfaceData.
*/
@Override
public Object getDestination() {
return offscreenImage;
}
@Override
public Rectangle getBounds() {
if (type == FLIP_BACKBUFFER || type == WINDOW) {
double scaleX = getDefaultScaleX();
@ -821,6 +830,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
}
}
@Override
public Rectangle getNativeBounds() {
D3DRenderQueue rq = D3DRenderQueue.getInstance();
// need to lock to make sure nativeWidth and Height are consistent
@ -836,10 +846,12 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
}
@Override
public GraphicsConfiguration getDeviceConfiguration() {
return graphicsDevice.getDefaultConfiguration();
}
@Override
public SurfaceData getReplacement() {
return restoreContents(offscreenImage);
}
@ -909,6 +921,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
* such resource doesn't exist or can not be retrieved.
* @see sun.java2d.pipe.hw.AccelSurface#getNativeResource
*/
@Override
public long getNativeResource(int resType) {
return getNativeResourceNative(getNativeOps(), resType);
}
@ -920,7 +933,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
*
* @see D3DScreenUpdateManager
*/
public static class D3DWindowSurfaceData extends D3DSurfaceData {
public static final class D3DWindowSurfaceData extends D3DSurfaceData {
StateTracker dirtyTracker;
public D3DWindowSurfaceData(WComponentPeer peer,

View File

@ -38,7 +38,7 @@ import sun.java2d.loops.CompositeType;
* SurfaceData with a cached D3D Texture and the code to create
* the accelerated surfaces.
*/
public class D3DSurfaceDataProxy extends SurfaceDataProxy {
public final class D3DSurfaceDataProxy extends SurfaceDataProxy {
public static SurfaceDataProxy createProxy(SurfaceData srcData,
D3DGraphicsConfig dstConfig)

View File

@ -59,10 +59,11 @@ class D3DTextRenderer extends BufferedTextPipe {
return new Tracer(this);
}
private static class Tracer extends D3DTextRenderer {
private static final class Tracer extends D3DTextRenderer {
Tracer(D3DTextRenderer d3dtr) {
super(d3dtr.rq);
}
@Override
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
GraphicsPrimitive.tracePrimitive("D3DDrawGlyphs");
super.drawGlyphList(sg2d, gl);

View File

@ -48,7 +48,7 @@ import static sun.java2d.pipe.hw.AccelSurface.RT_TEXTURE;
import static sun.java2d.pipe.hw.AccelSurface.TEXTURE;
import static sun.java2d.pipe.hw.AccelSurface.UNDEFINED;
public class D3DVolatileSurfaceManager
public final class D3DVolatileSurfaceManager
extends VolatileSurfaceManager
{
private boolean accelerationEnabled;
@ -75,6 +75,7 @@ public class D3DVolatileSurfaceManager
gd.isCapPresent(CAPS_RT_TEXTURE_ALPHA)));
}
@Override
protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}
@ -86,6 +87,7 @@ public class D3DVolatileSurfaceManager
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig).
*/
@Override
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();
@ -124,6 +126,7 @@ public class D3DVolatileSurfaceManager
return sData;
}
@Override
protected boolean isConfigValid(GraphicsConfiguration gc) {
return ((gc == null) || (gc == vImg.getGraphicsConfig()));
}

View File

@ -158,7 +158,7 @@ public final class WGLGraphicsConfig
* This is a small helper class that allows us to execute
* getWGLConfigInfo() on the queue flushing thread.
*/
private static class WGLGetConfigInfo implements Runnable {
private static final class WGLGetConfigInfo implements Runnable {
private int screen;
private int pixfmt;
private long cfginfo;
@ -184,21 +184,21 @@ public final class WGLGraphicsConfig
* See OGLContext.java for a list of supported capabilities.
*/
@Override
public final boolean isCapPresent(int cap) {
public boolean isCapPresent(int cap) {
return ((oglCaps.getCaps() & cap) != 0);
}
@Override
public final long getNativeConfigInfo() {
public long getNativeConfigInfo() {
return pConfigInfo;
}
@Override
public final OGLContext getContext() {
public OGLContext getContext() {
return context;
}
private static class WGLGCDisposerRecord implements DisposerRecord {
private static final class WGLGCDisposerRecord implements DisposerRecord {
private long pCfgInfo;
public WGLGCDisposerRecord(long pCfgInfo) {
this.pCfgInfo = pCfgInfo;
@ -374,7 +374,7 @@ public final class WGLGraphicsConfig
}
}
private static class WGLBufferCaps extends BufferCapabilities {
private static final class WGLBufferCaps extends BufferCapabilities {
public WGLBufferCaps(boolean dblBuf) {
super(imageCaps, imageCaps,
dblBuf ? FlipContents.UNDEFINED : null);
@ -390,7 +390,7 @@ public final class WGLGraphicsConfig
return bufferCaps;
}
private static class WGLImageCaps extends ImageCapabilities {
private static final class WGLImageCaps extends ImageCapabilities {
private WGLImageCaps() {
super(true);
}

View File

@ -75,6 +75,7 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
return scaleY;
}
@Override
public GraphicsConfiguration getDeviceConfiguration() {
return graphicsConfig;
}
@ -151,7 +152,7 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
}
}
public static class WGLWindowSurfaceData extends WGLSurfaceData {
public static final class WGLWindowSurfaceData extends WGLSurfaceData {
public WGLWindowSurfaceData(WComponentPeer peer,
WGLGraphicsConfig gc)
@ -159,10 +160,12 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
super(peer, gc, peer.getColorModel(), WINDOW);
}
@Override
public SurfaceData getReplacement() {
return peer.getSurfaceData();
}
@Override
public Rectangle getBounds() {
Rectangle r = peer.getBounds();
r.x = r.y = 0;
@ -174,6 +177,7 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
/**
* Returns destination Component associated with this SurfaceData.
*/
@Override
public Object getDestination() {
return peer.getTarget();
}
@ -188,7 +192,7 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
* belongs to is showed, it is first copied to the real private
* FLIP_BACKBUFFER, which is then flipped.
*/
public static class WGLVSyncOffScreenSurfaceData extends
public static final class WGLVSyncOffScreenSurfaceData extends
WGLOffScreenSurfaceData
{
private WGLOffScreenSurfaceData flipSurface;
@ -235,10 +239,12 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
initSurface(this.width, this.height);
}
@Override
public SurfaceData getReplacement() {
return restoreContents(offscreenImage);
}
@Override
public Rectangle getBounds() {
if (type == FLIP_BACKBUFFER) {
Rectangle r = peer.getBounds();
@ -254,6 +260,7 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
/**
* Returns destination Image associated with this SurfaceData.
*/
@Override
public Object getDestination() {
return offscreenImage;
}

View File

@ -43,7 +43,7 @@ import static sun.java2d.pipe.hw.AccelSurface.*;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class WGLVolatileSurfaceManager extends VolatileSurfaceManager {
public final class WGLVolatileSurfaceManager extends VolatileSurfaceManager {
private final boolean accelerationEnabled;
@ -62,6 +62,7 @@ public class WGLVolatileSurfaceManager extends VolatileSurfaceManager {
&& transparency != Transparency.BITMASK;
}
@Override
protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}
@ -70,6 +71,7 @@ public class WGLVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a FBO-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig).
*/
@Override
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();

View File

@ -43,7 +43,7 @@ import sun.java2d.SurfaceData;
* that is faster than our current fallback (which creates
* a temporary GDI DIB)
*/
public class GDIBlitLoops extends Blit {
public final class GDIBlitLoops extends Blit {
// Store these values to be passed to native code
int rmask, gmask, bmask;
@ -134,6 +134,7 @@ public class GDIBlitLoops extends Blit {
* Composite data because we only register these loops for
* SrcNoEa composite operations.
*/
@Override
public void Blit(SurfaceData src, SurfaceData dst,
Composite comp, Region clip,
int sx, int sy, int dx, int dy, int w, int h)

Some files were not shown because too many files have changed in this diff Show More