8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
Reviewed-by: pchelko
This commit is contained in:
parent
54e8ddf594
commit
529b1b6422
@ -99,6 +99,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
|
||||
|
||||
/**
|
||||
* Returns the direction of the arrow.
|
||||
*
|
||||
* @return the direction of the arrow
|
||||
*/
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -58,6 +58,11 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicButtonListener}.
|
||||
*
|
||||
* @param b an abstract button
|
||||
*/
|
||||
public BasicButtonListener(AbstractButton b) {
|
||||
}
|
||||
|
||||
@ -76,13 +81,20 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the opacity of the {@code AbstractButton}.
|
||||
*
|
||||
* @param b an abstract button
|
||||
*/
|
||||
protected void checkOpacity(AbstractButton b) {
|
||||
b.setOpaque( b.isContentAreaFilled() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register default key actions: pressing space to "click" a
|
||||
* button and registring the keyboard mnemonic (if any).
|
||||
* button and registering the keyboard mnemonic (if any).
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
public void installKeyboardActions(JComponent c) {
|
||||
AbstractButton b = (AbstractButton)c;
|
||||
@ -98,7 +110,9 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener,
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister's default key actions
|
||||
* Unregister default key actions.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
public void uninstallKeyboardActions(JComponent c) {
|
||||
SwingUtilities.replaceUIInputMap(c, JComponent.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,9 +29,6 @@ import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.*;
|
||||
import javax.swing.border.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* BasicCheckboxMenuItem implementation
|
||||
@ -42,6 +39,12 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI {
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicCheckBoxMenuItemUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicCheckBoxMenuItemUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new BasicCheckBoxMenuItemUI();
|
||||
}
|
||||
@ -50,6 +53,14 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI {
|
||||
return "CheckBoxMenuItem";
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when mouse event occurs.
|
||||
*
|
||||
* @param item a menu item
|
||||
* @param e a mouse event
|
||||
* @param path an array of {@code MenuElement}
|
||||
* @param manager an instance of {@code MenuSelectionManager}
|
||||
*/
|
||||
public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
|
||||
Point p = e.getPoint();
|
||||
if(p.x >= 0 && p.x < item.getWidth() &&
|
||||
|
@ -59,6 +59,13 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI {
|
||||
// ********************************
|
||||
// Create PLAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code BasicCheckBoxUI}.
|
||||
*
|
||||
* @param b a component
|
||||
* @return an instance of {@code BasicCheckBoxUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent b) {
|
||||
AppContext appContext = AppContext.getAppContext();
|
||||
BasicCheckBoxUI checkboxUI =
|
||||
|
@ -61,21 +61,45 @@ public class BasicColorChooserUI extends ColorChooserUI
|
||||
boolean isMultiPanel = false;
|
||||
private static TransferHandler defaultTransferHandler = new ColorTransferHandler();
|
||||
|
||||
/**
|
||||
* The array of default color choosers.
|
||||
*/
|
||||
protected AbstractColorChooserPanel[] defaultChoosers;
|
||||
|
||||
/**
|
||||
* The instance of {@code ChangeListener}.
|
||||
*/
|
||||
protected ChangeListener previewListener;
|
||||
|
||||
/**
|
||||
* The instance of {@code PropertyChangeListener}.
|
||||
*/
|
||||
protected PropertyChangeListener propertyChangeListener;
|
||||
private Handler handler;
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@code BasicColorChooserUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicColorChooserUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new BasicColorChooserUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of default color choosers.
|
||||
*
|
||||
* @return an array of default color choosers
|
||||
*/
|
||||
protected AbstractColorChooserPanel[] createDefaultChoosers() {
|
||||
AbstractColorChooserPanel[] panels = ColorChooserComponentFactory.getDefaultChooserPanels();
|
||||
return panels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default color choosers.
|
||||
*/
|
||||
protected void uninstallDefaultChoosers() {
|
||||
AbstractColorChooserPanel[] choosers = chooser.getChooserPanels();
|
||||
for( int i = 0 ; i < choosers.length; i++) {
|
||||
@ -138,6 +162,9 @@ public class BasicColorChooserUI extends ColorChooserUI
|
||||
handler = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs preview panel.
|
||||
*/
|
||||
protected void installPreviewPanel() {
|
||||
JComponent previewPanel = this.chooser.getPreviewPanel();
|
||||
if (previewPanel == null) {
|
||||
@ -169,6 +196,9 @@ public class BasicColorChooserUI extends ColorChooserUI
|
||||
this.chooser.remove(this.previewPanelHolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*/
|
||||
protected void installDefaults() {
|
||||
LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background",
|
||||
"ColorChooser.foreground",
|
||||
@ -180,16 +210,21 @@ public class BasicColorChooserUI extends ColorChooserUI
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*/
|
||||
protected void uninstallDefaults() {
|
||||
if (chooser.getTransferHandler() instanceof UIResource) {
|
||||
chooser.setTransferHandler(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers listeners.
|
||||
*/
|
||||
protected void installListeners() {
|
||||
propertyChangeListener = createPropertyChangeListener();
|
||||
chooser.addPropertyChangeListener( propertyChangeListener );
|
||||
chooser.addPropertyChangeListener(propertyChangeListener);
|
||||
|
||||
previewListener = getHandler();
|
||||
chooser.getSelectionModel().addChangeListener(previewListener);
|
||||
@ -202,10 +237,18 @@ public class BasicColorChooserUI extends ColorChooserUI
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code PropertyChangeListener}.
|
||||
*
|
||||
* @return an instance of {@code PropertyChangeListener}
|
||||
*/
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return getHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*/
|
||||
protected void uninstallListeners() {
|
||||
chooser.removePropertyChangeListener( propertyChangeListener );
|
||||
chooser.getSelectionModel().removeChangeListener(previewListener);
|
||||
|
@ -41,9 +41,15 @@ import sun.reflect.misc.MethodUtil;
|
||||
* @author Mark Davidson
|
||||
*/
|
||||
public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener {
|
||||
/**
|
||||
* An instance of {@code JTextField}.
|
||||
*/
|
||||
protected JTextField editor;
|
||||
private Object oldValue;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicComboBoxEditor}.
|
||||
*/
|
||||
public BasicComboBoxEditor() {
|
||||
editor = createEditorComponent();
|
||||
}
|
||||
|
@ -59,6 +59,9 @@ implements ListCellRenderer<Object>, Serializable {
|
||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
|
||||
private final static Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicComboBoxRenderer}.
|
||||
*/
|
||||
public BasicComboBoxRenderer() {
|
||||
super();
|
||||
setOpaque(true);
|
||||
|
@ -55,7 +55,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
private Handler handler;
|
||||
private PropertyChangeListener pcl;
|
||||
|
||||
/**
|
||||
* The instance of {@code JDesktopPane}.
|
||||
*/
|
||||
protected JDesktopPane desktop;
|
||||
|
||||
/**
|
||||
* The instance of {@code DesktopManager}.
|
||||
*/
|
||||
protected DesktopManager desktopManager;
|
||||
|
||||
/**
|
||||
@ -109,10 +116,19 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
@Deprecated
|
||||
protected KeyStroke navigateKey2;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicDesktopPaneUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicDesktopPaneUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new BasicDesktopPaneUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicDesktopPaneUI}.
|
||||
*/
|
||||
public BasicDesktopPaneUI() {
|
||||
}
|
||||
|
||||
@ -133,6 +149,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
handler = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*/
|
||||
protected void installDefaults() {
|
||||
if (desktop.getBackground() == null ||
|
||||
desktop.getBackground() instanceof UIResource) {
|
||||
@ -141,6 +160,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*/
|
||||
protected void uninstallDefaults() { }
|
||||
|
||||
/**
|
||||
@ -169,6 +191,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
pcl = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs desktop manager.
|
||||
*/
|
||||
protected void installDesktopManager() {
|
||||
desktopManager = desktop.getDesktopManager();
|
||||
if(desktopManager == null) {
|
||||
@ -177,6 +202,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls desktop manager.
|
||||
*/
|
||||
protected void uninstallDesktopManager() {
|
||||
if(desktop.getDesktopManager() instanceof UIResource) {
|
||||
desktop.setDesktopManager(null);
|
||||
@ -184,6 +212,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
desktopManager = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs keyboard actions.
|
||||
*/
|
||||
protected void installKeyboardActions(){
|
||||
InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
if (inputMap != null) {
|
||||
@ -202,9 +233,15 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
registerKeyboardActions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers keyboard actions.
|
||||
*/
|
||||
protected void registerKeyboardActions(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters keyboard actions.
|
||||
*/
|
||||
protected void unregisterKeyboardActions(){
|
||||
}
|
||||
|
||||
@ -253,6 +290,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI {
|
||||
map.put(new Actions(Actions.NAVIGATE_PREVIOUS));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters keyboard actions.
|
||||
*/
|
||||
protected void uninstallKeyboardActions(){
|
||||
unregisterKeyboardActions();
|
||||
SwingUtilities.replaceUIInputMap(desktop, JComponent.
|
||||
|
@ -55,6 +55,11 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
|
||||
private boolean busy = false;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicDirectoryModel}.
|
||||
*
|
||||
* @param filechooser an instance of {JFileChooser}
|
||||
*/
|
||||
public BasicDirectoryModel(JFileChooser filechooser) {
|
||||
this.filechooser = filechooser;
|
||||
validateFileCache();
|
||||
@ -93,6 +98,11 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of directories.
|
||||
*
|
||||
* @return a list of directories
|
||||
*/
|
||||
public Vector<File> getDirectories() {
|
||||
synchronized(fileCache) {
|
||||
if (directories != null) {
|
||||
@ -103,6 +113,11 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of files.
|
||||
*
|
||||
* @return a list of files
|
||||
*/
|
||||
public Vector<File> getFiles() {
|
||||
synchronized(fileCache) {
|
||||
if (files != null) {
|
||||
@ -126,6 +141,9 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates content of file cache.
|
||||
*/
|
||||
public void validateFileCache() {
|
||||
File currentDirectory = filechooser.getCurrentDirectory();
|
||||
if (currentDirectory == null) {
|
||||
@ -163,20 +181,34 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Invoked when a content is changed.
|
||||
*/
|
||||
public void fireContentsChanged() {
|
||||
// System.out.println("BasicDirectoryModel: firecontentschanged");
|
||||
fireContentsChanged(this, 0, getSize()-1);
|
||||
fireContentsChanged(this, 0, getSize() - 1);
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return fileCache.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if an element {@code o} is in file cache,
|
||||
* otherwise, returns {@code false}.
|
||||
*
|
||||
* @param o an element
|
||||
* @return {@code true} if an element {@code o} is in file cache
|
||||
*/
|
||||
public boolean contains(Object o) {
|
||||
return fileCache.contains(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an index of element {@code o} in file cache.
|
||||
*
|
||||
* @param o an element
|
||||
* @return an index of element {@code o} in file cache
|
||||
*/
|
||||
public int indexOf(Object o) {
|
||||
return fileCache.indexOf(o);
|
||||
}
|
||||
@ -197,6 +229,11 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts a list of files.
|
||||
*
|
||||
* @param v a list of files
|
||||
*/
|
||||
protected void sort(Vector<? extends File> v){
|
||||
ShellFolder.sort(v);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,16 +40,30 @@ import java.awt.event.InputEvent;
|
||||
import sun.swing.SwingUtilities2;
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Convenient util class.
|
||||
*
|
||||
* @author Hans Muller
|
||||
*/
|
||||
|
||||
public class BasicGraphicsUtils
|
||||
{
|
||||
|
||||
private static final Insets GROOVE_INSETS = new Insets(2, 2, 2, 2);
|
||||
private static final Insets ETCHED_INSETS = new Insets(2, 2, 2, 2);
|
||||
|
||||
/**
|
||||
* Draws an etched rectangle.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param x an X coordinate
|
||||
* @param y an Y coordinate
|
||||
* @param w a width
|
||||
* @param h a height
|
||||
* @param shadow a color of shadow
|
||||
* @param darkShadow a color of dark shadow
|
||||
* @param highlight a color highlighting
|
||||
* @param lightHighlight a color of light highlighting
|
||||
*/
|
||||
public static void drawEtchedRect(Graphics g, int x, int y, int w, int h,
|
||||
Color shadow, Color darkShadow,
|
||||
Color highlight, Color lightHighlight)
|
||||
@ -89,6 +103,17 @@ public class BasicGraphicsUtils
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a groove.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param x an X coordinate
|
||||
* @param y an Y coordinate
|
||||
* @param w a width
|
||||
* @param h a height
|
||||
* @param shadow a color of shadow
|
||||
* @param highlight a color highlighting
|
||||
*/
|
||||
public static void drawGroove(Graphics g, int x, int y, int w, int h,
|
||||
Color shadow, Color highlight)
|
||||
{
|
||||
@ -120,6 +145,21 @@ public class BasicGraphicsUtils
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a bezel.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param x an X coordinate
|
||||
* @param y an Y coordinate
|
||||
* @param w a width
|
||||
* @param h a height
|
||||
* @param isPressed is component pressed
|
||||
* @param isDefault is default drawing
|
||||
* @param shadow a color of shadow
|
||||
* @param darkShadow a color of dark shadow
|
||||
* @param highlight a color highlighting
|
||||
* @param lightHighlight a color of light highlighting
|
||||
*/
|
||||
public static void drawBezel(Graphics g, int x, int y, int w, int h,
|
||||
boolean isPressed, boolean isDefault,
|
||||
Color shadow, Color darkShadow,
|
||||
@ -176,6 +216,19 @@ public class BasicGraphicsUtils
|
||||
g.setColor(oldColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a lowered bezel.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param x an X coordinate
|
||||
* @param y an Y coordinate
|
||||
* @param w a width
|
||||
* @param h a height
|
||||
* @param shadow a color of shadow
|
||||
* @param darkShadow a color of dark shadow
|
||||
* @param highlight a color highlighting
|
||||
* @param lightHighlight a color of light highlighting
|
||||
*/
|
||||
public static void drawLoweredBezel(Graphics g, int x, int y, int w, int h,
|
||||
Color shadow, Color darkShadow,
|
||||
Color highlight, Color lightHighlight) {
|
||||
@ -197,11 +250,17 @@ public class BasicGraphicsUtils
|
||||
}
|
||||
|
||||
|
||||
/** Draw a string with the graphics <code>g</code> at location (x,y)
|
||||
* just like <code>g.drawString</code> would.
|
||||
* The first occurrence of <code>underlineChar</code>
|
||||
* in text will be underlined. The matching algorithm is
|
||||
* not case sensitive.
|
||||
/**
|
||||
* Draw a string with the graphics {@code g} at location (x,y)
|
||||
* just like {@code g.drawString} would. The first occurrence
|
||||
* of {@code underlineChar} in text will be underlined.
|
||||
* The matching algorithm is not case sensitive.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param text a text
|
||||
* @param underlinedChar an underlined char
|
||||
* @param x an X coordinate
|
||||
* @param y an Y coordinate
|
||||
*/
|
||||
public static void drawString(Graphics g,String text,int underlinedChar,int x,int y) {
|
||||
int index=-1;
|
||||
@ -244,9 +303,18 @@ public class BasicGraphicsUtils
|
||||
public static void drawStringUnderlineCharAt(Graphics g, String text,
|
||||
int underlinedIndex, int x,int y) {
|
||||
SwingUtilities2.drawStringUnderlineCharAt(null, g, text,
|
||||
underlinedIndex, x, y);
|
||||
underlinedIndex, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws dashed rectangle.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param x an X coordinate
|
||||
* @param y an Y coordinate
|
||||
* @param width a width of rectangle
|
||||
* @param height a height of rectangle
|
||||
*/
|
||||
public static void drawDashedRect(Graphics g,int x,int y,int width,int height) {
|
||||
int vx,vy;
|
||||
|
||||
@ -263,6 +331,13 @@ public class BasicGraphicsUtils
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred size of the button.
|
||||
*
|
||||
* @param b an instance of {@code AbstractButton}
|
||||
* @param textIconGap a gap between text and icon
|
||||
* @return the preferred size of the button
|
||||
*/
|
||||
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap)
|
||||
{
|
||||
if(b.getComponentCount() > 0) {
|
||||
|
@ -48,6 +48,10 @@ public class BasicHTML {
|
||||
/**
|
||||
* Create an html renderer for the given component and
|
||||
* string of html.
|
||||
*
|
||||
* @param c a component
|
||||
* @param html an HTML string
|
||||
* @return an HTML renderer
|
||||
*/
|
||||
public static View createHTMLView(JComponent c, String html) {
|
||||
BasicEditorKit kit = getFactory();
|
||||
@ -178,6 +182,10 @@ public class BasicHTML {
|
||||
* Check the given string to see if it should trigger the
|
||||
* html rendering logic in a non-text component that supports
|
||||
* html rendering.
|
||||
*
|
||||
* @param s a text
|
||||
* @return {@code true} if the given string should trigger the
|
||||
* html rendering logic in a non-text component
|
||||
*/
|
||||
public static boolean isHTMLString(String s) {
|
||||
if (s != null) {
|
||||
@ -198,6 +206,9 @@ public class BasicHTML {
|
||||
* This method is useful for ComponentUI implementations
|
||||
* that are static (i.e. shared) and get their state
|
||||
* entirely from the JComponent.
|
||||
*
|
||||
* @param c a component
|
||||
* @param text a text
|
||||
*/
|
||||
public static void updateRenderer(JComponent c, String text) {
|
||||
View value = null;
|
||||
|
@ -61,6 +61,11 @@ public class BasicIconFactory implements Serializable
|
||||
private static Icon menuItemArrowIcon;
|
||||
private static Icon menuArrowIcon;
|
||||
|
||||
/**
|
||||
* Returns a menu item check icon.
|
||||
*
|
||||
* @return a menu item check icon
|
||||
*/
|
||||
public static Icon getMenuItemCheckIcon() {
|
||||
if (menuItemCheckIcon == null) {
|
||||
menuItemCheckIcon = new MenuItemCheckIcon();
|
||||
@ -68,6 +73,11 @@ public class BasicIconFactory implements Serializable
|
||||
return menuItemCheckIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a menu item arrow icon.
|
||||
*
|
||||
* @return a menu item arrow icon
|
||||
*/
|
||||
public static Icon getMenuItemArrowIcon() {
|
||||
if (menuItemArrowIcon == null) {
|
||||
menuItemArrowIcon = new MenuItemArrowIcon();
|
||||
@ -75,6 +85,11 @@ public class BasicIconFactory implements Serializable
|
||||
return menuItemArrowIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a menu arrow icon.
|
||||
*
|
||||
* @return a menu arrow icon
|
||||
*/
|
||||
public static Icon getMenuArrowIcon() {
|
||||
if (menuArrowIcon == null) {
|
||||
menuArrowIcon = new MenuArrowIcon();
|
||||
@ -82,6 +97,11 @@ public class BasicIconFactory implements Serializable
|
||||
return menuArrowIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a check box icon.
|
||||
*
|
||||
* @return a check box icon
|
||||
*/
|
||||
public static Icon getCheckBoxIcon() {
|
||||
if (checkBoxIcon == null) {
|
||||
checkBoxIcon = new CheckBoxIcon();
|
||||
@ -89,6 +109,11 @@ public class BasicIconFactory implements Serializable
|
||||
return checkBoxIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a radio button icon.
|
||||
*
|
||||
* @return a radio button icon
|
||||
*/
|
||||
public static Icon getRadioButtonIcon() {
|
||||
if (radioButtonIcon == null) {
|
||||
radioButtonIcon = new RadioButtonIcon();
|
||||
@ -96,6 +121,11 @@ public class BasicIconFactory implements Serializable
|
||||
return radioButtonIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a check box menu item icon.
|
||||
*
|
||||
* @return a check box menu item icon
|
||||
*/
|
||||
public static Icon getCheckBoxMenuItemIcon() {
|
||||
if (checkBoxMenuItemIcon == null) {
|
||||
checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
|
||||
@ -103,6 +133,11 @@ public class BasicIconFactory implements Serializable
|
||||
return checkBoxMenuItemIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a radio button menu item icon.
|
||||
*
|
||||
* @return a radio button menu item icon
|
||||
*/
|
||||
public static Icon getRadioButtonMenuItemIcon() {
|
||||
if (radioButtonMenuItemIcon == null) {
|
||||
radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
|
||||
@ -110,6 +145,11 @@ public class BasicIconFactory implements Serializable
|
||||
return radioButtonMenuItemIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an empty frame icon.
|
||||
*
|
||||
* @return an empty frame icon
|
||||
*/
|
||||
public static Icon createEmptyFrameIcon() {
|
||||
if(frame_icon == null)
|
||||
frame_icon = new EmptyFrameIcon();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -54,11 +54,29 @@ import javax.swing.plaf.*;
|
||||
* @author Arnaud Weber
|
||||
*/
|
||||
public class BasicMenuBarUI extends MenuBarUI {
|
||||
|
||||
/**
|
||||
* The instance of {@code JMenuBar}.
|
||||
*/
|
||||
protected JMenuBar menuBar = null;
|
||||
|
||||
/**
|
||||
* The instance of {@code ContainerListener}.
|
||||
*/
|
||||
protected ContainerListener containerListener;
|
||||
|
||||
/**
|
||||
* The instance of {@code ChangeListener}.
|
||||
*/
|
||||
protected ChangeListener changeListener;
|
||||
private Handler handler;
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@code BasicMenuBarUI}.
|
||||
*
|
||||
* @param x a component
|
||||
* @return a new instance of {@code BasicMenuBarUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent x) {
|
||||
return new BasicMenuBarUI();
|
||||
}
|
||||
@ -76,6 +94,9 @@ public class BasicMenuBarUI extends MenuBarUI {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*/
|
||||
protected void installDefaults() {
|
||||
if (menuBar.getLayout() == null ||
|
||||
menuBar.getLayout() instanceof UIResource) {
|
||||
@ -90,6 +111,9 @@ public class BasicMenuBarUI extends MenuBarUI {
|
||||
"MenuBar.font");
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listeners.
|
||||
*/
|
||||
protected void installListeners() {
|
||||
containerListener = createContainerListener();
|
||||
changeListener = createChangeListener();
|
||||
@ -102,6 +126,9 @@ public class BasicMenuBarUI extends MenuBarUI {
|
||||
menuBar.addContainerListener(containerListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers keyboard actions.
|
||||
*/
|
||||
protected void installKeyboardActions() {
|
||||
InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
|
||||
@ -131,12 +158,18 @@ public class BasicMenuBarUI extends MenuBarUI {
|
||||
menuBar = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*/
|
||||
protected void uninstallDefaults() {
|
||||
if (menuBar!=null) {
|
||||
LookAndFeel.uninstallBorder(menuBar);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*/
|
||||
protected void uninstallListeners() {
|
||||
menuBar.removeContainerListener(containerListener);
|
||||
|
||||
@ -151,16 +184,29 @@ public class BasicMenuBarUI extends MenuBarUI {
|
||||
handler = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters keyboard actions.
|
||||
*/
|
||||
protected void uninstallKeyboardActions() {
|
||||
SwingUtilities.replaceUIInputMap(menuBar, JComponent.
|
||||
WHEN_IN_FOCUSED_WINDOW, null);
|
||||
SwingUtilities.replaceUIActionMap(menuBar, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code ContainerListener}.
|
||||
*
|
||||
* @return an instance of {@code ContainerListener}
|
||||
*/
|
||||
protected ContainerListener createContainerListener() {
|
||||
return getHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code ChangeListener}.
|
||||
*
|
||||
* @return an instance of {@code ChangeListener}
|
||||
*/
|
||||
protected ChangeListener createChangeListener() {
|
||||
return getHandler();
|
||||
}
|
||||
|
@ -48,7 +48,14 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class BasicMenuUI extends BasicMenuItemUI
|
||||
{
|
||||
/**
|
||||
* The instance of {@code ChangeListener}.
|
||||
*/
|
||||
protected ChangeListener changeListener;
|
||||
|
||||
/**
|
||||
* The instance of {@code MenuListener}.
|
||||
*/
|
||||
protected MenuListener menuListener;
|
||||
|
||||
private int lastMnemonic = 0;
|
||||
@ -63,6 +70,12 @@ public class BasicMenuUI extends BasicMenuItemUI
|
||||
|
||||
private static boolean crossMenuMnemonic = true;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicMenuUI}.
|
||||
*
|
||||
* @param x a component
|
||||
* @return a new instance of {@code BasicMenuUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent x) {
|
||||
return new BasicMenuUI();
|
||||
}
|
||||
@ -152,10 +165,22 @@ public class BasicMenuUI extends BasicMenuItemUI
|
||||
return getHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code MenuListener}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return an instance of {@code MenuListener}
|
||||
*/
|
||||
protected MenuListener createMenuListener(JComponent c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code ChangeListener}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return an instance of {@code ChangeListener}
|
||||
*/
|
||||
protected ChangeListener createChangeListener(JComponent c) {
|
||||
return null;
|
||||
}
|
||||
@ -208,6 +233,11 @@ public class BasicMenuUI extends BasicMenuItemUI
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets timer to the {@code menu}.
|
||||
*
|
||||
* @param menu an instance of {@code JMenu}.
|
||||
*/
|
||||
protected void setupPostTimer(JMenu menu) {
|
||||
Timer timer = new Timer(menu.getDelay(), new Actions(
|
||||
Actions.SELECT, menu,false));
|
||||
@ -388,11 +418,32 @@ public class BasicMenuUI extends BasicMenuItemUI
|
||||
* is now obsolete. KeyBindings are now managed by the popup menu.
|
||||
*/
|
||||
public class ChangeHandler implements ChangeListener {
|
||||
/**
|
||||
* The instance of {@code JMenu}.
|
||||
*/
|
||||
public JMenu menu;
|
||||
|
||||
/**
|
||||
* The instance of {@code BasicMenuUI}.
|
||||
*/
|
||||
public BasicMenuUI ui;
|
||||
|
||||
/**
|
||||
* {@code true} if an item of popup menu is selected.
|
||||
*/
|
||||
public boolean isSelected = false;
|
||||
|
||||
/**
|
||||
* The component that was focused.
|
||||
*/
|
||||
public Component wasFocused;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code ChangeHandler}.
|
||||
*
|
||||
* @param m an instance of {@code JMenu}
|
||||
* @param ui an instance of {@code BasicMenuUI}
|
||||
*/
|
||||
public ChangeHandler(JMenu m, BasicMenuUI ui) {
|
||||
menu = m;
|
||||
this.ui = ui;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,6 +43,12 @@ public class BasicPanelUI extends PanelUI {
|
||||
// Shared UI object
|
||||
private static PanelUI panelUI;
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code BasicPanelUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return an instance of {@code BasicPanelUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
if(panelUI == null) {
|
||||
panelUI = new BasicPanelUI();
|
||||
@ -62,6 +68,11 @@ public class BasicPanelUI extends PanelUI {
|
||||
super.uninstallUI(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for installing panel properties.
|
||||
*
|
||||
* @param p an instance of {@code JPanel}
|
||||
*/
|
||||
protected void installDefaults(JPanel p) {
|
||||
LookAndFeel.installColorsAndFont(p,
|
||||
"Panel.background",
|
||||
@ -71,6 +82,11 @@ public class BasicPanelUI extends PanelUI {
|
||||
LookAndFeel.installProperty(p, "opaque", Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for uninstalling panel properties.
|
||||
*
|
||||
* @param p an instance of {@code JPanel}
|
||||
*/
|
||||
protected void uninstallDefaults(JPanel p) {
|
||||
LookAndFeel.uninstallBorder(p);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,6 +42,12 @@ import javax.swing.plaf.ComponentUI;
|
||||
|
||||
public class BasicPopupMenuSeparatorUI extends BasicSeparatorUI
|
||||
{
|
||||
/**
|
||||
* Returns a new instance of {@code BasicPopupMenuSeparatorUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicPopupMenuSeparatorUI}
|
||||
*/
|
||||
public static ComponentUI createUI( JComponent c )
|
||||
{
|
||||
return new BasicPopupMenuSeparatorUI();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -66,6 +66,9 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
static final StringBuilder MENU_KEYBOARD_HELPER_KEY = new StringBuilder(
|
||||
"javax.swing.plaf.basic.BasicPopupMenuUI.MenuKeyboardHelper");
|
||||
|
||||
/**
|
||||
* The instance of {@code JPopupMenu}.
|
||||
*/
|
||||
protected JPopupMenu popupMenu = null;
|
||||
private transient PopupMenuListener popupMenuListener = null;
|
||||
private MenuKeyListener menuKeyListener = null;
|
||||
@ -73,10 +76,19 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
private static boolean checkedUnpostPopup;
|
||||
private static boolean unpostPopup;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicPopupMenuUI}.
|
||||
*
|
||||
* @param x a component
|
||||
* @return a new instance of {@code BasicPopupMenuUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent x) {
|
||||
return new BasicPopupMenuUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicPopupMenuUI}.
|
||||
*/
|
||||
public BasicPopupMenuUI() {
|
||||
BasicLookAndFeel.needsEventHelper = true;
|
||||
LookAndFeel laf = UIManager.getLookAndFeel();
|
||||
@ -93,6 +105,9 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
installKeyboardActions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*/
|
||||
public void installDefaults() {
|
||||
if (popupMenu.getLayout() == null ||
|
||||
popupMenu.getLayout() instanceof UIResource)
|
||||
@ -101,11 +116,14 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
LookAndFeel.installProperty(popupMenu, "opaque", Boolean.TRUE);
|
||||
LookAndFeel.installBorder(popupMenu, "PopupMenu.border");
|
||||
LookAndFeel.installColorsAndFont(popupMenu,
|
||||
"PopupMenu.background",
|
||||
"PopupMenu.foreground",
|
||||
"PopupMenu.font");
|
||||
"PopupMenu.background",
|
||||
"PopupMenu.foreground",
|
||||
"PopupMenu.font");
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listeners.
|
||||
*/
|
||||
protected void installListeners() {
|
||||
if (popupMenuListener == null) {
|
||||
popupMenuListener = new BasicPopupMenuListener();
|
||||
@ -138,6 +156,9 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers keyboard actions.
|
||||
*/
|
||||
protected void installKeyboardActions() {
|
||||
}
|
||||
|
||||
@ -181,10 +202,16 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
popupMenu = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*/
|
||||
protected void uninstallDefaults() {
|
||||
LookAndFeel.uninstallBorder(popupMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*/
|
||||
protected void uninstallListeners() {
|
||||
if (popupMenuListener != null) {
|
||||
popupMenu.removePopupMenuListener(popupMenuListener);
|
||||
@ -194,6 +221,9 @@ public class BasicPopupMenuUI extends PopupMenuUI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters keyboard actions.
|
||||
*/
|
||||
protected void uninstallKeyboardActions() {
|
||||
SwingUtilities.replaceUIActionMap(popupMenu, null);
|
||||
SwingUtilities.replaceUIInputMap(popupMenu,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,6 +39,12 @@ import javax.swing.border.*;
|
||||
*/
|
||||
public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
|
||||
{
|
||||
/**
|
||||
* Returns a new instance of {@code BasicRadioButtonMenuItemUI}.
|
||||
*
|
||||
* @param b a component
|
||||
* @return a new instance of {@code BasicRadioButtonMenuItemUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent b) {
|
||||
return new BasicRadioButtonMenuItemUI();
|
||||
}
|
||||
@ -47,6 +53,14 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
|
||||
return "RadioButtonMenuItem";
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when mouse event occurs.
|
||||
*
|
||||
* @param item a menu item
|
||||
* @param e a mouse event
|
||||
* @param path an array of {@code MenuElement}
|
||||
* @param manager an instance of {@code MenuSelectionManager}
|
||||
*/
|
||||
public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
|
||||
Point p = e.getPoint();
|
||||
if(p.x >= 0 && p.x < item.getWidth() &&
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,6 +44,9 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
|
||||
{
|
||||
private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object();
|
||||
|
||||
/**
|
||||
* The icon.
|
||||
*/
|
||||
protected Icon icon;
|
||||
|
||||
private boolean defaults_initialized = false;
|
||||
@ -53,6 +56,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
|
||||
// ********************************
|
||||
// Create PLAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code BasicRadioButtonUI}.
|
||||
*
|
||||
* @param b a component
|
||||
* @return an instance of {@code BasicRadioButtonUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent b) {
|
||||
AppContext appContext = AppContext.getAppContext();
|
||||
BasicRadioButtonUI radioButtonUI =
|
||||
@ -87,6 +97,11 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
|
||||
defaults_initialized = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default icon.
|
||||
*
|
||||
* @return the default icon
|
||||
*/
|
||||
public Icon getDefaultIcon() {
|
||||
return icon;
|
||||
}
|
||||
@ -195,6 +210,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints focused radio button.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param textRect bounds
|
||||
* @param size the size of radio button
|
||||
*/
|
||||
protected void paintFocus(Graphics g, Rectangle textRect, Dimension size){
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,12 @@ public class BasicRootPaneUI extends RootPaneUI implements
|
||||
PropertyChangeListener {
|
||||
private static RootPaneUI rootPaneUI = new BasicRootPaneUI();
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@code BasicRootPaneUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicRootPaneUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return rootPaneUI;
|
||||
}
|
||||
@ -67,17 +73,37 @@ public class BasicRootPaneUI extends RootPaneUI implements
|
||||
uninstallKeyboardActions((JRootPane)c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*
|
||||
* @param c an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void installDefaults(JRootPane c){
|
||||
LookAndFeel.installProperty(c, "opaque", Boolean.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs components.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void installComponents(JRootPane root) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listeners.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void installListeners(JRootPane root) {
|
||||
root.addPropertyChangeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers keyboard actions.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void installKeyboardActions(JRootPane root) {
|
||||
InputMap km = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, root);
|
||||
SwingUtilities.replaceUIInputMap(root,
|
||||
@ -92,19 +118,39 @@ public class BasicRootPaneUI extends RootPaneUI implements
|
||||
updateDefaultButtonBindings(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void uninstallDefaults(JRootPane root) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters components.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void uninstallComponents(JRootPane root) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void uninstallListeners(JRootPane root) {
|
||||
root.removePropertyChangeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters keyboard actions.
|
||||
*
|
||||
* @param root an instance of {@code JRootPane}
|
||||
*/
|
||||
protected void uninstallKeyboardActions(JRootPane root) {
|
||||
SwingUtilities.replaceUIInputMap(root, JComponent.
|
||||
WHEN_IN_FOCUSED_WINDOW, null);
|
||||
WHEN_IN_FOCUSED_WINDOW, null);
|
||||
SwingUtilities.replaceUIActionMap(root, null);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,9 +45,22 @@ import javax.swing.plaf.SeparatorUI;
|
||||
|
||||
public class BasicSeparatorUI extends SeparatorUI
|
||||
{
|
||||
/**
|
||||
* The color of the shadow.
|
||||
*/
|
||||
protected Color shadow;
|
||||
|
||||
/**
|
||||
* The color of the highlighting.
|
||||
*/
|
||||
protected Color highlight;
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@code BasicSeparatorUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicSeparatorUI}
|
||||
*/
|
||||
public static ComponentUI createUI( JComponent c )
|
||||
{
|
||||
return new BasicSeparatorUI();
|
||||
@ -65,20 +78,40 @@ public class BasicSeparatorUI extends SeparatorUI
|
||||
uninstallListeners( (JSeparator)c );
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*
|
||||
* @param s an instance of {@code JSeparator}
|
||||
*/
|
||||
protected void installDefaults( JSeparator s )
|
||||
{
|
||||
LookAndFeel.installColors( s, "Separator.background", "Separator.foreground" );
|
||||
LookAndFeel.installProperty( s, "opaque", Boolean.FALSE);
|
||||
LookAndFeel.installColors(s, "Separator.background", "Separator.foreground");
|
||||
LookAndFeel.installProperty(s, "opaque", Boolean.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*
|
||||
* @param s an instance of {@code JSeparator}
|
||||
*/
|
||||
protected void uninstallDefaults( JSeparator s )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listeners.
|
||||
*
|
||||
* @param s an instance of {@code JSeparator}
|
||||
*/
|
||||
protected void installListeners( JSeparator s )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*
|
||||
* @param s an instance of {@code JSeparator}
|
||||
*/
|
||||
protected void uninstallListeners( JSeparator s )
|
||||
{
|
||||
}
|
||||
|
@ -400,6 +400,8 @@ public class BasicSpinnerUI extends SpinnerUI
|
||||
* The implementation of <code>replaceEditor</code> should be coordinated
|
||||
* with the <code>createEditor</code> method.
|
||||
*
|
||||
* @param oldEditor an old instance of editor
|
||||
* @param newEditor a new instance of editor
|
||||
* @see #createEditor
|
||||
* @see #createPropertyChangeListener
|
||||
*/
|
||||
|
@ -49,11 +49,19 @@ public class BasicTableHeaderUI extends TableHeaderUI {
|
||||
// Instance Variables
|
||||
//
|
||||
|
||||
/** The JTableHeader that is delegating the painting to this UI. */
|
||||
/**
|
||||
* The {@code JTableHeader} that is delegating the painting to this UI.
|
||||
*/
|
||||
protected JTableHeader header;
|
||||
|
||||
/**
|
||||
* The instance of {@code CellRendererPane}.
|
||||
*/
|
||||
protected CellRendererPane rendererPane;
|
||||
|
||||
// Listeners that are attached to the JTable
|
||||
/**
|
||||
* Listeners that are attached to the {@code JTable}
|
||||
*/
|
||||
protected MouseInputListener mouseInputListener;
|
||||
|
||||
// The column header over which the mouse currently is.
|
||||
@ -300,7 +308,9 @@ public class BasicTableHeaderUI extends TableHeaderUI {
|
||||
//
|
||||
|
||||
/**
|
||||
* Creates the mouse listener for the JTableHeader.
|
||||
* Creates the mouse listener for the {@code JTableHeader}.
|
||||
*
|
||||
* @return the mouse listener for the {@code JTableHeader}
|
||||
*/
|
||||
protected MouseInputListener createMouseInputListener() {
|
||||
return new MouseInputHandler();
|
||||
@ -310,6 +320,12 @@ public class BasicTableHeaderUI extends TableHeaderUI {
|
||||
// The installation/uninstall procedures and support
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@code BasicTableHeaderUI}.
|
||||
*
|
||||
* @param h a component.
|
||||
* @return a new instance of {@code BasicTableHeaderUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent h) {
|
||||
return new BasicTableHeaderUI();
|
||||
}
|
||||
@ -376,8 +392,14 @@ public class BasicTableHeaderUI extends TableHeaderUI {
|
||||
header = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls default properties
|
||||
*/
|
||||
protected void uninstallDefaults() {}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*/
|
||||
protected void uninstallListeners() {
|
||||
header.removeMouseListener(mouseInputListener);
|
||||
header.removeMouseMotionListener(mouseInputListener);
|
||||
|
@ -443,6 +443,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
protected void uninstallListeners() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers keyboard actions.
|
||||
*/
|
||||
protected void installKeyboardActions() {
|
||||
// backward compatibility support... keymaps for the UI
|
||||
// are now installed in the more friendly input map.
|
||||
@ -637,6 +640,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters keyboard actions.
|
||||
*/
|
||||
protected void uninstallKeyboardActions() {
|
||||
editor.setKeymap(null);
|
||||
SwingUtilities.replaceUIInputMap(editor, JComponent.
|
||||
@ -1280,8 +1286,14 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation of the interface {@code Caret}.
|
||||
*/
|
||||
public static class BasicCaret extends DefaultCaret implements UIResource {}
|
||||
|
||||
/**
|
||||
* Default implementation of the interface {@code Highlighter}.
|
||||
*/
|
||||
public static class BasicHighlighter extends DefaultHighlighter implements UIResource {}
|
||||
|
||||
static class BasicCursor extends Cursor implements UIResource {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,6 +51,13 @@ public class BasicToggleButtonUI extends BasicButtonUI {
|
||||
// ********************************
|
||||
// Create PLAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code BasicToggleButtonUI}.
|
||||
*
|
||||
* @param b a component
|
||||
* @return an instance of {@code BasicToggleButtonUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent b) {
|
||||
AppContext appContext = AppContext.getAppContext();
|
||||
BasicToggleButtonUI toggleButtonUI =
|
||||
@ -127,6 +134,13 @@ public class BasicToggleButtonUI extends BasicButtonUI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints an icon in the specified location.
|
||||
*
|
||||
* @param g an instance of {@code Graphics}
|
||||
* @param b an instance of {@code Button}
|
||||
* @param iconRect bounds of an icon
|
||||
*/
|
||||
protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect) {
|
||||
ButtonModel model = b.getModel();
|
||||
Icon icon = null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,6 +45,12 @@ import javax.swing.plaf.basic.BasicSeparatorUI;
|
||||
|
||||
public class BasicToolBarSeparatorUI extends BasicSeparatorUI
|
||||
{
|
||||
/**
|
||||
* Returns a new instance of {@code BasicToolBarSeparatorUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return a new instance of {@code BasicToolBarSeparatorUI}
|
||||
*/
|
||||
public static ComponentUI createUI( JComponent c )
|
||||
{
|
||||
return new BasicToolBarSeparatorUI();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,10 +55,19 @@ public class BasicToolTipUI extends ToolTipUI
|
||||
|
||||
private PropertyChangeListener propertyChangeListener;
|
||||
|
||||
/**
|
||||
* Returns the instance of {@code BasicToolTipUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return the instance of {@code BasicToolTipUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code BasicToolTipUI}.
|
||||
*/
|
||||
public BasicToolTipUI() {
|
||||
super();
|
||||
}
|
||||
@ -76,22 +85,32 @@ public class BasicToolTipUI extends ToolTipUI
|
||||
uninstallListeners(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs default properties.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
protected void installDefaults(JComponent c){
|
||||
LookAndFeel.installColorsAndFont(c, "ToolTip.background",
|
||||
"ToolTip.foreground",
|
||||
"ToolTip.font");
|
||||
"ToolTip.foreground",
|
||||
"ToolTip.font");
|
||||
LookAndFeel.installProperty(c, "opaque", Boolean.TRUE);
|
||||
componentChanged(c);
|
||||
}
|
||||
|
||||
protected void uninstallDefaults(JComponent c){
|
||||
/**
|
||||
* Uninstalls default properties.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
protected void uninstallDefaults(JComponent c){
|
||||
LookAndFeel.uninstallBorder(c);
|
||||
}
|
||||
|
||||
/* Unfortunately this has to remain private until we can make API additions.
|
||||
*/
|
||||
private void installComponents(JComponent c){
|
||||
BasicHTML.updateRenderer(c, ((JToolTip)c).getTipText());
|
||||
BasicHTML.updateRenderer(c, ((JToolTip) c).getTipText());
|
||||
}
|
||||
|
||||
/* Unfortunately this has to remain private until we can make API additions.
|
||||
@ -100,12 +119,22 @@ public class BasicToolTipUI extends ToolTipUI
|
||||
BasicHTML.updateRenderer(c, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listeners.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
protected void installListeners(JComponent c) {
|
||||
propertyChangeListener = createPropertyChangeListener(c);
|
||||
|
||||
c.addPropertyChangeListener(propertyChangeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
protected void uninstallListeners(JComponent c) {
|
||||
c.removePropertyChangeListener(propertyChangeListener);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,6 +43,12 @@ public class BasicViewportUI extends ViewportUI {
|
||||
// Shared UI object
|
||||
private static ViewportUI viewportUI;
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code BasicViewportUI}.
|
||||
*
|
||||
* @param c a component
|
||||
* @return an instance of {@code BasicViewportUI}
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
if(viewportUI == null) {
|
||||
viewportUI = new BasicViewportUI();
|
||||
@ -60,6 +66,11 @@ public class BasicViewportUI extends ViewportUI {
|
||||
super.uninstallUI(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs view port properties.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
protected void installDefaults(JComponent c) {
|
||||
LookAndFeel.installColorsAndFont(c,
|
||||
"Viewport.background",
|
||||
@ -68,6 +79,11 @@ public class BasicViewportUI extends ViewportUI {
|
||||
LookAndFeel.installProperty(c, "opaque", Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall view port properties.
|
||||
*
|
||||
* @param c a component
|
||||
*/
|
||||
protected void uninstallDefaults(JComponent c) {
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ public interface ComboPopup {
|
||||
* Returns the list that is being used to draw the items in the combo box.
|
||||
* This method is highly implementation specific and should not be used
|
||||
* for general list manipulation.
|
||||
*
|
||||
* @return the list that is being used to draw the items in the combo box
|
||||
*/
|
||||
public JList<Object> getList();
|
||||
|
||||
@ -91,6 +93,8 @@ public interface ComboPopup {
|
||||
/**
|
||||
* Returns a key listener that will be added to the combo box or null.
|
||||
* If this method returns null then it will not be added to the combo box.
|
||||
*
|
||||
* @return a key listener that will be added to the combo box or null
|
||||
*/
|
||||
public KeyListener getKeyListener();
|
||||
|
||||
|
@ -41,6 +41,17 @@ import java.awt.Dimension;
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class DefaultMenuLayout extends BoxLayout implements UIResource {
|
||||
|
||||
/**
|
||||
* Constructs a new instance of {@code DefaultMenuLayout}.
|
||||
*
|
||||
* @param target the container that needs to be laid out
|
||||
* @param axis the axis to lay out components along. Can be one of:
|
||||
* {@code BoxLayout.X_AXIS},
|
||||
* {@code BoxLayout.Y_AXIS},
|
||||
* {@code BoxLayout.LINE_AXIS} or
|
||||
* {@code BoxLayout.PAGE_AXIS}
|
||||
*/
|
||||
public DefaultMenuLayout(Container target, int axis) {
|
||||
super(target, axis);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user