Merge
This commit is contained in:
commit
4ba2917e46
@ -39,7 +39,7 @@ import sun.lwawt.LWWindowPeer;
|
||||
import sun.lwawt.macosx.CPlatformWindow;
|
||||
|
||||
/**
|
||||
* The <code>Application</code> class allows you to integrate your Java application with the native Mac OS X environment.
|
||||
* The {@code Application} class allows you to integrate your Java application with the native Mac OS X environment.
|
||||
* You can provide your Mac OS X users a greatly enhanced experience by implementing a few basic handlers for standard system events.
|
||||
*
|
||||
* For example:
|
||||
@ -142,7 +142,7 @@ public class Application {
|
||||
/**
|
||||
* Installs a handler to show a custom About window for your application.
|
||||
*
|
||||
* Setting the {@link AboutHandler} to <code>null</code> reverts it to the default Cocoa About window.
|
||||
* Setting the {@link AboutHandler} to {@code null} reverts it to the default Cocoa About window.
|
||||
*
|
||||
* @param aboutHandler the handler to respond to the {@link AboutHandler#handleAbout()} message
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -155,7 +155,7 @@ public class Application {
|
||||
/**
|
||||
* Installs a handler to create the Preferences menu item in your application's app menu.
|
||||
*
|
||||
* Setting the {@link PreferencesHandler} to <code>null</code> will remove the Preferences item from the app menu.
|
||||
* Setting the {@link PreferencesHandler} to {@code null} will remove the Preferences item from the app menu.
|
||||
*
|
||||
* @param preferencesHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -167,8 +167,8 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Installs the handler which is notified when the application is asked to open a list of files.
|
||||
* The {@link OpenFilesHandler#openFiles(AppEvent.OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a <code>CFBundleDocumentTypes</code> array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleDocumentTypes</code> key to your app's Info.plist.
|
||||
* The {@link OpenFilesHandler#openFiles(AppEvent.OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
|
||||
*
|
||||
* @param openFileHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -180,8 +180,8 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Installs the handler which is notified when the application is asked to print a list of files.
|
||||
* The {@link PrintFilesHandler#printFiles(AppEvent.PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a <code>CFBundleDocumentTypes</code> array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleDocumentTypes</code> key to your app's Info.plist.
|
||||
* The {@link PrintFilesHandler#printFiles(AppEvent.PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
|
||||
*
|
||||
* @param printFileHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -193,10 +193,10 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Installs the handler which is notified when the application is asked to open a URL.
|
||||
* The {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a <code>CFBundleURLTypes</code> array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleURLTypes</code> key to your app's Info.plist.
|
||||
* The {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleURLTypes} array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleURLTypes} key to your app's Info.plist.
|
||||
*
|
||||
* Setting the handler to <code>null</code> causes all {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be enqueued until another handler is set.
|
||||
* Setting the handler to {@code null} causes all {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be enqueued until another handler is set.
|
||||
*
|
||||
* @param openURIHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -209,7 +209,7 @@ public class Application {
|
||||
/**
|
||||
* Installs the handler which determines if the application should quit.
|
||||
* The handler is passed a one-shot {@link QuitResponse} which can cancel or proceed with the quit.
|
||||
* Setting the handler to <code>null</code> causes all quit requests to directly perform the default {@link QuitStrategy}.
|
||||
* Setting the handler to {@code null} causes all quit requests to directly perform the default {@link QuitStrategy}.
|
||||
*
|
||||
* @param quitHandler the handler that is called when the application is asked to quit
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -432,11 +432,11 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Enables the Preferences item in the application menu. The ApplicationListener receives a callback for
|
||||
* selection of the Preferences item in the application menu only if this is set to <code>true</code>.
|
||||
* selection of the Preferences item in the application menu only if this is set to {@code true}.
|
||||
*
|
||||
* If a Preferences item isn't present, this method adds and enables it.
|
||||
*
|
||||
* @param enable specifies whether the Preferences item in the application menu should be enabled (<code>true</code>) or not (<code>false</code>)
|
||||
* @param enable specifies whether the Preferences item in the application menu should be enabled ({@code true}) or not ({@code false})
|
||||
*
|
||||
* @deprecated no replacement
|
||||
* @since 1.4
|
||||
@ -449,12 +449,12 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Enables the About item in the application menu. The ApplicationListener receives a callback for
|
||||
* selection of the About item in the application menu only if this is set to <code>true</code>. Because AWT supplies
|
||||
* a standard About window when an application may not, by default this is set to <code>true</code>.
|
||||
* selection of the About item in the application menu only if this is set to {@code true}. Because AWT supplies
|
||||
* a standard About window when an application may not, by default this is set to {@code true}.
|
||||
*
|
||||
* If the About item isn't present, this method adds and enables it.
|
||||
*
|
||||
* @param enable specifies whether the About item in the application menu should be enabled (<code>true</code>) or not (<code>false</code>)
|
||||
* @param enable specifies whether the About item in the application menu should be enabled ({@code true}) or not ({@code false})
|
||||
*
|
||||
* @deprecated no replacement
|
||||
* @since 1.4
|
||||
@ -553,7 +553,7 @@ public class Application {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use <code>java.awt.MouseInfo.getPointerInfo().getLocation()</code>.
|
||||
* @deprecated Use {@code java.awt.MouseInfo.getPointerInfo().getLocation()}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@
|
||||
package com.apple.eawt;
|
||||
|
||||
/**
|
||||
* An abstract adapter class for receiving <code>ApplicationEvents</code>.
|
||||
* An abstract adapter class for receiving {@code ApplicationEvents}.
|
||||
*
|
||||
* ApplicationEvents are deprecated. Use individual app event listeners or handlers instead.
|
||||
*
|
||||
|
@ -50,9 +50,9 @@ public class ApplicationEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* Determines whether an ApplicationListener has acted on a particular event.
|
||||
* An event is marked as having been handled with <code>setHandled(true)</code>.
|
||||
* An event is marked as having been handled with {@code setHandled(true)}.
|
||||
*
|
||||
* @return <code>true</code> if the event has been handled, otherwise <code>false</code>
|
||||
* @return {@code true} if the event has been handled, otherwise {@code false}
|
||||
*
|
||||
* @since 1.4
|
||||
* @deprecated
|
||||
@ -65,10 +65,10 @@ public class ApplicationEvent extends EventObject {
|
||||
/**
|
||||
* Marks the event as handled.
|
||||
* After this method handles an ApplicationEvent, it may be useful to specify that it has been handled.
|
||||
* This is usually used in conjunction with <code>getHandled()</code>.
|
||||
* Set to <code>true</code> to designate that this event has been handled. By default it is <code>false</code>.
|
||||
* This is usually used in conjunction with {@code getHandled()}.
|
||||
* Set to {@code true} to designate that this event has been handled. By default it is {@code false}.
|
||||
*
|
||||
* @param state <code>true</code> if the event has been handled, otherwise <code>false</code>.
|
||||
* @param state {@code true} if the event has been handled, otherwise {@code false}.
|
||||
*
|
||||
* @since 1.4
|
||||
* @deprecated
|
||||
@ -84,7 +84,7 @@ public class ApplicationEvent extends EventObject {
|
||||
* For example, the Print and Open events refer to specific files.
|
||||
* For these cases, this returns the appropriate file name.
|
||||
*
|
||||
* @return the full path to the file associated with the event, if applicable, otherwise <code>null</code>
|
||||
* @return the full path to the file associated with the event, if applicable, otherwise {@code null}
|
||||
*
|
||||
* @since 1.4
|
||||
* @deprecated use {@link OpenFilesHandler} or {@link PrintFilesHandler} instead
|
||||
|
@ -53,9 +53,9 @@ import java.util.EventListener;
|
||||
@Deprecated
|
||||
public interface ApplicationListener extends EventListener {
|
||||
/**
|
||||
* Called when the user selects the About item in the application menu. If <code>event</code> is not handled by
|
||||
* setting <code>isHandled(true)</code>, a default About window consisting of the application's name and icon is
|
||||
* displayed. To display a custom About window, designate the <code>event</code> as being handled and display the
|
||||
* Called when the user selects the About item in the application menu. If {@code event} is not handled by
|
||||
* setting {@code isHandled(true)}, a default About window consisting of the application's name and icon is
|
||||
* displayed. To display a custom About window, designate the {@code event} as being handled and display the
|
||||
* appropriate About window.
|
||||
*
|
||||
* @param event an ApplicationEvent initiated by the user choosing About in the application menu
|
||||
@ -99,7 +99,7 @@ public interface ApplicationListener extends EventListener {
|
||||
* Called when the Preference item in the application menu is selected. Native Mac OS X applications make their
|
||||
* Preferences window available through the application menu. Java applications are automatically given an application
|
||||
* menu in Mac OS X. By default, the Preferences item is disabled in that menu. If you are deploying an application
|
||||
* on Mac OS X, you should enable the preferences item with <code>setEnabledPreferencesMenu(true)</code> in the
|
||||
* on Mac OS X, you should enable the preferences item with {@code setEnabledPreferencesMenu(true)} in the
|
||||
* Application object and then display your Preferences window in this handler.
|
||||
*
|
||||
* @param event triggered when the user selects Preferences from the application menu
|
||||
@ -130,8 +130,8 @@ public interface ApplicationListener extends EventListener {
|
||||
* application menu, when the user types Command-Q, or when the user control clicks on your application icon in the
|
||||
* Dock and chooses Quit. You can either accept or reject the request to quit. You might want to reject the request
|
||||
* to quit if the user has unsaved work. Reject the request, move into your code to save changes, then quit your
|
||||
* application. To accept the request to quit, and terminate the application, set <code>isHandled(true)</code> for the
|
||||
* <code>event</code>. To reject the quit, set <code>isHandled(false)</code>.
|
||||
* application. To accept the request to quit, and terminate the application, set {@code isHandled(true)} for the
|
||||
* {@code event}. To reject the quit, set {@code isHandled(false)}.
|
||||
*
|
||||
* @param event a Quit Application event
|
||||
* @deprecated use {@link QuitHandler} and {@link QuitResponse}
|
||||
|
@ -29,8 +29,8 @@ import com.apple.eawt.AppEvent.OpenURIEvent;
|
||||
|
||||
/**
|
||||
* An implementor is notified when the application is asked to open a URI.
|
||||
* The application only sends {@link com.apple.eawt.EAWTEvent.OpenURIEvent}s when it has been launched as a bundled Mac application, and it's Info.plist claims URL schemes in it's <code>CFBundleURLTypes</code> entry.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleURLTypes</code> key to your app's Info.plist.
|
||||
* The application only sends {@link com.apple.eawt.EAWTEvent.OpenURIEvent}s when it has been launched as a bundled Mac application, and it's Info.plist claims URL schemes in it's {@code CFBundleURLTypes} entry.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleURLTypes} key to your app's Info.plist.
|
||||
*
|
||||
* @see Application#setOpenURIHandler(OpenURIHandler)
|
||||
*
|
||||
|
@ -38,7 +38,7 @@ package com.apple.eawt;
|
||||
*/
|
||||
public enum QuitStrategy {
|
||||
/**
|
||||
* Shuts down the application by calling <code>System.exit(0)</code>. This is the default strategy.
|
||||
* Shuts down the application by calling {@code System.exit(0)}. This is the default strategy.
|
||||
*/
|
||||
SYSTEM_EXIT_0,
|
||||
|
||||
|
@ -32,19 +32,19 @@ import java.io.*;
|
||||
* attributes. These attributes in turn are dependent on HFS and HFS+ file systems. As such, it is important to recognize
|
||||
* their limitation when writing code that must function well across multiple platforms.<p>
|
||||
*
|
||||
* In addition to file name suffixes, Mac OS X can use Finder attributes like file <code>type</code> and <code>creator</code> codes to
|
||||
* identify and handle files. These codes are unique 4-byte identifiers. The file <code>type</code> is a string that describes the
|
||||
* contents of a file. For example, the file type <code>APPL</code> identifies the file as an application and therefore
|
||||
* executable. A file type of <code>TEXT</code> means that the file contains raw text. Any application that can read raw
|
||||
* text can open a file of type <code>TEXT</code>. Applications that use proprietary file types might assign their files a proprietary
|
||||
* file <code>type</code> code.
|
||||
* In addition to file name suffixes, Mac OS X can use Finder attributes like file {@code type} and {@code creator} codes to
|
||||
* identify and handle files. These codes are unique 4-byte identifiers. The file {@code type} is a string that describes the
|
||||
* contents of a file. For example, the file type {@code APPL} identifies the file as an application and therefore
|
||||
* executable. A file type of {@code TEXT} means that the file contains raw text. Any application that can read raw
|
||||
* text can open a file of type {@code TEXT}. Applications that use proprietary file types might assign their files a proprietary
|
||||
* file {@code type} code.
|
||||
* <p>
|
||||
* To identify the application that can handle a document, the Finder can look at the <code>creator</code>. For example, if a user
|
||||
* double-clicks on a document with the <code>ttxt</code> <code>creator</code>, it opens up in Text Edit, the application registered
|
||||
* with the <code>ttxt</code> <code>creator</code> code. Note that the <code>creator</code>
|
||||
* To identify the application that can handle a document, the Finder can look at the {@code creator}. For example, if a user
|
||||
* double-clicks on a document with the {@code ttxt creator}, it opens up in Text Edit, the application registered
|
||||
* with the {@code ttxt creator} code. Note that the {@code creator}
|
||||
* code can be set to any application, not necessarily the application that created it. For example, if you
|
||||
* use an editor to create an HTML document, you might want to assign a browser's <code>creator</code> code for the file rather than
|
||||
* the HTML editor's <code>creator</code> code. Double-clicking on the document then opens the appropriate browser rather than the
|
||||
* use an editor to create an HTML document, you might want to assign a browser's {@code creator} code for the file rather than
|
||||
* the HTML editor's {@code creator} code. Double-clicking on the document then opens the appropriate browser rather than the
|
||||
*HTML editor.
|
||||
*<p>
|
||||
* If you plan to publicly distribute your application, you must register its creator and any proprietary file types with the Apple
|
||||
@ -126,7 +126,7 @@ public class FileManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file <code>type</code> and <code>creator</code> codes for a file or folder.
|
||||
* Sets the file {@code type} and {@code creator} codes for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -140,7 +140,7 @@ public class FileManager {
|
||||
private static native void _setFileTypeAndCreator(String filename, int type, int creator) throws IOException;
|
||||
|
||||
/**
|
||||
* Sets the file <code>type</code> code for a file or folder.
|
||||
* Sets the file {@code type} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -154,7 +154,7 @@ public class FileManager {
|
||||
private static native void _setFileType(String filename, int type) throws IOException;
|
||||
|
||||
/**
|
||||
* Sets the file <code>creator</code> code for a file or folder.
|
||||
* Sets the file {@code creator} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -168,7 +168,7 @@ public class FileManager {
|
||||
private static native void _setFileCreator(String filename, int creator) throws IOException;
|
||||
|
||||
/**
|
||||
* Obtains the file <code>type</code> code for a file or folder.
|
||||
* Obtains the file {@code type} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -182,7 +182,7 @@ public class FileManager {
|
||||
private static native int _getFileType(String filename) throws IOException;
|
||||
|
||||
/**
|
||||
* Obtains the file <code>creator</code> code for a file or folder.
|
||||
* Obtains the file {@code creator} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -200,11 +200,11 @@ public class FileManager {
|
||||
* Locates a folder of a particular type. Mac OS X recognizes certain specific folders that have distinct purposes.
|
||||
* For example, the user's desktop or temporary folder. These folders have corresponding codes. Given one of these codes,
|
||||
* this method returns the path to that particular folder. Certain folders of a given type may appear in more than
|
||||
* one domain. For example, although there is only one <code>root</code> folder, there are multiple <code>pref</code>
|
||||
* folders. If this method is called to find the <code>pref</code> folder, it will return the first one it finds,
|
||||
* the user's preferences folder in <code>~/Library/Preferences</code>. To explicitly locate a folder in a certain
|
||||
* domain use <code>findFolder(short domain, int folderType)</code> or <code>findFolder(short domain, int folderType,
|
||||
* boolean createIfNeeded)</code>.
|
||||
* one domain. For example, although there is only one {@code root} folder, there are multiple {@code pref}
|
||||
* folders. If this method is called to find the {@code pref} folder, it will return the first one it finds,
|
||||
* the user's preferences folder in {@code ~/Library/Preferences}. To explicitly locate a folder in a certain
|
||||
* domain use {@code findFolder(short domain, int folderType)} or
|
||||
* {@code findFolder(short domain, int folderType, boolean createIfNeeded)}.
|
||||
*
|
||||
* @return the path to the folder searched for
|
||||
*
|
||||
@ -215,8 +215,8 @@ public class FileManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates a folder of a particular type, within a given domain. Similar to <code>findFolder(int folderType)</code>
|
||||
* except that the domain to look in can be specified. Valid values for <code>domain</code>include:
|
||||
* Locates a folder of a particular type, within a given domain. Similar to {@code findFolder(int folderType)}
|
||||
* except that the domain to look in can be specified. Valid values for {@code domain} include:
|
||||
* <dl>
|
||||
* <dt>user</dt>
|
||||
* <dd>The User domain contains resources specific to the user who is currently logged in</dd>
|
||||
@ -239,12 +239,12 @@ public class FileManager {
|
||||
|
||||
/**
|
||||
* Locates a folder of a particular type within a given domain and optionally creating the folder if it does
|
||||
* not exist. The behavior is similar to <code>findFolder(int folderType)</code> and
|
||||
* <code>findFolder(short domain, int folderType)</code> except that it can create the folder if it does not already exist.
|
||||
* not exist. The behavior is similar to {@code findFolder(int folderType)} and
|
||||
* {@code findFolder(short domain, int folderType)} except that it can create the folder if it does not already exist.
|
||||
*
|
||||
* @param createIfNeeded
|
||||
* set to <code>true</code>, by setting to <code>false</code> the behavior will be the
|
||||
* same as <code>findFolder(short domain, int folderType, boolean createIfNeeded)</code>
|
||||
* set to {@code true}, by setting to {@code false} the behavior will be the
|
||||
* same as {@code findFolder(short domain, int folderType, boolean createIfNeeded)}
|
||||
* @return the path to the folder searched for
|
||||
*
|
||||
* @since 1.4
|
||||
@ -263,9 +263,9 @@ public class FileManager {
|
||||
|
||||
|
||||
/**
|
||||
* Opens the path specified by a URL in the appropriate application for that URL. HTTP URL's (<code>http://</code>)
|
||||
* open in the default browser as set in the Internet pane of System Preferences. File (<code>file://</code>) and
|
||||
* FTP URL's (<code>ftp://</code>) open in the Finder. Note that opening an FTP URL will prompt the user for where
|
||||
* Opens the path specified by a URL in the appropriate application for that URL. HTTP URL's ({@code http://})
|
||||
* open in the default browser as set in the Internet pane of System Preferences. File ({@code file://}) and
|
||||
* FTP URL's ({@code ftp://}) open in the Finder. Note that opening an FTP URL will prompt the user for where
|
||||
* they want to save the downloaded file(s).
|
||||
*
|
||||
* @param url
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.apple.laf;
|
||||
|
||||
|
||||
import java.awt.ComponentOrientation;
|
||||
import java.beans.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@ -85,6 +86,15 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
} else if (prop == JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY) {
|
||||
invalidateFileCache();
|
||||
validateFileCache();
|
||||
} else if (prop.equals("componentOrientation")) {
|
||||
ComponentOrientation o = (ComponentOrientation) e.getNewValue();
|
||||
JFileChooser cc = (JFileChooser) e.getSource();
|
||||
if (o != e.getOldValue()) {
|
||||
cc.applyComponentOrientation(o);
|
||||
}
|
||||
fFileList.setComponentOrientation(o);
|
||||
fFileList.getParent().getParent().setComponentOrientation(o);
|
||||
|
||||
}
|
||||
if (prop == SORT_BY_CHANGED) {// $ Ought to just resort
|
||||
fSortNames = (((Integer)e.getNewValue()).intValue() == 0);
|
||||
|
@ -105,7 +105,9 @@ public class AquaInternalFrameManager extends DefaultDesktopManager {
|
||||
// Position depends on *current* position of frame, unlike super which reuses the first position
|
||||
final Rectangle r = getBoundsForIconOf(f);
|
||||
desktopIcon.setBounds(r.x, r.y, r.width, r.height);
|
||||
|
||||
if (!wasIcon(f)) {
|
||||
setWasIcon(f, Boolean.TRUE);
|
||||
}
|
||||
c = f.getParent();
|
||||
if (c == null) return;
|
||||
|
||||
|
@ -295,9 +295,9 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs necessary mouse handlers on <code>newPane</code>
|
||||
* Installs necessary mouse handlers on {@code newPane}
|
||||
* and adds it to the frame.
|
||||
* Reverse process for the <code>currentPane</code>.
|
||||
* Reverse process for the {@code currentPane}.
|
||||
*/
|
||||
@Override
|
||||
protected void replacePane(final JComponent currentPane, final JComponent newPane) {
|
||||
|
@ -82,9 +82,9 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the <code>LookAndFeel</code> returned
|
||||
* <code>RootPaneUI</code> instances support providing Window decorations
|
||||
* in a <code>JRootPane</code>.
|
||||
* Returns true if the {@code LookAndFeel} returned
|
||||
* {@code RootPaneUI} instances support providing Window decorations
|
||||
* in a {@code JRootPane}.
|
||||
* <p>
|
||||
* The default implementation returns false, subclasses that support
|
||||
* Window decorations should override this and return true.
|
||||
@ -174,20 +174,20 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>ActionMap</code>.
|
||||
* Returns an {@code ActionMap}.
|
||||
* <P>
|
||||
* This <code>ActionMap</code> contains <code>Actions</code> that
|
||||
* This {@code ActionMap} contains {@code Actions} that
|
||||
* embody the ability to render an auditory cue. These auditory
|
||||
* cues map onto user and system activities that may be useful
|
||||
* for an end user to know about (such as a dialog box appearing).
|
||||
* <P>
|
||||
* At the appropriate time in a <code>JComponent</code> UI's lifecycle,
|
||||
* At the appropriate time in a {@code JComponent} UI's lifecycle,
|
||||
* the ComponentUI is responsible for getting the appropriate
|
||||
* <code>Action</code> out of the <code>ActionMap</code> and passing
|
||||
* it on to <code>playSound</code>.
|
||||
* {@code Action} out of the {@code ActionMap} and passing
|
||||
* it on to {@code playSound}.
|
||||
* <P>
|
||||
* The <code>Actions</code> in this <code>ActionMap</code> are
|
||||
* created by the <code>createAudioAction</code> method.
|
||||
* The {@code Actions} in this {@code ActionMap} are
|
||||
* created by the {@code createAudioAction} method.
|
||||
*
|
||||
* @return an ActionMap containing Actions
|
||||
* responsible for rendering auditory cues
|
||||
|
@ -47,7 +47,7 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
|
||||
/**
|
||||
* Creates and returns a Container containin the buttons. The buttons
|
||||
* are created by calling <code>getButtons</code>.
|
||||
* are created by calling {@code getButtons}.
|
||||
*/
|
||||
protected Container createButtonArea() {
|
||||
final Container bottom = super.createButtonArea();
|
||||
@ -141,5 +141,27 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
xLocation += xOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container c) {
|
||||
if (c != null) {
|
||||
Component[] children = c.getComponents();
|
||||
if (children != null && children.length > 0) {
|
||||
int numChildren = children.length;
|
||||
Insets cInsets = c.getInsets();
|
||||
int extraHeight = cInsets.top + cInsets.bottom;
|
||||
int extraWidth = cInsets.left + cInsets.right;
|
||||
int okCancelButtonWidth = extraWidth
|
||||
+ (kOKCancelButtonWidth * numChildren)
|
||||
+ (numChildren - 1) * padding;
|
||||
int okbuttonHeight = extraHeight + kButtonHeight;
|
||||
Dimension minSize = super.minimumLayoutSize(c);
|
||||
return new Dimension(Math.max(minSize.width,
|
||||
okCancelButtonWidth),
|
||||
Math.max(minSize.height, okbuttonHeight));
|
||||
}
|
||||
}
|
||||
return new Dimension(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,10 +180,19 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
final int width = progressBar.getWidth() - (i.right + i.left);
|
||||
final int height = progressBar.getHeight() - (i.bottom + i.top);
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
final AffineTransform savedAT = g2.getTransform();
|
||||
if (!progressBar.getComponentOrientation().isLeftToRight()) {
|
||||
//Scale operation: Flips component about pivot
|
||||
//Translate operation: Moves component back into original position
|
||||
g2.scale(-1, 1);
|
||||
g2.translate(-progressBar.getWidth(), 0);
|
||||
}
|
||||
painter.paint(g, progressBar, i.left, i.top, width, height);
|
||||
|
||||
g2.setTransform(savedAT);
|
||||
if (progressBar.isStringPainted() && !progressBar.isIndeterminate()) {
|
||||
paintString(g, i.left, i.top, width, height);
|
||||
paintString(g, i.left, i.top, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
|
||||
/**
|
||||
* Invoked when a property changes on the root pane. If the event
|
||||
* indicates the <code>defaultButton</code> has changed, this will
|
||||
* indicates the {@code defaultButton} has changed, this will
|
||||
* update the animation.
|
||||
* If the enabled state changed, it will start or stop the animation
|
||||
*/
|
||||
|
@ -22,7 +22,6 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.apple.laf;
|
||||
|
||||
import java.awt.*;
|
||||
@ -45,33 +44,37 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
/**
|
||||
* This is originally derived from BasicSpinnerUI, but they made everything private
|
||||
* so we can't subclass!
|
||||
* This is originally derived from BasicSpinnerUI, but they made everything
|
||||
* private so we can't subclass!
|
||||
*/
|
||||
public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
private static final RecyclableSingleton<? extends PropertyChangeListener> propertyChangeListener
|
||||
= new RecyclableSingletonFromDefaultConstructor<>(PropertyChangeHandler.class);
|
||||
|
||||
static PropertyChangeListener getPropertyChangeListener() {
|
||||
return propertyChangeListener.get();
|
||||
}
|
||||
|
||||
private static final RecyclableSingleton<ArrowButtonHandler> nextButtonHandler
|
||||
= new RecyclableSingleton<ArrowButtonHandler>() {
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("increment", true);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("increment", true);
|
||||
}
|
||||
};
|
||||
|
||||
static ArrowButtonHandler getNextButtonHandler() {
|
||||
return nextButtonHandler.get();
|
||||
}
|
||||
private static final RecyclableSingleton<ArrowButtonHandler> previousButtonHandler
|
||||
= new RecyclableSingleton<ArrowButtonHandler>() {
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("decrement", false);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("decrement", false);
|
||||
}
|
||||
};
|
||||
|
||||
static ArrowButtonHandler getPreviousButtonHandler() {
|
||||
return previousButtonHandler.get();
|
||||
}
|
||||
@ -92,9 +95,10 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
boolean wasOpaque;
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
this.spinner = (JSpinner)c;
|
||||
this.spinner = (JSpinner) c;
|
||||
installDefaults();
|
||||
installListeners();
|
||||
next = createNextButton();
|
||||
@ -110,8 +114,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
installKeyboardActions();
|
||||
|
||||
// this doesn't work because JSpinner calls setOpaque(true) directly in it's constructor
|
||||
// LookAndFeel.installProperty(spinner, "opaque", Boolean.FALSE);
|
||||
|
||||
// LookAndFeel.installProperty(spinner, "opaque", Boolean.FALSE);
|
||||
// ...so we have to handle the is/was opaque ourselves
|
||||
wasOpaque = spinner.isOpaque();
|
||||
spinner.setOpaque(false);
|
||||
@ -208,6 +211,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class TransparentButton extends JButton implements SwingConstants {
|
||||
|
||||
boolean interceptRepaints = false;
|
||||
|
||||
public TransparentButton() {
|
||||
@ -219,14 +223,17 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g) {}
|
||||
public void paint(final Graphics g) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void repaint() {
|
||||
// only intercept repaints if we are after this has been initialized
|
||||
// otherwise we can't talk to our containing class
|
||||
if (interceptRepaints) {
|
||||
if (spinPainter == null) return;
|
||||
if (spinPainter == null) {
|
||||
return;
|
||||
}
|
||||
spinPainter.repaint();
|
||||
}
|
||||
super.repaint();
|
||||
@ -246,7 +253,9 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
protected void fixupEditor(final JComponent editor) {
|
||||
if (!(editor instanceof DefaultEditor)) return;
|
||||
if (!(editor instanceof DefaultEditor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.setOpaque(false);
|
||||
editor.setInheritsPopupMenu(true);
|
||||
@ -255,7 +264,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
editor.setFont(new FontUIResource(spinner.getFont()));
|
||||
}
|
||||
|
||||
final JFormattedTextField editorTextField = ((DefaultEditor)editor).getTextField();
|
||||
final JFormattedTextField editorTextField = ((DefaultEditor) editor).getTextField();
|
||||
if (editorTextField.getFont() instanceof UIResource) {
|
||||
editorTextField.setFont(new FontUIResource(spinner.getFont()));
|
||||
}
|
||||
@ -277,7 +286,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
child.setEnabled(enabled);
|
||||
if (child instanceof Container) {
|
||||
updateEnabledState((Container)child, enabled);
|
||||
updateEnabledState((Container) child, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -290,13 +299,13 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
private InputMap getInputMap(final int condition) {
|
||||
if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
|
||||
return (InputMap)UIManager.get("Spinner.ancestorInputMap");
|
||||
return (InputMap) UIManager.get("Spinner.ancestorInputMap");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ActionMap getActionMap() {
|
||||
ActionMap map = (ActionMap)UIManager.get("Spinner.actionMap");
|
||||
ActionMap map = (ActionMap) UIManager.get("Spinner.actionMap");
|
||||
|
||||
if (map == null) {
|
||||
map = createActionMap();
|
||||
@ -316,6 +325,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private static class ArrowButtonHandler extends AbstractAction implements MouseListener {
|
||||
|
||||
final javax.swing.Timer autoRepeatTimer;
|
||||
final boolean isNext;
|
||||
JSpinner spinner = null;
|
||||
@ -330,9 +340,9 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
private JSpinner eventToSpinner(final AWTEvent e) {
|
||||
Object src = e.getSource();
|
||||
while ((src instanceof Component) && !(src instanceof JSpinner)) {
|
||||
src = ((Component)src).getParent();
|
||||
src = ((Component) src).getParent();
|
||||
}
|
||||
return (src instanceof JSpinner) ? (JSpinner)src : null;
|
||||
return (src instanceof JSpinner) ? (JSpinner) src : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -342,13 +352,15 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
spinner = eventToSpinner(e);
|
||||
}
|
||||
|
||||
if (spinner == null) return;
|
||||
if (spinner == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final int calendarField = getCalendarField(spinner);
|
||||
spinner.commitEdit();
|
||||
if (calendarField != -1) {
|
||||
((SpinnerDateModel)spinner.getModel()).setCalendarField(calendarField);
|
||||
((SpinnerDateModel) spinner.getModel()).setCalendarField(calendarField);
|
||||
}
|
||||
final Object value = (isNext) ? spinner.getNextValue() : spinner.getPreviousValue();
|
||||
if (value != null) {
|
||||
@ -368,37 +380,46 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
*/
|
||||
private void select(final JSpinner spinnerComponent) {
|
||||
final JComponent editor = spinnerComponent.getEditor();
|
||||
if (!(editor instanceof JSpinner.DateEditor)) return;
|
||||
if (!(editor instanceof JSpinner.DateEditor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor) editor;
|
||||
final JFormattedTextField ftf = dateEditor.getTextField();
|
||||
final Format format = dateEditor.getFormat();
|
||||
Object value;
|
||||
if (format == null || (value = spinnerComponent.getValue()) == null) return;
|
||||
if (format == null || (value = spinnerComponent.getValue()) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SpinnerDateModel model = dateEditor.getModel();
|
||||
final DateFormat.Field field = DateFormat.Field.ofCalendarField(model.getCalendarField());
|
||||
if (field == null) return;
|
||||
if (field == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final AttributedCharacterIterator iterator = format.formatToCharacterIterator(value);
|
||||
if (!select(ftf, iterator, field) && field == DateFormat.Field.HOUR0) {
|
||||
select(ftf, iterator, DateFormat.Field.HOUR1);
|
||||
}
|
||||
} catch (final IllegalArgumentException iae) {}
|
||||
} catch (final IllegalArgumentException iae) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the passed in field, returning true if it is found,
|
||||
* false otherwise.
|
||||
* Selects the passed in field, returning true if it is found, false
|
||||
* otherwise.
|
||||
*/
|
||||
private boolean select(final JFormattedTextField ftf, final AttributedCharacterIterator iterator, final DateFormat.Field field) {
|
||||
final int max = ftf.getDocument().getLength();
|
||||
|
||||
iterator.first();
|
||||
do {
|
||||
final Map<Attribute,Object> attrs = iterator.getAttributes();
|
||||
if (attrs == null || !attrs.containsKey(field)) continue;
|
||||
final Map<Attribute, Object> attrs = iterator.getAttributes();
|
||||
if (attrs == null || !attrs.containsKey(field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final int start = iterator.getRunStart(field);
|
||||
final int end = iterator.getRunLimit(field);
|
||||
@ -412,29 +433,35 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the calendarField under the start of the selection, or
|
||||
* -1 if there is no valid calendar field under the selection (or
|
||||
* the spinner isn't editing dates.
|
||||
* Returns the calendarField under the start of the selection, or -1 if
|
||||
* there is no valid calendar field under the selection (or the spinner
|
||||
* isn't editing dates.
|
||||
*/
|
||||
private int getCalendarField(final JSpinner spinnerComponent) {
|
||||
final JComponent editor = spinnerComponent.getEditor();
|
||||
if (!(editor instanceof JSpinner.DateEditor)) return -1;
|
||||
if (!(editor instanceof JSpinner.DateEditor)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor) editor;
|
||||
final JFormattedTextField ftf = dateEditor.getTextField();
|
||||
final int start = ftf.getSelectionStart();
|
||||
final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
|
||||
if (!(formatter instanceof InternationalFormatter)) return -1;
|
||||
if (!(formatter instanceof InternationalFormatter)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
|
||||
final Format.Field[] fields = ((InternationalFormatter) formatter).getFields(start);
|
||||
for (final Field element : fields) {
|
||||
if (!(element instanceof DateFormat.Field)) continue;
|
||||
if (!(element instanceof DateFormat.Field)) {
|
||||
continue;
|
||||
}
|
||||
int calendarField;
|
||||
|
||||
if (element == DateFormat.Field.HOUR1) {
|
||||
calendarField = Calendar.HOUR;
|
||||
} else {
|
||||
calendarField = ((DateFormat.Field)element).getCalendarField();
|
||||
calendarField = ((DateFormat.Field) element).getCalendarField();
|
||||
}
|
||||
|
||||
if (calendarField != -1) {
|
||||
@ -446,7 +473,9 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (!SwingUtilities.isLeftMouseButton(e) || !e.getComponent().isEnabled()) return;
|
||||
if (!SwingUtilities.isLeftMouseButton(e) || !e.getComponent().isEnabled()) {
|
||||
return;
|
||||
}
|
||||
spinner = eventToSpinner(e);
|
||||
autoRepeatTimer.start();
|
||||
|
||||
@ -460,26 +489,35 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {}
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {}
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) {}
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests focus on a child of the spinner if the spinner doesn't
|
||||
* have focus.
|
||||
* Requests focus on a child of the spinner if the spinner doesn't have
|
||||
* focus.
|
||||
*/
|
||||
private void focusSpinnerIfNecessary() {
|
||||
final Component fo = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
if (!spinner.isRequestFocusEnabled() || (fo != null && (SwingUtilities.isDescendingFrom(fo, spinner)))) return;
|
||||
if (!spinner.isRequestFocusEnabled() || (fo != null && (SwingUtilities.isDescendingFrom(fo, spinner)))) {
|
||||
return;
|
||||
}
|
||||
Container root = spinner;
|
||||
|
||||
if (!root.isFocusCycleRoot()) {
|
||||
root = root.getFocusCycleRootAncestor();
|
||||
}
|
||||
|
||||
if (root == null) return;
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
final FocusTraversalPolicy ftp = root.getFocusTraversalPolicy();
|
||||
final Component child = ftp.getComponentAfter(root, spinner);
|
||||
|
||||
@ -491,6 +529,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class SpinPainter extends JComponent {
|
||||
|
||||
final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getSpinnerArrows());
|
||||
|
||||
ButtonModel fTopModel;
|
||||
@ -551,11 +590,12 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple layout manager for the editor and the next/previous buttons.
|
||||
* See the AquaSpinnerUI javadoc for more information about exactly
|
||||
* how the components are arranged.
|
||||
* A simple layout manager for the editor and the next/previous buttons. See
|
||||
* the AquaSpinnerUI javadoc for more information about exactly how the
|
||||
* components are arranged.
|
||||
*/
|
||||
static class SpinnerLayout implements LayoutManager {
|
||||
|
||||
private Component nextButton = null;
|
||||
private Component previousButton = null;
|
||||
private Component editor = null;
|
||||
@ -656,26 +696,38 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect JSpinner property changes we're interested in and delegate. Subclasses
|
||||
* shouldn't need to replace the default propertyChangeListener (although they
|
||||
* can by overriding createPropertyChangeListener) since all of the interesting
|
||||
* property changes are delegated to protected methods.
|
||||
* Detect JSpinner property changes we're interested in and delegate.
|
||||
* Subclasses shouldn't need to replace the default propertyChangeListener
|
||||
* (although they can by overriding createPropertyChangeListener) since all
|
||||
* of the interesting property changes are delegated to protected methods.
|
||||
*/
|
||||
static class PropertyChangeHandler implements PropertyChangeListener {
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String propertyName = e.getPropertyName();
|
||||
final JSpinner spinner = (JSpinner)(e.getSource());
|
||||
final JSpinner spinner = (JSpinner) (e.getSource());
|
||||
final SpinnerUI spinnerUI = spinner.getUI();
|
||||
|
||||
if (spinnerUI instanceof AquaSpinnerUI) {
|
||||
final AquaSpinnerUI ui = (AquaSpinnerUI)spinnerUI;
|
||||
final AquaSpinnerUI ui = (AquaSpinnerUI) spinnerUI;
|
||||
|
||||
if ("editor".equals(propertyName)) {
|
||||
final JComponent oldEditor = (JComponent)e.getOldValue();
|
||||
final JComponent newEditor = (JComponent)e.getNewValue();
|
||||
final JComponent oldEditor = (JComponent) e.getOldValue();
|
||||
final JComponent newEditor = (JComponent) e.getNewValue();
|
||||
ui.replaceEditor(oldEditor, newEditor);
|
||||
ui.updateEnabledState();
|
||||
} else if ("componentOrientation".equals(propertyName)) {
|
||||
ComponentOrientation o
|
||||
= (ComponentOrientation) e.getNewValue();
|
||||
if (o != e.getOldValue()) {
|
||||
JComponent editor = spinner.getEditor();
|
||||
if (editor != null) {
|
||||
editor.applyComponentOrientation(o);
|
||||
}
|
||||
spinner.revalidate();
|
||||
spinner.repaint();
|
||||
}
|
||||
} else if ("enabled".equals(propertyName)) {
|
||||
ui.updateEnabledState();
|
||||
} else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
|
||||
@ -683,8 +735,8 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
} else if ("font".equals(propertyName)) {
|
||||
JComponent editor = spinner.getEditor();
|
||||
if (editor instanceof JSpinner.DefaultEditor) {
|
||||
JTextField tf =
|
||||
((JSpinner.DefaultEditor) editor).getTextField();
|
||||
JTextField tf
|
||||
= ((JSpinner.DefaultEditor) editor).getTextField();
|
||||
if (tf != null) {
|
||||
if (tf.getFont() instanceof UIResource) {
|
||||
tf.setFont(new FontUIResource(spinner.getFont()));
|
||||
@ -703,12 +755,12 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
final Component[] children = spinnerComponent.getComponents();
|
||||
for (final Component element : children) {
|
||||
if (element instanceof JSpinner.DefaultEditor) {
|
||||
final JTextField tf = ((JSpinner.DefaultEditor)element).getTextField();
|
||||
final JTextField tf = ((JSpinner.DefaultEditor) element).getTextField();
|
||||
if (tf != null) {
|
||||
tf.setToolTipText(toolTipText);
|
||||
}
|
||||
} else if (element instanceof JComponent) {
|
||||
((JComponent)element).setToolTipText(toolTipText);
|
||||
((JComponent) element).setToolTipText(toolTipText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,9 +235,9 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by <code>installUI</code> to create
|
||||
* Invoked by {@code installUI} to create
|
||||
* a layout manager object to manage
|
||||
* the <code>JTabbedPane</code>.
|
||||
* the {@code JTabbedPane}.
|
||||
*
|
||||
* @return a layout manager object
|
||||
*
|
||||
@ -536,7 +536,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* Sets the tab the mouse is over by location. This is a cover method
|
||||
* for <code>setRolloverTab(tabForCoordinate(x, y, false))</code>.
|
||||
* for {@code setRolloverTab(tabForCoordinate(x, y, false))}.
|
||||
*/
|
||||
private void setRolloverTab(final int x, final int y) {
|
||||
// NOTE:
|
||||
@ -547,8 +547,8 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tab the mouse is currently over to <code>index</code>.
|
||||
* <code>index</code> will be -1 if the mouse is no longer over any
|
||||
* Sets the tab the mouse is currently over to {@code index}.
|
||||
* {@code index} will be -1 if the mouse is no longer over any
|
||||
* tab. No checking is done to ensure the passed in index identifies a
|
||||
* valid tab.
|
||||
*
|
||||
@ -676,7 +676,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* Returns the amount the baseline is offset by. This is typically
|
||||
* the same as <code>getTabLabelShiftY</code>.
|
||||
* the same as {@code getTabLabelShiftY}.
|
||||
*
|
||||
* @return amount to offset the baseline by
|
||||
* @since 1.6
|
||||
@ -765,10 +765,10 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
/**
|
||||
* Paints the tabs in the tab area.
|
||||
* Invoked by paint().
|
||||
* The graphics parameter must be a valid <code>Graphics</code>
|
||||
* The graphics parameter must be a valid {@code Graphics}
|
||||
* object. Tab placement may be either:
|
||||
* <code>JTabbedPane.TOP</code>, <code>JTabbedPane.BOTTOM</code>,
|
||||
* <code>JTabbedPane.LEFT</code>, or <code>JTabbedPane.RIGHT</code>.
|
||||
* {@code JTabbedPane.TOP}, {@code JTabbedPane.BOTTOM},
|
||||
* {@code JTabbedPane.LEFT}, or {@code JTabbedPane.RIGHT}.
|
||||
* The selected index must be a valid tabbed pane tab index (0 to
|
||||
* tab count - 1, inclusive) or -1 if no tab is currently selected.
|
||||
* The handling of invalid parameters is unspecified.
|
||||
@ -1406,7 +1406,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* designated Rectangle object (rather than instantiating and returning
|
||||
* a new Rectangle each time). The tab index parameter must be a valid
|
||||
* tabbed pane tab index (0 to tab count - 1, inclusive). The destination
|
||||
* rectangle parameter must be a valid <code>Rectangle</code> instance.
|
||||
* rectangle parameter must be a valid {@code Rectangle} instance.
|
||||
* The handling of invalid parameters is unspecified.
|
||||
*
|
||||
* @param tabIndex the index of the tab
|
||||
@ -3717,7 +3717,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* An ActionMap that populates its contents as necessary. The
|
||||
* contents are populated by invoking the <code>loadActionMap</code>
|
||||
* contents are populated by invoking the {@code loadActionMap}
|
||||
* method on the passed in Object.
|
||||
*
|
||||
* @version 1.6, 11/17/05
|
||||
@ -3726,14 +3726,14 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class LazyActionMap extends ActionMapUIResource {
|
||||
/**
|
||||
* Object to invoke <code>loadActionMap</code> on. This may be
|
||||
* Object to invoke {@code loadActionMap} on. This may be
|
||||
* a Class object.
|
||||
*/
|
||||
private transient Object _loader;
|
||||
|
||||
/**
|
||||
* Installs an ActionMap that will be populated by invoking the
|
||||
* <code>loadActionMap</code> method on the specified Class
|
||||
* {@code loadActionMap} method on the specified Class
|
||||
* when necessary.
|
||||
* <p>
|
||||
* This should be used if the ActionMap can be shared.
|
||||
@ -3755,7 +3755,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* Returns an ActionMap that will be populated by invoking the
|
||||
* <code>loadActionMap</code> method on the specified Class
|
||||
* {@code loadActionMap} method on the specified Class
|
||||
* when necessary.
|
||||
* <p>
|
||||
* This should be used if the ActionMap can be shared.
|
||||
|
@ -179,8 +179,8 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the expand (toggle) part of a row. The receiver should NOT modify <code>clipBounds</code>, or
|
||||
* <code>insets</code>.
|
||||
* Paints the expand (toggle) part of a row. The receiver should NOT modify {@code clipBounds}, or
|
||||
* {@code insets}.
|
||||
*/
|
||||
protected void paintExpandControl(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) {
|
||||
final Object value = path.getLastPathComponent();
|
||||
|
@ -41,7 +41,7 @@ public class NativeFont extends PhysicalFont {
|
||||
|
||||
/**
|
||||
* Verifies native font is accessible.
|
||||
* @throws FontFormatException - if the font can't be located.
|
||||
* @throws FontFormatException if the font can't be located.
|
||||
*/
|
||||
public NativeFont(String platName, boolean isBitmapDelegate)
|
||||
throws FontFormatException {
|
||||
|
@ -37,10 +37,10 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
IntBuffer bankdata[];
|
||||
|
||||
/**
|
||||
* Constructs an integer-based <CODE>DataBuffer</CODE> with a single bank
|
||||
* Constructs an integer-based {@code DataBuffer} with a single bank
|
||||
* and the specified size.
|
||||
*
|
||||
* @param size The size of the <CODE>DataBuffer</CODE>.
|
||||
* @param size The size of the {@code DataBuffer}.
|
||||
*/
|
||||
public DataBufferNIOInt(int size) {
|
||||
super(TYPE_INT,size);
|
||||
@ -51,7 +51,7 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default (first) IntBuffer in <CODE>DataBuffer</CODE>.
|
||||
* Returns the default (first) IntBuffer in {@code DataBuffer}.
|
||||
*
|
||||
* @return The first IntBuffer.
|
||||
*/
|
||||
@ -70,7 +70,7 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default (first) int data array in <CODE>DataBuffer</CODE>.
|
||||
* Returns the default (first) int data array in {@code DataBuffer}.
|
||||
*
|
||||
* @return The first integer data array.
|
||||
*/
|
||||
@ -137,7 +137,7 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
|
||||
/**
|
||||
* Sets the requested data array element in the specified bank
|
||||
* to the integer value <CODE>i</CODE>.
|
||||
* to the integer value {@code i}.
|
||||
* @param bank The bank in which you want to set the data array element.
|
||||
* @param i The data array element you want to set.
|
||||
* @param val The integer value to which you want to set the specified data array element.
|
||||
|
@ -33,7 +33,7 @@ import java.net.URI;
|
||||
|
||||
|
||||
/**
|
||||
* Concrete implementation of the interface <code>DesktopPeer</code> for MacOS X
|
||||
* Concrete implementation of the interface {@code DesktopPeer} for MacOS X
|
||||
*
|
||||
* @see DesktopPeer
|
||||
*/
|
||||
|
@ -101,7 +101,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* method.
|
||||
*
|
||||
* @param context the input method context for this input method
|
||||
* @exception NullPointerException if <code>context</code> is null
|
||||
* @exception NullPointerException if {@code context} is null
|
||||
*/
|
||||
public void setInputMethodContext(InputMethodContext context) {
|
||||
fIMContext = context;
|
||||
@ -124,7 +124,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
*
|
||||
* @param lang locale to input
|
||||
* @return whether the specified locale is supported
|
||||
* @exception NullPointerException if <code>locale</code> is null
|
||||
* @exception NullPointerException if {@code locale} is null
|
||||
*/
|
||||
public boolean setLocale(Locale lang) {
|
||||
return setLocale(lang, false);
|
||||
@ -205,7 +205,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* are dispatched to the current input method for this component before
|
||||
* they are dispatched to the component's methods or event listeners.
|
||||
* The input method decides whether it needs to handle the event. If it
|
||||
* does, it also calls the event's <code>consume</code> method; this
|
||||
* does, it also calls the event's {@code consume} method; this
|
||||
* causes the event to not get dispatched to the component's event
|
||||
* processing methods or event listeners.
|
||||
* <p>
|
||||
@ -216,7 +216,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* This method is called by {@link java.awt.im.InputContext#dispatchEvent InputContext.dispatchEvent}.
|
||||
*
|
||||
* @param event the event being dispatched to the input method
|
||||
* @exception NullPointerException if <code>event</code> is null
|
||||
* @exception NullPointerException if {@code event} is null
|
||||
*/
|
||||
public void dispatchEvent(final AWTEvent event) {
|
||||
// No-op for Mac OS X.
|
||||
|
@ -75,8 +75,7 @@ final class CPlatformResponder {
|
||||
jclickCount = clickCount;
|
||||
}
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
|
||||
modifierFlags);
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
||||
|
||||
eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
|
||||
@ -90,9 +89,7 @@ final class CPlatformResponder {
|
||||
void handleScrollEvent(final int x, final int y, final int absX,
|
||||
final int absY, final int modifierFlags,
|
||||
final double deltaX, final double deltaY) {
|
||||
final int buttonNumber = CocoaConstants.kCGMouseButtonCenter;
|
||||
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
|
||||
modifierFlags);
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
final boolean isShift = (jmodifiers & InputEvent.SHIFT_DOWN_MASK) != 0;
|
||||
|
||||
// Vertical scroll.
|
||||
@ -187,8 +184,7 @@ final class CPlatformResponder {
|
||||
postsTyped = false;
|
||||
}
|
||||
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags);
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
long when = System.currentTimeMillis();
|
||||
|
||||
if (jeventType == KeyEvent.KEY_PRESSED) {
|
||||
|
@ -35,8 +35,8 @@ public class CPrinterDevice extends GraphicsDevice {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this <code>GraphicsDevice</code>.
|
||||
* @return the type of this <code>GraphicsDevice</code>, which can
|
||||
* Returns the type of this {@code GraphicsDevice}.
|
||||
* @return the type of this {@code GraphicsDevice}, which can
|
||||
* either be TYPE_RASTER_SCREEN, TYPE_PRINTER or TYPE_IMAGE_BUFFER.
|
||||
* @see #TYPE_RASTER_SCREEN
|
||||
* @see #TYPE_PRINTER
|
||||
@ -48,30 +48,30 @@ public class CPrinterDevice extends GraphicsDevice {
|
||||
|
||||
/**
|
||||
* Returns the identification string associated with this
|
||||
* <code>GraphicsDevice</code>.
|
||||
* @return a <code>String</code> that is the identification
|
||||
* of this <code>GraphicsDevice</code>.
|
||||
* {@code GraphicsDevice}.
|
||||
* @return a {@code String} that is the identification
|
||||
* of this {@code GraphicsDevice}.
|
||||
*/
|
||||
public String getIDstring() {
|
||||
return ("Printer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of the <code>GraphicsConfiguration</code>
|
||||
* objects associated with this <code>GraphicsDevice</code>.
|
||||
* @return an array of <code>GraphicsConfiguration</code>
|
||||
* Returns all of the {@code GraphicsConfiguration}
|
||||
* objects associated with this {@code GraphicsDevice}.
|
||||
* @return an array of {@code GraphicsConfiguration}
|
||||
* objects that are associated with this
|
||||
* <code>GraphicsDevice</code>.
|
||||
* {@code GraphicsDevice}.
|
||||
*/
|
||||
public GraphicsConfiguration[] getConfigurations() {
|
||||
return new GraphicsConfiguration[] { gc };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default <code>GraphicsConfiguration</code>
|
||||
* associated with this <code>GraphicsDevice</code>.
|
||||
* @return the default <code>GraphicsConfiguration</code>
|
||||
* of this <code>GraphicsDevice</code>.
|
||||
* Returns the default {@code GraphicsConfiguration}
|
||||
* associated with this {@code GraphicsDevice}.
|
||||
* @return the default {@code GraphicsConfiguration}
|
||||
* of this {@code GraphicsDevice}.
|
||||
*/
|
||||
public GraphicsConfiguration getDefaultConfiguration() {
|
||||
return gc;
|
||||
|
@ -49,9 +49,9 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the {@link GraphicsDevice} associated with this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* @return a <code>GraphicsDevice</code> object that is
|
||||
* associated with this <code>GraphicsConfiguration</code>.
|
||||
* {@code GraphicsConfiguration}.
|
||||
* @return a {@code GraphicsDevice} object that is
|
||||
* associated with this {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public GraphicsDevice getDevice() {
|
||||
return gd;
|
||||
@ -59,16 +59,16 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns a {@link BufferedImage} with a data layout and color model
|
||||
* compatible with this <code>GraphicsConfiguration</code>. This
|
||||
* compatible with this {@code GraphicsConfiguration}. This
|
||||
* method has nothing to do with memory-mapping
|
||||
* a device. The returned <code>BufferedImage</code> has
|
||||
* a device. The returned {@code BufferedImage} has
|
||||
* a layout and color model that is closest to this native device
|
||||
* configuration and can therefore be optimally blitted to this
|
||||
* device.
|
||||
* @param width the width of the returned <code>BufferedImage</code>
|
||||
* @param height the height of the returned <code>BufferedImage</code>
|
||||
* @return a <code>BufferedImage</code> whose data layout and color
|
||||
* model is compatible with this <code>GraphicsConfiguration</code>.
|
||||
* @param width the width of the returned {@code BufferedImage}
|
||||
* @param height the height of the returned {@code BufferedImage}
|
||||
* @return a {@code BufferedImage} whose data layout and color
|
||||
* model is compatible with this {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public BufferedImage createCompatibleImage(int width, int height) {
|
||||
return createCompatibleImage(width, height, Transparency.OPAQUE);
|
||||
@ -76,15 +76,15 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns a {@link VolatileImage} with a data layout and color model
|
||||
* compatible with this <code>GraphicsConfiguration</code>.
|
||||
* The returned <code>VolatileImage</code>
|
||||
* compatible with this {@code GraphicsConfiguration}.
|
||||
* The returned {@code VolatileImage}
|
||||
* may have data that is stored optimally for the underlying graphics
|
||||
* device and may therefore benefit from platform-specific rendering
|
||||
* acceleration.
|
||||
* @param width the width of the returned <code>VolatileImage</code>
|
||||
* @param height the height of the returned <code>VolatileImage</code>
|
||||
* @return a <code>VolatileImage</code> whose data layout and color
|
||||
* model is compatible with this <code>GraphicsConfiguration</code>.
|
||||
* @param width the width of the returned {@code VolatileImage}
|
||||
* @param height the height of the returned {@code VolatileImage}
|
||||
* @return a {@code VolatileImage} whose data layout and color
|
||||
* model is compatible with this {@code GraphicsConfiguration}.
|
||||
* @see Component#createVolatileImage(int, int)
|
||||
*/
|
||||
public VolatileImage createCompatibleVolatileImage(int width, int height) {
|
||||
@ -97,18 +97,18 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>BufferedImage</code> that supports the specified
|
||||
* Returns a {@code BufferedImage} that supports the specified
|
||||
* transparency and has a data layout and color model
|
||||
* compatible with this <code>GraphicsConfiguration</code>. This
|
||||
* compatible with this {@code GraphicsConfiguration}. This
|
||||
* method has nothing to do with memory-mapping
|
||||
* a device. The returned <code>BufferedImage</code> has a layout and
|
||||
* a device. The returned {@code BufferedImage} has a layout and
|
||||
* color model that can be optimally blitted to a device
|
||||
* with this <code>GraphicsConfiguration</code>.
|
||||
* @param width the width of the returned <code>BufferedImage</code>
|
||||
* @param height the height of the returned <code>BufferedImage</code>
|
||||
* with this {@code GraphicsConfiguration}.
|
||||
* @param width the width of the returned {@code BufferedImage}
|
||||
* @param height the height of the returned {@code BufferedImage}
|
||||
* @param transparency the specified transparency mode
|
||||
* @return a <code>BufferedImage</code> whose data layout and color
|
||||
* model is compatible with this <code>GraphicsConfiguration</code>
|
||||
* @return a {@code BufferedImage} whose data layout and color
|
||||
* model is compatible with this {@code GraphicsConfiguration}
|
||||
* and also supports the specified transparency.
|
||||
* @see Transparency#OPAQUE
|
||||
* @see Transparency#BITMASK
|
||||
@ -121,21 +121,21 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the {@link ColorModel} associated with this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* @return a <code>ColorModel</code> object that is associated with
|
||||
* this <code>GraphicsConfiguration</code>.
|
||||
* {@code GraphicsConfiguration}.
|
||||
* @return a {@code ColorModel} object that is associated with
|
||||
* this {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public ColorModel getColorModel() {
|
||||
return getColorModel(Transparency.OPAQUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>ColorModel</code> associated with this
|
||||
* <code>GraphicsConfiguration</code> that supports the specified
|
||||
* Returns the {@code ColorModel} associated with this
|
||||
* {@code GraphicsConfiguration} that supports the specified
|
||||
* transparency.
|
||||
* @param transparency the specified transparency mode
|
||||
* @return a <code>ColorModel</code> object that is associated with
|
||||
* this <code>GraphicsConfiguration</code> and supports the
|
||||
* @return a {@code ColorModel} object that is associated with
|
||||
* this {@code GraphicsConfiguration} and supports the
|
||||
* specified transparency.
|
||||
*/
|
||||
public ColorModel getColorModel(int transparency) {
|
||||
@ -144,22 +144,22 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the default {@link AffineTransform} for this
|
||||
* <code>GraphicsConfiguration</code>. This
|
||||
* <code>AffineTransform</code> is typically the Identity transform
|
||||
* for most normal screens. The default <code>AffineTransform</code>
|
||||
* {@code GraphicsConfiguration}. This
|
||||
* {@code AffineTransform} is typically the Identity transform
|
||||
* for most normal screens. The default {@code AffineTransform}
|
||||
* maps coordinates onto the device such that 72 user space
|
||||
* coordinate units measure approximately 1 inch in device
|
||||
* space. The normalizing transform can be used to make
|
||||
* this mapping more exact. Coordinates in the coordinate space
|
||||
* defined by the default <code>AffineTransform</code> for screen and
|
||||
* defined by the default {@code AffineTransform} for screen and
|
||||
* printer devices have the origin in the upper left-hand corner of
|
||||
* the target region of the device, with X coordinates
|
||||
* increasing to the right and Y coordinates increasing downwards.
|
||||
* For image buffers not associated with a device, such as those not
|
||||
* created by <code>createCompatibleImage</code>,
|
||||
* this <code>AffineTransform</code> is the Identity transform.
|
||||
* @return the default <code>AffineTransform</code> for this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* created by {@code createCompatibleImage},
|
||||
* this {@code AffineTransform} is the Identity transform.
|
||||
* @return the default {@code AffineTransform} for this
|
||||
* {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public AffineTransform getDefaultTransform() {
|
||||
return new AffineTransform();
|
||||
@ -167,9 +167,9 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a <code>AffineTransform</code> that can be concatenated
|
||||
* with the default <code>AffineTransform</code>
|
||||
* of a <code>GraphicsConfiguration</code> so that 72 units in user
|
||||
* Returns a {@code AffineTransform} that can be concatenated
|
||||
* with the default {@code AffineTransform}
|
||||
* of a {@code GraphicsConfiguration} so that 72 units in user
|
||||
* space equals 1 inch in device space.
|
||||
* <p>
|
||||
* For a particular {@link Graphics2D}, g, one
|
||||
@ -181,16 +181,16 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
* g.setTransform(gc.getDefaultTransform());
|
||||
* g.transform(gc.getNormalizingTransform());
|
||||
* </pre>
|
||||
* Note that sometimes this <code>AffineTransform</code> is identity,
|
||||
* Note that sometimes this {@code AffineTransform} is identity,
|
||||
* such as for printers or metafile output, and that this
|
||||
* <code>AffineTransform</code> is only as accurate as the information
|
||||
* {@code AffineTransform} is only as accurate as the information
|
||||
* supplied by the underlying system. For image buffers not
|
||||
* associated with a device, such as those not created by
|
||||
* <code>createCompatibleImage</code>, this
|
||||
* <code>AffineTransform</code> is the Identity transform
|
||||
* {@code createCompatibleImage}, this
|
||||
* {@code AffineTransform} is the Identity transform
|
||||
* since there is no valid distance measurement.
|
||||
* @return an <code>AffineTransform</code> to concatenate to the
|
||||
* default <code>AffineTransform</code> so that 72 units in user
|
||||
* @return an {@code AffineTransform} to concatenate to the
|
||||
* default {@code AffineTransform} so that 72 units in user
|
||||
* space is mapped to 1 inch in device space.
|
||||
*/
|
||||
public AffineTransform getNormalizingTransform() {
|
||||
@ -198,12 +198,12 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of the <code>GraphicsConfiguration</code>
|
||||
* Returns the bounds of the {@code GraphicsConfiguration}
|
||||
* in the device coordinates. In a multi-screen environment
|
||||
* with a virtual device, the bounds can have negative X
|
||||
* or Y origins.
|
||||
* @return the bounds of the area covered by this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* {@code GraphicsConfiguration}.
|
||||
* @since 1.3
|
||||
*/
|
||||
public Rectangle getBounds() {
|
||||
|
@ -83,13 +83,13 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
* to these native print services.
|
||||
* To present the cross platform print dialog for all services,
|
||||
* including native ones instead use
|
||||
* <code>printDialog(PrintRequestAttributeSet)</code>.
|
||||
* {@code printDialog(PrintRequestAttributeSet)}.
|
||||
* <p>
|
||||
* PrinterJob implementations which can use PrintService's will update
|
||||
* the PrintService for this PrinterJob to reflect the new service
|
||||
* selected by the user.
|
||||
* @return <code>true</code> if the user does not cancel the dialog;
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if the user does not cancel the dialog;
|
||||
* {@code false} otherwise.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
@ -117,19 +117,19 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
|
||||
/**
|
||||
* Displays a dialog that allows modification of a
|
||||
* <code>PageFormat</code> instance.
|
||||
* The <code>page</code> argument is used to initialize controls
|
||||
* {@code PageFormat} instance.
|
||||
* The {@code page} argument is used to initialize controls
|
||||
* in the page setup dialog.
|
||||
* If the user cancels the dialog then this method returns the
|
||||
* original <code>page</code> object unmodified.
|
||||
* original {@code page} object unmodified.
|
||||
* If the user okays the dialog then this method returns a new
|
||||
* <code>PageFormat</code> object with the indicated changes.
|
||||
* In either case, the original <code>page</code> object is
|
||||
* {@code PageFormat} object with the indicated changes.
|
||||
* In either case, the original {@code page} object is
|
||||
* not modified.
|
||||
* @param page the default <code>PageFormat</code> presented to the
|
||||
* @param page the default {@code PageFormat} presented to the
|
||||
* user for modification
|
||||
* @return the original <code>page</code> object if the dialog
|
||||
* is cancelled; a new <code>PageFormat</code> object
|
||||
* @return the original {@code page} object if the dialog
|
||||
* is cancelled; a new {@code PageFormat} object
|
||||
* containing the format indicated by the user if the
|
||||
* dialog is acknowledged.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
@ -157,11 +157,11 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones the <code>PageFormat</code> argument and alters the
|
||||
* Clones the {@code PageFormat} argument and alters the
|
||||
* clone to describe a default page size and orientation.
|
||||
* @param page the <code>PageFormat</code> to be cloned and altered
|
||||
* @return clone of <code>page</code>, altered to describe a default
|
||||
* <code>PageFormat</code>.
|
||||
* @param page the {@code PageFormat} to be cloned and altered
|
||||
* @return clone of {@code page}, altered to describe a default
|
||||
* {@code PageFormat}.
|
||||
*/
|
||||
@Override
|
||||
public PageFormat defaultPage(PageFormat page) {
|
||||
|
@ -73,7 +73,7 @@ class CRobot implements RobotPeer {
|
||||
* Presses one or more mouse buttons.
|
||||
*
|
||||
* @param buttons the button mask (combination of
|
||||
* <code>InputEvent.BUTTON1/2/3_MASK</code>)
|
||||
* {@code InputEvent.BUTTON1/2/3_MASK})
|
||||
*/
|
||||
@Override
|
||||
public void mousePress(int buttons) {
|
||||
@ -87,7 +87,7 @@ class CRobot implements RobotPeer {
|
||||
* Releases one or more mouse buttons.
|
||||
*
|
||||
* @param buttons the button mask (combination of
|
||||
* <code>InputEvent.BUTTON1/2/3_MASK</code>)
|
||||
* {@code InputEvent.BUTTON1/2/3_MASK})
|
||||
*/
|
||||
@Override
|
||||
public void mouseRelease(int buttons) {
|
||||
@ -133,14 +133,14 @@ class CRobot implements RobotPeer {
|
||||
* Presses a given key.
|
||||
* <p>
|
||||
* Key codes that have more than one physical key associated with them
|
||||
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
|
||||
* (e.g. {@code KeyEvent.VK_SHIFT} could mean either the
|
||||
* left or right shift key) will map to the left key.
|
||||
* <p>
|
||||
* Assumes that the
|
||||
* peer implementations will throw an exception for other bogus
|
||||
* values e.g. -1, 999999
|
||||
*
|
||||
* @param keycode the key to press (e.g. <code>KeyEvent.VK_A</code>)
|
||||
* @param keycode the key to press (e.g. {@code KeyEvent.VK_A})
|
||||
*/
|
||||
@Override
|
||||
public void keyPress(final int keycode) {
|
||||
@ -151,14 +151,14 @@ class CRobot implements RobotPeer {
|
||||
* Releases a given key.
|
||||
* <p>
|
||||
* Key codes that have more than one physical key associated with them
|
||||
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
|
||||
* (e.g. {@code KeyEvent.VK_SHIFT} could mean either the
|
||||
* left or right shift key) will map to the left key.
|
||||
* <p>
|
||||
* Assumes that the
|
||||
* peer implementations will throw an exception for other bogus
|
||||
* values e.g. -1, 999999
|
||||
*
|
||||
* @param keycode the key to release (e.g. <code>KeyEvent.VK_A</code>)
|
||||
* @param keycode the key to release (e.g. {@code KeyEvent.VK_A})
|
||||
*/
|
||||
@Override
|
||||
public void keyRelease(final int keycode) {
|
||||
|
@ -214,7 +214,7 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
|
||||
jclickCount = nsEvent.getClickCount();
|
||||
}
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(
|
||||
nsEvent.getModifierFlags());
|
||||
boolean isPopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
||||
|
||||
|
@ -515,13 +515,13 @@ public final class LWCToolkit extends LWToolkit {
|
||||
* key for menu shortcuts.
|
||||
* <p>
|
||||
* Menu shortcuts, which are embodied in the
|
||||
* <code>MenuShortcut</code> class, are handled by the
|
||||
* <code>MenuBar</code> class.
|
||||
* {@code MenuShortcut} class, are handled by the
|
||||
* {@code MenuBar} class.
|
||||
* <p>
|
||||
* By default, this method returns <code>Event.CTRL_MASK</code>.
|
||||
* By default, this method returns {@code Event.CTRL_MASK}.
|
||||
* Toolkit implementations should override this method if the
|
||||
* <b>Control</b> key isn't the correct key for accelerators.
|
||||
* @return the modifier mask on the <code>Event</code> class
|
||||
* @return the modifier mask on the {@code Event} class
|
||||
* that is used for menu shortcuts on this toolkit.
|
||||
* @see java.awt.MenuBar
|
||||
* @see java.awt.MenuShortcut
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -231,16 +231,14 @@ final class NSEvent {
|
||||
return jeventType;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts NSEvent mouse modifiers to AWT mouse modifiers.
|
||||
/**
|
||||
* Converts NSEvent key modifiers to AWT key modifiers. Note that this
|
||||
* method adds the current mouse state as a mouse modifiers.
|
||||
*
|
||||
* @param modifierFlags the NSEvent key modifiers
|
||||
* @return the java key and mouse modifiers
|
||||
*/
|
||||
static native int nsToJavaMouseModifiers(int buttonNumber,
|
||||
int modifierFlags);
|
||||
|
||||
/*
|
||||
* Converts NSEvent key modifiers to AWT key modifiers.
|
||||
*/
|
||||
static native int nsToJavaKeyModifiers(int modifierFlags);
|
||||
static native int nsToJavaModifiers(int modifierFlags);
|
||||
|
||||
/*
|
||||
* Converts NSEvent key info to AWT key info.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -579,7 +579,7 @@ NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods)
|
||||
}
|
||||
|
||||
|
||||
jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags)
|
||||
jint GetJavaMouseModifiers(NSUInteger modifierFlags)
|
||||
{
|
||||
// Mousing needs the key modifiers
|
||||
jint modifiers = NsKeyModifiersToJavaModifiers(modifierFlags, YES);
|
||||
@ -632,38 +632,18 @@ Java_java_awt_AWTEvent_nativeSetSource
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_NSEvent
|
||||
* Method: nsToJavaMouseModifiers
|
||||
* Method: nsToJavaModifiers
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_lwawt_macosx_NSEvent_nsToJavaMouseModifiers
|
||||
(JNIEnv *env, jclass cls, jint buttonNumber, jint modifierFlags)
|
||||
{
|
||||
jint jmodifiers = 0;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
jmodifiers = GetJavaMouseModifiers(buttonNumber, modifierFlags);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
return jmodifiers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_NSEvent
|
||||
* Method: nsToJavaKeyModifiers
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyModifiers
|
||||
Java_sun_lwawt_macosx_NSEvent_nsToJavaModifiers
|
||||
(JNIEnv *env, jclass cls, jint modifierFlags)
|
||||
{
|
||||
jint jmodifiers = 0;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags, YES);
|
||||
jmodifiers = GetJavaMouseModifiers(modifierFlags);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
|
@ -562,6 +562,17 @@ CGGI_CreateImageForGlyph
|
||||
(CGGI_GlyphCanvas *canvas, const CGGlyph glyph,
|
||||
GlyphInfo *info, const CGGI_RenderingMode *mode)
|
||||
{
|
||||
if (isnan(info->topLeftX) || isnan(info->topLeftY)) {
|
||||
// Explicitly set glyphInfo width/height to be 0 to ensure
|
||||
// zero length glyph image is copied into GlyphInfo from canvas
|
||||
info->width = 0;
|
||||
info->height = 0;
|
||||
|
||||
// copy the "empty" glyph from the canvas into the info
|
||||
(*mode->glyphDescriptor->copyFxnPtr)(canvas, info);
|
||||
return;
|
||||
}
|
||||
|
||||
// clean the canvas
|
||||
CGGI_ClearCanvas(canvas, info);
|
||||
|
||||
@ -570,7 +581,6 @@ CGGI_CreateImageForGlyph
|
||||
-info->topLeftX,
|
||||
canvas->image->height + info->topLeftY,
|
||||
&glyph, 1);
|
||||
|
||||
// copy the glyph from the canvas into the info
|
||||
(*mode->glyphDescriptor->copyFxnPtr)(canvas, info);
|
||||
}
|
||||
|
@ -259,6 +259,10 @@ AWTGetGlyphOutline(CGGlyph *glyphs, NSFont *font,
|
||||
|
||||
OSStatus status = noErr;
|
||||
|
||||
if ( isnan(tx->a) || isnan(tx->b) || isnan(tx->c) ||
|
||||
isnan(tx->d) || isnan(tx->tx) || isnan(tx->ty)) {
|
||||
return status;
|
||||
}
|
||||
glyphs = glyphs + inStartIndex;
|
||||
// advanceArray = advanceArray + inStartIndex; // TODO(cpc): use advance
|
||||
|
||||
|
@ -3,4 +3,5 @@ com.sun.media.sound.AuFileReader
|
||||
com.sun.media.sound.AiffFileReader
|
||||
com.sun.media.sound.WaveFileReader
|
||||
com.sun.media.sound.WaveFloatFileReader
|
||||
com.sun.media.sound.WaveExtensibleFileReader
|
||||
com.sun.media.sound.SoftMidiAudioFileReader
|
||||
|
@ -2,3 +2,4 @@
|
||||
com.sun.media.sound.AuFileWriter
|
||||
com.sun.media.sound.AiffFileWriter
|
||||
com.sun.media.sound.WaveFileWriter
|
||||
com.sun.media.sound.WaveFloatFileWriter
|
||||
|
@ -74,7 +74,7 @@ import com.sun.imageio.plugins.common.I18N;
|
||||
/** This class is the Java Image IO plugin reader for BMP images.
|
||||
* It may subsample the image, clip the image, select sub-bands,
|
||||
* and shift the decoded image origin if the proper decoding parameter
|
||||
* are set in the provided <code>ImageReadParam</code>.
|
||||
* are set in the provided {@code ImageReadParam}.
|
||||
*
|
||||
* This class supports Microsoft Windows Bitmap Version 3-5,
|
||||
* as well as OS/2 Bitmap Version 2.x (for single-image BMP file).
|
||||
@ -159,8 +159,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
||||
/** source and destination bands. */
|
||||
private int[] sourceBands, destBands;
|
||||
|
||||
/** Constructs <code>BMPImageReader</code> from the provided
|
||||
* <code>ImageReaderSpi</code>.
|
||||
/** Constructs {@code BMPImageReader} from the provided
|
||||
* {@code ImageReaderSpi}.
|
||||
*/
|
||||
public BMPImageReader(ImageReaderSpi originator) {
|
||||
super(originator);
|
||||
@ -1681,8 +1681,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
||||
/** Decodes the jpeg/png image embedded in the bitmap using any jpeg
|
||||
* ImageIO-style plugin.
|
||||
*
|
||||
* @param bi The destination <code>BufferedImage</code>.
|
||||
* @param bmpParam The <code>ImageReadParam</code> for decoding this
|
||||
* @param bi The destination {@code BufferedImage}.
|
||||
* @param bmpParam The {@code ImageReadParam} for decoding this
|
||||
* BMP image. The parameters for subregion, band selection and
|
||||
* subsampling are used in decoding the jpeg image.
|
||||
*/
|
||||
|
@ -69,7 +69,7 @@ import com.sun.imageio.plugins.common.I18N;
|
||||
* a BMP format.
|
||||
*
|
||||
* The encoding process may clip, subsample using the parameters
|
||||
* specified in the <code>ImageWriteParam</code>.
|
||||
* specified in the {@code ImageWriteParam}.
|
||||
*
|
||||
* @see javax.imageio.plugins.bmp.BMPImageWriteParam
|
||||
*/
|
||||
@ -88,8 +88,8 @@ public class BMPImageWriter extends ImageWriter implements BMPConstants {
|
||||
private short[] spixels;
|
||||
private int[] ipixels;
|
||||
|
||||
/** Constructs <code>BMPImageWriter</code> based on the provided
|
||||
* <code>ImageWriterSpi</code>.
|
||||
/** Constructs {@code BMPImageWriter} based on the provided
|
||||
* {@code ImageWriterSpi}.
|
||||
*/
|
||||
public BMPImageWriter(ImageWriterSpi originator) {
|
||||
super(originator);
|
||||
|
@ -28,7 +28,7 @@ package com.sun.imageio.plugins.common;
|
||||
import java.awt.color.ColorSpace;
|
||||
|
||||
/**
|
||||
* A dummy <code>ColorSpace</code> to enable <code>ColorModel</code>
|
||||
* A dummy {@code ColorSpace} to enable {@code ColorModel}
|
||||
* for image data which do not have an innate color representation.
|
||||
*/
|
||||
@SuppressWarnings("serial") // JDK-implementation class
|
||||
@ -37,8 +37,8 @@ public class BogusColorSpace extends ColorSpace {
|
||||
* Return the type given the number of components.
|
||||
*
|
||||
* @param numComponents The number of components in the
|
||||
* <code>ColorSpace</code>.
|
||||
* @exception IllegalArgumentException if <code>numComponents</code>
|
||||
* {@code ColorSpace}.
|
||||
* @exception IllegalArgumentException if {@code numComponents}
|
||||
* is less than 1.
|
||||
*/
|
||||
private static int getType(int numComponents) {
|
||||
@ -62,11 +62,11 @@ public class BogusColorSpace extends ColorSpace {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a bogus <code>ColorSpace</code>.
|
||||
* Constructs a bogus {@code ColorSpace}.
|
||||
*
|
||||
* @param numComponents The number of components in the
|
||||
* <code>ColorSpace</code>.
|
||||
* @exception IllegalArgumentException if <code>numComponents</code>
|
||||
* {@code ColorSpace}.
|
||||
* @exception IllegalArgumentException if {@code numComponents}
|
||||
* is less than 1.
|
||||
*/
|
||||
public BogusColorSpace(int numComponents) {
|
||||
|
@ -37,9 +37,9 @@ import java.net.URL;
|
||||
* the file from the jar as the package name is included automatically.
|
||||
*
|
||||
* <p>Extenders need only provide a static method
|
||||
* <code>getString(String)</code> which calls the static method in this
|
||||
* {@code getString(String)} which calls the static method in this
|
||||
* class with the name of the invoking class and returns a
|
||||
* <code>String</code>.
|
||||
* {@code String}.
|
||||
*/
|
||||
public class I18NImpl {
|
||||
/**
|
||||
|
@ -58,35 +58,35 @@ import javax.imageio.spi.ImageWriterSpi;
|
||||
|
||||
public class ImageUtil {
|
||||
/**
|
||||
* Creates a <code>ColorModel</code> that may be used with the
|
||||
* specified <code>SampleModel</code>. If a suitable
|
||||
* <code>ColorModel</code> cannot be found, this method returns
|
||||
* <code>null</code>.
|
||||
* Creates a {@code ColorModel} that may be used with the
|
||||
* specified {@code SampleModel}. If a suitable
|
||||
* {@code ColorModel} cannot be found, this method returns
|
||||
* {@code null}.
|
||||
*
|
||||
* <p> Suitable <code>ColorModel</code>s are guaranteed to exist
|
||||
* for all instances of <code>ComponentSampleModel</code>.
|
||||
* For 1- and 3- banded <code>SampleModel</code>s, the returned
|
||||
* <code>ColorModel</code> will be opaque. For 2- and 4-banded
|
||||
* <code>SampleModel</code>s, the output will use alpha transparency
|
||||
* <p> Suitable {@code ColorModel}s are guaranteed to exist
|
||||
* for all instances of {@code ComponentSampleModel}.
|
||||
* For 1- and 3- banded {@code SampleModel}s, the returned
|
||||
* {@code ColorModel} will be opaque. For 2- and 4-banded
|
||||
* {@code SampleModel}s, the output will use alpha transparency
|
||||
* which is not premultiplied. 1- and 2-banded data will use a
|
||||
* grayscale <code>ColorSpace</code>, and 3- and 4-banded data a sRGB
|
||||
* <code>ColorSpace</code>. Data with 5 or more bands will have a
|
||||
* <code>BogusColorSpace</code>.</p>
|
||||
* grayscale {@code ColorSpace}, and 3- and 4-banded data a sRGB
|
||||
* {@code ColorSpace}. Data with 5 or more bands will have a
|
||||
* {@code BogusColorSpace}.</p>
|
||||
*
|
||||
* <p>An instance of <code>DirectColorModel</code> will be created for
|
||||
* instances of <code>SinglePixelPackedSampleModel</code> with no more
|
||||
* <p>An instance of {@code DirectColorModel} will be created for
|
||||
* instances of {@code SinglePixelPackedSampleModel} with no more
|
||||
* than 4 bands.</p>
|
||||
*
|
||||
* <p>An instance of <code>IndexColorModel</code> will be created for
|
||||
* instances of <code>MultiPixelPackedSampleModel</code>. The colormap
|
||||
* will be a grayscale ramp with <code>1 << numberOfBits</code>
|
||||
* <p>An instance of {@code IndexColorModel} will be created for
|
||||
* instances of {@code MultiPixelPackedSampleModel}. The colormap
|
||||
* will be a grayscale ramp with <code>1 << numberOfBits</code>
|
||||
* entries ranging from zero to at most 255.</p>
|
||||
*
|
||||
* @return An instance of <code>ColorModel</code> that is suitable for
|
||||
* the supplied <code>SampleModel</code>, or <code>null</code>.
|
||||
* @return An instance of {@code ColorModel} that is suitable for
|
||||
* the supplied {@code SampleModel}, or {@code null}.
|
||||
*
|
||||
* @throws IllegalArgumentException If <code>sampleModel</code> is
|
||||
* <code>null</code>.
|
||||
* @throws IllegalArgumentException If {@code sampleModel} is
|
||||
* {@code null}.
|
||||
*/
|
||||
public static final ColorModel createColorModel(SampleModel sampleModel) {
|
||||
// Check the parameter.
|
||||
@ -194,19 +194,19 @@ public class ImageUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* For the case of binary data (<code>isBinary()</code> returns
|
||||
* <code>true</code>), return the binary data as a packed byte array.
|
||||
* For the case of binary data ({@code isBinary()} returns
|
||||
* {@code true}), return the binary data as a packed byte array.
|
||||
* The data will be packed as eight bits per byte with no bit offset,
|
||||
* i.e., the first bit in each image line will be the left-most of the
|
||||
* first byte of the line. The line stride in bytes will be
|
||||
* <code>(int)((getWidth()+7)/8)</code>. The length of the returned
|
||||
* array will be the line stride multiplied by <code>getHeight()</code>
|
||||
* {@code (int)((getWidth()+7)/8)}. The length of the returned
|
||||
* array will be the line stride multiplied by {@code getHeight()}
|
||||
*
|
||||
* @return the binary data as a packed array of bytes with zero offset
|
||||
* of <code>null</code> if the data are not binary.
|
||||
* @throws IllegalArgumentException if <code>isBinary()</code> returns
|
||||
* <code>false</code> with the <code>SampleModel</code> of the
|
||||
* supplied <code>Raster</code> as argument.
|
||||
* of {@code null} if the data are not binary.
|
||||
* @throws IllegalArgumentException if {@code isBinary()} returns
|
||||
* {@code false} with the {@code SampleModel} of the
|
||||
* supplied {@code Raster} as argument.
|
||||
*/
|
||||
public static byte[] getPackedBinaryData(Raster raster,
|
||||
Rectangle rect) {
|
||||
@ -387,11 +387,11 @@ public class ImageUtil {
|
||||
|
||||
/**
|
||||
* Returns the binary data unpacked into an array of bytes.
|
||||
* The line stride will be the width of the <code>Raster</code>.
|
||||
* The line stride will be the width of the {@code Raster}.
|
||||
*
|
||||
* @throws IllegalArgumentException if <code>isBinary()</code> returns
|
||||
* <code>false</code> with the <code>SampleModel</code> of the
|
||||
* supplied <code>Raster</code> as argument.
|
||||
* @throws IllegalArgumentException if {@code isBinary()} returns
|
||||
* {@code false} with the {@code SampleModel} of the
|
||||
* supplied {@code Raster} as argument.
|
||||
*/
|
||||
public static byte[] getUnpackedBinaryData(Raster raster,
|
||||
Rectangle rect) {
|
||||
@ -467,13 +467,13 @@ public class ImageUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the supplied <code>Raster</code>'s data from an array
|
||||
* Sets the supplied {@code Raster}'s data from an array
|
||||
* of packed binary data of the form returned by
|
||||
* <code>getPackedBinaryData()</code>.
|
||||
* {@code getPackedBinaryData()}.
|
||||
*
|
||||
* @throws IllegalArgumentException if <code>isBinary()</code> returns
|
||||
* <code>false</code> with the <code>SampleModel</code> of the
|
||||
* supplied <code>Raster</code> as argument.
|
||||
* @throws IllegalArgumentException if {@code isBinary()} returns
|
||||
* {@code false} with the {@code SampleModel} of the
|
||||
* supplied {@code Raster} as argument.
|
||||
*/
|
||||
public static void setPackedBinaryData(byte[] binaryDataArray,
|
||||
WritableRaster raster,
|
||||
@ -713,16 +713,16 @@ public class ImageUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data into the packed array of the <code>Raster</code>
|
||||
* Copies data into the packed array of the {@code Raster}
|
||||
* from an array of unpacked data of the form returned by
|
||||
* <code>getUnpackedBinaryData()</code>.
|
||||
* {@code getUnpackedBinaryData()}.
|
||||
*
|
||||
* <p> If the data are binary, then the target bit will be set if
|
||||
* and only if the corresponding byte is non-zero.
|
||||
*
|
||||
* @throws IllegalArgumentException if <code>isBinary()</code> returns
|
||||
* <code>false</code> with the <code>SampleModel</code> of the
|
||||
* supplied <code>Raster</code> as argument.
|
||||
* @throws IllegalArgumentException if {@code isBinary()} returns
|
||||
* {@code false} with the {@code SampleModel} of the
|
||||
* supplied {@code Raster} as argument.
|
||||
*/
|
||||
public static void setUnpackedBinaryData(byte[] bdata,
|
||||
WritableRaster raster,
|
||||
@ -983,7 +983,7 @@ public class ImageUtil {
|
||||
* @param g The green channel color indices.
|
||||
* @param b The blue channel color indices.
|
||||
* @return If all the indices have 256 entries, and are identical mappings,
|
||||
* return <code>true</code>; otherwise, return <code>false</code>.
|
||||
* return {@code true}; otherwise, return {@code false}.
|
||||
*/
|
||||
public static boolean isIndicesForGrayscale(byte[] r, byte[] g, byte[] b) {
|
||||
if (r.length != g.length || r.length != b.length)
|
||||
@ -1004,7 +1004,7 @@ public class ImageUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Converts the provided object to <code>String</code> */
|
||||
/** Converts the provided object to {@code String} */
|
||||
public static String convertObjectToString(Object obj) {
|
||||
if (obj == null)
|
||||
return "";
|
||||
@ -1035,10 +1035,10 @@ public class ImageUtil {
|
||||
|
||||
}
|
||||
|
||||
/** Checks that the provided <code>ImageWriter</code> can encode
|
||||
* the provided <code>ImageTypeSpecifier</code> or not. If not, an
|
||||
* <code>IIOException</code> will be thrown.
|
||||
* @param writer The provided <code>ImageWriter</code>.
|
||||
/** Checks that the provided {@code ImageWriter} can encode
|
||||
* the provided {@code ImageTypeSpecifier} or not. If not, an
|
||||
* {@code IIOException} will be thrown.
|
||||
* @param writer The provided {@code ImageWriter}.
|
||||
* @param type The image to be tested.
|
||||
* @throws IIOException If the writer cannot encoded the provided image.
|
||||
*/
|
||||
@ -1053,12 +1053,12 @@ public class ImageUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/** Checks that the provided <code>ImageWriter</code> can encode
|
||||
* the provided <code>ColorModel</code> and <code>SampleModel</code>.
|
||||
* If not, an <code>IIOException</code> will be thrown.
|
||||
* @param writer The provided <code>ImageWriter</code>.
|
||||
* @param colorModel The provided <code>ColorModel</code>.
|
||||
* @param sampleModel The provided <code>SampleModel</code>.
|
||||
/** Checks that the provided {@code ImageWriter} can encode
|
||||
* the provided {@code ColorModel} and {@code SampleModel}.
|
||||
* If not, an {@code IIOException} will be thrown.
|
||||
* @param writer The provided {@code ImageWriter}.
|
||||
* @param colorModel The provided {@code ColorModel}.
|
||||
* @param sampleModel The provided {@code SampleModel}.
|
||||
* @throws IIOException If the writer cannot encoded the provided image.
|
||||
*/
|
||||
public static final void canEncodeImage(ImageWriter writer,
|
||||
|
@ -31,9 +31,9 @@ import java.io.PrintStream;
|
||||
* General purpose LZW String Table.
|
||||
* Extracted from GIFEncoder by Adam Doppelt
|
||||
* Comments added by Robin Luiten
|
||||
* <code>expandCode</code> added by Robin Luiten
|
||||
* {@code expandCode} added by Robin Luiten
|
||||
* The strLen table to give quick access to the lenght of an expanded
|
||||
* code for use by the <code>expandCode</code> method added by Robin.
|
||||
* code for use by the {@code expandCode} method added by Robin.
|
||||
**/
|
||||
public class LZWStringTable {
|
||||
/** codesize + Reserved Codes */
|
||||
|
@ -70,19 +70,19 @@ public class PaletteBuilder {
|
||||
|
||||
/**
|
||||
* Creates an image representing given image
|
||||
* <code>src</code> using <code>IndexColorModel</code>.
|
||||
* {@code src} using {@code IndexColorModel}.
|
||||
*
|
||||
* Lossless conversion is not always possible (e.g. if number
|
||||
* of colors in the given image exceeds maximum palette size).
|
||||
* Result image then is an approximation constructed by octree
|
||||
* quantization method.
|
||||
*
|
||||
* @exception IllegalArgumentException if <code>src</code> is
|
||||
* <code>null</code>.
|
||||
* @exception IllegalArgumentException if {@code src} is
|
||||
* {@code null}.
|
||||
*
|
||||
* @exception UnsupportedOperationException if implemented method
|
||||
* is unable to create approximation of <code>src</code>
|
||||
* and <code>canCreatePalette</code> returns <code>false</code>.
|
||||
* is unable to create approximation of {@code src}
|
||||
* and {@code canCreatePalette} returns {@code false}.
|
||||
*
|
||||
* @see createIndexColorModel
|
||||
*
|
||||
@ -97,15 +97,15 @@ public class PaletteBuilder {
|
||||
|
||||
/**
|
||||
* Creates an palette representing colors from given image
|
||||
* <code>img</code>. If number of colors in the given image exceeds
|
||||
* {@code img}. If number of colors in the given image exceeds
|
||||
* maximum palette size closest colors would be merged.
|
||||
*
|
||||
* @exception IllegalArgumentException if <code>img</code> is
|
||||
* <code>null</code>.
|
||||
* @exception IllegalArgumentException if {@code img} is
|
||||
* {@code null}.
|
||||
*
|
||||
* @exception UnsupportedOperationException if implemented method
|
||||
* is unable to create approximation of <code>img</code>
|
||||
* and <code>canCreatePalette</code> returns <code>false</code>.
|
||||
* is unable to create approximation of {@code img}
|
||||
* and {@code canCreatePalette} returns {@code false}.
|
||||
*
|
||||
* @see createIndexedImage
|
||||
*
|
||||
@ -119,17 +119,17 @@ public class PaletteBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if PaletteBuilder is able to create
|
||||
* Returns {@code true} if PaletteBuilder is able to create
|
||||
* palette for given image type.
|
||||
*
|
||||
* @param type an instance of <code>ImageTypeSpecifier</code> to be
|
||||
* @param type an instance of {@code ImageTypeSpecifier} to be
|
||||
* indexed.
|
||||
*
|
||||
* @return <code>true</code> if the <code>PaletteBuilder</code>
|
||||
* @return {@code true} if the {@code PaletteBuilder}
|
||||
* is likely to be able to create palette for this image type.
|
||||
*
|
||||
* @exception IllegalArgumentException if <code>type</code>
|
||||
* is <code>null</code>.
|
||||
* @exception IllegalArgumentException if {@code type}
|
||||
* is {@code null}.
|
||||
*/
|
||||
public static boolean canCreatePalette(ImageTypeSpecifier type) {
|
||||
if (type == null) {
|
||||
@ -139,17 +139,17 @@ public class PaletteBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if PaletteBuilder is able to create
|
||||
* Returns {@code true} if PaletteBuilder is able to create
|
||||
* palette for given rendered image.
|
||||
*
|
||||
* @param image an instance of <code>RenderedImage</code> to be
|
||||
* @param image an instance of {@code RenderedImage} to be
|
||||
* indexed.
|
||||
*
|
||||
* @return <code>true</code> if the <code>PaletteBuilder</code>
|
||||
* @return {@code true} if the {@code PaletteBuilder}
|
||||
* is likely to be able to create palette for this image type.
|
||||
*
|
||||
* @exception IllegalArgumentException if <code>image</code>
|
||||
* is <code>null</code>.
|
||||
* @exception IllegalArgumentException if {@code image}
|
||||
* is {@code null}.
|
||||
*/
|
||||
public static boolean canCreatePalette(RenderedImage image) {
|
||||
if (image == null) {
|
||||
|
@ -134,25 +134,25 @@ public class ReaderUtil {
|
||||
* pixels that will be written during a particular decoding pass.
|
||||
* The intent is to simplify the work done by readers in combining
|
||||
* the source region, source subsampling, and destination offset
|
||||
* information obtained from the <code>ImageReadParam</code> with
|
||||
* information obtained from the {@code ImageReadParam} with
|
||||
* the offsets and periods of a progressive or interlaced decoding
|
||||
* pass.
|
||||
*
|
||||
* @param sourceRegion a <code>Rectangle</code> containing the
|
||||
* @param sourceRegion a {@code Rectangle} containing the
|
||||
* source region being read, offset by the source subsampling
|
||||
* offsets, and clipped against the source bounds, as returned by
|
||||
* the <code>getSourceRegion</code> method.
|
||||
* @param destinationOffset a <code>Point</code> containing the
|
||||
* the {@code getSourceRegion} method.
|
||||
* @param destinationOffset a {@code Point} containing the
|
||||
* coordinates of the upper-left pixel to be written in the
|
||||
* destination.
|
||||
* @param dstMinX the smallest X coordinate (inclusive) of the
|
||||
* destination <code>Raster</code>.
|
||||
* destination {@code Raster}.
|
||||
* @param dstMinY the smallest Y coordinate (inclusive) of the
|
||||
* destination <code>Raster</code>.
|
||||
* destination {@code Raster}.
|
||||
* @param dstMaxX the largest X coordinate (inclusive) of the destination
|
||||
* <code>Raster</code>.
|
||||
* {@code Raster}.
|
||||
* @param dstMaxY the largest Y coordinate (inclusive) of the destination
|
||||
* <code>Raster</code>.
|
||||
* {@code Raster}.
|
||||
* @param sourceXSubsampling the X subsampling factor.
|
||||
* @param sourceYSubsampling the Y subsampling factor.
|
||||
* @param passXStart the smallest source X coordinate (inclusive)
|
||||
@ -168,7 +168,7 @@ public class ReaderUtil {
|
||||
* @param passPeriodY the Y period (vertical spacing between
|
||||
* pixels) of the current progressive pass.
|
||||
*
|
||||
* @return an array of 6 <code>int</code>s containing the
|
||||
* @return an array of 6 {@code int}s containing the
|
||||
* destination min X, min Y, width, height, X period and Y period
|
||||
* of the region that will be updated.
|
||||
*/
|
||||
|
@ -1017,7 +1017,7 @@ public class GIFImageReader extends ImageReader {
|
||||
|
||||
/**
|
||||
* Remove all settings including global settings such as
|
||||
* <code>Locale</code>s and listeners, as well as stream settings.
|
||||
* {@code Locale}s and listeners, as well as stream settings.
|
||||
*/
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
@ -70,7 +70,7 @@ public class GIFImageWriter extends ImageWriter {
|
||||
GIFWritableImageMetadata.NATIVE_FORMAT_NAME;
|
||||
|
||||
/**
|
||||
* The <code>output</code> case to an <code>ImageOutputStream</code>.
|
||||
* The {@code output} case to an {@code ImageOutputStream}.
|
||||
*/
|
||||
private ImageOutputStream stream = null;
|
||||
|
||||
@ -272,7 +272,7 @@ public class GIFImageWriter extends ImageWriter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges <code>inData</code> into <code>outData</code>. The supplied
|
||||
* Merges {@code inData} into {@code outData}. The supplied
|
||||
* metadata format name is attempted first and failing that the standard
|
||||
* metadata format name is attempted.
|
||||
*/
|
||||
@ -554,8 +554,8 @@ public class GIFImageWriter extends ImageWriter {
|
||||
*
|
||||
* @param writeHeader Whether to write the header.
|
||||
* @param writeTrailer Whether to write the trailer.
|
||||
* @param sm The stream metadata or <code>null</code> if
|
||||
* <code>writeHeader</code> is <code>false</code>.
|
||||
* @param sm The stream metadata or {@code null} if
|
||||
* {@code writeHeader} is {@code false}.
|
||||
* @param iioimage The image and image metadata.
|
||||
* @param p The write parameters.
|
||||
*
|
||||
@ -564,10 +564,10 @@ public class GIFImageWriter extends ImageWriter {
|
||||
* greater than 8.
|
||||
* @throws IllegalArgumentException if the color component size is
|
||||
* greater than 8.
|
||||
* @throws IllegalArgumentException if <code>writeHeader</code> is
|
||||
* <code>true</code> and <code>sm</code> is <code>null</code>.
|
||||
* @throws IllegalArgumentException if <code>writeHeader</code> is
|
||||
* <code>false</code> and a sequence is not being written.
|
||||
* @throws IllegalArgumentException if {@code writeHeader} is
|
||||
* {@code true} and {@code sm} is {@code null}.
|
||||
* @throws IllegalArgumentException if {@code writeHeader} is
|
||||
* {@code false} and a sequence is not being written.
|
||||
*/
|
||||
private void write(boolean writeHeader,
|
||||
boolean writeTrailer,
|
||||
|
@ -32,7 +32,7 @@ import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* Class which adds utility DOM element attribute access methods to
|
||||
* <code>IIOMetadata</code> for subclass use.
|
||||
* {@code IIOMetadata} for subclass use.
|
||||
*/
|
||||
abstract class GIFMetadata extends IIOMetadata {
|
||||
|
||||
|
@ -39,7 +39,7 @@ import org.w3c.dom.Node;
|
||||
* comment data as it is read from the stream. If the marker segment is
|
||||
* constructed from a String, then local default encoding is assumed
|
||||
* when creating the byte array. If the marker segment is created from
|
||||
* an <code>IIOMetadataNode</code>, the user object, if present is
|
||||
* an {@code IIOMetadataNode}, the user object, if present is
|
||||
* assumed to be a byte array containing the comment data. If there is
|
||||
* no user object then the comment attribute is used to create the
|
||||
* byte array, again assuming the default local encoding.
|
||||
@ -49,7 +49,7 @@ class COMMarkerSegment extends MarkerSegment {
|
||||
|
||||
/**
|
||||
* Constructs a marker segment from the given buffer, which contains
|
||||
* data from an <code>ImageInputStream</code>. This is used when
|
||||
* data from an {@code ImageInputStream}. This is used when
|
||||
* reading metadata from a stream.
|
||||
*/
|
||||
COMMarkerSegment(JPEGBuffer buffer) throws IOException {
|
||||
@ -69,7 +69,7 @@ class COMMarkerSegment extends MarkerSegment {
|
||||
|
||||
/**
|
||||
* Constructs a marker segment from a native tree node. If the node
|
||||
* is an <code>IIOMetadataNode</code> and contains a user object,
|
||||
* is an {@code IIOMetadataNode} and contains a user object,
|
||||
* that object is used rather than the string attribute. If the
|
||||
* string attribute is used, the default encoding is used.
|
||||
*/
|
||||
@ -103,7 +103,7 @@ class COMMarkerSegment extends MarkerSegment {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>IIOMetadataNode</code> containing the data array
|
||||
* Returns an {@code IIOMetadataNode} containing the data array
|
||||
* as a user object and a string encoded using ISO-8895-1, as an
|
||||
* attribute.
|
||||
*/
|
||||
|
@ -90,7 +90,7 @@ class JFIFMarkerSegment extends MarkerSegment {
|
||||
private final boolean debug = false;
|
||||
|
||||
/**
|
||||
* Set to <code>true</code> when reading the chunks of an
|
||||
* Set to {@code true} when reading the chunks of an
|
||||
* ICC profile. All chunks are consolidated to create a single
|
||||
* "segment" containing all the chunks. This flag is a state
|
||||
* variable identifying whether to construct a new segment or
|
||||
@ -594,10 +594,10 @@ class JFIFMarkerSegment extends MarkerSegment {
|
||||
|
||||
/**
|
||||
* Writes out a default JFIF marker segment to the given
|
||||
* output stream. If <code>thumbnails</code> is not <code>null</code>,
|
||||
* output stream. If {@code thumbnails} is not {@code null},
|
||||
* writes out the set of thumbnail images as JFXX marker segments, or
|
||||
* incorporated into the JFIF segment if appropriate.
|
||||
* If <code>iccProfile</code> is not <code>null</code>,
|
||||
* If {@code iccProfile} is not {@code null},
|
||||
* writes out the profile after the JFIF segment using as many APP2
|
||||
* marker segments as necessary.
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ import java.awt.color.ICC_ColorSpace;
|
||||
/**
|
||||
* A class containing JPEG-related constants, definitions, and
|
||||
* static methods. This class and its constants must be public so that
|
||||
* <code>JPEGImageWriteParam</code> can see it.
|
||||
* {@code JPEGImageWriteParam} can see it.
|
||||
*/
|
||||
public class JPEG {
|
||||
|
||||
@ -234,10 +234,10 @@ public class JPEG {
|
||||
public static final float DEFAULT_QUALITY = 0.75F;
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the given <code>ColorSpace</code>
|
||||
* Returns {@code true} if the given {@code ColorSpace}
|
||||
* object is an instance of ICC_ColorSpace but is not one of the
|
||||
* standard <code>ColorSpaces</code> returned by
|
||||
* <code>ColorSpace.getInstance()</code>.
|
||||
* standard {@code ColorSpaces} returned by
|
||||
* {@code ColorSpace.getInstance()}.
|
||||
*/
|
||||
static boolean isNonStandardICC(ColorSpace cs) {
|
||||
boolean retval = false;
|
||||
@ -255,8 +255,8 @@ public class JPEG {
|
||||
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the given imageType can be used
|
||||
* in a JFIF file. If <code>input</code> is true, then the
|
||||
* Returns {@code true} if the given imageType can be used
|
||||
* in a JFIF file. If {@code input} is true, then the
|
||||
* image type is considered before colorspace conversion.
|
||||
*/
|
||||
static boolean isJFIFcompliant(ImageTypeSpecifier imageType,
|
||||
@ -295,7 +295,7 @@ public class JPEG {
|
||||
/**
|
||||
* Given an image type, return the Adobe transform corresponding to
|
||||
* that type, or ADOBE_IMPOSSIBLE if the image type is incompatible
|
||||
* with an Adobe marker segment. If <code>input</code> is true, then
|
||||
* with an Adobe marker segment. If {@code input} is true, then
|
||||
* the image type is considered before colorspace conversion.
|
||||
*/
|
||||
static int transformForType(ImageTypeSpecifier imageType, boolean input) {
|
||||
|
@ -75,12 +75,12 @@ class JPEGBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that there are at least <code>count</code> bytes available
|
||||
* Ensures that there are at least {@code count} bytes available
|
||||
* in the buffer, loading more data and moving any remaining
|
||||
* bytes to the front. A count of 0 means to just fill the buffer.
|
||||
* If the count is larger than the buffer size, just fills the buffer.
|
||||
* If the end of the stream is encountered before a non-0 count can
|
||||
* be satisfied, an <code>IIOException</code> is thrown with the
|
||||
* be satisfied, an {@code IIOException} is thrown with the
|
||||
* message "Image Format Error".
|
||||
*/
|
||||
void loadBuf(int count) throws IOException {
|
||||
@ -122,7 +122,7 @@ class JPEGBuffer {
|
||||
* the buffer and then reading directly from the stream
|
||||
* if necessary. The buffer is left in an appropriate
|
||||
* state. If the end of the stream is encountered, an
|
||||
* <code>IIOException</code> is thrown with the
|
||||
* {@code IIOException} is thrown with the
|
||||
* message "Image Format Error".
|
||||
*/
|
||||
void readData(byte [] data) throws IOException {
|
||||
@ -149,9 +149,9 @@ class JPEGBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips <code>count</code> bytes, leaving the buffer
|
||||
* Skips {@code count} bytes, leaving the buffer
|
||||
* in an appropriate state. If the end of the stream is
|
||||
* encountered, an <code>IIOException</code> is thrown with the
|
||||
* encountered, an {@code IIOException} is thrown with the
|
||||
* message "Image Format Error".
|
||||
*/
|
||||
void skipData(int count) throws IOException {
|
||||
@ -195,8 +195,8 @@ class JPEGBuffer {
|
||||
* the buffer as necessary. The buffer position is left
|
||||
* pointing to the first non-0xff byte after a run of
|
||||
* 0xff bytes. If the end of the stream is encountered,
|
||||
* an EOI marker is inserted into the buffer and <code>true</code>
|
||||
* is returned. Otherwise returns <code>false</code>.
|
||||
* an EOI marker is inserted into the buffer and {@code true}
|
||||
* is returned. Otherwise returns {@code false}.
|
||||
*/
|
||||
boolean scanForFF(JPEGImageReader reader) throws IOException {
|
||||
boolean retval = false;
|
||||
|
@ -544,7 +544,7 @@ public class JPEGImageReader extends ImageReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if there is an image beyond
|
||||
* Returns {@code true} if there is an image beyond
|
||||
* the current stream position. Does not disturb the
|
||||
* stream position.
|
||||
*/
|
||||
@ -614,13 +614,13 @@ public class JPEGImageReader extends ImageReader {
|
||||
|
||||
/**
|
||||
* Read in the header information starting from the current
|
||||
* stream position, returning <code>true</code> if the
|
||||
* stream position, returning {@code true} if the
|
||||
* header was a tables-only image. After this call, the
|
||||
* native IJG decompression struct will contain the image
|
||||
* information required by most query calls below
|
||||
* (e.g. getWidth, getHeight, etc.), if the header was not
|
||||
* a tables-only image.
|
||||
* If reset is <code>true</code>, the state of the IJG
|
||||
* If reset is {@code true}, the state of the IJG
|
||||
* object is reset so that it can read a header again.
|
||||
* This happens automatically if the header was a tables-only
|
||||
* image.
|
||||
@ -867,7 +867,7 @@ public class JPEGImageReader extends ImageReader {
|
||||
* Checks the implied color conversion between the stream and
|
||||
* the target image, altering the IJG output color space if necessary.
|
||||
* If a java color conversion is required, then this sets up
|
||||
* <code>convert</code>.
|
||||
* {@code convert}.
|
||||
* If bands are being rearranged at all (either source or destination
|
||||
* bands are specified in the param), then the default color
|
||||
* conversions are assumed to be correct.
|
||||
@ -1394,7 +1394,7 @@ public class JPEGImageReader extends ImageReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the read was aborted.
|
||||
* Returns {@code true} if the read was aborted.
|
||||
*/
|
||||
private native boolean readImage(long structPointer,
|
||||
byte [] buffer,
|
||||
@ -1788,6 +1788,8 @@ class ImageTypeProducer {
|
||||
case JPEG.JCS_GRAYSCALE:
|
||||
return ImageTypeSpecifier.createFromBufferedImageType
|
||||
(BufferedImage.TYPE_BYTE_GRAY);
|
||||
case JPEG.JCS_YCbCr:
|
||||
//there is no YCbCr raw type so by default we assume it as RGB
|
||||
case JPEG.JCS_RGB:
|
||||
return ImageTypeSpecifier.createInterleaved(JPEG.JCS.sRGB,
|
||||
JPEG.bOffsRGB,
|
||||
|
@ -1130,10 +1130,10 @@ public class JPEGImageWriter extends ImageWriter {
|
||||
/*
|
||||
* from jpeg_metadata.html:
|
||||
* If no stream metadata is supplied to
|
||||
* <code>ImageWriter.prepareWriteSequence</code>, then no
|
||||
* {@code ImageWriter.prepareWriteSequence}, then no
|
||||
* tables-only image is written. If stream metadata containing
|
||||
* no tables is supplied to
|
||||
* <code>ImageWriter.prepareWriteSequence</code>, then a tables-only
|
||||
* {@code ImageWriter.prepareWriteSequence}, then a tables-only
|
||||
* image containing default visually lossless tables is written.
|
||||
*/
|
||||
if (streamMetadata != null) {
|
||||
@ -1699,7 +1699,7 @@ public class JPEGImageWriter extends ImageWriter {
|
||||
private native void setDest(long structPointer);
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the write was aborted.
|
||||
* Returns {@code true} if the write was aborted.
|
||||
*/
|
||||
private native boolean writeImage(long structPointer,
|
||||
byte [] data,
|
||||
|
@ -66,17 +66,17 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
|
||||
private static final boolean debug = false;
|
||||
|
||||
/**
|
||||
* A copy of <code>markerSequence</code>, created the first time the
|
||||
* <code>markerSequence</code> is modified. This is used by reset
|
||||
* A copy of {@code markerSequence}, created the first time the
|
||||
* {@code markerSequence} is modified. This is used by reset
|
||||
* to restore the original state.
|
||||
*/
|
||||
private List<MarkerSegment> resetSequence = null;
|
||||
|
||||
/**
|
||||
* Set to <code>true</code> when reading a thumbnail stored as
|
||||
* Set to {@code true} when reading a thumbnail stored as
|
||||
* JPEG. This is used to enforce the prohibition of JFIF thumbnails
|
||||
* containing any JFIF marker segments, and to ensure generation of
|
||||
* a correct native subtree during <code>getAsTree</code>.
|
||||
* a correct native subtree during {@code getAsTree}.
|
||||
*/
|
||||
private boolean inThumb = false;
|
||||
|
||||
@ -93,7 +93,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
|
||||
/////// Package-access variables
|
||||
|
||||
/**
|
||||
* All data is a list of <code>MarkerSegment</code> objects.
|
||||
* All data is a list of {@code MarkerSegment} objects.
|
||||
* When accessing the list, use the tag to identify the particular
|
||||
* subclass. Any JFIF marker segment must be the first element
|
||||
* of the list if it is present, and any JFXX or APP2ICC marker
|
||||
@ -132,17 +132,17 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructs a <code>JPEGMetadata</code> object by reading the
|
||||
* contents of an <code>ImageInputStream</code>. Has package-only
|
||||
* Constructs a {@code JPEGMetadata} object by reading the
|
||||
* contents of an {@code ImageInputStream}. Has package-only
|
||||
* access.
|
||||
*
|
||||
* @param isStream A boolean indicating whether this object will be
|
||||
* stream or image metadata.
|
||||
* @param isThumb A boolean indicating whether this metadata object
|
||||
* is for an image or for a thumbnail stored as JPEG.
|
||||
* @param iis An <code>ImageInputStream</code> from which to read
|
||||
* @param iis An {@code ImageInputStream} from which to read
|
||||
* the metadata.
|
||||
* @param reader The <code>JPEGImageReader</code> calling this
|
||||
* @param reader The {@code JPEGImageReader} calling this
|
||||
* constructor, to which warnings should be sent.
|
||||
*/
|
||||
JPEGMetadata(boolean isStream,
|
||||
@ -365,7 +365,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a default stream <code>JPEGMetadata</code> object appropriate
|
||||
* Constructs a default stream {@code JPEGMetadata} object appropriate
|
||||
* for the given write parameters.
|
||||
*/
|
||||
JPEGMetadata(ImageWriteParam param, JPEGImageWriter writer) {
|
||||
@ -398,7 +398,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a default image <code>JPEGMetadata</code> object appropriate
|
||||
* Constructs a default image {@code JPEGMetadata} object appropriate
|
||||
* for the given image type and write parameters.
|
||||
*/
|
||||
JPEGMetadata(ImageTypeSpecifier imageType,
|
||||
@ -2248,7 +2248,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
|
||||
|
||||
/**
|
||||
* Check that this metadata object is in a consistent state and
|
||||
* return <code>true</code> if it is or <code>false</code>
|
||||
* return {@code true} if it is or {@code false}
|
||||
* otherwise. All the constructors and modifiers should call
|
||||
* this method at the end to guarantee that the data is always
|
||||
* consistent, as the writer relies on this.
|
||||
|
@ -133,12 +133,12 @@ abstract class JPEGMetadataFormat extends IIOMetadataFormatImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the named element occurs in the
|
||||
* Returns {@code true} if the named element occurs in the
|
||||
* subtree of the format starting with the node named by
|
||||
* <code>subtreeName</code>, including the node
|
||||
* itself. <code>subtreeName</code> may be any node in
|
||||
* {@code subtreeName}, including the node
|
||||
* itself. {@code subtreeName} may be any node in
|
||||
* the format. If it is not, an
|
||||
* <code>IllegalArgumentException</code> is thrown.
|
||||
* {@code IllegalArgumentException} is thrown.
|
||||
*/
|
||||
protected boolean isInSubtree(String elementName,
|
||||
String subtreeName) {
|
||||
|
@ -51,8 +51,8 @@ class MarkerSegment implements Cloneable {
|
||||
boolean unknown = false; // Set to true if the tag is not recognized
|
||||
|
||||
/**
|
||||
* Constructor for creating <code>MarkerSegment</code>s by reading
|
||||
* from an <code>ImageInputStream</code>.
|
||||
* Constructor for creating {@code MarkerSegment}s by reading
|
||||
* from an {@code ImageInputStream}.
|
||||
*/
|
||||
MarkerSegment(JPEGBuffer buffer) throws IOException {
|
||||
|
||||
|
@ -26,16 +26,13 @@
|
||||
package com.sun.imageio.plugins.png;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.IndexColorModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.awt.image.SampleModel;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.Deflater;
|
||||
@ -46,14 +43,13 @@ import javax.imageio.ImageTypeSpecifier;
|
||||
import javax.imageio.ImageWriteParam;
|
||||
import javax.imageio.ImageWriter;
|
||||
import javax.imageio.metadata.IIOMetadata;
|
||||
import javax.imageio.metadata.IIOMetadata;
|
||||
import javax.imageio.spi.ImageWriterSpi;
|
||||
import javax.imageio.stream.ImageOutputStream;
|
||||
import javax.imageio.stream.ImageOutputStreamImpl;
|
||||
|
||||
class CRC {
|
||||
final class CRC {
|
||||
|
||||
private static int[] crcTable = new int[256];
|
||||
private static final int[] crcTable = new int[256];
|
||||
private int crc = 0xffffffff;
|
||||
|
||||
static {
|
||||
@ -72,23 +68,25 @@ class CRC {
|
||||
}
|
||||
}
|
||||
|
||||
public CRC() {}
|
||||
CRC() {}
|
||||
|
||||
public void reset() {
|
||||
void reset() {
|
||||
crc = 0xffffffff;
|
||||
}
|
||||
|
||||
public void update(byte[] data, int off, int len) {
|
||||
void update(byte[] data, int off, int len) {
|
||||
int c = crc;
|
||||
for (int n = 0; n < len; n++) {
|
||||
crc = crcTable[(crc ^ data[off + n]) & 0xff] ^ (crc >>> 8);
|
||||
c = crcTable[(c ^ data[off + n]) & 0xff] ^ (c >>> 8);
|
||||
}
|
||||
crc = c;
|
||||
}
|
||||
|
||||
public void update(int data) {
|
||||
void update(int data) {
|
||||
crc = crcTable[(crc ^ data) & 0xff] ^ (crc >>> 8);
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
int getValue() {
|
||||
return crc ^ 0xffffffff;
|
||||
}
|
||||
}
|
||||
@ -96,11 +94,11 @@ class CRC {
|
||||
|
||||
final class ChunkStream extends ImageOutputStreamImpl {
|
||||
|
||||
private ImageOutputStream stream;
|
||||
private long startPos;
|
||||
private CRC crc = new CRC();
|
||||
private final ImageOutputStream stream;
|
||||
private final long startPos;
|
||||
private final CRC crc = new CRC();
|
||||
|
||||
public ChunkStream(int type, ImageOutputStream stream) throws IOException {
|
||||
ChunkStream(int type, ImageOutputStream stream) throws IOException {
|
||||
this.stream = stream;
|
||||
this.startPos = stream.getStreamPosition();
|
||||
|
||||
@ -108,25 +106,29 @@ final class ChunkStream extends ImageOutputStreamImpl {
|
||||
writeInt(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
throw new RuntimeException("Method not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
throw new RuntimeException("Method not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
crc.update(b, off, len);
|
||||
stream.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
crc.update(b);
|
||||
stream.write(b);
|
||||
}
|
||||
|
||||
public void finish() throws IOException {
|
||||
void finish() throws IOException {
|
||||
// Write CRC
|
||||
stream.writeInt(crc.getValue());
|
||||
|
||||
@ -140,6 +142,7 @@ final class ChunkStream extends ImageOutputStreamImpl {
|
||||
stream.flushBefore(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
// Empty finalizer (for improved performance; no need to call
|
||||
// super.finalize() in this case)
|
||||
@ -150,24 +153,29 @@ final class ChunkStream extends ImageOutputStreamImpl {
|
||||
// fixed length.
|
||||
final class IDATOutputStream extends ImageOutputStreamImpl {
|
||||
|
||||
private static byte[] chunkType = {
|
||||
private static final byte[] chunkType = {
|
||||
(byte)'I', (byte)'D', (byte)'A', (byte)'T'
|
||||
};
|
||||
|
||||
private ImageOutputStream stream;
|
||||
private int chunkLength;
|
||||
private final ImageOutputStream stream;
|
||||
private final int chunkLength;
|
||||
private long startPos;
|
||||
private CRC crc = new CRC();
|
||||
private final CRC crc = new CRC();
|
||||
|
||||
Deflater def = new Deflater(Deflater.BEST_COMPRESSION);
|
||||
byte[] buf = new byte[512];
|
||||
private final Deflater def;
|
||||
private final byte[] buf = new byte[512];
|
||||
// reused 1 byte[] array:
|
||||
private final byte[] wbuf1 = new byte[1];
|
||||
|
||||
private int bytesRemaining;
|
||||
|
||||
public IDATOutputStream(ImageOutputStream stream, int chunkLength)
|
||||
throws IOException {
|
||||
IDATOutputStream(ImageOutputStream stream, int chunkLength,
|
||||
int deflaterLevel) throws IOException
|
||||
{
|
||||
this.stream = stream;
|
||||
this.chunkLength = chunkLength;
|
||||
this.def = new Deflater(deflaterLevel);
|
||||
|
||||
startChunk();
|
||||
}
|
||||
|
||||
@ -206,14 +214,17 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
throw new RuntimeException("Method not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
throw new RuntimeException("Method not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
if (len == 0) {
|
||||
return;
|
||||
@ -227,7 +238,7 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public void deflate() throws IOException {
|
||||
void deflate() throws IOException {
|
||||
int len = def.deflate(buf, 0, buf.length);
|
||||
int off = 0;
|
||||
|
||||
@ -247,13 +258,13 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
byte[] wbuf = new byte[1];
|
||||
wbuf[0] = (byte)b;
|
||||
write(wbuf, 0, 1);
|
||||
wbuf1[0] = (byte)b;
|
||||
write(wbuf1, 0, 1);
|
||||
}
|
||||
|
||||
public void finish() throws IOException {
|
||||
void finish() throws IOException {
|
||||
try {
|
||||
if (!def.finished()) {
|
||||
def.finish();
|
||||
@ -267,6 +278,7 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
// Empty finalizer (for improved performance; no need to call
|
||||
// super.finalize() in this case)
|
||||
@ -274,18 +286,76 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
|
||||
}
|
||||
|
||||
|
||||
class PNGImageWriteParam extends ImageWriteParam {
|
||||
final class PNGImageWriteParam extends ImageWriteParam {
|
||||
|
||||
public PNGImageWriteParam(Locale locale) {
|
||||
/** Default quality level = 0.5 ie medium compression */
|
||||
private static final float DEFAULT_QUALITY = 0.5f;
|
||||
|
||||
private static final String[] compressionNames = {"Deflate"};
|
||||
private static final float[] qualityVals = { 0.00F, 0.30F, 0.75F, 1.00F };
|
||||
private static final String[] qualityDescs = {
|
||||
"High compression", // 0.00 -> 0.30
|
||||
"Medium compression", // 0.30 -> 0.75
|
||||
"Low compression" // 0.75 -> 1.00
|
||||
};
|
||||
|
||||
PNGImageWriteParam(Locale locale) {
|
||||
super();
|
||||
this.canWriteProgressive = true;
|
||||
this.locale = locale;
|
||||
this.canWriteCompressed = true;
|
||||
this.compressionTypes = compressionNames;
|
||||
this.compressionType = compressionTypes[0];
|
||||
this.compressionMode = MODE_DEFAULT;
|
||||
this.compressionQuality = DEFAULT_QUALITY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any previous compression quality setting.
|
||||
*
|
||||
* <p> The default implementation resets the compression quality
|
||||
* to <code>0.5F</code>.
|
||||
*
|
||||
* @exception IllegalStateException if the compression mode is not
|
||||
* <code>MODE_EXPLICIT</code>.
|
||||
*/
|
||||
@Override
|
||||
public void unsetCompression() {
|
||||
super.unsetCompression();
|
||||
this.compressionType = compressionTypes[0];
|
||||
this.compressionQuality = DEFAULT_QUALITY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> since the PNG plug-in only supports
|
||||
* lossless compression.
|
||||
*
|
||||
* @return <code>true</code>.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCompressionLossless() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCompressionQualityDescriptions() {
|
||||
super.getCompressionQualityDescriptions();
|
||||
return qualityDescs.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getCompressionQualityValues() {
|
||||
super.getCompressionQualityValues();
|
||||
return qualityVals.clone();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PNGImageWriter extends ImageWriter {
|
||||
public final class PNGImageWriter extends ImageWriter {
|
||||
|
||||
/** Default compression level = 4 ie medium compression */
|
||||
private static final int DEFAULT_COMPRESSION_LEVEL = 4;
|
||||
|
||||
ImageOutputStream stream = null;
|
||||
|
||||
@ -334,6 +404,7 @@ public class PNGImageWriter extends ImageWriter {
|
||||
super(originatingProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutput(Object output) {
|
||||
super.setOutput(output);
|
||||
if (output != null) {
|
||||
@ -346,16 +417,17 @@ public class PNGImageWriter extends ImageWriter {
|
||||
}
|
||||
}
|
||||
|
||||
private static int[] allowedProgressivePasses = { 1, 7 };
|
||||
|
||||
@Override
|
||||
public ImageWriteParam getDefaultWriteParam() {
|
||||
return new PNGImageWriteParam(getLocale());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIOMetadata getDefaultStreamMetadata(ImageWriteParam param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType,
|
||||
ImageWriteParam param) {
|
||||
PNGMetadata m = new PNGMetadata();
|
||||
@ -363,11 +435,13 @@ public class PNGImageWriter extends ImageWriter {
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIOMetadata convertStreamMetadata(IIOMetadata inData,
|
||||
ImageWriteParam param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIOMetadata convertImageMetadata(IIOMetadata inData,
|
||||
ImageTypeSpecifier imageType,
|
||||
ImageWriteParam param) {
|
||||
@ -934,8 +1008,11 @@ public class PNGImageWriter extends ImageWriter {
|
||||
}
|
||||
|
||||
// Use sourceXOffset, etc.
|
||||
private void write_IDAT(RenderedImage image) throws IOException {
|
||||
IDATOutputStream ios = new IDATOutputStream(stream, 32768);
|
||||
private void write_IDAT(RenderedImage image, int deflaterLevel)
|
||||
throws IOException
|
||||
{
|
||||
IDATOutputStream ios = new IDATOutputStream(stream, 32768,
|
||||
deflaterLevel);
|
||||
try {
|
||||
if (metadata.IHDR_interlaceMethod == 1) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
@ -1028,6 +1105,7 @@ public class PNGImageWriter extends ImageWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(IIOMetadata streamMetadata,
|
||||
IIOImage image,
|
||||
ImageWriteParam param) throws IIOException {
|
||||
@ -1110,7 +1188,23 @@ public class PNGImageWriter extends ImageWriter {
|
||||
metadata = new PNGMetadata();
|
||||
}
|
||||
|
||||
// reset compression level to default:
|
||||
int deflaterLevel = DEFAULT_COMPRESSION_LEVEL;
|
||||
|
||||
if (param != null) {
|
||||
switch(param.getCompressionMode()) {
|
||||
case ImageWriteParam.MODE_DISABLED:
|
||||
deflaterLevel = Deflater.NO_COMPRESSION;
|
||||
break;
|
||||
case ImageWriteParam.MODE_EXPLICIT:
|
||||
float quality = param.getCompressionQuality();
|
||||
if (quality >= 0f && quality <= 1f) {
|
||||
deflaterLevel = 9 - Math.round(9f * quality);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
// Use Adam7 interlacing if set in write param
|
||||
switch (param.getProgressiveMode()) {
|
||||
case ImageWriteParam.MODE_DEFAULT:
|
||||
@ -1119,8 +1213,9 @@ public class PNGImageWriter extends ImageWriter {
|
||||
case ImageWriteParam.MODE_DISABLED:
|
||||
metadata.IHDR_interlaceMethod = 0;
|
||||
break;
|
||||
// MODE_COPY_FROM_METADATA should alreay be taken care of
|
||||
// MODE_COPY_FROM_METADATA should already be taken care of
|
||||
// MODE_EXPLICIT is not allowed
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@ -1165,7 +1260,7 @@ public class PNGImageWriter extends ImageWriter {
|
||||
|
||||
writeUnknownChunks();
|
||||
|
||||
write_IDAT(im);
|
||||
write_IDAT(im, deflaterLevel);
|
||||
|
||||
if (abortRequested()) {
|
||||
processWriteAborted();
|
||||
|
@ -254,7 +254,7 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
|
||||
|
||||
/**
|
||||
* Sets the IHDR_bitDepth and IHDR_colorType variables.
|
||||
* The <code>numBands</code> parameter is necessary since
|
||||
* The {@code numBands} parameter is necessary since
|
||||
* we may only be writing a subset of the image bands.
|
||||
*/
|
||||
public void initialize(ImageTypeSpecifier imageType, int numBands) {
|
||||
|
@ -362,9 +362,9 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
offsets.add(f);
|
||||
}
|
||||
|
||||
List<TIFFField> byteCounts = new ArrayList<>();
|
||||
if (offsets.size() > 0) {
|
||||
// StripByteCounts
|
||||
List<TIFFField> byteCounts = new ArrayList<>();
|
||||
f = getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS);
|
||||
if (f != null) {
|
||||
if (f.getCount() != count) {
|
||||
@ -415,6 +415,12 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure there is at least a data pointer for JPEG interchange format or
|
||||
// both data offsets and byte counts for other compression types.
|
||||
if (jpegOffset == null && (offsets.size() == 0 || byteCounts.size() == 0)) {
|
||||
throw new IIOException("Insufficient data offsets or byte counts");
|
||||
}
|
||||
|
||||
// JPEGQTables - one 64-byte table for each offset.
|
||||
f = getTIFFField(BaselineTIFFTagSet.TAG_JPEG_Q_TABLES);
|
||||
if (f != null) {
|
||||
@ -480,14 +486,16 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
stream.skipBytes(4);
|
||||
continue;
|
||||
}
|
||||
int count = (int)stream.readUnsignedInt();
|
||||
long longCount = stream.readUnsignedInt();
|
||||
|
||||
// Get the associated TIFFTag.
|
||||
TIFFTag tag = getTag(tagNumber, tagSetList);
|
||||
|
||||
// Ignore unknown fields.
|
||||
// Ignore unknown fields, fields with unknown type, and fields
|
||||
// with count out of int range.
|
||||
if((tag == null && ignoreUnknownFields)
|
||||
|| (tag != null && !tag.isDataTypeOK(type))) {
|
||||
|| (tag != null && !tag.isDataTypeOK(type))
|
||||
|| longCount > Integer.MAX_VALUE) {
|
||||
// Skip the value/offset so as to leave the stream
|
||||
// position at the start of the next IFD entry.
|
||||
stream.skipBytes(4);
|
||||
@ -496,6 +504,8 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
continue;
|
||||
}
|
||||
|
||||
int count = (int)longCount;
|
||||
|
||||
if (tag == null) {
|
||||
tag = new TIFFTag(TIFFTag.UNKNOWN_TAG_NAME, tagNumber,
|
||||
1 << type, count);
|
||||
@ -518,7 +528,14 @@ public class TIFFIFD extends TIFFDirectory {
|
||||
}
|
||||
}
|
||||
|
||||
int size = count*sizeOfType;
|
||||
long longSize = longCount*sizeOfType;
|
||||
if (longSize > Integer.MAX_VALUE) {
|
||||
// Continue with the next IFD entry.
|
||||
stream.skipBytes(4);
|
||||
continue;
|
||||
}
|
||||
int size = (int)longSize;
|
||||
|
||||
if (size > 4 || tag.isIFDPointer()) {
|
||||
// The IFD entry value is a pointer to the actual field value.
|
||||
long offset = stream.readUnsignedInt();
|
||||
|
@ -266,6 +266,8 @@ public class TIFFImageWriter extends ImageWriter {
|
||||
super.setOutput(output);
|
||||
|
||||
if (output != null) {
|
||||
reset();
|
||||
|
||||
if (!(output instanceof ImageOutputStream)) {
|
||||
throw new IllegalArgumentException
|
||||
("output not an ImageOutputStream!");
|
||||
|
@ -50,7 +50,7 @@ import com.sun.imageio.plugins.common.ReaderUtil;
|
||||
/** This class is the Java Image IO plugin reader for WBMP images.
|
||||
* It may subsample the image, clip the image,
|
||||
* and shift the decoded image origin if the proper decoding parameter
|
||||
* are set in the provided <code>WBMPImageReadParam</code>.
|
||||
* are set in the provided {@code WBMPImageReadParam}.
|
||||
*/
|
||||
public class WBMPImageReader extends ImageReader {
|
||||
/** The input stream where reads from */
|
||||
@ -69,8 +69,8 @@ public class WBMPImageReader extends ImageReader {
|
||||
|
||||
private WBMPMetadata metadata;
|
||||
|
||||
/** Constructs <code>WBMPImageReader</code> from the provided
|
||||
* <code>ImageReaderSpi</code>.
|
||||
/** Constructs {@code WBMPImageReader} from the provided
|
||||
* {@code ImageReaderSpi}.
|
||||
*/
|
||||
public WBMPImageReader(ImageReaderSpi originator) {
|
||||
super(originator);
|
||||
|
@ -57,7 +57,7 @@ import com.sun.imageio.plugins.common.I18N;
|
||||
* a WBMP format.
|
||||
*
|
||||
* The encoding process may clip, subsample using the parameters
|
||||
* specified in the <code>ImageWriteParam</code>.
|
||||
* specified in the {@code ImageWriteParam}.
|
||||
*
|
||||
* @see com.sun.media.imageio.plugins.WBMPImageWriteParam
|
||||
*/
|
||||
@ -92,8 +92,8 @@ public class WBMPImageWriter extends ImageWriter {
|
||||
return multiBytes;
|
||||
}
|
||||
|
||||
/** Constructs <code>WBMPImageWriter</code> based on the provided
|
||||
* <code>ImageWriterSpi</code>.
|
||||
/** Constructs {@code WBMPImageWriter} based on the provided
|
||||
* {@code ImageWriterSpi}.
|
||||
*/
|
||||
public WBMPImageWriter(ImageWriterSpi originator) {
|
||||
super(originator);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -25,23 +25,22 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
|
||||
//$$fb this class is buggy. Should be replaced in future.
|
||||
@ -63,6 +62,7 @@ public final class AiffFileWriter extends SunFileWriter {
|
||||
|
||||
// METHODS TO IMPLEMENT AudioFileWriter
|
||||
|
||||
@Override
|
||||
public AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
|
||||
|
||||
AudioFileFormat.Type[] filetypes = new AudioFileFormat.Type[types.length];
|
||||
@ -84,6 +84,7 @@ public final class AiffFileWriter extends SunFileWriter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
@ -106,6 +107,7 @@ public final class AiffFileWriter extends SunFileWriter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
@ -160,6 +162,9 @@ public final class AiffFileWriter extends SunFileWriter {
|
||||
* Throws IllegalArgumentException if not supported.
|
||||
*/
|
||||
private AudioFileFormat getAudioFileFormat(AudioFileFormat.Type type, AudioInputStream stream) {
|
||||
if (!isFileTypeSupported(type, stream)) {
|
||||
throw new IllegalArgumentException("File type " + type + " not supported.");
|
||||
}
|
||||
|
||||
AudioFormat format = null;
|
||||
AiffFileFormat fileFormat = null;
|
||||
@ -177,10 +182,6 @@ public final class AiffFileWriter extends SunFileWriter {
|
||||
int fileSize;
|
||||
boolean convert8to16 = false;
|
||||
|
||||
if( !types[0].equals(type) ) {
|
||||
throw new IllegalArgumentException("File type " + type + " not supported.");
|
||||
}
|
||||
|
||||
if( (AudioFormat.Encoding.ALAW.equals(streamEncoding)) ||
|
||||
(AudioFormat.Encoding.ULAW.equals(streamEncoding)) ) {
|
||||
|
||||
|
@ -135,45 +135,48 @@ public final class AlawCodec extends SunCodec {
|
||||
AudioFormat sourceFormat = sourceStream.getFormat();
|
||||
AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
|
||||
|
||||
if( !isConversionSupported(targetEncoding,sourceStream.getFormat()) ) {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
if( sourceEncoding.equals( targetEncoding ) ) {
|
||||
return sourceStream;
|
||||
} else {
|
||||
AudioFormat targetFormat = null;
|
||||
if( !isConversionSupported(targetEncoding,sourceStream.getFormat()) ) {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
if( sourceEncoding.equals( AudioFormat.Encoding.ALAW ) &&
|
||||
targetEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) ) {
|
||||
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
16,
|
||||
sourceFormat.getChannels(),
|
||||
2*sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
sourceFormat.isBigEndian());
|
||||
|
||||
} else if( sourceEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) &&
|
||||
targetEncoding.equals( AudioFormat.Encoding.ALAW ) ) {
|
||||
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
8,
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
false);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
return getAudioInputStream( targetFormat, sourceStream );
|
||||
}
|
||||
AudioFormat targetFormat = null;
|
||||
if( sourceEncoding.equals( AudioFormat.Encoding.ALAW ) &&
|
||||
targetEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) ) {
|
||||
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
16,
|
||||
sourceFormat.getChannels(),
|
||||
2*sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
sourceFormat.isBigEndian());
|
||||
|
||||
} else if( sourceEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) &&
|
||||
targetEncoding.equals( AudioFormat.Encoding.ALAW ) ) {
|
||||
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
8,
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
false);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
return getConvertedStream(targetFormat, sourceStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* use old code...
|
||||
*/
|
||||
public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
|
||||
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
|
||||
throw new IllegalArgumentException("Unsupported conversion: "
|
||||
+ sourceStream.getFormat().toString() + " to "
|
||||
+ targetFormat.toString());
|
||||
return getConvertedStream( targetFormat, sourceStream );
|
||||
}
|
||||
|
||||
@ -218,33 +221,28 @@ public final class AlawCodec extends SunCodec {
|
||||
Vector<AudioFormat> formats = new Vector<>();
|
||||
AudioFormat format;
|
||||
|
||||
if ( AudioFormat.Encoding.PCM_SIGNED.equals(inputFormat.getEncoding())) {
|
||||
if (inputFormat.getSampleSizeInBits() == 16
|
||||
&& AudioFormat.Encoding.PCM_SIGNED.equals(inputFormat.getEncoding())) {
|
||||
format = new AudioFormat(AudioFormat.Encoding.ALAW,
|
||||
inputFormat.getSampleRate(),
|
||||
8,
|
||||
inputFormat.getSampleRate(), 8,
|
||||
inputFormat.getChannels(),
|
||||
inputFormat.getChannels(),
|
||||
inputFormat.getSampleRate(),
|
||||
false );
|
||||
inputFormat.getSampleRate(), false);
|
||||
formats.addElement(format);
|
||||
}
|
||||
|
||||
if (AudioFormat.Encoding.ALAW.equals(inputFormat.getEncoding())) {
|
||||
if (inputFormat.getSampleSizeInBits() == 8
|
||||
&& AudioFormat.Encoding.ALAW.equals(inputFormat.getEncoding())) {
|
||||
format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
|
||||
inputFormat.getSampleRate(),
|
||||
16,
|
||||
inputFormat.getSampleRate(), 16,
|
||||
inputFormat.getChannels(),
|
||||
inputFormat.getChannels()*2,
|
||||
inputFormat.getSampleRate(),
|
||||
false );
|
||||
inputFormat.getChannels() * 2,
|
||||
inputFormat.getSampleRate(), false);
|
||||
formats.addElement(format);
|
||||
format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
|
||||
inputFormat.getSampleRate(),
|
||||
16,
|
||||
inputFormat.getSampleRate(), 16,
|
||||
inputFormat.getChannels(),
|
||||
inputFormat.getChannels()*2,
|
||||
inputFormat.getSampleRate(),
|
||||
true );
|
||||
inputFormat.getChannels() * 2,
|
||||
inputFormat.getSampleRate(), true);
|
||||
formats.addElement(format);
|
||||
}
|
||||
|
||||
@ -256,7 +254,7 @@ public final class AlawCodec extends SunCodec {
|
||||
}
|
||||
|
||||
|
||||
final class AlawCodecStream extends AudioInputStream {
|
||||
private final class AlawCodecStream extends AudioInputStream {
|
||||
|
||||
// tempBuffer required only for encoding (when encode is true)
|
||||
private static final int tempBufferSize = 64;
|
||||
@ -446,5 +444,12 @@ public final class AlawCodec extends SunCodec {
|
||||
return (i - off);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(final long n) throws IOException {
|
||||
// Implementation of this method assumes that we support
|
||||
// encoding/decoding from/to 8/16 bits only
|
||||
return encode ? super.skip(n * 2) / 2 : super.skip(n / 2) * 2;
|
||||
}
|
||||
} // end class AlawCodecStream
|
||||
} // end class ALAW
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -25,24 +25,18 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
|
||||
|
||||
/**
|
||||
* AU file format.
|
||||
*
|
||||
* @author Jan Borgersen
|
||||
*/
|
||||
|
||||
final class AuFileFormat extends AudioFileFormat {
|
||||
|
||||
// magic numbers
|
||||
static final int AU_SUN_MAGIC = 0x2e736e64;
|
||||
static final int AU_SUN_INV_MAGIC = 0x646e732e;
|
||||
static final int AU_DEC_MAGIC = 0x2e736400;
|
||||
static final int AU_DEC_INV_MAGIC = 0x0064732e;
|
||||
static final int AU_SUN_MAGIC = 0x2e736e64; // ".snd"
|
||||
|
||||
// encodings
|
||||
static final int AU_ULAW_8 = 1; /* 8-bit ISDN u-law */
|
||||
@ -62,11 +56,6 @@ final class AuFileFormat extends AudioFileFormat {
|
||||
|
||||
private int auType;
|
||||
|
||||
AuFileFormat( AudioFileFormat aff ) {
|
||||
|
||||
this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
|
||||
}
|
||||
|
||||
AuFileFormat(AudioFileFormat.Type type, int lengthInBytes, AudioFormat format, int lengthInFrames) {
|
||||
|
||||
super(type,lengthInBytes,format,lengthInFrames);
|
||||
@ -94,12 +83,9 @@ final class AuFileFormat extends AudioFileFormat {
|
||||
auType = AU_LINEAR_32;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getAuType() {
|
||||
|
||||
return auType;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,45 +46,25 @@ public final class AuFileReader extends SunFileReader {
|
||||
@Override
|
||||
public AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
|
||||
throws UnsupportedAudioFileException, IOException {
|
||||
boolean bigendian = false;
|
||||
int headerSize = -1;
|
||||
int dataSize = -1;
|
||||
int encoding_local = -1;
|
||||
int sampleRate = -1;
|
||||
int frameRate = -1;
|
||||
int frameSize = -1;
|
||||
int channels = -1;
|
||||
final int sampleSizeInBits;
|
||||
int length = 0;
|
||||
int nread = 0;
|
||||
AudioFormat.Encoding encoding = null;
|
||||
|
||||
DataInputStream dis = new DataInputStream( stream );
|
||||
|
||||
final int magic = dis.readInt(); nread += 4;
|
||||
|
||||
if (! (magic == AuFileFormat.AU_SUN_MAGIC) || (magic == AuFileFormat.AU_DEC_MAGIC) ||
|
||||
(magic == AuFileFormat.AU_SUN_INV_MAGIC) || (magic == AuFileFormat.AU_DEC_INV_MAGIC) ) {
|
||||
final DataInputStream dis = new DataInputStream(stream);
|
||||
final int magic = dis.readInt();
|
||||
|
||||
if (magic != AuFileFormat.AU_SUN_MAGIC) {
|
||||
// not AU, throw exception
|
||||
throw new UnsupportedAudioFileException("not an AU file");
|
||||
}
|
||||
|
||||
if ((magic == AuFileFormat.AU_SUN_MAGIC) || (magic == AuFileFormat.AU_DEC_MAGIC)) {
|
||||
bigendian = true; // otherwise little-endian
|
||||
}
|
||||
|
||||
headerSize = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4;
|
||||
dataSize = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4;
|
||||
encoding_local = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4;
|
||||
sampleRate = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4;
|
||||
channels = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4;
|
||||
final int headerSize = dis.readInt();
|
||||
final int dataSize = dis.readInt();
|
||||
final int encoding_local = dis.readInt();
|
||||
final int sampleRate = dis.readInt();
|
||||
final int channels = dis.readInt();
|
||||
if (channels <= 0) {
|
||||
throw new UnsupportedAudioFileException("Invalid number of channels");
|
||||
}
|
||||
|
||||
frameRate = sampleRate;
|
||||
|
||||
final int sampleSizeInBits;
|
||||
final AudioFormat.Encoding encoding;
|
||||
switch (encoding_local) {
|
||||
case AuFileFormat.AU_ULAW_8:
|
||||
encoding = AudioFormat.Encoding.ULAW;
|
||||
@ -138,24 +118,24 @@ public final class AuFileReader extends SunFileReader {
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
// unsupported filetype, throw exception
|
||||
throw new UnsupportedAudioFileException("not a valid AU file");
|
||||
// unsupported filetype, throw exception
|
||||
throw new UnsupportedAudioFileException("not a valid AU file");
|
||||
}
|
||||
|
||||
frameSize = calculatePCMFrameSize(sampleSizeInBits, channels);
|
||||
final int frameSize = calculatePCMFrameSize(sampleSizeInBits, channels);
|
||||
//$$fb 2002-11-02: fix for 4629669: AU file reader: problems with empty files
|
||||
if( dataSize < 0 ) {
|
||||
final int length;
|
||||
if (dataSize < 0) {
|
||||
length = AudioSystem.NOT_SPECIFIED;
|
||||
} else {
|
||||
//$$fb 2003-10-20: fix for 4940459: AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED
|
||||
length = dataSize / frameSize;
|
||||
}
|
||||
// now seek past the header
|
||||
dis.skipBytes(headerSize - nread);
|
||||
AudioFormat format = new AudioFormat(encoding, sampleRate,
|
||||
sampleSizeInBits, channels,
|
||||
frameSize, (float) frameRate,
|
||||
bigendian);
|
||||
dis.skipBytes(headerSize - AuFileFormat.AU_HEADERSIZE);
|
||||
final AudioFormat format = new AudioFormat(encoding, sampleRate,
|
||||
sampleSizeInBits, channels,
|
||||
frameSize, sampleRate, true);
|
||||
return new AuFileFormat(AudioFileFormat.Type.AU, dataSize + headerSize,
|
||||
format, length);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -25,26 +25,24 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
|
||||
|
||||
/**
|
||||
* AU file writer.
|
||||
*
|
||||
@ -52,8 +50,10 @@ import javax.sound.sampled.AudioSystem;
|
||||
*/
|
||||
public final class AuFileWriter extends SunFileWriter {
|
||||
|
||||
//$$fb value for length field if length is not known
|
||||
public static final int UNKNOWN_SIZE=-1;
|
||||
/**
|
||||
* Value for length field if length is not known.
|
||||
*/
|
||||
private static final int UNKNOWN_SIZE = -1;
|
||||
|
||||
/**
|
||||
* Constructs a new AuFileWriter object.
|
||||
@ -62,6 +62,7 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AU});
|
||||
}
|
||||
|
||||
@Override
|
||||
public AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
|
||||
|
||||
AudioFileFormat.Type[] filetypes = new AudioFileFormat.Type[types.length];
|
||||
@ -82,7 +83,7 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
return new AudioFileFormat.Type[0];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
@ -96,13 +97,10 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
|
||||
// throws IllegalArgumentException if not supported
|
||||
AuFileFormat auFileFormat = (AuFileFormat)getAudioFileFormat(fileType, stream);
|
||||
|
||||
int bytesWritten = writeAuFile(stream, auFileFormat, out);
|
||||
return bytesWritten;
|
||||
return writeAuFile(stream, auFileFormat, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
@ -137,7 +135,6 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -145,6 +142,9 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
* Throws IllegalArgumentException if not supported.
|
||||
*/
|
||||
private AudioFileFormat getAudioFileFormat(AudioFileFormat.Type type, AudioInputStream stream) {
|
||||
if (!isFileTypeSupported(type, stream)) {
|
||||
throw new IllegalArgumentException("File type " + type + " not supported.");
|
||||
}
|
||||
|
||||
AudioFormat format = null;
|
||||
AuFileFormat fileFormat = null;
|
||||
@ -154,17 +154,9 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
AudioFormat.Encoding streamEncoding = streamFormat.getEncoding();
|
||||
|
||||
|
||||
float sampleRate;
|
||||
int sampleSizeInBits;
|
||||
int channels;
|
||||
int frameSize;
|
||||
float frameRate;
|
||||
int fileSize;
|
||||
|
||||
if( !types[0].equals(type) ) {
|
||||
throw new IllegalArgumentException("File type " + type + " not supported.");
|
||||
}
|
||||
|
||||
if( (AudioFormat.Encoding.ALAW.equals(streamEncoding)) ||
|
||||
(AudioFormat.Encoding.ULAW.equals(streamEncoding)) ) {
|
||||
|
||||
@ -206,14 +198,12 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
return fileFormat;
|
||||
}
|
||||
|
||||
|
||||
private InputStream getFileStream(AuFileFormat auFileFormat, InputStream audioStream) throws IOException {
|
||||
private InputStream getFileStream(AuFileFormat auFileFormat, AudioInputStream audioStream) throws IOException {
|
||||
|
||||
// private method ... assumes auFileFormat is a supported file type
|
||||
|
||||
AudioFormat format = auFileFormat.getFormat();
|
||||
|
||||
int magic = AuFileFormat.AU_SUN_MAGIC;
|
||||
int headerSize = AuFileFormat.AU_HEADERSIZE;
|
||||
long dataSize = auFileFormat.getFrameLength();
|
||||
//$$fb fix for Bug 4351296
|
||||
@ -225,9 +215,6 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
int encoding_local = auFileFormat.getAuType();
|
||||
int sampleRate = (int)format.getSampleRate();
|
||||
int channels = format.getChannels();
|
||||
//$$fb below is the fix for 4297100.
|
||||
//boolean bigendian = format.isBigEndian();
|
||||
boolean bigendian = true; // force bigendian
|
||||
|
||||
byte header[] = null;
|
||||
ByteArrayInputStream headerStream = null;
|
||||
@ -243,54 +230,37 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
|
||||
codedAudioStream = audioStream;
|
||||
|
||||
if( audioStream instanceof AudioInputStream ) {
|
||||
audioStreamFormat = audioStream.getFormat();
|
||||
encoding = audioStreamFormat.getEncoding();
|
||||
|
||||
//$$ fb 2001-07-13: Bug 4391108
|
||||
if( (AudioFormat.Encoding.PCM_UNSIGNED.equals(encoding)) ||
|
||||
(AudioFormat.Encoding.PCM_SIGNED.equals(encoding)
|
||||
&& !audioStreamFormat.isBigEndian()) ) {
|
||||
// We always write big endian au files, this is by far the standard
|
||||
codedAudioStream = AudioSystem.getAudioInputStream( new AudioFormat (
|
||||
AudioFormat.Encoding.PCM_SIGNED,
|
||||
audioStreamFormat.getSampleRate(),
|
||||
audioStreamFormat.getSampleSizeInBits(),
|
||||
audioStreamFormat.getChannels(),
|
||||
audioStreamFormat.getFrameSize(),
|
||||
audioStreamFormat.getFrameRate(),
|
||||
true),
|
||||
audioStream );
|
||||
|
||||
|
||||
audioStreamFormat = ((AudioInputStream)audioStream).getFormat();
|
||||
encoding = audioStreamFormat.getEncoding();
|
||||
|
||||
//$$ fb 2001-07-13: Bug 4391108
|
||||
if( (AudioFormat.Encoding.PCM_UNSIGNED.equals(encoding)) ||
|
||||
(AudioFormat.Encoding.PCM_SIGNED.equals(encoding)
|
||||
&& bigendian != audioStreamFormat.isBigEndian()) ) {
|
||||
|
||||
// plug in the transcoder to convert to PCM_SIGNED, bigendian
|
||||
// NOTE: little endian AU is not common, so we're always converting
|
||||
// to big endian unless the passed in audioFileFormat is little.
|
||||
// $$fb this NOTE is superseded. We always write big endian au files, this is by far the standard.
|
||||
codedAudioStream = AudioSystem.getAudioInputStream( new AudioFormat (
|
||||
AudioFormat.Encoding.PCM_SIGNED,
|
||||
audioStreamFormat.getSampleRate(),
|
||||
audioStreamFormat.getSampleSizeInBits(),
|
||||
audioStreamFormat.getChannels(),
|
||||
audioStreamFormat.getFrameSize(),
|
||||
audioStreamFormat.getFrameRate(),
|
||||
bigendian),
|
||||
(AudioInputStream)audioStream );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
baos = new ByteArrayOutputStream();
|
||||
dos = new DataOutputStream(baos);
|
||||
|
||||
|
||||
if (bigendian) {
|
||||
dos.writeInt(AuFileFormat.AU_SUN_MAGIC);
|
||||
dos.writeInt(headerSize);
|
||||
dos.writeInt((int)dataSizeInBytes);
|
||||
dos.writeInt(encoding_local);
|
||||
dos.writeInt(sampleRate);
|
||||
dos.writeInt(channels);
|
||||
} else {
|
||||
dos.writeInt(AuFileFormat.AU_SUN_INV_MAGIC);
|
||||
dos.writeInt(big2little(headerSize));
|
||||
dos.writeInt(big2little((int)dataSizeInBytes));
|
||||
dos.writeInt(big2little(encoding_local));
|
||||
dos.writeInt(big2little(sampleRate));
|
||||
dos.writeInt(big2little(channels));
|
||||
}
|
||||
dos.writeInt(AuFileFormat.AU_SUN_MAGIC);
|
||||
dos.writeInt(headerSize);
|
||||
dos.writeInt((int)dataSizeInBytes);
|
||||
dos.writeInt(encoding_local);
|
||||
dos.writeInt(sampleRate);
|
||||
dos.writeInt(channels);
|
||||
|
||||
// Now create a new InputStream from headerStream and the InputStream
|
||||
// in audioStream
|
||||
@ -304,7 +274,7 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
return auStream;
|
||||
}
|
||||
|
||||
private int writeAuFile(InputStream in, AuFileFormat auFileFormat, OutputStream out) throws IOException {
|
||||
private int writeAuFile(AudioInputStream in, AuFileFormat auFileFormat, OutputStream out) throws IOException {
|
||||
|
||||
int bytesRead = 0;
|
||||
int bytesWritten = 0;
|
||||
@ -332,6 +302,4 @@ public final class AuFileWriter extends SunFileWriter {
|
||||
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -475,6 +476,11 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
|
||||
|
||||
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
|
||||
AudioInputStream sourceStream) {
|
||||
if (!isConversionSupported(targetEncoding, sourceStream.getFormat())) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unsupported conversion: " + sourceStream.getFormat()
|
||||
.toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
if (sourceStream.getFormat().getEncoding().equals(targetEncoding))
|
||||
return sourceStream;
|
||||
AudioFormat format = sourceStream.getFormat();
|
||||
|
@ -32,9 +32,9 @@ import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.SourceDataLine;
|
||||
|
||||
/**
|
||||
* <code>AudioSynthesizer</code> is a <code>Synthesizer</code>
|
||||
* which renders it's output audio into <code>SourceDataLine</code>
|
||||
* or <code>AudioInputStream</code>.
|
||||
* {@code AudioSynthesizer} is a {@code Synthesizer}
|
||||
* which renders it's output audio into {@code SourceDataLine}
|
||||
* or {@code AudioInputStream}.
|
||||
*
|
||||
* @see MidiSystem#getSynthesizer
|
||||
* @see Synthesizer
|
||||
@ -59,7 +59,7 @@ public interface AudioSynthesizer extends Synthesizer {
|
||||
* Gets information about the possible properties for the synthesizer.
|
||||
*
|
||||
* @param info a proposed list of tag/value pairs that will be sent on open.
|
||||
* @return an array of <code>AudioSynthesizerPropertyInfo</code> objects
|
||||
* @return an array of {@code AudioSynthesizerPropertyInfo} objects
|
||||
* describing possible properties. This array may be an empty array if
|
||||
* no properties are required.
|
||||
*/
|
||||
@ -68,7 +68,7 @@ public interface AudioSynthesizer extends Synthesizer {
|
||||
|
||||
/**
|
||||
* Opens the synthesizer and starts rendering audio into
|
||||
* <code>SourceDataLine</code>.
|
||||
* {@code SourceDataLine}.
|
||||
*
|
||||
* <p>An application opening a synthesizer explicitly with this call
|
||||
* has to close the synthesizer by calling {@link #close}. This is
|
||||
@ -77,13 +77,13 @@ public interface AudioSynthesizer extends Synthesizer {
|
||||
*
|
||||
* <p>Note that some synthesizers, once closed, cannot be reopened.
|
||||
* Attempts to reopen such a synthesizer will always result in
|
||||
* a <code>MidiUnavailableException</code>.
|
||||
* a {@code MidiUnavailableException}.
|
||||
*
|
||||
* @param line which <code>AudioSynthesizer</code> writes output audio into.
|
||||
* If <code>line</code> is null, then line from system default mixer is used.
|
||||
* @param info a <code>Map<String,Object></code> object containing
|
||||
* @param line which {@code AudioSynthesizer} writes output audio into.
|
||||
* If {@code line} is null, then line from system default mixer is used.
|
||||
* @param info a {@code Map<String,Object>} object containing
|
||||
* properties for additional configuration supported by synthesizer.
|
||||
* If <code>info</code> is null then default settings are used.
|
||||
* If {@code info} is null then default settings are used.
|
||||
*
|
||||
* @throws MidiUnavailableException thrown if the synthesizer cannot be
|
||||
* opened due to resource restrictions.
|
||||
@ -98,7 +98,7 @@ public interface AudioSynthesizer extends Synthesizer {
|
||||
|
||||
/**
|
||||
* Opens the synthesizer and renders audio into returned
|
||||
* <code>AudioInputStream</code>.
|
||||
* {@code AudioInputStream}.
|
||||
*
|
||||
* <p>An application opening a synthesizer explicitly with this call
|
||||
* has to close the synthesizer by calling {@link #close}. This is
|
||||
@ -107,13 +107,13 @@ public interface AudioSynthesizer extends Synthesizer {
|
||||
*
|
||||
* <p>Note that some synthesizers, once closed, cannot be reopened.
|
||||
* Attempts to reopen such a synthesizer will always result in
|
||||
* a <code>MidiUnavailableException<code>.
|
||||
* a {@code MidiUnavailableException}.
|
||||
*
|
||||
* @param targetFormat specifies the <code>AudioFormat</code>
|
||||
* used in returned <code>AudioInputStream</code>.
|
||||
* @param info a <code>Map<String,Object></code> object containing
|
||||
* @param targetFormat specifies the {@code AudioFormat}
|
||||
* used in returned {@code AudioInputStream}.
|
||||
* @param info a {@code Map<String,Object>} object containing
|
||||
* properties for additional configuration supported by synthesizer.
|
||||
* If <code>info</code> is null then default settings are used.
|
||||
* If {@code info} is null then default settings are used.
|
||||
*
|
||||
* @throws MidiUnavailableException thrown if the synthesizer cannot be
|
||||
* opened due to resource restrictions.
|
||||
|
@ -25,16 +25,16 @@
|
||||
package com.sun.media.sound;
|
||||
|
||||
/**
|
||||
* Information about property used in opening <code>AudioSynthesizer</code>.
|
||||
* Information about property used in opening {@code AudioSynthesizer}.
|
||||
*
|
||||
* @author Karl Helgason
|
||||
*/
|
||||
public final class AudioSynthesizerPropertyInfo {
|
||||
|
||||
/**
|
||||
* Constructs a <code>AudioSynthesizerPropertyInfo</code> object with a given
|
||||
* name and value. The <code>description</code> and <code>choices</code>
|
||||
* are initialized by <code>null</code> values.
|
||||
* Constructs a {@code AudioSynthesizerPropertyInfo} object with a given
|
||||
* name and value. The {@code description} and {@code choices}
|
||||
* are initialized by {@code null} values.
|
||||
*
|
||||
* @param name the name of the property
|
||||
* @param value the current value or class used for values.
|
||||
@ -60,18 +60,18 @@ public final class AudioSynthesizerPropertyInfo {
|
||||
*/
|
||||
public String description = null;
|
||||
/**
|
||||
* The <code>value</code> field specifies the current value of
|
||||
* The {@code value} field specifies the current value of
|
||||
* the property.
|
||||
*/
|
||||
public Object value = null;
|
||||
/**
|
||||
* The <code>valueClass</code> field specifies class
|
||||
* used in <code>value</code> field.
|
||||
* The {@code valueClass} field specifies class
|
||||
* used in {@code value} field.
|
||||
*/
|
||||
public Class<?> valueClass = null;
|
||||
/**
|
||||
* An array of possible values if the value for the field
|
||||
* <code>AudioSynthesizerPropertyInfo.value</code> may be selected
|
||||
* {@code AudioSynthesizerPropertyInfo.value} may be selected
|
||||
* from a particular set of values; otherwise null.
|
||||
*/
|
||||
public Object[] choices = null;
|
||||
|
@ -250,7 +250,7 @@ public final class MidiUtils {
|
||||
/**
|
||||
* Binary search for the event indexes of the track
|
||||
*
|
||||
* @param tick - tick number of index to be found in array
|
||||
* @param tick tick number of index to be found in array
|
||||
* @return index in track which is on or after "tick".
|
||||
* if no entries are found that follow after tick, track.size() is returned
|
||||
*/
|
||||
|
@ -33,7 +33,6 @@ import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
|
||||
|
||||
/**
|
||||
* Converts among signed/unsigned and little/big endianness of sampled.
|
||||
*
|
||||
@ -52,11 +51,6 @@ public final class PCMtoPCMCodec extends SunCodec {
|
||||
AudioFormat.Encoding.PCM_UNSIGNED,
|
||||
};
|
||||
|
||||
|
||||
|
||||
private static final int tempBufferSize = 64;
|
||||
private byte tempBuffer [] = null;
|
||||
|
||||
/**
|
||||
* Constructs a new PCMtoPCM codec object.
|
||||
*/
|
||||
@ -67,21 +61,31 @@ public final class PCMtoPCMCodec extends SunCodec {
|
||||
|
||||
// NEW CODE
|
||||
|
||||
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
|
||||
|
||||
/**
|
||||
*/
|
||||
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
|
||||
|
||||
if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED ) ||
|
||||
sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_UNSIGNED ) ) {
|
||||
|
||||
AudioFormat.Encoding encs[] = new AudioFormat.Encoding[2];
|
||||
encs[0] = AudioFormat.Encoding.PCM_SIGNED;
|
||||
encs[1] = AudioFormat.Encoding.PCM_UNSIGNED;
|
||||
return encs;
|
||||
} else {
|
||||
return new AudioFormat.Encoding[0];
|
||||
final int sampleSize = sourceFormat.getSampleSizeInBits();
|
||||
AudioFormat.Encoding encoding = sourceFormat.getEncoding();
|
||||
if (sampleSize == 8) {
|
||||
if (encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) {
|
||||
return new AudioFormat.Encoding[]{
|
||||
AudioFormat.Encoding.PCM_UNSIGNED
|
||||
};
|
||||
}
|
||||
if (encoding.equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
|
||||
return new AudioFormat.Encoding[]{
|
||||
AudioFormat.Encoding.PCM_SIGNED
|
||||
};
|
||||
}
|
||||
} else if (sampleSize == 16) {
|
||||
if (encoding.equals(AudioFormat.Encoding.PCM_SIGNED)
|
||||
|| encoding.equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
|
||||
return new AudioFormat.Encoding[]{
|
||||
AudioFormat.Encoding.PCM_UNSIGNED,
|
||||
AudioFormat.Encoding.PCM_SIGNED
|
||||
};
|
||||
}
|
||||
}
|
||||
return new AudioFormat.Encoding[0];
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +129,7 @@ public final class PCMtoPCMCodec extends SunCodec {
|
||||
sourceFormat.getFrameRate(),
|
||||
sourceFormat.isBigEndian() );
|
||||
|
||||
return getAudioInputStream( targetFormat, sourceStream );
|
||||
return getConvertedStream(targetFormat, sourceStream);
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString() );
|
||||
@ -136,7 +140,10 @@ public final class PCMtoPCMCodec extends SunCodec {
|
||||
* use old code
|
||||
*/
|
||||
public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
|
||||
|
||||
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
|
||||
throw new IllegalArgumentException("Unsupported conversion: "
|
||||
+ sourceStream.getFormat().toString() + " to "
|
||||
+ targetFormat.toString());
|
||||
return getConvertedStream( targetFormat, sourceStream );
|
||||
}
|
||||
|
||||
@ -166,7 +173,6 @@ public final class PCMtoPCMCodec extends SunCodec {
|
||||
} else {
|
||||
|
||||
cs = (AudioInputStream) (new PCMtoPCMCodecStream(stream, outputFormat));
|
||||
tempBuffer = new byte[tempBufferSize];
|
||||
}
|
||||
return cs;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
package com.sun.media.sound;
|
||||
|
||||
/**
|
||||
* <code>SoftControl</code> are the basic controls
|
||||
* {@code SoftControl} are the basic controls
|
||||
* used for control-rate processing.
|
||||
*
|
||||
* @author Karl Helgason
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -131,7 +132,8 @@ public final class SoftMidiAudioFileReader extends SunFileReader {
|
||||
stream.mark(200);
|
||||
try {
|
||||
return getAudioInputStream(MidiSystem.getSequence(stream));
|
||||
} catch (final InvalidMidiDataException ignored) {
|
||||
} catch (InvalidMidiDataException | EOFException ignored) {
|
||||
// stream is unsupported or the header is less than was expected
|
||||
stream.reset();
|
||||
throw new UnsupportedAudioFileException();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -26,11 +26,8 @@
|
||||
package com.sun.media.sound;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
|
||||
import javax.sound.sampled.spi.FormatConversionProvider;
|
||||
|
||||
|
||||
/**
|
||||
* A codec can encode and/or decode audio data. It provides an
|
||||
* AudioInputStream from which processed data may be read.
|
||||
@ -73,23 +70,4 @@ abstract class SunCodec extends FormatConversionProvider {
|
||||
System.arraycopy(outputEncodings, 0, encodings, 0, outputEncodings.length);
|
||||
return encodings;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat);
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat);
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream);
|
||||
/**
|
||||
*/
|
||||
public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream);
|
||||
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ package com.sun.media.sound;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@ -51,6 +52,9 @@ abstract class SunFileReader extends AudioFileReader {
|
||||
stream.mark(200); // The biggest value which was historically used
|
||||
try {
|
||||
return getAudioFileFormatImpl(stream);
|
||||
} catch (final EOFException ignored) {
|
||||
// the header is less than was expected
|
||||
throw new UnsupportedAudioFileException();
|
||||
} finally {
|
||||
stream.reset();
|
||||
}
|
||||
@ -61,6 +65,9 @@ abstract class SunFileReader extends AudioFileReader {
|
||||
throws UnsupportedAudioFileException, IOException {
|
||||
try (InputStream is = url.openStream()) {
|
||||
return getAudioFileFormatImpl(new BufferedInputStream(is));
|
||||
} catch (final EOFException ignored) {
|
||||
// the header is less than was expected
|
||||
throw new UnsupportedAudioFileException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +76,9 @@ abstract class SunFileReader extends AudioFileReader {
|
||||
throws UnsupportedAudioFileException, IOException {
|
||||
try (InputStream is = new FileInputStream(file)) {
|
||||
return getAudioFileFormatImpl(new BufferedInputStream(is));
|
||||
} catch (final EOFException ignored) {
|
||||
// the header is less than was expected
|
||||
throw new UnsupportedAudioFileException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,9 +92,10 @@ abstract class SunFileReader extends AudioFileReader {
|
||||
// beginning of the audio data, so return an AudioInputStream
|
||||
return new AudioInputStream(stream, fileFormat.getFormat(),
|
||||
fileFormat.getFrameLength());
|
||||
} catch (final UnsupportedAudioFileException e) {
|
||||
} catch (UnsupportedAudioFileException | EOFException ignored) {
|
||||
// stream is unsupported or the header is less than was expected
|
||||
stream.reset();
|
||||
throw e;
|
||||
throw new UnsupportedAudioFileException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,6 +136,9 @@ abstract class SunFileReader extends AudioFileReader {
|
||||
* @throws UnsupportedAudioFileException if the stream does not point to
|
||||
* valid audio file data recognized by the system
|
||||
* @throws IOException if an I/O exception occurs
|
||||
* @throws EOFException is used incorrectly by our readers instead of
|
||||
* UnsupportedAudioFileException if the header is less than was
|
||||
* expected
|
||||
*/
|
||||
abstract AudioFileFormat getAudioFileFormatImpl(InputStream stream)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -25,19 +25,13 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.spi.AudioFileWriter;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Abstract File Writer class.
|
||||
*
|
||||
@ -75,14 +69,6 @@ abstract class SunFileWriter extends AudioFileWriter {
|
||||
return localArray;
|
||||
}
|
||||
|
||||
|
||||
public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);
|
||||
|
||||
public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException;
|
||||
|
||||
public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException;
|
||||
|
||||
|
||||
// HELPER METHODS
|
||||
|
||||
|
||||
|
@ -26,13 +26,12 @@
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
|
||||
|
||||
/**
|
||||
@ -126,43 +125,46 @@ public final class UlawCodec extends SunCodec {
|
||||
AudioFormat sourceFormat = sourceStream.getFormat();
|
||||
AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
|
||||
|
||||
if (!isConversionSupported(targetEncoding,sourceStream.getFormat())) {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
if (sourceEncoding.equals(targetEncoding)) {
|
||||
return sourceStream;
|
||||
} else {
|
||||
AudioFormat targetFormat = null;
|
||||
if (!isConversionSupported(targetEncoding,sourceStream.getFormat())) {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
if (AudioFormat.Encoding.ULAW.equals(sourceEncoding) &&
|
||||
AudioFormat.Encoding.PCM_SIGNED.equals(targetEncoding) ) {
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
16,
|
||||
sourceFormat.getChannels(),
|
||||
2*sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
sourceFormat.isBigEndian());
|
||||
} else if (AudioFormat.Encoding.PCM_SIGNED.equals(sourceEncoding) &&
|
||||
AudioFormat.Encoding.ULAW.equals(targetEncoding)) {
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
8,
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
false);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
|
||||
return getAudioInputStream( targetFormat, sourceStream );
|
||||
}
|
||||
AudioFormat targetFormat = null;
|
||||
if (AudioFormat.Encoding.ULAW.equals(sourceEncoding) &&
|
||||
AudioFormat.Encoding.PCM_SIGNED.equals(targetEncoding) ) {
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
16,
|
||||
sourceFormat.getChannels(),
|
||||
2*sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
sourceFormat.isBigEndian());
|
||||
} else if (AudioFormat.Encoding.PCM_SIGNED.equals(sourceEncoding) &&
|
||||
AudioFormat.Encoding.ULAW.equals(targetEncoding)) {
|
||||
targetFormat = new AudioFormat( targetEncoding,
|
||||
sourceFormat.getSampleRate(),
|
||||
8,
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getChannels(),
|
||||
sourceFormat.getSampleRate(),
|
||||
false);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported conversion: " + sourceStream.getFormat().toString() + " to " + targetEncoding.toString());
|
||||
}
|
||||
|
||||
return getConvertedStream(targetFormat, sourceStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* use old code...
|
||||
*/
|
||||
public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
|
||||
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
|
||||
throw new IllegalArgumentException("Unsupported conversion: "
|
||||
+ sourceStream.getFormat().toString() + " to "
|
||||
+ targetFormat.toString());
|
||||
return getConvertedStream(targetFormat, sourceStream);
|
||||
}
|
||||
|
||||
@ -215,24 +217,20 @@ public final class UlawCodec extends SunCodec {
|
||||
false );
|
||||
formats.addElement(format);
|
||||
}
|
||||
|
||||
if (AudioFormat.Encoding.ULAW.equals(inputFormat.getEncoding())) {
|
||||
if (inputFormat.getSampleSizeInBits() == 8
|
||||
&& AudioFormat.Encoding.ULAW.equals(inputFormat.getEncoding())) {
|
||||
format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
|
||||
inputFormat.getSampleRate(),
|
||||
16,
|
||||
inputFormat.getSampleRate(), 16,
|
||||
inputFormat.getChannels(),
|
||||
inputFormat.getChannels()*2,
|
||||
inputFormat.getSampleRate(),
|
||||
false );
|
||||
inputFormat.getChannels() * 2,
|
||||
inputFormat.getSampleRate(), false);
|
||||
formats.addElement(format);
|
||||
|
||||
format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
|
||||
inputFormat.getSampleRate(),
|
||||
16,
|
||||
inputFormat.getSampleRate(), 16,
|
||||
inputFormat.getChannels(),
|
||||
inputFormat.getChannels()*2,
|
||||
inputFormat.getSampleRate(),
|
||||
true );
|
||||
inputFormat.getChannels() * 2,
|
||||
inputFormat.getSampleRate(), true);
|
||||
formats.addElement(format);
|
||||
}
|
||||
|
||||
@ -244,7 +242,7 @@ public final class UlawCodec extends SunCodec {
|
||||
}
|
||||
|
||||
|
||||
class UlawCodecStream extends AudioInputStream {
|
||||
private final class UlawCodecStream extends AudioInputStream {
|
||||
|
||||
private static final int tempBufferSize = 64;
|
||||
private byte tempBuffer [] = null;
|
||||
@ -416,6 +414,12 @@ public final class UlawCodec extends SunCodec {
|
||||
return (i - off);
|
||||
}
|
||||
}
|
||||
} // end class UlawCodecStream
|
||||
|
||||
@Override
|
||||
public long skip(final long n) throws IOException {
|
||||
// Implementation of this method assumes that we support
|
||||
// encoding/decoding from/to 8/16 bits only
|
||||
return encode ? super.skip(n * 2) / 2 : super.skip(n / 2) * 2;
|
||||
}
|
||||
} // end class UlawCodecStream
|
||||
} // end class ULAW
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, 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
|
||||
@ -124,7 +124,6 @@ public final class WaveExtensibleFileReader extends SunFileReader {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final String[] channelnames = { "FL", "FR", "FC", "LF",
|
||||
@ -196,9 +195,9 @@ public final class WaveExtensibleFileReader extends SunFileReader {
|
||||
fmt_found = true;
|
||||
|
||||
int format = chunk.readUnsignedShort();
|
||||
if (format != 0xFFFE)
|
||||
throw new UnsupportedAudioFileException(); // WAVE_FORMAT_EXTENSIBLE
|
||||
// only
|
||||
if (format != WaveFileFormat.WAVE_FORMAT_EXTENSIBLE) {
|
||||
throw new UnsupportedAudioFileException();
|
||||
}
|
||||
channels = chunk.readUnsignedShort();
|
||||
samplerate = chunk.readUnsignedInt();
|
||||
/* framerate = */chunk.readUnsignedInt();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -28,13 +28,11 @@ package com.sun.media.sound;
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
|
||||
|
||||
/**
|
||||
* WAVE file format class.
|
||||
*
|
||||
* @author Jan Borgersen
|
||||
*/
|
||||
|
||||
final class WaveFileFormat extends AudioFileFormat {
|
||||
|
||||
/**
|
||||
@ -53,15 +51,16 @@ final class WaveFileFormat extends AudioFileFormat {
|
||||
private static final int STANDARD_FMT_CHUNK_SIZE = 16;
|
||||
|
||||
// magic numbers
|
||||
static final int RIFF_MAGIC = 1380533830;
|
||||
static final int WAVE_MAGIC = 1463899717;
|
||||
static final int FMT_MAGIC = 0x666d7420; // "fmt "
|
||||
static final int DATA_MAGIC = 0x64617461; // "data"
|
||||
static final int RIFF_MAGIC = 1380533830;
|
||||
static final int WAVE_MAGIC = 1463899717;
|
||||
static final int FMT_MAGIC = 0x666d7420; // "fmt "
|
||||
static final int DATA_MAGIC = 0x64617461; // "data"
|
||||
|
||||
// encodings
|
||||
static final int WAVE_FORMAT_UNKNOWN = 0x0000;
|
||||
static final int WAVE_FORMAT_PCM = 0x0001;
|
||||
static final int WAVE_FORMAT_ADPCM = 0x0002;
|
||||
static final int WAVE_FORMAT_IEEE_FLOAT= 0x0003;
|
||||
static final int WAVE_FORMAT_ALAW = 0x0006;
|
||||
static final int WAVE_FORMAT_MULAW = 0x0007;
|
||||
static final int WAVE_FORMAT_OKI_ADPCM = 0x0010;
|
||||
@ -72,12 +71,7 @@ final class WaveFileFormat extends AudioFileFormat {
|
||||
static final int WAVE_IBM_FORMAT_ADPCM = 0x0103;
|
||||
static final int WAVE_FORMAT_DVI_ADPCM = 0x0011;
|
||||
static final int WAVE_FORMAT_SX7383 = 0x1C07;
|
||||
|
||||
|
||||
WaveFileFormat( AudioFileFormat aff ) {
|
||||
|
||||
this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
|
||||
}
|
||||
static final int WAVE_FORMAT_EXTENSIBLE= 0xFFFE;
|
||||
|
||||
WaveFileFormat(AudioFileFormat.Type type, int lengthInBytes, AudioFormat format, int lengthInFrames) {
|
||||
|
||||
@ -98,7 +92,6 @@ final class WaveFileFormat extends AudioFileFormat {
|
||||
}
|
||||
|
||||
int getWaveType() {
|
||||
|
||||
return waveType;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, 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
|
||||
@ -25,23 +25,22 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
|
||||
//$$fb this class is buggy. Should be replaced in future.
|
||||
@ -53,27 +52,6 @@ import javax.sound.sampled.AudioSystem;
|
||||
*/
|
||||
public final class WaveFileWriter extends SunFileWriter {
|
||||
|
||||
// magic numbers
|
||||
static final int RIFF_MAGIC = 1380533830;
|
||||
static final int WAVE_MAGIC = 1463899717;
|
||||
static final int FMT_MAGIC = 0x666d7420; // "fmt "
|
||||
static final int DATA_MAGIC = 0x64617461; // "data"
|
||||
|
||||
// encodings
|
||||
static final int WAVE_FORMAT_UNKNOWN = 0x0000;
|
||||
static final int WAVE_FORMAT_PCM = 0x0001;
|
||||
static final int WAVE_FORMAT_ADPCM = 0x0002;
|
||||
static final int WAVE_FORMAT_ALAW = 0x0006;
|
||||
static final int WAVE_FORMAT_MULAW = 0x0007;
|
||||
static final int WAVE_FORMAT_OKI_ADPCM = 0x0010;
|
||||
static final int WAVE_FORMAT_DIGISTD = 0x0015;
|
||||
static final int WAVE_FORMAT_DIGIFIX = 0x0016;
|
||||
static final int WAVE_IBM_FORMAT_MULAW = 0x0101;
|
||||
static final int WAVE_IBM_FORMAT_ALAW = 0x0102;
|
||||
static final int WAVE_IBM_FORMAT_ADPCM = 0x0103;
|
||||
static final int WAVE_FORMAT_DVI_ADPCM = 0x0011;
|
||||
static final int WAVE_FORMAT_SX7383 = 0x1C07;
|
||||
|
||||
/**
|
||||
* Constructs a new WaveFileWriter object.
|
||||
*/
|
||||
@ -81,10 +59,7 @@ public final class WaveFileWriter extends SunFileWriter {
|
||||
super(new AudioFileFormat.Type[]{AudioFileFormat.Type.WAVE});
|
||||
}
|
||||
|
||||
|
||||
// METHODS TO IMPLEMENT AudioFileWriter
|
||||
|
||||
|
||||
@Override
|
||||
public AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
|
||||
|
||||
AudioFileFormat.Type[] filetypes = new AudioFileFormat.Type[types.length];
|
||||
@ -106,6 +81,7 @@ public final class WaveFileWriter extends SunFileWriter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
@ -125,11 +101,11 @@ public final class WaveFileWriter extends SunFileWriter {
|
||||
throw new IOException("stream length not specified");
|
||||
}
|
||||
|
||||
int bytesWritten = writeWaveFile(stream, waveFileFormat, out);
|
||||
return bytesWritten;
|
||||
return writeWaveFile(stream, waveFileFormat, out);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
@ -173,6 +149,9 @@ public final class WaveFileWriter extends SunFileWriter {
|
||||
* Throws IllegalArgumentException if not supported.
|
||||
*/
|
||||
private AudioFileFormat getAudioFileFormat(AudioFileFormat.Type type, AudioInputStream stream) {
|
||||
if (!isFileTypeSupported(type, stream)) {
|
||||
throw new IllegalArgumentException("File type " + type + " not supported.");
|
||||
}
|
||||
AudioFormat format = null;
|
||||
WaveFileFormat fileFormat = null;
|
||||
AudioFormat.Encoding encoding = AudioFormat.Encoding.PCM_SIGNED;
|
||||
@ -187,9 +166,6 @@ public final class WaveFileWriter extends SunFileWriter {
|
||||
float frameRate;
|
||||
int fileSize;
|
||||
|
||||
if (!types[0].equals(type)) {
|
||||
throw new IllegalArgumentException("File type " + type + " not supported.");
|
||||
}
|
||||
int waveType = WaveFileFormat.WAVE_FORMAT_PCM;
|
||||
|
||||
if( AudioFormat.Encoding.ALAW.equals(streamEncoding) ||
|
||||
@ -198,9 +174,9 @@ public final class WaveFileWriter extends SunFileWriter {
|
||||
encoding = streamEncoding;
|
||||
sampleSizeInBits = streamFormat.getSampleSizeInBits();
|
||||
if (streamEncoding.equals(AudioFormat.Encoding.ALAW)) {
|
||||
waveType = WAVE_FORMAT_ALAW;
|
||||
waveType = WaveFileFormat.WAVE_FORMAT_ALAW;
|
||||
} else {
|
||||
waveType = WAVE_FORMAT_MULAW;
|
||||
waveType = WaveFileFormat.WAVE_FORMAT_MULAW;
|
||||
}
|
||||
} else if ( streamFormat.getSampleSizeInBits()==8 ) {
|
||||
encoding = AudioFormat.Encoding.PCM_UNSIGNED;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, 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
|
||||
@ -67,8 +67,9 @@ public final class WaveFloatFileReader extends SunFileReader {
|
||||
fmt_found = true;
|
||||
|
||||
int format = chunk.readUnsignedShort();
|
||||
if (format != 3) // WAVE_FORMAT_IEEE_FLOAT only
|
||||
if (format != WaveFileFormat.WAVE_FORMAT_IEEE_FLOAT) {
|
||||
throw new UnsupportedAudioFileException();
|
||||
}
|
||||
channels = chunk.readUnsignedShort();
|
||||
samplerate = chunk.readUnsignedInt();
|
||||
/* framerate = */chunk.readUnsignedInt();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2016, 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
|
||||
@ -22,18 +22,20 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioFileFormat.Type;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioFormat.Encoding;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.AudioFileFormat.Type;
|
||||
import javax.sound.sampled.spi.AudioFileWriter;
|
||||
|
||||
/**
|
||||
@ -43,10 +45,12 @@ import javax.sound.sampled.spi.AudioFileWriter;
|
||||
*/
|
||||
public final class WaveFloatFileWriter extends AudioFileWriter {
|
||||
|
||||
@Override
|
||||
public Type[] getAudioFileTypes() {
|
||||
return new Type[] { Type.WAVE };
|
||||
return new Type[]{Type.WAVE};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type[] getAudioFileTypes(AudioInputStream stream) {
|
||||
|
||||
if (!stream.getFormat().getEncoding().equals(Encoding.PCM_FLOAT))
|
||||
@ -92,18 +96,22 @@ public final class WaveFloatFileWriter extends AudioFileWriter {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
out.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
out.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
out.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
out.write(b);
|
||||
}
|
||||
@ -118,8 +126,12 @@ public final class WaveFloatFileWriter extends AudioFileWriter {
|
||||
return AudioSystem.getAudioInputStream(targetFormat, ais);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, Type fileType, OutputStream out)
|
||||
throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
Objects.requireNonNull(out);
|
||||
|
||||
checkFormat(fileType, stream);
|
||||
if (stream.getFormat().isBigEndian())
|
||||
@ -131,8 +143,13 @@ public final class WaveFloatFileWriter extends AudioFileWriter {
|
||||
return fpointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int write(AudioInputStream stream, Type fileType, File out)
|
||||
throws IOException {
|
||||
Objects.requireNonNull(stream);
|
||||
Objects.requireNonNull(fileType);
|
||||
Objects.requireNonNull(out);
|
||||
|
||||
checkFormat(fileType, stream);
|
||||
if (stream.getFormat().isBigEndian())
|
||||
stream = toLittleEndian(stream);
|
||||
@ -142,5 +159,4 @@ public final class WaveFloatFileWriter extends AudioFileWriter {
|
||||
writer.close();
|
||||
return fpointer;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,9 +38,9 @@ import javax.accessibility.*;
|
||||
* An applet is a small program that is intended not to be run on
|
||||
* its own, but rather to be embedded inside another application.
|
||||
* <p>
|
||||
* The <code>Applet</code> class must be the superclass of any
|
||||
* The {@code Applet} class must be the superclass of any
|
||||
* applet that is to be embedded in a Web page or viewed by the Java
|
||||
* Applet Viewer. The <code>Applet</code> class provides a standard
|
||||
* Applet Viewer. The {@code Applet} class provides a standard
|
||||
* interface between applets and their environment.
|
||||
*
|
||||
* @author Arthur van Hoff
|
||||
@ -52,10 +52,10 @@ public class Applet extends Panel {
|
||||
/**
|
||||
* Constructs a new Applet.
|
||||
* <p>
|
||||
* Note: Many methods in <code>java.applet.Applet</code>
|
||||
* Note: Many methods in {@code java.applet.Applet}
|
||||
* may be invoked by the applet only after the applet is
|
||||
* fully constructed; applet should avoid calling methods
|
||||
* in <code>java.applet.Applet</code> in the constructor.
|
||||
* in {@code java.applet.Applet} in the constructor.
|
||||
*
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true.
|
||||
@ -88,8 +88,8 @@ public class Applet extends Panel {
|
||||
* Read an applet from an object input stream.
|
||||
* @param s an object input stream.
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless()</code> returns
|
||||
* <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless()} returns
|
||||
* {@code true}
|
||||
* @serial
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
* @since 1.4
|
||||
@ -104,9 +104,9 @@ public class Applet extends Panel {
|
||||
|
||||
/**
|
||||
* Sets this applet's stub. This is done automatically by the system.
|
||||
* <p>If there is a security manager, its <code> checkPermission </code>
|
||||
* <p>If there is a security manager, its {@code checkPermission}
|
||||
* method is called with the
|
||||
* <code>AWTPermission("setAppletStub")</code>
|
||||
* {@code AWTPermission("setAppletStub")}
|
||||
* permission if a stub has already been set.
|
||||
* @param stub the new stub.
|
||||
* @exception SecurityException if the caller cannot set the stub
|
||||
@ -123,11 +123,11 @@ public class Applet extends Panel {
|
||||
|
||||
/**
|
||||
* Determines if this applet is active. An applet is marked active
|
||||
* just before its <code>start</code> method is called. It becomes
|
||||
* inactive just before its <code>stop</code> method is called.
|
||||
* just before its {@code start} method is called. It becomes
|
||||
* inactive just before its {@code stop} method is called.
|
||||
*
|
||||
* @return <code>true</code> if the applet is active;
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if the applet is active;
|
||||
* {@code false} otherwise.
|
||||
* @see java.applet.Applet#start()
|
||||
* @see java.applet.Applet#stop()
|
||||
*/
|
||||
@ -179,14 +179,14 @@ public class Applet extends Panel {
|
||||
* </applet>
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
* then a call to <code>getParameter("Color")</code> returns the
|
||||
* value <code>"blue"</code>.
|
||||
* then a call to {@code getParameter("Color")} returns the
|
||||
* value {@code "blue"}.
|
||||
* <p>
|
||||
* The <code>name</code> argument is case insensitive.
|
||||
* The {@code name} argument is case insensitive.
|
||||
*
|
||||
* @param name a parameter name.
|
||||
* @return the value of the named parameter,
|
||||
* or <code>null</code> if not set.
|
||||
* or {@code null} if not set.
|
||||
*/
|
||||
public String getParameter(String name) {
|
||||
return stub.getParameter(name);
|
||||
@ -260,8 +260,8 @@ public class Applet extends Panel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>Image</code> object that can then be painted on
|
||||
* the screen. The <code>url</code> that is passed as an argument
|
||||
* Returns an {@code Image} object that can then be painted on
|
||||
* the screen. The {@code url} that is passed as an argument
|
||||
* must specify an absolute URL.
|
||||
* <p>
|
||||
* This method always returns immediately, whether or not the image
|
||||
@ -278,10 +278,10 @@ public class Applet extends Panel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>Image</code> object that can then be painted on
|
||||
* the screen. The <code>url</code> argument must specify an absolute
|
||||
* URL. The <code>name</code> argument is a specifier that is
|
||||
* relative to the <code>url</code> argument.
|
||||
* Returns an {@code Image} object that can then be painted on
|
||||
* the screen. The {@code url} argument must specify an absolute
|
||||
* URL. The {@code name} argument is a specifier that is
|
||||
* relative to the {@code url} argument.
|
||||
* <p>
|
||||
* This method always returns immediately, whether or not the image
|
||||
* exists. When this applet attempts to draw the image on the screen,
|
||||
@ -290,7 +290,7 @@ public class Applet extends Panel {
|
||||
*
|
||||
* @param url an absolute URL giving the base location of the image.
|
||||
* @param name the location of the image, relative to the
|
||||
* <code>url</code> argument.
|
||||
* {@code url} argument.
|
||||
* @return the image at the specified URL.
|
||||
* @see java.awt.Image
|
||||
*/
|
||||
@ -315,8 +315,8 @@ public class Applet extends Panel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>AudioClip</code> object specified by the
|
||||
* <code>URL</code> argument.
|
||||
* Returns the {@code AudioClip} object specified by the
|
||||
* {@code URL} argument.
|
||||
* <p>
|
||||
* This method always returns immediately, whether or not the audio
|
||||
* clip exists. When this applet attempts to play the audio clip, the
|
||||
@ -331,8 +331,8 @@ public class Applet extends Panel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>AudioClip</code> object specified by the
|
||||
* <code>URL</code> and <code>name</code> arguments.
|
||||
* Returns the {@code AudioClip} object specified by the
|
||||
* {@code URL} and {@code name} arguments.
|
||||
* <p>
|
||||
* This method always returns immediately, whether or not the audio
|
||||
* clip exists. When this applet attempts to play the audio clip, the
|
||||
@ -341,7 +341,7 @@ public class Applet extends Panel {
|
||||
* @param url an absolute URL giving the base location of the
|
||||
* audio clip.
|
||||
* @param name the location of the audio clip, relative to the
|
||||
* <code>url</code> argument.
|
||||
* {@code url} argument.
|
||||
* @return the audio clip at the specified URL.
|
||||
* @see java.applet.AudioClip
|
||||
*/
|
||||
@ -355,11 +355,11 @@ public class Applet extends Panel {
|
||||
|
||||
/**
|
||||
* Returns information about this applet. An applet should override
|
||||
* this method to return a <code>String</code> containing information
|
||||
* this method to return a {@code String} containing information
|
||||
* about the author, version, and copyright of the applet.
|
||||
* <p>
|
||||
* The implementation of this method provided by the
|
||||
* <code>Applet</code> class returns <code>null</code>.
|
||||
* {@code Applet} class returns {@code null}.
|
||||
*
|
||||
* @return a string containing information about the author, version, and
|
||||
* copyright of the applet.
|
||||
@ -388,10 +388,10 @@ public class Applet extends Panel {
|
||||
/**
|
||||
* Returns information about the parameters that are understood by
|
||||
* this applet. An applet should override this method to return an
|
||||
* array of <code>Strings</code> describing these parameters.
|
||||
* array of {@code Strings} describing these parameters.
|
||||
* <p>
|
||||
* Each element of the array should be a set of three
|
||||
* <code>Strings</code> containing the name, the type, and a
|
||||
* {@code Strings} containing the name, the type, and a
|
||||
* description. For example:
|
||||
* <blockquote><pre>
|
||||
* String pinfo[][] = {
|
||||
@ -402,7 +402,7 @@ public class Applet extends Panel {
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
* The implementation of this method provided by the
|
||||
* <code>Applet</code> class returns <code>null</code>.
|
||||
* {@code Applet} class returns {@code null}.
|
||||
*
|
||||
* @return an array describing the parameters this applet looks for.
|
||||
*/
|
||||
@ -430,7 +430,7 @@ public class Applet extends Panel {
|
||||
* @param url an absolute URL giving the base location of the
|
||||
* audio clip.
|
||||
* @param name the location of the audio clip, relative to the
|
||||
* <code>url</code> argument.
|
||||
* {@code url} argument.
|
||||
*/
|
||||
public void play(URL url, String name) {
|
||||
AudioClip clip = getAudioClip(url, name);
|
||||
@ -442,16 +442,16 @@ public class Applet extends Panel {
|
||||
/**
|
||||
* Called by the browser or applet viewer to inform
|
||||
* this applet that it has been loaded into the system. It is always
|
||||
* called before the first time that the <code>start</code> method is
|
||||
* called before the first time that the {@code start} method is
|
||||
* called.
|
||||
* <p>
|
||||
* A subclass of <code>Applet</code> should override this method if
|
||||
* A subclass of {@code Applet} should override this method if
|
||||
* it has initialization to perform. For example, an applet with
|
||||
* threads would use the <code>init</code> method to create the
|
||||
* threads and the <code>destroy</code> method to kill them.
|
||||
* threads would use the {@code init} method to create the
|
||||
* threads and the {@code destroy} method to kill them.
|
||||
* <p>
|
||||
* The implementation of this method provided by the
|
||||
* <code>Applet</code> class does nothing.
|
||||
* {@code Applet} class does nothing.
|
||||
*
|
||||
* @see java.applet.Applet#destroy()
|
||||
* @see java.applet.Applet#start()
|
||||
@ -463,25 +463,25 @@ public class Applet extends Panel {
|
||||
/**
|
||||
* Called by the browser or applet viewer to inform
|
||||
* this applet that it should start its execution. It is called after
|
||||
* the <code>init</code> method and each time the applet is revisited
|
||||
* the {@code init} method and each time the applet is revisited
|
||||
* in a Web page.
|
||||
* <p>
|
||||
* A subclass of <code>Applet</code> should override this method if
|
||||
* A subclass of {@code Applet} should override this method if
|
||||
* it has any operation that it wants to perform each time the Web
|
||||
* page containing it is visited. For example, an applet with
|
||||
* animation might want to use the <code>start</code> method to
|
||||
* resume animation, and the <code>stop</code> method to suspend the
|
||||
* animation might want to use the {@code start} method to
|
||||
* resume animation, and the {@code stop} method to suspend the
|
||||
* animation.
|
||||
* <p>
|
||||
* Note: some methods, such as <code>getLocationOnScreen</code>, can only
|
||||
* Note: some methods, such as {@code getLocationOnScreen}, can only
|
||||
* provide meaningful results if the applet is showing. Because
|
||||
* <code>isShowing</code> returns <code>false</code> when the applet's
|
||||
* <code>start</code> is first called, methods requiring
|
||||
* <code>isShowing</code> to return <code>true</code> should be called from
|
||||
* a <code>ComponentListener</code>.
|
||||
* {@code isShowing} returns {@code false} when the applet's
|
||||
* {@code start} is first called, methods requiring
|
||||
* {@code isShowing} to return {@code true} should be called from
|
||||
* a {@code ComponentListener}.
|
||||
* <p>
|
||||
* The implementation of this method provided by the
|
||||
* <code>Applet</code> class does nothing.
|
||||
* {@code Applet} class does nothing.
|
||||
*
|
||||
* @see java.applet.Applet#destroy()
|
||||
* @see java.applet.Applet#init()
|
||||
@ -498,15 +498,15 @@ public class Applet extends Panel {
|
||||
* the Web page that contains this applet has been replaced by
|
||||
* another page, and also just before the applet is to be destroyed.
|
||||
* <p>
|
||||
* A subclass of <code>Applet</code> should override this method if
|
||||
* A subclass of {@code Applet} should override this method if
|
||||
* it has any operation that it wants to perform each time the Web
|
||||
* page containing it is no longer visible. For example, an applet
|
||||
* with animation might want to use the <code>start</code> method to
|
||||
* resume animation, and the <code>stop</code> method to suspend the
|
||||
* with animation might want to use the {@code start} method to
|
||||
* resume animation, and the {@code stop} method to suspend the
|
||||
* animation.
|
||||
* <p>
|
||||
* The implementation of this method provided by the
|
||||
* <code>Applet</code> class does nothing.
|
||||
* {@code Applet} class does nothing.
|
||||
*
|
||||
* @see java.applet.Applet#destroy()
|
||||
* @see java.applet.Applet#init()
|
||||
@ -517,17 +517,17 @@ public class Applet extends Panel {
|
||||
/**
|
||||
* Called by the browser or applet viewer to inform
|
||||
* this applet that it is being reclaimed and that it should destroy
|
||||
* any resources that it has allocated. The <code>stop</code> method
|
||||
* will always be called before <code>destroy</code>.
|
||||
* any resources that it has allocated. The {@code stop} method
|
||||
* will always be called before {@code destroy}.
|
||||
* <p>
|
||||
* A subclass of <code>Applet</code> should override this method if
|
||||
* A subclass of {@code Applet} should override this method if
|
||||
* it has any operation that it wants to perform before it is
|
||||
* destroyed. For example, an applet with threads would use the
|
||||
* <code>init</code> method to create the threads and the
|
||||
* <code>destroy</code> method to kill them.
|
||||
* {@code init} method to create the threads and the
|
||||
* {@code destroy} method to kill them.
|
||||
* <p>
|
||||
* The implementation of this method provided by the
|
||||
* <code>Applet</code> class does nothing.
|
||||
* {@code Applet} class does nothing.
|
||||
*
|
||||
* @see java.applet.Applet#init()
|
||||
* @see java.applet.Applet#start()
|
||||
@ -561,7 +561,7 @@ public class Applet extends Panel {
|
||||
|
||||
/**
|
||||
* This class implements accessibility support for the
|
||||
* <code>Applet</code> class. It provides an implementation of the
|
||||
* {@code Applet} class. It provides an implementation of the
|
||||
* Java Accessibility API appropriate to applet user-interface elements.
|
||||
* @since 1.3
|
||||
*/
|
||||
|
@ -26,8 +26,8 @@
|
||||
package java.applet;
|
||||
|
||||
/**
|
||||
* The <code>AudioClip</code> interface is a simple abstraction for
|
||||
* playing a sound clip. Multiple <code>AudioClip</code> items can be
|
||||
* The {@code AudioClip} interface is a simple abstraction for
|
||||
* playing a sound clip. Multiple {@code AudioClip} items can be
|
||||
* playing at the same time, and the resulting sound is mixed
|
||||
* together to produce a composite.
|
||||
*
|
||||
|
@ -38,7 +38,7 @@ public class AWTError extends Error {
|
||||
private static final long serialVersionUID = -1819846354050686206L;
|
||||
|
||||
/**
|
||||
* Constructs an instance of <code>AWTError</code> with the specified
|
||||
* Constructs an instance of {@code AWTError} with the specified
|
||||
* detail message.
|
||||
* @param msg the detail message.
|
||||
* @since 1.0
|
||||
|
@ -410,11 +410,11 @@ public abstract class AWTEvent extends EventObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the state of this <code>Event</code>.
|
||||
* Returns a string representing the state of this {@code Event}.
|
||||
* This method is intended to be used only for debugging purposes, and the
|
||||
* content and format of the returned string may vary between
|
||||
* implementations. The returned string may be empty but may not be
|
||||
* <code>null</code>.
|
||||
* {@code null}.
|
||||
*
|
||||
* @return a string representation of this event
|
||||
*/
|
||||
|
@ -122,9 +122,9 @@ public class AWTEventMulticaster implements
|
||||
|
||||
/**
|
||||
* Creates an event multicaster instance which chains listener-a
|
||||
* with listener-b. Input parameters <code>a</code> and <code>b</code>
|
||||
* should not be <code>null</code>, though implementations may vary in
|
||||
* choosing whether or not to throw <code>NullPointerException</code>
|
||||
* with listener-b. Input parameters {@code a} and {@code b}
|
||||
* should not be {@code null}, though implementations may vary in
|
||||
* choosing whether or not to throw {@code NullPointerException}
|
||||
* in that case.
|
||||
* @param a listener-a
|
||||
* @param b listener-b
|
||||
@ -1078,30 +1078,30 @@ public class AWTEventMulticaster implements
|
||||
/**
|
||||
* Returns an array of all the objects chained as
|
||||
* <code><em>Foo</em>Listener</code>s by the specified
|
||||
* <code>java.util.EventListener</code>.
|
||||
* {@code java.util.EventListener}.
|
||||
* <code><em>Foo</em>Listener</code>s are chained by the
|
||||
* <code>AWTEventMulticaster</code> using the
|
||||
* {@code AWTEventMulticaster} using the
|
||||
* <code>add<em>Foo</em>Listener</code> method.
|
||||
* If a <code>null</code> listener is specified, this method returns an
|
||||
* If a {@code null} listener is specified, this method returns an
|
||||
* empty array. If the specified listener is not an instance of
|
||||
* <code>AWTEventMulticaster</code>, this method returns an array which
|
||||
* {@code AWTEventMulticaster}, this method returns an array which
|
||||
* contains only the specified listener. If no such listeners are chained,
|
||||
* this method returns an empty array.
|
||||
*
|
||||
* @param <T> the listener type
|
||||
* @param l the specified <code>java.util.EventListener</code>
|
||||
* @param l the specified {@code java.util.EventListener}
|
||||
* @param listenerType the type of listeners requested; this parameter
|
||||
* should specify an interface that descends from
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
* @return an array of all objects chained as
|
||||
* <code><em>Foo</em>Listener</code>s by the specified multicast
|
||||
* listener, or an empty array if no such listeners have been
|
||||
* chained by the specified multicast listener
|
||||
* @exception NullPointerException if the specified
|
||||
* {@code listenertype} parameter is {@code null}
|
||||
* @exception ClassCastException if <code>listenerType</code>
|
||||
* @exception ClassCastException if {@code listenerType}
|
||||
* doesn't specify a class or interface that implements
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -38,9 +38,9 @@ public class AWTException extends Exception {
|
||||
private static final long serialVersionUID = -1900414231151323879L;
|
||||
|
||||
/**
|
||||
* Constructs an instance of <code>AWTException</code> with the
|
||||
* Constructs an instance of {@code AWTException} with the
|
||||
* specified detail message. A detail message is an
|
||||
* instance of <code>String</code> that describes this particular
|
||||
* instance of {@code String} that describes this particular
|
||||
* exception.
|
||||
* @param msg the detail message
|
||||
* @since 1.0
|
||||
|
@ -37,22 +37,22 @@ import java.lang.reflect.Field;
|
||||
import sun.swing.SwingAccessor;
|
||||
|
||||
/**
|
||||
* An <code>AWTKeyStroke</code> represents a key action on the
|
||||
* keyboard, or equivalent input device. <code>AWTKeyStroke</code>s
|
||||
* An {@code AWTKeyStroke} represents a key action on the
|
||||
* keyboard, or equivalent input device. {@code AWTKeyStroke}s
|
||||
* can correspond to only a press or release of a
|
||||
* particular key, just as <code>KEY_PRESSED</code> and
|
||||
* <code>KEY_RELEASED</code> <code>KeyEvent</code>s do;
|
||||
* particular key, just as {@code KEY_PRESSED} and
|
||||
* {@code KEY_RELEASED KeyEvent}s do;
|
||||
* alternately, they can correspond to typing a specific Java character, just
|
||||
* as <code>KEY_TYPED</code> <code>KeyEvent</code>s do.
|
||||
* In all cases, <code>AWTKeyStroke</code>s can specify modifiers
|
||||
* as {@code KEY_TYPED KeyEvent}s do.
|
||||
* In all cases, {@code AWTKeyStroke}s can specify modifiers
|
||||
* (alt, shift, control, meta, altGraph, or a combination thereof) which must be present
|
||||
* during the action for an exact match.
|
||||
* <p>
|
||||
* <code>AWTKeyStrokes</code> are immutable, and are intended
|
||||
* {@code AWTKeyStrokes} are immutable, and are intended
|
||||
* to be unique. Client code should never create an
|
||||
* <code>AWTKeyStroke</code> on its own, but should instead use
|
||||
* a variant of <code>getAWTKeyStroke</code>. Client use of these factory
|
||||
* methods allows the <code>AWTKeyStroke</code> implementation
|
||||
* {@code AWTKeyStroke} on its own, but should instead use
|
||||
* a variant of {@code getAWTKeyStroke}. Client use of these factory
|
||||
* methods allows the {@code AWTKeyStroke} implementation
|
||||
* to cache and share instances efficiently.
|
||||
*
|
||||
* @see #getAWTKeyStroke
|
||||
@ -88,17 +88,17 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an <code>AWTKeyStroke</code> with default values.
|
||||
* Constructs an {@code AWTKeyStroke} with default values.
|
||||
* The default values used are:
|
||||
* <table border="1" summary="AWTKeyStroke default values">
|
||||
* <tr><th>Property</th><th>Default Value</th></tr>
|
||||
* <tr>
|
||||
* <td>Key Char</td>
|
||||
* <td><code>KeyEvent.CHAR_UNDEFINED</code></td>
|
||||
* <td>{@code KeyEvent.CHAR_UNDEFINED}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>Key Code</td>
|
||||
* <td><code>KeyEvent.VK_UNDEFINED</code></td>
|
||||
* <td>{@code KeyEvent.VK_UNDEFINED}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>Modifiers</td>
|
||||
@ -106,12 +106,12 @@ public class AWTKeyStroke implements Serializable {
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>On key release?</td>
|
||||
* <td><code>false</code></td>
|
||||
* <td>{@code false}</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* <code>AWTKeyStroke</code>s should not be constructed
|
||||
* by client code. Use a variant of <code>getAWTKeyStroke</code>
|
||||
* {@code AWTKeyStroke}s should not be constructed
|
||||
* by client code. Use a variant of {@code getAWTKeyStroke}
|
||||
* instead.
|
||||
*
|
||||
* @see #getAWTKeyStroke
|
||||
@ -120,17 +120,17 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an <code>AWTKeyStroke</code> with the specified
|
||||
* values. <code>AWTKeyStroke</code>s should not be constructed
|
||||
* by client code. Use a variant of <code>getAWTKeyStroke</code>
|
||||
* Constructs an {@code AWTKeyStroke} with the specified
|
||||
* values. {@code AWTKeyStroke}s should not be constructed
|
||||
* by client code. Use a variant of {@code getAWTKeyStroke}
|
||||
* instead.
|
||||
*
|
||||
* @param keyChar the character value for a keyboard key
|
||||
* @param keyCode the key code for this <code>AWTKeyStroke</code>
|
||||
* @param keyCode the key code for this {@code AWTKeyStroke}
|
||||
* @param modifiers a bitwise-ored combination of any modifiers
|
||||
* @param onKeyRelease <code>true</code> if this
|
||||
* <code>AWTKeyStroke</code> corresponds
|
||||
* to a key release; <code>false</code> otherwise
|
||||
* @param onKeyRelease {@code true} if this
|
||||
* {@code AWTKeyStroke} corresponds
|
||||
* to a key release; {@code false} otherwise
|
||||
* @see #getAWTKeyStroke
|
||||
*/
|
||||
protected AWTKeyStroke(char keyChar, int keyCode, int modifiers,
|
||||
@ -185,12 +185,12 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a shared instance of an <code>AWTKeyStroke</code>
|
||||
* that represents a <code>KEY_TYPED</code> event for the
|
||||
* Returns a shared instance of an {@code AWTKeyStroke}
|
||||
* that represents a {@code KEY_TYPED} event for the
|
||||
* specified character.
|
||||
*
|
||||
* @param keyChar the character value for a keyboard key
|
||||
* @return an <code>AWTKeyStroke</code> object for that key
|
||||
* @return an {@code AWTKeyStroke} object for that key
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(char keyChar) {
|
||||
return getCachedStroke(keyChar, KeyEvent.VK_UNDEFINED, 0, false);
|
||||
@ -202,7 +202,7 @@ public class AWTKeyStroke implements Serializable {
|
||||
* specified Character object and a set of modifiers. Note
|
||||
* that the first parameter is of type Character rather than
|
||||
* char. This is to avoid inadvertent clashes with
|
||||
* calls to <code>getAWTKeyStroke(int keyCode, int modifiers)</code>.
|
||||
* calls to {@code getAWTKeyStroke(int keyCode, int modifiers)}.
|
||||
*
|
||||
* The modifiers consist of any combination of following:<ul>
|
||||
* <li>java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||
@ -227,9 +227,9 @@ public class AWTKeyStroke implements Serializable {
|
||||
*
|
||||
* @param keyChar the Character object for a keyboard character
|
||||
* @param modifiers a bitwise-ored combination of any modifiers
|
||||
* @return an <code>AWTKeyStroke</code> object for that key
|
||||
* @throws IllegalArgumentException if <code>keyChar</code> is
|
||||
* <code>null</code>
|
||||
* @return an {@code AWTKeyStroke} object for that key
|
||||
* @throws IllegalArgumentException if {@code keyChar} is
|
||||
* {@code null}
|
||||
*
|
||||
* @see java.awt.event.InputEvent
|
||||
*/
|
||||
@ -243,19 +243,19 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a shared instance of an <code>AWTKeyStroke</code>,
|
||||
* Returns a shared instance of an {@code AWTKeyStroke},
|
||||
* given a numeric key code and a set of modifiers, specifying
|
||||
* whether the key is activated when it is pressed or released.
|
||||
* <p>
|
||||
* The "virtual key" constants defined in
|
||||
* <code>java.awt.event.KeyEvent</code> can be
|
||||
* {@code java.awt.event.KeyEvent} can be
|
||||
* used to specify the key code. For example:<ul>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_ENTER</code>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_TAB</code>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_SPACE</code>
|
||||
* <li>{@code java.awt.event.KeyEvent.VK_ENTER}
|
||||
* <li>{@code java.awt.event.KeyEvent.VK_TAB}
|
||||
* <li>{@code java.awt.event.KeyEvent.VK_SPACE}
|
||||
* </ul>
|
||||
* Alternatively, the key code may be obtained by calling
|
||||
* <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
|
||||
* {@code java.awt.event.KeyEvent.getExtendedKeyCodeForChar}.
|
||||
*
|
||||
* The modifiers consist of any combination of:<ul>
|
||||
* <li>java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||
@ -279,8 +279,8 @@ public class AWTKeyStroke implements Serializable {
|
||||
*
|
||||
* @param keyCode an int specifying the numeric code for a keyboard key
|
||||
* @param modifiers a bitwise-ored combination of any modifiers
|
||||
* @param onKeyRelease <code>true</code> if the <code>AWTKeyStroke</code>
|
||||
* should represent a key release; <code>false</code> otherwise
|
||||
* @param onKeyRelease {@code true} if the {@code AWTKeyStroke}
|
||||
* should represent a key release; {@code false} otherwise
|
||||
* @return an AWTKeyStroke object for that key
|
||||
*
|
||||
* @see java.awt.event.KeyEvent
|
||||
@ -293,16 +293,16 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a shared instance of an <code>AWTKeyStroke</code>,
|
||||
* Returns a shared instance of an {@code AWTKeyStroke},
|
||||
* given a numeric key code and a set of modifiers. The returned
|
||||
* <code>AWTKeyStroke</code> will correspond to a key press.
|
||||
* {@code AWTKeyStroke} will correspond to a key press.
|
||||
* <p>
|
||||
* The "virtual key" constants defined in
|
||||
* <code>java.awt.event.KeyEvent</code> can be
|
||||
* {@code java.awt.event.KeyEvent} can be
|
||||
* used to specify the key code. For example:<ul>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_ENTER</code>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_TAB</code>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_SPACE</code>
|
||||
* <li>{@code java.awt.event.KeyEvent.VK_ENTER}
|
||||
* <li>{@code java.awt.event.KeyEvent.VK_TAB}
|
||||
* <li>{@code java.awt.event.KeyEvent.VK_SPACE}
|
||||
* </ul>
|
||||
* The modifiers consist of any combination of:<ul>
|
||||
* <li>java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||
@ -326,7 +326,7 @@ public class AWTKeyStroke implements Serializable {
|
||||
*
|
||||
* @param keyCode an int specifying the numeric code for a keyboard key
|
||||
* @param modifiers a bitwise-ored combination of any modifiers
|
||||
* @return an <code>AWTKeyStroke</code> object for that key
|
||||
* @return an {@code AWTKeyStroke} object for that key
|
||||
*
|
||||
* @see java.awt.event.KeyEvent
|
||||
* @see java.awt.event.InputEvent
|
||||
@ -337,18 +337,18 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>AWTKeyStroke</code> which represents the
|
||||
* stroke which generated a given <code>KeyEvent</code>.
|
||||
* Returns an {@code AWTKeyStroke} which represents the
|
||||
* stroke which generated a given {@code KeyEvent}.
|
||||
* <p>
|
||||
* This method obtains the keyChar from a <code>KeyTyped</code>
|
||||
* event, and the keyCode from a <code>KeyPressed</code> or
|
||||
* <code>KeyReleased</code> event. The <code>KeyEvent</code> modifiers are
|
||||
* obtained for all three types of <code>KeyEvent</code>.
|
||||
* This method obtains the keyChar from a {@code KeyTyped}
|
||||
* event, and the keyCode from a {@code KeyPressed} or
|
||||
* {@code KeyReleased} event. The {@code KeyEvent} modifiers are
|
||||
* obtained for all three types of {@code KeyEvent}.
|
||||
*
|
||||
* @param anEvent the <code>KeyEvent</code> from which to
|
||||
* obtain the <code>AWTKeyStroke</code>
|
||||
* @throws NullPointerException if <code>anEvent</code> is null
|
||||
* @return the <code>AWTKeyStroke</code> that precipitated the event
|
||||
* @param anEvent the {@code KeyEvent} from which to
|
||||
* obtain the {@code AWTKeyStroke}
|
||||
* @throws NullPointerException if {@code anEvent} is null
|
||||
* @return the {@code AWTKeyStroke} that precipitated the event
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) {
|
||||
int id = anEvent.getID();
|
||||
@ -371,7 +371,7 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string and returns an <code>AWTKeyStroke</code>.
|
||||
* Parses a string and returns an {@code AWTKeyStroke}.
|
||||
* The string must have the following syntax:
|
||||
* <pre>
|
||||
* <modifiers>* (<typedID> | <pressedReleasedID>)
|
||||
@ -393,8 +393,8 @@ public class AWTKeyStroke implements Serializable {
|
||||
* </pre>
|
||||
*
|
||||
* @param s a String formatted as described above
|
||||
* @return an <code>AWTKeyStroke</code> object for that String
|
||||
* @throws IllegalArgumentException if <code>s</code> is <code>null</code>,
|
||||
* @return an {@code AWTKeyStroke} object for that String
|
||||
* @throws IllegalArgumentException if {@code s} is {@code null},
|
||||
* or is formatted incorrectly
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(String s) {
|
||||
@ -500,8 +500,8 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
/**
|
||||
* Returns the integer constant for the KeyEvent.VK field named
|
||||
* <code>key</code>. This will throw an
|
||||
* <code>IllegalArgumentException</code> if <code>key</code> is
|
||||
* {@code key}. This will throw an
|
||||
* {@code IllegalArgumentException} if {@code key} is
|
||||
* not a valid constant.
|
||||
*/
|
||||
private static int getVKValue(String key) {
|
||||
@ -527,7 +527,7 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character for this <code>AWTKeyStroke</code>.
|
||||
* Returns the character for this {@code AWTKeyStroke}.
|
||||
*
|
||||
* @return a char value
|
||||
* @see #getAWTKeyStroke(char)
|
||||
@ -538,7 +538,7 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric key code for this <code>AWTKeyStroke</code>.
|
||||
* Returns the numeric key code for this {@code AWTKeyStroke}.
|
||||
*
|
||||
* @return an int containing the key code value
|
||||
* @see #getAWTKeyStroke(int,int)
|
||||
@ -549,7 +549,7 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the modifier keys for this <code>AWTKeyStroke</code>.
|
||||
* Returns the modifier keys for this {@code AWTKeyStroke}.
|
||||
*
|
||||
* @return an int containing the modifiers
|
||||
* @see #getAWTKeyStroke(int,int)
|
||||
@ -559,10 +559,10 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this <code>AWTKeyStroke</code> represents a key release.
|
||||
* Returns whether this {@code AWTKeyStroke} represents a key release.
|
||||
*
|
||||
* @return <code>true</code> if this <code>AWTKeyStroke</code>
|
||||
* represents a key release; <code>false</code> otherwise
|
||||
* @return {@code true} if this {@code AWTKeyStroke}
|
||||
* represents a key release; {@code false} otherwise
|
||||
* @see #getAWTKeyStroke(int,int,boolean)
|
||||
*/
|
||||
public final boolean isOnKeyRelease() {
|
||||
@ -570,12 +570,12 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of <code>KeyEvent</code> which corresponds to
|
||||
* this <code>AWTKeyStroke</code>.
|
||||
* Returns the type of {@code KeyEvent} which corresponds to
|
||||
* this {@code AWTKeyStroke}.
|
||||
*
|
||||
* @return <code>KeyEvent.KEY_PRESSED</code>,
|
||||
* <code>KeyEvent.KEY_TYPED</code>,
|
||||
* or <code>KeyEvent.KEY_RELEASED</code>
|
||||
* @return {@code KeyEvent.KEY_PRESSED},
|
||||
* {@code KeyEvent.KEY_TYPED},
|
||||
* or {@code KeyEvent.KEY_RELEASED}
|
||||
* @see java.awt.event.KeyEvent
|
||||
*/
|
||||
public final int getKeyEventType() {
|
||||
@ -617,8 +617,8 @@ public class AWTKeyStroke implements Serializable {
|
||||
|
||||
/**
|
||||
* Returns a string that displays and identifies this object's properties.
|
||||
* The <code>String</code> returned by this method can be passed
|
||||
* as a parameter to <code>getAWTKeyStroke(String)</code> to produce
|
||||
* The {@code String} returned by this method can be passed
|
||||
* as a parameter to {@code getAWTKeyStroke(String)} to produce
|
||||
* a key stroke equal to this key stroke.
|
||||
*
|
||||
* @return a String representation of this object
|
||||
@ -695,8 +695,8 @@ public class AWTKeyStroke implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a cached instance of <code>AWTKeyStroke</code> (or a subclass of
|
||||
* <code>AWTKeyStroke</code>) which is equal to this instance.
|
||||
* Returns a cached instance of {@code AWTKeyStroke} (or a subclass of
|
||||
* {@code AWTKeyStroke}) which is equal to this instance.
|
||||
*
|
||||
* @return a cached instance which is equal to this instance
|
||||
* @throws java.io.ObjectStreamException if a serialization problem occurs
|
||||
|
@ -29,7 +29,7 @@ import java.security.BasicPermission;
|
||||
|
||||
/**
|
||||
* This class is for AWT permissions.
|
||||
* An <code>AWTPermission</code> contains a target name but
|
||||
* An {@code AWTPermission} contains a target name but
|
||||
* no actions list; you either have the named permission
|
||||
* or you don't.
|
||||
*
|
||||
@ -39,7 +39,7 @@ import java.security.BasicPermission;
|
||||
* Also, an asterisk could be used to represent all AWT permissions.
|
||||
*
|
||||
* <P>
|
||||
* The following table lists all the possible <code>AWTPermission</code>
|
||||
* The following table lists all the possible {@code AWTPermission}
|
||||
* target names, and for each provides a description of what the
|
||||
* permission allows and a discussion of the risks of granting code
|
||||
* the permission.
|
||||
@ -125,12 +125,12 @@ import java.security.BasicPermission;
|
||||
*
|
||||
* <tr>
|
||||
* <td>replaceKeyboardFocusManager</td>
|
||||
* <td>Sets the <code>KeyboardFocusManager</code> for
|
||||
* <td>Sets the {@code KeyboardFocusManager} for
|
||||
* a particular thread.
|
||||
* <td>When <code>SecurityManager</code> is installed, the invoking
|
||||
* <td>When {@code SecurityManager} is installed, the invoking
|
||||
* thread must be granted this permission in order to replace
|
||||
* the current <code>KeyboardFocusManager</code>. If permission
|
||||
* is not granted, a <code>SecurityException</code> will be thrown.
|
||||
* the current {@code KeyboardFocusManager}. If permission
|
||||
* is not granted, a {@code SecurityException} will be thrown.
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
@ -201,15 +201,15 @@ public final class AWTPermission extends BasicPermission {
|
||||
private static final long serialVersionUID = 8890392402588814465L;
|
||||
|
||||
/**
|
||||
* Creates a new <code>AWTPermission</code> with the specified name.
|
||||
* The name is the symbolic name of the <code>AWTPermission</code>,
|
||||
* Creates a new {@code AWTPermission} with the specified name.
|
||||
* The name is the symbolic name of the {@code AWTPermission},
|
||||
* such as "topLevelWindow", "systemClipboard", etc. An asterisk
|
||||
* may be used to indicate all AWT permissions.
|
||||
*
|
||||
* @param name the name of the AWTPermission
|
||||
*
|
||||
* @throws NullPointerException if <code>name</code> is <code>null</code>.
|
||||
* @throws IllegalArgumentException if <code>name</code> is empty.
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
* @throws IllegalArgumentException if {@code name} is empty.
|
||||
*/
|
||||
|
||||
public AWTPermission(String name)
|
||||
@ -218,15 +218,15 @@ public final class AWTPermission extends BasicPermission {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>AWTPermission</code> object with the specified name.
|
||||
* The name is the symbolic name of the <code>AWTPermission</code>, and the
|
||||
* actions string is currently unused and should be <code>null</code>.
|
||||
* Creates a new {@code AWTPermission} object with the specified name.
|
||||
* The name is the symbolic name of the {@code AWTPermission}, and the
|
||||
* actions string is currently unused and should be {@code null}.
|
||||
*
|
||||
* @param name the name of the <code>AWTPermission</code>
|
||||
* @param actions should be <code>null</code>
|
||||
* @param name the name of the {@code AWTPermission}
|
||||
* @param actions should be {@code null}
|
||||
*
|
||||
* @throws NullPointerException if <code>name</code> is <code>null</code>.
|
||||
* @throws IllegalArgumentException if <code>name</code> is empty.
|
||||
* @throws NullPointerException if {@code name} is {@code null}.
|
||||
* @throws IllegalArgumentException if {@code name} is empty.
|
||||
*/
|
||||
|
||||
public AWTPermission(String name, String actions)
|
||||
|
@ -28,19 +28,19 @@ package java.awt;
|
||||
/**
|
||||
* An interface for events that know how to dispatch themselves.
|
||||
* By implementing this interface an event can be placed upon the event
|
||||
* queue and its <code>dispatch()</code> method will be called when the event
|
||||
* is dispatched, using the <code>EventDispatchThread</code>.
|
||||
* queue and its {@code dispatch()} method will be called when the event
|
||||
* is dispatched, using the {@code EventDispatchThread}.
|
||||
* <p>
|
||||
* This is a very useful mechanism for avoiding deadlocks. If
|
||||
* a thread is executing in a critical section (i.e., it has entered
|
||||
* one or more monitors), calling other synchronized code may
|
||||
* cause deadlocks. To avoid the potential deadlocks, an
|
||||
* <code>ActiveEvent</code> can be created to run the second section of
|
||||
* {@code ActiveEvent} can be created to run the second section of
|
||||
* code at later time. If there is contention on the monitor,
|
||||
* the second thread will simply block until the first thread
|
||||
* has finished its work and exited its monitors.
|
||||
* <p>
|
||||
* For security reasons, it is often desirable to use an <code>ActiveEvent</code>
|
||||
* For security reasons, it is often desirable to use an {@code ActiveEvent}
|
||||
* to avoid calling untrusted code from a critical thread. For
|
||||
* instance, peer implementations can use this facility to avoid
|
||||
* making calls into user code from a system thread. Doing so avoids
|
||||
|
@ -39,25 +39,25 @@ import java.lang.annotation.Native;
|
||||
public interface Adjustable {
|
||||
|
||||
/**
|
||||
* Indicates that the <code>Adjustable</code> has horizontal orientation.
|
||||
* Indicates that the {@code Adjustable} has horizontal orientation.
|
||||
*/
|
||||
@Native public static final int HORIZONTAL = 0;
|
||||
|
||||
/**
|
||||
* Indicates that the <code>Adjustable</code> has vertical orientation.
|
||||
* Indicates that the {@code Adjustable} has vertical orientation.
|
||||
*/
|
||||
@Native public static final int VERTICAL = 1;
|
||||
|
||||
/**
|
||||
* Indicates that the <code>Adjustable</code> has no orientation.
|
||||
* Indicates that the {@code Adjustable} has no orientation.
|
||||
*/
|
||||
@Native public static final int NO_ORIENTATION = 2;
|
||||
|
||||
/**
|
||||
* Gets the orientation of the adjustable object.
|
||||
* @return the orientation of the adjustable object;
|
||||
* either <code>HORIZONTAL</code>, <code>VERTICAL</code>,
|
||||
* or <code>NO_ORIENTATION</code>
|
||||
* either {@code HORIZONTAL}, {@code VERTICAL},
|
||||
* or {@code NO_ORIENTATION}
|
||||
*/
|
||||
int getOrientation();
|
||||
|
||||
@ -124,15 +124,15 @@ public interface Adjustable {
|
||||
|
||||
/**
|
||||
* Sets the current value of the adjustable object. If
|
||||
* the value supplied is less than <code>minimum</code>
|
||||
* or greater than <code>maximum</code> - <code>visibleAmount</code>,
|
||||
* the value supplied is less than {@code minimum}
|
||||
* or greater than {@code maximum} - {@code visibleAmount},
|
||||
* then one of those values is substituted, as appropriate.
|
||||
* <p>
|
||||
* Calling this method does not fire an
|
||||
* <code>AdjustmentEvent</code>.
|
||||
* {@code AdjustmentEvent}.
|
||||
*
|
||||
* @param v the current value, between <code>minimum</code>
|
||||
* and <code>maximum</code> - <code>visibleAmount</code>
|
||||
* @param v the current value, between {@code minimum}
|
||||
* and {@code maximum} - {@code visibleAmount}
|
||||
*/
|
||||
void setValue(int v);
|
||||
|
||||
|
@ -30,7 +30,7 @@ import java.lang.annotation.Native;
|
||||
import sun.java2d.SunCompositeContext;
|
||||
|
||||
/**
|
||||
* The <code>AlphaComposite</code> class implements basic alpha
|
||||
* The {@code AlphaComposite} class implements basic alpha
|
||||
* compositing rules for combining source and destination colors
|
||||
* to achieve blending and transparency effects with graphics and
|
||||
* images.
|
||||
@ -44,7 +44,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* <p>
|
||||
* This class extends the standard equations defined by Porter and
|
||||
* Duff to include one additional factor.
|
||||
* An instance of the <code>AlphaComposite</code> class can contain
|
||||
* An instance of the {@code AlphaComposite} class can contain
|
||||
* an alpha value that is used to modify the opacity or coverage of
|
||||
* every source pixel before it is used in the blending equations.
|
||||
*
|
||||
@ -52,7 +52,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* It is important to note that the equations defined by the Porter
|
||||
* and Duff paper are all defined to operate on color components
|
||||
* that are premultiplied by their corresponding alpha components.
|
||||
* Since the <code>ColorModel</code> and <code>Raster</code> classes
|
||||
* Since the {@code ColorModel} and {@code Raster} classes
|
||||
* allow the storage of pixel data in either premultiplied or
|
||||
* non-premultiplied form, all input data must be normalized into
|
||||
* premultiplied form before applying the equations and all results
|
||||
@ -96,7 +96,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* that specify visual effects.
|
||||
* For example,
|
||||
* the description for
|
||||
* <a href="#SRC_OVER"><code>SRC_OVER</code></a>
|
||||
* <a href="#SRC_OVER">{@code SRC_OVER}</a>
|
||||
* specifies that <em>F<sub>s</sub></em> = 1 and <em>F<sub>d</sub></em> = (1-<em>A<sub>s</sub></em>).
|
||||
* Once a set of equations for determining the blending factors is
|
||||
* known they can then be applied to each pixel to produce a result
|
||||
@ -128,12 +128,12 @@ import sun.java2d.SunCompositeContext;
|
||||
* <h3>Preparing Inputs</h3>
|
||||
*
|
||||
* <p>
|
||||
* The <code>AlphaComposite</code> class defines an additional alpha
|
||||
* The {@code AlphaComposite} class defines an additional alpha
|
||||
* value that is applied to the source alpha.
|
||||
* This value is applied as if an implicit SRC_IN rule were first
|
||||
* applied to the source pixel against a pixel with the indicated
|
||||
* alpha by multiplying both the raw source alpha and the raw
|
||||
* source colors by the alpha in the <code>AlphaComposite</code>.
|
||||
* source colors by the alpha in the {@code AlphaComposite}.
|
||||
* This leads to the following equation for producing the alpha
|
||||
* used in the Porter and Duff blending equation:
|
||||
*
|
||||
@ -141,7 +141,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* <em>A<sub>s</sub></em> = <em>A<sub>sr</sub></em> * <em>A<sub>ac</sub></em> </pre>
|
||||
*
|
||||
* All of the raw source color components need to be multiplied
|
||||
* by the alpha in the <code>AlphaComposite</code> instance.
|
||||
* by the alpha in the {@code AlphaComposite} instance.
|
||||
* Additionally, if the source was not in premultiplied form
|
||||
* then the color components also need to be multiplied by the
|
||||
* source alpha.
|
||||
@ -196,11 +196,11 @@ import sun.java2d.SunCompositeContext;
|
||||
*
|
||||
* <p>
|
||||
* For performance reasons, it is preferable that
|
||||
* <code>Raster</code> objects passed to the <code>compose</code>
|
||||
* {@code Raster} objects passed to the {@code compose}
|
||||
* method of a {@link CompositeContext} object created by the
|
||||
* <code>AlphaComposite</code> class have premultiplied data.
|
||||
* If either the source <code>Raster</code>
|
||||
* or the destination <code>Raster</code>
|
||||
* {@code AlphaComposite} class have premultiplied data.
|
||||
* If either the source {@code Raster}
|
||||
* or the destination {@code Raster}
|
||||
* is not premultiplied, however,
|
||||
* appropriate conversions are performed before and after the compositing
|
||||
* operation.
|
||||
@ -210,7 +210,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* <ul>
|
||||
* <li>
|
||||
* Many sources, such as some of the opaque image types listed
|
||||
* in the <code>BufferedImage</code> class, do not store alpha values
|
||||
* in the {@code BufferedImage} class, do not store alpha values
|
||||
* for their pixels. Such sources supply an alpha of 1.0 for
|
||||
* all of their pixels.
|
||||
*
|
||||
@ -237,7 +237,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* that does not separately store
|
||||
* color components is not a
|
||||
* good candidate for any type of translucent blending.
|
||||
* For example, <code>BufferedImage.TYPE_BYTE_INDEXED</code>
|
||||
* For example, {@code BufferedImage.TYPE_BYTE_INDEXED}
|
||||
* should not be used as a destination for a blending operation
|
||||
* because every operation
|
||||
* can introduce large errors, due to
|
||||
@ -277,7 +277,7 @@ import sun.java2d.SunCompositeContext;
|
||||
* <p>
|
||||
* If integer math were being used and this value were being
|
||||
* composited in
|
||||
* <a href="#SRC"><code>SRC</code></a>
|
||||
* <a href="#SRC">{@code SRC}</a>
|
||||
* mode with no extra alpha, then the math would
|
||||
* indicate that the results were (in integer format):
|
||||
*
|
||||
@ -510,21 +510,21 @@ public final class AlphaComposite implements Composite {
|
||||
@Native public static final int XOR = 12;
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque CLEAR rule
|
||||
* {@code AlphaComposite} object that implements the opaque CLEAR rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #CLEAR
|
||||
*/
|
||||
public static final AlphaComposite Clear = new AlphaComposite(CLEAR);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque SRC rule
|
||||
* {@code AlphaComposite} object that implements the opaque SRC rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #SRC
|
||||
*/
|
||||
public static final AlphaComposite Src = new AlphaComposite(SRC);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque DST rule
|
||||
* {@code AlphaComposite} object that implements the opaque DST rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #DST
|
||||
* @since 1.4
|
||||
@ -532,49 +532,49 @@ public final class AlphaComposite implements Composite {
|
||||
public static final AlphaComposite Dst = new AlphaComposite(DST);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque SRC_OVER rule
|
||||
* {@code AlphaComposite} object that implements the opaque SRC_OVER rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #SRC_OVER
|
||||
*/
|
||||
public static final AlphaComposite SrcOver = new AlphaComposite(SRC_OVER);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque DST_OVER rule
|
||||
* {@code AlphaComposite} object that implements the opaque DST_OVER rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #DST_OVER
|
||||
*/
|
||||
public static final AlphaComposite DstOver = new AlphaComposite(DST_OVER);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque SRC_IN rule
|
||||
* {@code AlphaComposite} object that implements the opaque SRC_IN rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #SRC_IN
|
||||
*/
|
||||
public static final AlphaComposite SrcIn = new AlphaComposite(SRC_IN);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque DST_IN rule
|
||||
* {@code AlphaComposite} object that implements the opaque DST_IN rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #DST_IN
|
||||
*/
|
||||
public static final AlphaComposite DstIn = new AlphaComposite(DST_IN);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque SRC_OUT rule
|
||||
* {@code AlphaComposite} object that implements the opaque SRC_OUT rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #SRC_OUT
|
||||
*/
|
||||
public static final AlphaComposite SrcOut = new AlphaComposite(SRC_OUT);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque DST_OUT rule
|
||||
* {@code AlphaComposite} object that implements the opaque DST_OUT rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #DST_OUT
|
||||
*/
|
||||
public static final AlphaComposite DstOut = new AlphaComposite(DST_OUT);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque SRC_ATOP rule
|
||||
* {@code AlphaComposite} object that implements the opaque SRC_ATOP rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #SRC_ATOP
|
||||
* @since 1.4
|
||||
@ -582,7 +582,7 @@ public final class AlphaComposite implements Composite {
|
||||
public static final AlphaComposite SrcAtop = new AlphaComposite(SRC_ATOP);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque DST_ATOP rule
|
||||
* {@code AlphaComposite} object that implements the opaque DST_ATOP rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #DST_ATOP
|
||||
* @since 1.4
|
||||
@ -590,7 +590,7 @@ public final class AlphaComposite implements Composite {
|
||||
public static final AlphaComposite DstAtop = new AlphaComposite(DST_ATOP);
|
||||
|
||||
/**
|
||||
* <code>AlphaComposite</code> object that implements the opaque XOR rule
|
||||
* {@code AlphaComposite} object that implements the opaque XOR rule
|
||||
* with an alpha of 1.0f.
|
||||
* @see #XOR
|
||||
* @since 1.4
|
||||
@ -620,11 +620,11 @@ public final class AlphaComposite implements Composite {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an <code>AlphaComposite</code> object with the specified rule.
|
||||
* Creates an {@code AlphaComposite} object with the specified rule.
|
||||
*
|
||||
* @param rule the compositing rule
|
||||
* @return the {@code AlphaComposite} object created
|
||||
* @throws IllegalArgumentException if <code>rule</code> is not one of
|
||||
* @throws IllegalArgumentException if {@code rule} is not one of
|
||||
* the following: {@link #CLEAR}, {@link #SRC}, {@link #DST},
|
||||
* {@link #SRC_OVER}, {@link #DST_OVER}, {@link #SRC_IN},
|
||||
* {@link #DST_IN}, {@link #SRC_OUT}, {@link #DST_OUT},
|
||||
@ -662,19 +662,19 @@ public final class AlphaComposite implements Composite {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an <code>AlphaComposite</code> object with the specified rule and
|
||||
* Creates an {@code AlphaComposite} object with the specified rule and
|
||||
* the constant alpha to multiply with the alpha of the source.
|
||||
* The source is multiplied with the specified alpha before being composited
|
||||
* with the destination.
|
||||
*
|
||||
* @param rule the compositing rule
|
||||
* @param alpha the constant alpha to be multiplied with the alpha of
|
||||
* the source. <code>alpha</code> must be a floating point number in the
|
||||
* the source. {@code alpha} must be a floating point number in the
|
||||
* inclusive range [0.0, 1.0].
|
||||
* @return the {@code AlphaComposite} object created
|
||||
* @throws IllegalArgumentException if
|
||||
* <code>alpha</code> is less than 0.0 or greater than 1.0, or if
|
||||
* <code>rule</code> is not one of
|
||||
* {@code alpha} is less than 0.0 or greater than 1.0, or if
|
||||
* {@code rule} is not one of
|
||||
* the following: {@link #CLEAR}, {@link #SRC}, {@link #DST},
|
||||
* {@link #SRC_OVER}, {@link #DST_OVER}, {@link #SRC_IN},
|
||||
* {@link #DST_IN}, {@link #SRC_OUT}, {@link #DST_OUT},
|
||||
@ -692,8 +692,8 @@ public final class AlphaComposite implements Composite {
|
||||
* The context contains state that is used in performing
|
||||
* the compositing operation.
|
||||
* @param srcColorModel the {@link ColorModel} of the source
|
||||
* @param dstColorModel the <code>ColorModel</code> of the destination
|
||||
* @return the <code>CompositeContext</code> object to be used to perform
|
||||
* @param dstColorModel the {@code ColorModel} of the destination
|
||||
* @return the {@code CompositeContext} object to be used to perform
|
||||
* compositing operations.
|
||||
*/
|
||||
public CompositeContext createContext(ColorModel srcColorModel,
|
||||
@ -703,32 +703,32 @@ public final class AlphaComposite implements Composite {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the alpha value of this <code>AlphaComposite</code>. If this
|
||||
* <code>AlphaComposite</code> does not have an alpha value, 1.0 is returned.
|
||||
* @return the alpha value of this <code>AlphaComposite</code>.
|
||||
* Returns the alpha value of this {@code AlphaComposite}. If this
|
||||
* {@code AlphaComposite} does not have an alpha value, 1.0 is returned.
|
||||
* @return the alpha value of this {@code AlphaComposite}.
|
||||
*/
|
||||
public float getAlpha() {
|
||||
return extraAlpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the compositing rule of this <code>AlphaComposite</code>.
|
||||
* @return the compositing rule of this <code>AlphaComposite</code>.
|
||||
* Returns the compositing rule of this {@code AlphaComposite}.
|
||||
* @return the compositing rule of this {@code AlphaComposite}.
|
||||
*/
|
||||
public int getRule() {
|
||||
return rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a similar <code>AlphaComposite</code> object that uses
|
||||
* Returns a similar {@code AlphaComposite} object that uses
|
||||
* the specified compositing rule.
|
||||
* If this object already uses the specified compositing rule,
|
||||
* this object is returned.
|
||||
* @return an <code>AlphaComposite</code> object derived from
|
||||
* @return an {@code AlphaComposite} object derived from
|
||||
* this object that uses the specified compositing rule.
|
||||
* @param rule the compositing rule
|
||||
* @throws IllegalArgumentException if
|
||||
* <code>rule</code> is not one of
|
||||
* {@code rule} is not one of
|
||||
* the following: {@link #CLEAR}, {@link #SRC}, {@link #DST},
|
||||
* {@link #SRC_OVER}, {@link #DST_OVER}, {@link #SRC_IN},
|
||||
* {@link #DST_IN}, {@link #SRC_OUT}, {@link #DST_OUT},
|
||||
@ -742,17 +742,17 @@ public final class AlphaComposite implements Composite {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a similar <code>AlphaComposite</code> object that uses
|
||||
* Returns a similar {@code AlphaComposite} object that uses
|
||||
* the specified alpha value.
|
||||
* If this object already has the specified alpha value,
|
||||
* this object is returned.
|
||||
* @return an <code>AlphaComposite</code> object derived from
|
||||
* @return an {@code AlphaComposite} object derived from
|
||||
* this object that uses the specified alpha value.
|
||||
* @param alpha the constant alpha to be multiplied with the alpha of
|
||||
* the source. <code>alpha</code> must be a floating point number in the
|
||||
* the source. {@code alpha} must be a floating point number in the
|
||||
* inclusive range [0.0, 1.0].
|
||||
* @throws IllegalArgumentException if
|
||||
* <code>alpha</code> is less than 0.0 or greater than 1.0
|
||||
* {@code alpha} is less than 0.0 or greater than 1.0
|
||||
* @since 1.6
|
||||
*/
|
||||
public AlphaComposite derive(float alpha) {
|
||||
@ -771,16 +771,16 @@ public final class AlphaComposite implements Composite {
|
||||
|
||||
/**
|
||||
* Determines whether the specified object is equal to this
|
||||
* <code>AlphaComposite</code>.
|
||||
* {@code AlphaComposite}.
|
||||
* <p>
|
||||
* The result is <code>true</code> if and only if
|
||||
* the argument is not <code>null</code> and is an
|
||||
* <code>AlphaComposite</code> object that has the same
|
||||
* The result is {@code true} if and only if
|
||||
* the argument is not {@code null} and is an
|
||||
* {@code AlphaComposite} object that has the same
|
||||
* compositing rule and alpha value as this object.
|
||||
*
|
||||
* @param obj the <code>Object</code> to test for equality
|
||||
* @return <code>true</code> if <code>obj</code> equals this
|
||||
* <code>AlphaComposite</code>; <code>false</code> otherwise.
|
||||
* @param obj the {@code Object} to test for equality
|
||||
* @return {@code true} if {@code obj} equals this
|
||||
* {@code AlphaComposite}; {@code false} otherwise.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof AlphaComposite)) {
|
||||
|
@ -33,8 +33,8 @@ import java.util.Hashtable;
|
||||
* north, south, east, west, and center.
|
||||
* Each region may contain no more than one component, and
|
||||
* is identified by a corresponding constant:
|
||||
* <code>NORTH</code>, <code>SOUTH</code>, <code>EAST</code>,
|
||||
* <code>WEST</code>, and <code>CENTER</code>. When adding a
|
||||
* {@code NORTH}, {@code SOUTH}, {@code EAST},
|
||||
* {@code WEST}, and {@code CENTER}. When adding a
|
||||
* component to a container with a border layout, use one of these
|
||||
* five constants, for example:
|
||||
* <pre>
|
||||
@ -42,55 +42,55 @@ import java.util.Hashtable;
|
||||
* p.setLayout(new BorderLayout());
|
||||
* p.add(new Button("Okay"), BorderLayout.SOUTH);
|
||||
* </pre>
|
||||
* As a convenience, <code>BorderLayout</code> interprets the
|
||||
* As a convenience, {@code BorderLayout} interprets the
|
||||
* absence of a string specification the same as the constant
|
||||
* <code>CENTER</code>:
|
||||
* {@code CENTER}:
|
||||
* <pre>
|
||||
* Panel p2 = new Panel();
|
||||
* p2.setLayout(new BorderLayout());
|
||||
* p2.add(new TextArea()); // Same as p.add(new TextArea(), BorderLayout.CENTER);
|
||||
* </pre>
|
||||
* <p>
|
||||
* In addition, <code>BorderLayout</code> supports the relative
|
||||
* positioning constants, <code>PAGE_START</code>, <code>PAGE_END</code>,
|
||||
* <code>LINE_START</code>, and <code>LINE_END</code>.
|
||||
* In a container whose <code>ComponentOrientation</code> is set to
|
||||
* <code>ComponentOrientation.LEFT_TO_RIGHT</code>, these constants map to
|
||||
* <code>NORTH</code>, <code>SOUTH</code>, <code>WEST</code>, and
|
||||
* <code>EAST</code>, respectively.
|
||||
* In addition, {@code BorderLayout} supports the relative
|
||||
* positioning constants, {@code PAGE_START}, {@code PAGE_END},
|
||||
* {@code LINE_START}, and {@code LINE_END}.
|
||||
* In a container whose {@code ComponentOrientation} is set to
|
||||
* {@code ComponentOrientation.LEFT_TO_RIGHT}, these constants map to
|
||||
* {@code NORTH}, {@code SOUTH}, {@code WEST}, and
|
||||
* {@code EAST}, respectively.
|
||||
* <p>
|
||||
* For compatibility with previous releases, <code>BorderLayout</code>
|
||||
* also includes the relative positioning constants <code>BEFORE_FIRST_LINE</code>,
|
||||
* <code>AFTER_LAST_LINE</code>, <code>BEFORE_LINE_BEGINS</code> and
|
||||
* <code>AFTER_LINE_ENDS</code>. These are equivalent to
|
||||
* <code>PAGE_START</code>, <code>PAGE_END</code>, <code>LINE_START</code>
|
||||
* and <code>LINE_END</code> respectively. For
|
||||
* For compatibility with previous releases, {@code BorderLayout}
|
||||
* also includes the relative positioning constants {@code BEFORE_FIRST_LINE},
|
||||
* {@code AFTER_LAST_LINE}, {@code BEFORE_LINE_BEGINS} and
|
||||
* {@code AFTER_LINE_ENDS}. These are equivalent to
|
||||
* {@code PAGE_START}, {@code PAGE_END}, {@code LINE_START}
|
||||
* and {@code LINE_END} respectively. For
|
||||
* consistency with the relative positioning constants used by other
|
||||
* components, the latter constants are preferred.
|
||||
* <p>
|
||||
* Mixing both absolute and relative positioning constants can lead to
|
||||
* unpredictable results. If
|
||||
* you use both types, the relative constants will take precedence.
|
||||
* For example, if you add components using both the <code>NORTH</code>
|
||||
* and <code>PAGE_START</code> constants in a container whose
|
||||
* orientation is <code>LEFT_TO_RIGHT</code>, only the
|
||||
* <code>PAGE_START</code> will be laid out.
|
||||
* For example, if you add components using both the {@code NORTH}
|
||||
* and {@code PAGE_START} constants in a container whose
|
||||
* orientation is {@code LEFT_TO_RIGHT}, only the
|
||||
* {@code PAGE_START} will be laid out.
|
||||
* <p>
|
||||
* NOTE: Currently (in the Java 2 platform v1.2),
|
||||
* <code>BorderLayout</code> does not support vertical
|
||||
* orientations. The <code>isVertical</code> setting on the container's
|
||||
* <code>ComponentOrientation</code> is not respected.
|
||||
* {@code BorderLayout} does not support vertical
|
||||
* orientations. The {@code isVertical} setting on the container's
|
||||
* {@code ComponentOrientation} is not respected.
|
||||
* <p>
|
||||
* The components are laid out according to their
|
||||
* preferred sizes and the constraints of the container's size.
|
||||
* The <code>NORTH</code> and <code>SOUTH</code> components may
|
||||
* be stretched horizontally; the <code>EAST</code> and
|
||||
* <code>WEST</code> components may be stretched vertically;
|
||||
* the <code>CENTER</code> component may stretch both horizontally
|
||||
* The {@code NORTH} and {@code SOUTH} components may
|
||||
* be stretched horizontally; the {@code EAST} and
|
||||
* {@code WEST} components may be stretched vertically;
|
||||
* the {@code CENTER} component may stretch both horizontally
|
||||
* and vertically to fill any space left over.
|
||||
* <p>
|
||||
* Here is an example of five buttons in an applet laid out using
|
||||
* the <code>BorderLayout</code> layout manager:
|
||||
* the {@code BorderLayout} layout manager:
|
||||
* <p>
|
||||
* <img src="doc-files/BorderLayout-1.gif"
|
||||
* alt="Diagram of an applet demonstrating BorderLayout.
|
||||
@ -126,7 +126,7 @@ public class BorderLayout implements LayoutManager2,
|
||||
/**
|
||||
* Constructs a border layout with the horizontal gaps
|
||||
* between components.
|
||||
* The horizontal gap is specified by <code>hgap</code>.
|
||||
* The horizontal gap is specified by {@code hgap}.
|
||||
*
|
||||
* @see #getHgap()
|
||||
* @see #setHgap(int)
|
||||
@ -138,7 +138,7 @@ public class BorderLayout implements LayoutManager2,
|
||||
/**
|
||||
* Constructs a border layout with the vertical gaps
|
||||
* between components.
|
||||
* The vertical gap is specified by <code>vgap</code>.
|
||||
* The vertical gap is specified by {@code vgap}.
|
||||
*
|
||||
* @see #getVgap()
|
||||
* @see #setVgap(int)
|
||||
@ -208,10 +208,10 @@ public class BorderLayout implements LayoutManager2,
|
||||
* north, south, east, west or center.
|
||||
* mixing the two types of constants can lead to unpredictable results. If
|
||||
* you use both types, the relative constants will take precedence.
|
||||
* For example, if you add components using both the <code>NORTH</code>
|
||||
* and <code>BEFORE_FIRST_LINE</code> constants in a container whose
|
||||
* orientation is <code>LEFT_TO_RIGHT</code>, only the
|
||||
* <code>BEFORE_FIRST_LINE</code> will be laid out.
|
||||
* For example, if you add components using both the {@code NORTH}
|
||||
* and {@code BEFORE_FIRST_LINE} constants in a container whose
|
||||
* orientation is {@code LEFT_TO_RIGHT}, only the
|
||||
* {@code BEFORE_FIRST_LINE} will be laid out.
|
||||
* This will be the same for lastLine, firstItem, lastItem.
|
||||
* @serial
|
||||
*/
|
||||
@ -355,8 +355,8 @@ public class BorderLayout implements LayoutManager2,
|
||||
/**
|
||||
* Constructs a border layout with the specified gaps
|
||||
* between components.
|
||||
* The horizontal gap is specified by <code>hgap</code>
|
||||
* and the vertical gap is specified by <code>vgap</code>.
|
||||
* The horizontal gap is specified by {@code hgap}
|
||||
* and the vertical gap is specified by {@code vgap}.
|
||||
* @param hgap the horizontal gap.
|
||||
* @param vgap the vertical gap.
|
||||
*/
|
||||
@ -408,13 +408,13 @@ public class BorderLayout implements LayoutManager2,
|
||||
/**
|
||||
* Adds the specified component to the layout, using the specified
|
||||
* constraint object. For border layouts, the constraint must be
|
||||
* one of the following constants: <code>NORTH</code>,
|
||||
* <code>SOUTH</code>, <code>EAST</code>,
|
||||
* <code>WEST</code>, or <code>CENTER</code>.
|
||||
* one of the following constants: {@code NORTH},
|
||||
* {@code SOUTH}, {@code EAST},
|
||||
* {@code WEST}, or {@code CENTER}.
|
||||
* <p>
|
||||
* Most applications do not call this method directly. This method
|
||||
* is called when a component is added to a container using the
|
||||
* <code>Container.add</code> method with the same argument types.
|
||||
* {@code Container.add} method with the same argument types.
|
||||
* @param comp the component to be added.
|
||||
* @param constraints an object that specifies how and where
|
||||
* the component is added to the layout.
|
||||
@ -434,7 +434,7 @@ public class BorderLayout implements LayoutManager2,
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated replaced by <code>addLayoutComponent(Component, Object)</code>.
|
||||
* @deprecated replaced by {@code addLayoutComponent(Component, Object)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void addLayoutComponent(String name, Component comp) {
|
||||
@ -472,8 +472,8 @@ public class BorderLayout implements LayoutManager2,
|
||||
|
||||
/**
|
||||
* Removes the specified component from this border layout. This
|
||||
* method is called when a container calls its <code>remove</code> or
|
||||
* <code>removeAll</code> methods. Most applications do not call this
|
||||
* method is called when a container calls its {@code remove} or
|
||||
* {@code removeAll} methods. Most applications do not call this
|
||||
* method directly.
|
||||
* @param comp the component to be removed.
|
||||
* @see java.awt.Container#remove(java.awt.Component)
|
||||
@ -507,12 +507,12 @@ public class BorderLayout implements LayoutManager2,
|
||||
/**
|
||||
* Gets the component that was added using the given constraint
|
||||
*
|
||||
* @param constraints the desired constraint, one of <code>CENTER</code>,
|
||||
* <code>NORTH</code>, <code>SOUTH</code>,
|
||||
* <code>WEST</code>, <code>EAST</code>,
|
||||
* <code>PAGE_START</code>, <code>PAGE_END</code>,
|
||||
* <code>LINE_START</code>, <code>LINE_END</code>
|
||||
* @return the component at the given location, or <code>null</code> if
|
||||
* @param constraints the desired constraint, one of {@code CENTER},
|
||||
* {@code NORTH}, {@code SOUTH},
|
||||
* {@code WEST}, {@code EAST},
|
||||
* {@code PAGE_START}, {@code PAGE_END},
|
||||
* {@code LINE_START}, {@code LINE_END}
|
||||
* @return the component at the given location, or {@code null} if
|
||||
* the location is empty
|
||||
* @exception IllegalArgumentException if the constraint object is
|
||||
* not one of the nine specified constants
|
||||
@ -546,21 +546,21 @@ public class BorderLayout implements LayoutManager2,
|
||||
|
||||
/**
|
||||
* Returns the component that corresponds to the given constraint location
|
||||
* based on the target <code>Container</code>'s component orientation.
|
||||
* Components added with the relative constraints <code>PAGE_START</code>,
|
||||
* <code>PAGE_END</code>, <code>LINE_START</code>, and <code>LINE_END</code>
|
||||
* based on the target {@code Container}'s component orientation.
|
||||
* Components added with the relative constraints {@code PAGE_START},
|
||||
* {@code PAGE_END}, {@code LINE_START}, and {@code LINE_END}
|
||||
* take precedence over components added with the explicit constraints
|
||||
* <code>NORTH</code>, <code>SOUTH</code>, <code>WEST</code>, and <code>EAST</code>.
|
||||
* The <code>Container</code>'s component orientation is used to determine the location of components
|
||||
* added with <code>LINE_START</code> and <code>LINE_END</code>.
|
||||
* {@code NORTH}, {@code SOUTH}, {@code WEST}, and {@code EAST}.
|
||||
* The {@code Container}'s component orientation is used to determine the location of components
|
||||
* added with {@code LINE_START} and {@code LINE_END}.
|
||||
*
|
||||
* @param constraints the desired absolute position, one of <code>CENTER</code>,
|
||||
* <code>NORTH</code>, <code>SOUTH</code>,
|
||||
* <code>EAST</code>, <code>WEST</code>
|
||||
* @param constraints the desired absolute position, one of {@code CENTER},
|
||||
* {@code NORTH}, {@code SOUTH},
|
||||
* {@code EAST}, {@code WEST}
|
||||
* @param target the {@code Container} used to obtain
|
||||
* the constraint location based on the target
|
||||
* {@code Container}'s component orientation.
|
||||
* @return the component at the given location, or <code>null</code> if
|
||||
* @return the component at the given location, or {@code null} if
|
||||
* the location is empty
|
||||
* @exception IllegalArgumentException if the constraint object is
|
||||
* not one of the five specified constants
|
||||
@ -634,11 +634,11 @@ public class BorderLayout implements LayoutManager2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the minimum size of the <code>target</code> container
|
||||
* Determines the minimum size of the {@code target} container
|
||||
* using this layout manager.
|
||||
* <p>
|
||||
* This method is called when a container calls its
|
||||
* <code>getMinimumSize</code> method. Most applications do not call
|
||||
* {@code getMinimumSize} method. Most applications do not call
|
||||
* this method directly.
|
||||
* @param target the container in which to do the layout.
|
||||
* @return the minimum dimensions needed to lay out the subcomponents
|
||||
@ -689,12 +689,12 @@ public class BorderLayout implements LayoutManager2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the preferred size of the <code>target</code>
|
||||
* Determines the preferred size of the {@code target}
|
||||
* container using this layout manager, based on the components
|
||||
* in the container.
|
||||
* <p>
|
||||
* Most applications do not call this method directly. This method
|
||||
* is called when a container calls its <code>getPreferredSize</code>
|
||||
* is called when a container calls its {@code getPreferredSize}
|
||||
* method.
|
||||
* @param target the container in which to do the layout.
|
||||
* @return the preferred dimensions to lay out the subcomponents
|
||||
@ -790,16 +790,16 @@ public class BorderLayout implements LayoutManager2,
|
||||
* <p>
|
||||
* This method actually reshapes the components in the specified
|
||||
* container in order to satisfy the constraints of this
|
||||
* <code>BorderLayout</code> object. The <code>NORTH</code>
|
||||
* and <code>SOUTH</code> components, if any, are placed at
|
||||
* {@code BorderLayout} object. The {@code NORTH}
|
||||
* and {@code SOUTH} components, if any, are placed at
|
||||
* the top and bottom of the container, respectively. The
|
||||
* <code>WEST</code> and <code>EAST</code> components are
|
||||
* {@code WEST} and {@code EAST} components are
|
||||
* then placed on the left and right, respectively. Finally,
|
||||
* the <code>CENTER</code> object is placed in any remaining
|
||||
* the {@code CENTER} object is placed in any remaining
|
||||
* space in the middle.
|
||||
* <p>
|
||||
* Most applications do not call this method directly. This method
|
||||
* is called when a container calls its <code>doLayout</code> method.
|
||||
* is called when a container calls its {@code doLayout} method.
|
||||
* @param target the container in which to do the layout.
|
||||
* @see java.awt.Container
|
||||
* @see java.awt.Container#doLayout()
|
||||
|
@ -42,13 +42,13 @@ public class BufferCapabilities implements Cloneable {
|
||||
/**
|
||||
* Creates a new object for specifying buffering capabilities
|
||||
* @param frontCaps the capabilities of the front buffer; cannot be
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
* @param backCaps the capabilities of the back and intermediate buffers;
|
||||
* cannot be <code>null</code>
|
||||
* cannot be {@code null}
|
||||
* @param flipContents the contents of the back buffer after page-flipping,
|
||||
* <code>null</code> if page flipping is not used (implies blitting)
|
||||
* {@code null} if page flipping is not used (implies blitting)
|
||||
* @exception IllegalArgumentException if frontCaps or backCaps are
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
*/
|
||||
public BufferCapabilities(ImageCapabilities frontCaps,
|
||||
ImageCapabilities backCaps, FlipContents flipContents) {
|
||||
@ -83,8 +83,8 @@ public class BufferCapabilities implements Cloneable {
|
||||
* more back buffers by switching the video pointer (or by copying memory
|
||||
* internally). A non-flipping set of
|
||||
* buffers uses blitting to copy the contents from one buffer to
|
||||
* another; when this is the case, <code>getFlipContents</code> returns
|
||||
* <code>null</code>
|
||||
* another; when this is the case, {@code getFlipContents} returns
|
||||
* {@code null}
|
||||
*/
|
||||
public boolean isPageFlipping() {
|
||||
return (getFlipContents() != null);
|
||||
@ -92,12 +92,12 @@ public class BufferCapabilities implements Cloneable {
|
||||
|
||||
/**
|
||||
* @return the resulting contents of the back buffer after page-flipping.
|
||||
* This value is <code>null</code> when the <code>isPageFlipping</code>
|
||||
* returns <code>false</code>, implying blitting. It can be one of
|
||||
* <code>FlipContents.UNDEFINED</code>
|
||||
* (the assumed default), <code>FlipContents.BACKGROUND</code>,
|
||||
* <code>FlipContents.PRIOR</code>, or
|
||||
* <code>FlipContents.COPIED</code>.
|
||||
* This value is {@code null} when the {@code isPageFlipping}
|
||||
* returns {@code false}, implying blitting. It can be one of
|
||||
* {@code FlipContents.UNDEFINED}
|
||||
* (the assumed default), {@code FlipContents.BACKGROUND},
|
||||
* {@code FlipContents.PRIOR}, or
|
||||
* {@code FlipContents.COPIED}.
|
||||
* @see #isPageFlipping
|
||||
* @see FlipContents#UNDEFINED
|
||||
* @see FlipContents#BACKGROUND
|
||||
@ -110,7 +110,7 @@ public class BufferCapabilities implements Cloneable {
|
||||
|
||||
/**
|
||||
* @return whether page flipping is only available in full-screen mode. If this
|
||||
* is <code>true</code>, full-screen exclusive mode is required for
|
||||
* is {@code true}, full-screen exclusive mode is required for
|
||||
* page-flipping.
|
||||
* @see #isPageFlipping
|
||||
* @see GraphicsDevice#setFullScreenWindow
|
||||
@ -158,7 +158,7 @@ public class BufferCapabilities implements Cloneable {
|
||||
{ "undefined", "background", "prior", "copied" };
|
||||
|
||||
/**
|
||||
* When flip contents are <code>UNDEFINED</code>, the
|
||||
* When flip contents are {@code UNDEFINED}, the
|
||||
* contents of the back buffer are undefined after flipping.
|
||||
* @see #isPageFlipping
|
||||
* @see #getFlipContents
|
||||
@ -170,7 +170,7 @@ public class BufferCapabilities implements Cloneable {
|
||||
new FlipContents(I_UNDEFINED);
|
||||
|
||||
/**
|
||||
* When flip contents are <code>BACKGROUND</code>, the
|
||||
* When flip contents are {@code BACKGROUND}, the
|
||||
* contents of the back buffer are cleared with the background color after
|
||||
* flipping.
|
||||
* @see #isPageFlipping
|
||||
@ -183,7 +183,7 @@ public class BufferCapabilities implements Cloneable {
|
||||
new FlipContents(I_BACKGROUND);
|
||||
|
||||
/**
|
||||
* When flip contents are <code>PRIOR</code>, the
|
||||
* When flip contents are {@code PRIOR}, the
|
||||
* contents of the back buffer are the prior contents of the front buffer
|
||||
* (a true page flip).
|
||||
* @see #isPageFlipping
|
||||
@ -196,7 +196,7 @@ public class BufferCapabilities implements Cloneable {
|
||||
new FlipContents(I_PRIOR);
|
||||
|
||||
/**
|
||||
* When flip contents are <code>COPIED</code>, the
|
||||
* When flip contents are {@code COPIED}, the
|
||||
* contents of the back buffer are copied to the front buffer when
|
||||
* flipping.
|
||||
* @see #isPageFlipping
|
||||
|
@ -37,7 +37,7 @@ import javax.accessibility.*;
|
||||
/**
|
||||
* This class creates a labeled button. The application can cause
|
||||
* some action to happen when the button is pushed. This image
|
||||
* depicts three views of a "<code>Quit</code>" button as it appears
|
||||
* depicts three views of a "{@code Quit}" button as it appears
|
||||
* under the Solaris operating system:
|
||||
* <p>
|
||||
* <img src="doc-files/Button-1.gif" alt="The following context describes the graphic"
|
||||
@ -51,31 +51,31 @@ import javax.accessibility.*;
|
||||
* requests that an action be performed.
|
||||
* <p>
|
||||
* The gesture of clicking on a button with the mouse
|
||||
* is associated with one instance of <code>ActionEvent</code>,
|
||||
* is associated with one instance of {@code ActionEvent},
|
||||
* which is sent out when the mouse is both pressed and released
|
||||
* over the button. If an application is interested in knowing
|
||||
* when the button has been pressed but not released, as a separate
|
||||
* gesture, it can specialize <code>processMouseEvent</code>,
|
||||
* gesture, it can specialize {@code processMouseEvent},
|
||||
* or it can register itself as a listener for mouse events by
|
||||
* calling <code>addMouseListener</code>. Both of these methods are
|
||||
* defined by <code>Component</code>, the abstract superclass of
|
||||
* calling {@code addMouseListener}. Both of these methods are
|
||||
* defined by {@code Component}, the abstract superclass of
|
||||
* all components.
|
||||
* <p>
|
||||
* When a button is pressed and released, AWT sends an instance
|
||||
* of <code>ActionEvent</code> to the button, by calling
|
||||
* <code>processEvent</code> on the button. The button's
|
||||
* <code>processEvent</code> method receives all events
|
||||
* of {@code ActionEvent} to the button, by calling
|
||||
* {@code processEvent} on the button. The button's
|
||||
* {@code processEvent} method receives all events
|
||||
* for the button; it passes an action event along by
|
||||
* calling its own <code>processActionEvent</code> method.
|
||||
* calling its own {@code processActionEvent} method.
|
||||
* The latter method passes the action event on to any action
|
||||
* listeners that have registered an interest in action
|
||||
* events generated by this button.
|
||||
* <p>
|
||||
* If an application wants to perform some action based on
|
||||
* a button being pressed and released, it should implement
|
||||
* <code>ActionListener</code> and register the new listener
|
||||
* {@code ActionListener} and register the new listener
|
||||
* to receive events from this button, by calling the button's
|
||||
* <code>addActionListener</code> method. The application can
|
||||
* {@code addActionListener} method. The application can
|
||||
* make use of the button's action command as a messaging protocol.
|
||||
*
|
||||
* @author Sami Shaio
|
||||
@ -144,7 +144,7 @@ public class Button extends Component implements Accessible {
|
||||
* Constructs a button with the specified label.
|
||||
*
|
||||
* @param label a string label for the button, or
|
||||
* <code>null</code> for no label
|
||||
* {@code null} for no label
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
@ -182,7 +182,7 @@ public class Button extends Component implements Accessible {
|
||||
/**
|
||||
* Gets the label of this button.
|
||||
*
|
||||
* @return the button's label, or <code>null</code>
|
||||
* @return the button's label, or {@code null}
|
||||
* if the button has no label.
|
||||
* @see java.awt.Button#setLabel
|
||||
*/
|
||||
@ -193,7 +193,7 @@ public class Button extends Component implements Accessible {
|
||||
/**
|
||||
* Sets the button's label to be the specified string.
|
||||
*
|
||||
* @param label the new label, or <code>null</code>
|
||||
* @param label the new label, or {@code null}
|
||||
* if the button has no label.
|
||||
* @see java.awt.Button#getLabel
|
||||
*/
|
||||
@ -225,7 +225,7 @@ public class Button extends Component implements Accessible {
|
||||
*
|
||||
* @param command a string used to set the button's
|
||||
* action command.
|
||||
* If the string is <code>null</code> then the action command
|
||||
* If the string is {@code null} then the action command
|
||||
* is set to match the label of the button.
|
||||
* @see java.awt.event.ActionEvent
|
||||
* @since 1.1
|
||||
@ -236,7 +236,7 @@ public class Button extends Component implements Accessible {
|
||||
|
||||
/**
|
||||
* Returns the command name of the action event fired by this button.
|
||||
* If the command name is <code>null</code> (default) then this method
|
||||
* If the command name is {@code null} (default) then this method
|
||||
* returns the label of the button.
|
||||
*
|
||||
* @return the action command name (or label) for this button
|
||||
@ -292,7 +292,7 @@ public class Button extends Component implements Accessible {
|
||||
* Returns an array of all the action listeners
|
||||
* registered on this button.
|
||||
*
|
||||
* @return all of this button's <code>ActionListener</code>s
|
||||
* @return all of this button's {@code ActionListener}s
|
||||
* or an empty array if no action
|
||||
* listeners are currently registered
|
||||
*
|
||||
@ -308,16 +308,16 @@ public class Button extends Component implements Accessible {
|
||||
/**
|
||||
* Returns an array of all the objects currently registered
|
||||
* as <code><em>Foo</em>Listener</code>s
|
||||
* upon this <code>Button</code>.
|
||||
* upon this {@code Button}.
|
||||
* <code><em>Foo</em>Listener</code>s are registered using the
|
||||
* <code>add<em>Foo</em>Listener</code> method.
|
||||
*
|
||||
* <p>
|
||||
* You can specify the <code>listenerType</code> argument
|
||||
* You can specify the {@code listenerType} argument
|
||||
* with a class literal, such as
|
||||
* <code><em>Foo</em>Listener.class</code>.
|
||||
* For example, you can query a
|
||||
* <code>Button</code> <code>b</code>
|
||||
* {@code Button b}
|
||||
* for its action listeners with the following code:
|
||||
*
|
||||
* <pre>ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class));</pre>
|
||||
@ -326,14 +326,14 @@ public class Button extends Component implements Accessible {
|
||||
*
|
||||
* @param listenerType the type of listeners requested; this parameter
|
||||
* should specify an interface that descends from
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
* @return an array of all objects registered as
|
||||
* <code><em>Foo</em>Listener</code>s on this button,
|
||||
* or an empty array if no such
|
||||
* listeners have been added
|
||||
* @exception ClassCastException if <code>listenerType</code>
|
||||
* @exception ClassCastException if {@code listenerType}
|
||||
* doesn't specify a class or interface that implements
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
*
|
||||
* @see #getActionListeners
|
||||
* @since 1.3
|
||||
@ -362,10 +362,10 @@ public class Button extends Component implements Accessible {
|
||||
|
||||
/**
|
||||
* Processes events on this button. If an event is
|
||||
* an instance of <code>ActionEvent</code>, this method invokes
|
||||
* the <code>processActionEvent</code> method. Otherwise,
|
||||
* it invokes <code>processEvent</code> on the superclass.
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* an instance of {@code ActionEvent}, this method invokes
|
||||
* the {@code processActionEvent} method. Otherwise,
|
||||
* it invokes {@code processEvent} on the superclass.
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -385,17 +385,17 @@ public class Button extends Component implements Accessible {
|
||||
/**
|
||||
* Processes action events occurring on this button
|
||||
* by dispatching them to any registered
|
||||
* <code>ActionListener</code> objects.
|
||||
* {@code ActionListener} objects.
|
||||
* <p>
|
||||
* This method is not called unless action events are
|
||||
* enabled for this button. Action events are enabled
|
||||
* when one of the following occurs:
|
||||
* <ul>
|
||||
* <li>An <code>ActionListener</code> object is registered
|
||||
* via <code>addActionListener</code>.
|
||||
* <li>Action events are enabled via <code>enableEvents</code>.
|
||||
* <li>An {@code ActionListener} object is registered
|
||||
* via {@code addActionListener}.
|
||||
* <li>Action events are enabled via {@code enableEvents}.
|
||||
* </ul>
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -413,11 +413,11 @@ public class Button extends Component implements Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the state of this <code>Button</code>.
|
||||
* Returns a string representing the state of this {@code Button}.
|
||||
* This method is intended to be used only for debugging purposes, and the
|
||||
* content and format of the returned string may vary between
|
||||
* implementations. The returned string may be empty but may not be
|
||||
* <code>null</code>.
|
||||
* {@code null}.
|
||||
*
|
||||
* @return the parameter string of this button
|
||||
*/
|
||||
@ -437,19 +437,19 @@ public class Button extends Component implements Accessible {
|
||||
|
||||
/**
|
||||
* Writes default serializable fields to stream. Writes
|
||||
* a list of serializable <code>ActionListeners</code>
|
||||
* a list of serializable {@code ActionListeners}
|
||||
* as optional data. The non-serializable
|
||||
* <code>ActionListeners</code> are detected and
|
||||
* {@code ActionListeners} are detected and
|
||||
* no attempt is made to serialize them.
|
||||
*
|
||||
* @serialData <code>null</code> terminated sequence of 0 or
|
||||
* more pairs: the pair consists of a <code>String</code>
|
||||
* and an <code>Object</code>; the <code>String</code>
|
||||
* @serialData {@code null} terminated sequence of 0 or
|
||||
* more pairs: the pair consists of a {@code String}
|
||||
* and an {@code Object}; the {@code String}
|
||||
* indicates the type of object and is one of the following:
|
||||
* <code>actionListenerK</code> indicating an
|
||||
* <code>ActionListener</code> object
|
||||
* {@code actionListenerK} indicating an
|
||||
* {@code ActionListener} object
|
||||
*
|
||||
* @param s the <code>ObjectOutputStream</code> to write
|
||||
* @param s the {@code ObjectOutputStream} to write
|
||||
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
|
||||
* @see java.awt.Component#actionListenerK
|
||||
* @see #readObject(ObjectInputStream)
|
||||
@ -464,15 +464,15 @@ public class Button extends Component implements Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the <code>ObjectInputStream</code> and if
|
||||
* it isn't <code>null</code> adds a listener to
|
||||
* Reads the {@code ObjectInputStream} and if
|
||||
* it isn't {@code null} adds a listener to
|
||||
* receive action events fired by the button.
|
||||
* Unrecognized keys or values will be ignored.
|
||||
*
|
||||
* @param s the <code>ObjectInputStream</code> to read
|
||||
* @param s the {@code ObjectInputStream} to read
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code> returns
|
||||
* <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless} returns
|
||||
* {@code true}
|
||||
* @serial
|
||||
* @see #removeActionListener(ActionListener)
|
||||
* @see #addActionListener(ActionListener)
|
||||
@ -503,15 +503,15 @@ public class Button extends Component implements Accessible {
|
||||
////////////////
|
||||
|
||||
/**
|
||||
* Gets the <code>AccessibleContext</code> associated with
|
||||
* this <code>Button</code>. For buttons, the
|
||||
* <code>AccessibleContext</code> takes the form of an
|
||||
* <code>AccessibleAWTButton</code>.
|
||||
* A new <code>AccessibleAWTButton</code> instance is
|
||||
* Gets the {@code AccessibleContext} associated with
|
||||
* this {@code Button}. For buttons, the
|
||||
* {@code AccessibleContext} takes the form of an
|
||||
* {@code AccessibleAWTButton}.
|
||||
* A new {@code AccessibleAWTButton} instance is
|
||||
* created if necessary.
|
||||
*
|
||||
* @return an <code>AccessibleAWTButton</code> that serves as the
|
||||
* <code>AccessibleContext</code> of this <code>Button</code>
|
||||
* @return an {@code AccessibleAWTButton} that serves as the
|
||||
* {@code AccessibleContext} of this {@code Button}
|
||||
* @since 1.3
|
||||
*/
|
||||
@BeanProperty(expert = true, description
|
||||
@ -525,7 +525,7 @@ public class Button extends Component implements Accessible {
|
||||
|
||||
/**
|
||||
* This class implements accessibility support for the
|
||||
* <code>Button</code> class. It provides an implementation of the
|
||||
* {@code Button} class. It provides an implementation of the
|
||||
* Java Accessibility API appropriate to button user-interface elements.
|
||||
* @since 1.3
|
||||
*/
|
||||
|
@ -29,13 +29,13 @@ import java.awt.peer.CanvasPeer;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* A <code>Canvas</code> component represents a blank rectangular
|
||||
* A {@code Canvas} component represents a blank rectangular
|
||||
* area of the screen onto which the application can draw or from
|
||||
* which the application can trap input events from the user.
|
||||
* <p>
|
||||
* An application must subclass the <code>Canvas</code> class in
|
||||
* An application must subclass the {@code Canvas} class in
|
||||
* order to get useful functionality such as creating a custom
|
||||
* component. The <code>paint</code> method must be overridden
|
||||
* component. The {@code paint} method must be overridden
|
||||
* in order to perform custom graphics on the canvas.
|
||||
*
|
||||
* @author Sami Shaio
|
||||
@ -108,7 +108,7 @@ public class Canvas extends Component implements Accessible {
|
||||
/**
|
||||
* Paints this canvas.
|
||||
* <p>
|
||||
* Most applications that subclass <code>Canvas</code> should
|
||||
* Most applications that subclass {@code Canvas} should
|
||||
* override this method in order to perform some useful operation
|
||||
* (typically, custom painting of the canvas).
|
||||
* The default operation is simply to clear the canvas.
|
||||
@ -126,10 +126,10 @@ public class Canvas extends Component implements Accessible {
|
||||
/**
|
||||
* Updates this canvas.
|
||||
* <p>
|
||||
* This method is called in response to a call to <code>repaint</code>.
|
||||
* This method is called in response to a call to {@code repaint}.
|
||||
* The canvas is first cleared by filling it with the background
|
||||
* color, and then completely redrawn by calling this canvas's
|
||||
* <code>paint</code> method.
|
||||
* {@code paint} method.
|
||||
* Note: applications that override this method should either call
|
||||
* super.update(g) or incorporate the functionality described
|
||||
* above into their own code.
|
||||
@ -151,7 +151,7 @@ public class Canvas extends Component implements Accessible {
|
||||
* Creates a new strategy for multi-buffering on this component.
|
||||
* Multi-buffering is useful for rendering performance. This method
|
||||
* attempts to create the best strategy available with the number of
|
||||
* buffers supplied. It will always create a <code>BufferStrategy</code>
|
||||
* buffers supplied. It will always create a {@code BufferStrategy}
|
||||
* with that number of buffers.
|
||||
* A page-flipping strategy is attempted first, then a blitting strategy
|
||||
* using accelerated buffers. Finally, an unaccelerated blitting
|
||||
@ -180,13 +180,13 @@ public class Canvas extends Component implements Accessible {
|
||||
* is called, the existing buffer strategy for this component is discarded.
|
||||
* @param numBuffers number of buffers to create
|
||||
* @param caps the required capabilities for creating the buffer strategy;
|
||||
* cannot be <code>null</code>
|
||||
* cannot be {@code null}
|
||||
* @exception AWTException if the capabilities supplied could not be
|
||||
* supported or met; this may happen, for example, if there is not enough
|
||||
* accelerated memory currently available, or if page flipping is specified
|
||||
* but not possible.
|
||||
* @exception IllegalArgumentException if numBuffers is less than 1, or if
|
||||
* caps is <code>null</code>
|
||||
* caps is {@code null}
|
||||
* @see #getBufferStrategy
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -196,8 +196,8 @@ public class Canvas extends Component implements Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>BufferStrategy</code> used by this component. This
|
||||
* method will return null if a <code>BufferStrategy</code> has not yet
|
||||
* Returns the {@code BufferStrategy} used by this component. This
|
||||
* method will return null if a {@code BufferStrategy} has not yet
|
||||
* been created or has been disposed.
|
||||
*
|
||||
* @return the buffer strategy used by this component
|
||||
@ -232,7 +232,7 @@ public class Canvas extends Component implements Accessible {
|
||||
|
||||
/**
|
||||
* This class implements accessibility support for the
|
||||
* <code>Canvas</code> class. It provides an implementation of the
|
||||
* {@code Canvas} class. It provides an implementation of the
|
||||
* Java Accessibility API appropriate to canvas user-interface elements.
|
||||
* @since 1.3
|
||||
*/
|
||||
|
@ -36,15 +36,15 @@ import java.io.ObjectStreamField;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A <code>CardLayout</code> object is a layout manager for a
|
||||
* A {@code CardLayout} object is a layout manager for a
|
||||
* container. It treats each component in the container as a card.
|
||||
* Only one card is visible at a time, and the container acts as
|
||||
* a stack of cards. The first component added to a
|
||||
* <code>CardLayout</code> object is the visible component when the
|
||||
* {@code CardLayout} object is the visible component when the
|
||||
* container is first displayed.
|
||||
* <p>
|
||||
* The ordering of cards is determined by the container's own internal
|
||||
* ordering of its component objects. <code>CardLayout</code>
|
||||
* ordering of its component objects. {@code CardLayout}
|
||||
* defines a set of methods that allow an application to flip
|
||||
* through these cards sequentially, or to show a specified card.
|
||||
* The {@link CardLayout#addLayoutComponent}
|
||||
@ -188,10 +188,10 @@ public class CardLayout implements LayoutManager2,
|
||||
|
||||
/**
|
||||
* Adds the specified component to this card layout's internal
|
||||
* table of names. The object specified by <code>constraints</code>
|
||||
* table of names. The object specified by {@code constraints}
|
||||
* must be a string. The card layout stores this string as a key-value
|
||||
* pair that can be used for random access to a particular card.
|
||||
* By calling the <code>show</code> method, an application can
|
||||
* By calling the {@code show} method, an application can
|
||||
* display the component with the specified name.
|
||||
* @param comp the component to be added.
|
||||
* @param constraints a tag that identifies a particular
|
||||
@ -214,7 +214,7 @@ public class CardLayout implements LayoutManager2,
|
||||
|
||||
/**
|
||||
* @deprecated replaced by
|
||||
* <code>addLayoutComponent(Component, Object)</code>.
|
||||
* {@code addLayoutComponent(Component, Object)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void addLayoutComponent(String name, Component comp) {
|
||||
@ -365,7 +365,7 @@ public class CardLayout implements LayoutManager2,
|
||||
/**
|
||||
* Lays out the specified container using this card layout.
|
||||
* <p>
|
||||
* Each component in the <code>parent</code> container is reshaped
|
||||
* Each component in the {@code parent} container is reshaped
|
||||
* to be the size of the container, minus space for surrounding
|
||||
* insets, horizontal gaps, and vertical gaps.
|
||||
*
|
||||
@ -515,7 +515,7 @@ public class CardLayout implements LayoutManager2,
|
||||
|
||||
/**
|
||||
* Flips to the component that was added to this layout with the
|
||||
* specified <code>name</code>, using <code>addLayoutComponent</code>.
|
||||
* specified {@code name}, using {@code addLayoutComponent}.
|
||||
* If no such component exists, then nothing happens.
|
||||
* @param parent the parent container in which to do the layout
|
||||
* @param name the component name
|
||||
|
@ -35,7 +35,7 @@ import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
* A check box is a graphical component that can be in either an
|
||||
* "on" (<code>true</code>) or "off" (<code>false</code>) state.
|
||||
* "on" ({@code true}) or "off" ({@code false}) state.
|
||||
* Clicking on a check box changes its state from
|
||||
* "on" to "off," or from "off" to "on."
|
||||
* <p>
|
||||
@ -55,14 +55,14 @@ import javax.accessibility.*;
|
||||
* <img src="doc-files/Checkbox-1.gif" alt="The following context describes the graphic."
|
||||
* style="float:center; margin: 7px 10px;">
|
||||
* <p>
|
||||
* The button labeled <code>one</code> is in the "on" state, and the
|
||||
* The button labeled {@code one} is in the "on" state, and the
|
||||
* other two are in the "off" state. In this example, which uses the
|
||||
* <code>GridLayout</code> class, the states of the three check
|
||||
* {@code GridLayout} class, the states of the three check
|
||||
* boxes are set independently.
|
||||
* <p>
|
||||
* Alternatively, several check boxes can be grouped together under
|
||||
* the control of a single object, using the
|
||||
* <code>CheckboxGroup</code> class.
|
||||
* {@code CheckboxGroup} class.
|
||||
* In a check box group, at most one button can be in the "on"
|
||||
* state at any given time. Clicking on a check box to turn it on
|
||||
* forces any other check box in the same group that is on
|
||||
@ -93,7 +93,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
String label;
|
||||
|
||||
/**
|
||||
* The state of the <code>Checkbox</code>.
|
||||
* The state of the {@code Checkbox}.
|
||||
* @serial
|
||||
* @see #getState()
|
||||
* @see #setState(boolean)
|
||||
@ -150,10 +150,10 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* any check box group.
|
||||
*
|
||||
* @param label a string label for this check box,
|
||||
* or <code>null</code> for no label.
|
||||
* or {@code null} for no label.
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code>
|
||||
* returns <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless}
|
||||
* returns {@code true}
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
public Checkbox(String label) throws HeadlessException {
|
||||
@ -166,11 +166,11 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* This check box is not part of any check box group.
|
||||
*
|
||||
* @param label a string label for this check box,
|
||||
* or <code>null</code> for no label
|
||||
* or {@code null} for no label
|
||||
* @param state the initial state of this check box
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code>
|
||||
* returns <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless}
|
||||
* returns {@code true}
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
public Checkbox(String label, boolean state) throws HeadlessException {
|
||||
@ -182,13 +182,13 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* specified state, and in the specified check box group.
|
||||
*
|
||||
* @param label a string label for this check box,
|
||||
* or <code>null</code> for no label.
|
||||
* or {@code null} for no label.
|
||||
* @param state the initial state of this check box.
|
||||
* @param group a check box group for this check box,
|
||||
* or <code>null</code> for no group.
|
||||
* or {@code null} for no group.
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code>
|
||||
* returns <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless}
|
||||
* returns {@code true}
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
* @since 1.1
|
||||
*/
|
||||
@ -208,13 +208,13 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* check box group, and set to the specified state.
|
||||
*
|
||||
* @param label a string label for this check box,
|
||||
* or <code>null</code> for no label.
|
||||
* or {@code null} for no label.
|
||||
* @param group a check box group for this check box,
|
||||
* or <code>null</code> for no group.
|
||||
* or {@code null} for no group.
|
||||
* @param state the initial state of this check box.
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code>
|
||||
* returns <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless}
|
||||
* returns {@code true}
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
* @since 1.1
|
||||
*/
|
||||
@ -225,7 +225,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Constructs a name for this component. Called by
|
||||
* <code>getName</code> when the name is <code>null</code>.
|
||||
* {@code getName} when the name is {@code null}.
|
||||
*
|
||||
* @return a name for this component
|
||||
*/
|
||||
@ -252,7 +252,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
/**
|
||||
* Gets the label of this check box.
|
||||
*
|
||||
* @return the label of this check box, or <code>null</code>
|
||||
* @return the label of this check box, or {@code null}
|
||||
* if this check box has no label.
|
||||
* @see #setLabel(String)
|
||||
*/
|
||||
@ -264,7 +264,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* Sets this check box's label to be the string argument.
|
||||
*
|
||||
* @param label a string to set as the new label, or
|
||||
* <code>null</code> for no label.
|
||||
* {@code null} for no label.
|
||||
* @see #getLabel
|
||||
*/
|
||||
public void setLabel(String label) {
|
||||
@ -290,8 +290,8 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Determines whether this check box is in the "on" or "off" state.
|
||||
* The boolean value <code>true</code> indicates the "on" state,
|
||||
* and <code>false</code> indicates the "off" state.
|
||||
* The boolean value {@code true} indicates the "on" state,
|
||||
* and {@code false} indicates the "off" state.
|
||||
*
|
||||
* @return the state of this check box, as a boolean value
|
||||
* @see #setState
|
||||
@ -302,14 +302,14 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Sets the state of this check box to the specified state.
|
||||
* The boolean value <code>true</code> indicates the "on" state,
|
||||
* and <code>false</code> indicates the "off" state.
|
||||
* The boolean value {@code true} indicates the "on" state,
|
||||
* and {@code false} indicates the "off" state.
|
||||
*
|
||||
* <p>Note that this method should be primarily used to
|
||||
* initialize the state of the checkbox. Programmatically
|
||||
* setting the state of the checkbox will <i>not</i> trigger
|
||||
* an <code>ItemEvent</code>. The only way to trigger an
|
||||
* <code>ItemEvent</code> is by user interaction.
|
||||
* an {@code ItemEvent}. The only way to trigger an
|
||||
* {@code ItemEvent} is by user interaction.
|
||||
*
|
||||
* @param state the boolean state of the check box
|
||||
* @see #getState
|
||||
@ -343,7 +343,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Determines this check box's group.
|
||||
* @return this check box's group, or <code>null</code>
|
||||
* @return this check box's group, or {@code null}
|
||||
* if the check box is not part of a check box group.
|
||||
* @see #setCheckboxGroup(CheckboxGroup)
|
||||
*/
|
||||
@ -356,14 +356,14 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* If this check box is already in a different check box group,
|
||||
* it is first taken out of that group.
|
||||
* <p>
|
||||
* If the state of this check box is <code>true</code> and the new
|
||||
* If the state of this check box is {@code true} and the new
|
||||
* group already has a check box selected, this check box's state
|
||||
* is changed to <code>false</code>. If the state of this check
|
||||
* box is <code>true</code> and the new group has no check box
|
||||
* is changed to {@code false}. If the state of this check
|
||||
* box is {@code true} and the new group has no check box
|
||||
* selected, this check box becomes the selected checkbox for
|
||||
* the new group and its state is <code>true</code>.
|
||||
* the new group and its state is {@code true}.
|
||||
*
|
||||
* @param g the new check box group, or <code>null</code>
|
||||
* @param g the new check box group, or {@code null}
|
||||
* to remove this check box from any check box group
|
||||
* @see #getCheckboxGroup
|
||||
*/
|
||||
@ -458,7 +458,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
* Returns an array of all the item listeners
|
||||
* registered on this checkbox.
|
||||
*
|
||||
* @return all of this checkbox's <code>ItemListener</code>s
|
||||
* @return all of this checkbox's {@code ItemListener}s
|
||||
* or an empty array if no item
|
||||
* listeners are currently registered
|
||||
*
|
||||
@ -475,16 +475,16 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
/**
|
||||
* Returns an array of all the objects currently registered
|
||||
* as <code><em>Foo</em>Listener</code>s
|
||||
* upon this <code>Checkbox</code>.
|
||||
* upon this {@code Checkbox}.
|
||||
* <code><em>Foo</em>Listener</code>s are registered using the
|
||||
* <code>add<em>Foo</em>Listener</code> method.
|
||||
*
|
||||
* <p>
|
||||
* You can specify the <code>listenerType</code> argument
|
||||
* You can specify the {@code listenerType} argument
|
||||
* with a class literal, such as
|
||||
* <code><em>Foo</em>Listener.class</code>.
|
||||
* For example, you can query a
|
||||
* <code>Checkbox</code> <code>c</code>
|
||||
* {@code Checkbox c}
|
||||
* for its item listeners with the following code:
|
||||
*
|
||||
* <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre>
|
||||
@ -493,14 +493,14 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
*
|
||||
* @param listenerType the type of listeners requested; this parameter
|
||||
* should specify an interface that descends from
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
* @return an array of all objects registered as
|
||||
* <code><em>Foo</em>Listener</code>s on this checkbox,
|
||||
* or an empty array if no such
|
||||
* listeners have been added
|
||||
* @exception ClassCastException if <code>listenerType</code>
|
||||
* @exception ClassCastException if {@code listenerType}
|
||||
* doesn't specify a class or interface that implements
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
*
|
||||
* @see #getItemListeners
|
||||
* @since 1.3
|
||||
@ -529,10 +529,10 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Processes events on this check box.
|
||||
* If the event is an instance of <code>ItemEvent</code>,
|
||||
* this method invokes the <code>processItemEvent</code> method.
|
||||
* Otherwise, it calls its superclass's <code>processEvent</code> method.
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* If the event is an instance of {@code ItemEvent},
|
||||
* this method invokes the {@code processItemEvent} method.
|
||||
* Otherwise, it calls its superclass's {@code processEvent} method.
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -552,17 +552,17 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
/**
|
||||
* Processes item events occurring on this check box by
|
||||
* dispatching them to any registered
|
||||
* <code>ItemListener</code> objects.
|
||||
* {@code ItemListener} objects.
|
||||
* <p>
|
||||
* This method is not called unless item events are
|
||||
* enabled for this component. Item events are enabled
|
||||
* when one of the following occurs:
|
||||
* <ul>
|
||||
* <li>An <code>ItemListener</code> object is registered
|
||||
* via <code>addItemListener</code>.
|
||||
* <li>Item events are enabled via <code>enableEvents</code>.
|
||||
* <li>An {@code ItemListener} object is registered
|
||||
* via {@code addItemListener}.
|
||||
* <li>Item events are enabled via {@code enableEvents}.
|
||||
* </ul>
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -581,11 +581,11 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the state of this <code>Checkbox</code>.
|
||||
* Returns a string representing the state of this {@code Checkbox}.
|
||||
* This method is intended to be used only for debugging purposes, and the
|
||||
* content and format of the returned string may vary between
|
||||
* implementations. The returned string may be empty but may not be
|
||||
* <code>null</code>.
|
||||
* {@code null}.
|
||||
*
|
||||
* @return the parameter string of this check box
|
||||
*/
|
||||
@ -610,18 +610,18 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Writes default serializable fields to stream. Writes
|
||||
* a list of serializable <code>ItemListeners</code>
|
||||
* a list of serializable {@code ItemListeners}
|
||||
* as optional data. The non-serializable
|
||||
* <code>ItemListeners</code> are detected and
|
||||
* {@code ItemListeners} are detected and
|
||||
* no attempt is made to serialize them.
|
||||
*
|
||||
* @param s the <code>ObjectOutputStream</code> to write
|
||||
* @serialData <code>null</code> terminated sequence of 0
|
||||
* or more pairs; the pair consists of a <code>String</code>
|
||||
* and an <code>Object</code>; the <code>String</code> indicates
|
||||
* @param s the {@code ObjectOutputStream} to write
|
||||
* @serialData {@code null} terminated sequence of 0
|
||||
* or more pairs; the pair consists of a {@code String}
|
||||
* and an {@code Object}; the {@code String} indicates
|
||||
* the type of object and is one of the following:
|
||||
* <code>itemListenerK</code> indicating an
|
||||
* <code>ItemListener</code> object
|
||||
* {@code itemListenerK} indicating an
|
||||
* {@code ItemListener} object
|
||||
*
|
||||
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
|
||||
* @see java.awt.Component#itemListenerK
|
||||
@ -637,15 +637,15 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the <code>ObjectInputStream</code> and if it
|
||||
* isn't <code>null</code> adds a listener to receive
|
||||
* item events fired by the <code>Checkbox</code>.
|
||||
* Reads the {@code ObjectInputStream} and if it
|
||||
* isn't {@code null} adds a listener to receive
|
||||
* item events fired by the {@code Checkbox}.
|
||||
* Unrecognized keys or values will be ignored.
|
||||
*
|
||||
* @param s the <code>ObjectInputStream</code> to read
|
||||
* @param s the {@code ObjectInputStream} to read
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code> returns
|
||||
* <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless} returns
|
||||
* {@code true}
|
||||
* @serial
|
||||
* @see #removeItemListener(ItemListener)
|
||||
* @see #addItemListener(ItemListener)
|
||||
@ -700,7 +700,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* This class implements accessibility support for the
|
||||
* <code>Checkbox</code> class. It provides an implementation of the
|
||||
* {@code Checkbox} class. It provides an implementation of the
|
||||
* Java Accessibility API appropriate to checkbox user-interface elements.
|
||||
* @since 1.3
|
||||
*/
|
||||
|
@ -40,20 +40,20 @@ import sun.awt.AWTAccessor;
|
||||
* "on" to "off" or from "off" to "on."
|
||||
* <p>
|
||||
* The following picture depicts a menu which contains an instance
|
||||
* of <code>CheckBoxMenuItem</code>:
|
||||
* of {@code CheckBoxMenuItem}:
|
||||
* <p>
|
||||
* <img src="doc-files/MenuBar-1.gif"
|
||||
* alt="Menu labeled Examples, containing items Basic, Simple, Check, and More Examples. The Check item is a CheckBoxMenuItem instance, in the off state."
|
||||
* style="float:center; margin: 7px 10px;">
|
||||
* <p>
|
||||
* The item labeled <code>Check</code> shows a check box menu item
|
||||
* The item labeled {@code Check} shows a check box menu item
|
||||
* in its "off" state.
|
||||
* <p>
|
||||
* When a check box menu item is selected, AWT sends an item event to
|
||||
* the item. Since the event is an instance of <code>ItemEvent</code>,
|
||||
* the <code>processEvent</code> method examines the event and passes
|
||||
* it along to <code>processItemEvent</code>. The latter method redirects
|
||||
* the event to any <code>ItemListener</code> objects that have
|
||||
* the item. Since the event is an instance of {@code ItemEvent},
|
||||
* the {@code processEvent} method examines the event and passes
|
||||
* it along to {@code processItemEvent}. The latter method redirects
|
||||
* the event to any {@code ItemListener} objects that have
|
||||
* registered an interest in item events generated by this menu item.
|
||||
*
|
||||
* @author Sami Shaio
|
||||
@ -113,7 +113,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
* The item's state is initially set to "off."
|
||||
|
||||
* @param label a string label for the check box menu item,
|
||||
* or <code>null</code> for an unlabeled menu item.
|
||||
* or {@code null} for an unlabeled menu item.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
@ -125,10 +125,10 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
/**
|
||||
* Create a check box menu item with the specified label and state.
|
||||
* @param label a string label for the check box menu item,
|
||||
* or <code>null</code> for an unlabeled menu item.
|
||||
* or {@code null} for an unlabeled menu item.
|
||||
* @param state the initial state of the menu item, where
|
||||
* <code>true</code> indicates "on" and
|
||||
* <code>false</code> indicates "off."
|
||||
* {@code true} indicates "on" and
|
||||
* {@code false} indicates "off."
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
@ -170,8 +170,8 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
* is "on" or "off."
|
||||
*
|
||||
* @return the state of this check box menu item, where
|
||||
* <code>true</code> indicates "on" and
|
||||
* <code>false</code> indicates "off"
|
||||
* {@code true} indicates "on" and
|
||||
* {@code false} indicates "off"
|
||||
* @see #setState
|
||||
*/
|
||||
public boolean getState() {
|
||||
@ -180,18 +180,18 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
|
||||
/**
|
||||
* Sets this check box menu item to the specified state.
|
||||
* The boolean value <code>true</code> indicates "on" while
|
||||
* <code>false</code> indicates "off."
|
||||
* The boolean value {@code true} indicates "on" while
|
||||
* {@code false} indicates "off."
|
||||
*
|
||||
* <p>Note that this method should be primarily used to
|
||||
* initialize the state of the check box menu item.
|
||||
* Programmatically setting the state of the check box
|
||||
* menu item will <i>not</i> trigger
|
||||
* an <code>ItemEvent</code>. The only way to trigger an
|
||||
* <code>ItemEvent</code> is by user interaction.
|
||||
* an {@code ItemEvent}. The only way to trigger an
|
||||
* {@code ItemEvent} is by user interaction.
|
||||
*
|
||||
* @param b <code>true</code> if the check box
|
||||
* menu item is on, otherwise <code>false</code>
|
||||
* @param b {@code true} if the check box
|
||||
* menu item is on, otherwise {@code false}
|
||||
* @see #getState
|
||||
*/
|
||||
public synchronized void setState(boolean b) {
|
||||
@ -265,7 +265,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
* Returns an array of all the item listeners
|
||||
* registered on this checkbox menuitem.
|
||||
*
|
||||
* @return all of this checkbox menuitem's <code>ItemListener</code>s
|
||||
* @return all of this checkbox menuitem's {@code ItemListener}s
|
||||
* or an empty array if no item
|
||||
* listeners are currently registered
|
||||
*
|
||||
@ -282,16 +282,16 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
/**
|
||||
* Returns an array of all the objects currently registered
|
||||
* as <code><em>Foo</em>Listener</code>s
|
||||
* upon this <code>CheckboxMenuItem</code>.
|
||||
* upon this {@code CheckboxMenuItem}.
|
||||
* <code><em>Foo</em>Listener</code>s are registered using the
|
||||
* <code>add<em>Foo</em>Listener</code> method.
|
||||
*
|
||||
* <p>
|
||||
* You can specify the <code>listenerType</code> argument
|
||||
* You can specify the {@code listenerType} argument
|
||||
* with a class literal, such as
|
||||
* <code><em>Foo</em>Listener.class</code>.
|
||||
* For example, you can query a
|
||||
* <code>CheckboxMenuItem</code> <code>c</code>
|
||||
* {@code CheckboxMenuItem c}
|
||||
* for its item listeners with the following code:
|
||||
*
|
||||
* <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre>
|
||||
@ -300,14 +300,14 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
*
|
||||
* @param listenerType the type of listeners requested; this parameter
|
||||
* should specify an interface that descends from
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
* @return an array of all objects registered as
|
||||
* <code><em>Foo</em>Listener</code>s on this checkbox menuitem,
|
||||
* or an empty array if no such
|
||||
* listeners have been added
|
||||
* @exception ClassCastException if <code>listenerType</code>
|
||||
* @exception ClassCastException if {@code listenerType}
|
||||
* doesn't specify a class or interface that implements
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
*
|
||||
* @see #getItemListeners
|
||||
* @since 1.3
|
||||
@ -336,13 +336,13 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
|
||||
/**
|
||||
* Processes events on this check box menu item.
|
||||
* If the event is an instance of <code>ItemEvent</code>,
|
||||
* this method invokes the <code>processItemEvent</code> method.
|
||||
* If the event is an instance of {@code ItemEvent},
|
||||
* this method invokes the {@code processItemEvent} method.
|
||||
* If the event is not an item event,
|
||||
* it invokes <code>processEvent</code> on the superclass.
|
||||
* it invokes {@code processEvent} on the superclass.
|
||||
* <p>
|
||||
* Check box menu items currently support only item events.
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -361,17 +361,17 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
|
||||
/**
|
||||
* Processes item events occurring on this check box menu item by
|
||||
* dispatching them to any registered <code>ItemListener</code> objects.
|
||||
* dispatching them to any registered {@code ItemListener} objects.
|
||||
* <p>
|
||||
* This method is not called unless item events are
|
||||
* enabled for this menu item. Item events are enabled
|
||||
* when one of the following occurs:
|
||||
* <ul>
|
||||
* <li>An <code>ItemListener</code> object is registered
|
||||
* via <code>addItemListener</code>.
|
||||
* <li>Item events are enabled via <code>enableEvents</code>.
|
||||
* <li>An {@code ItemListener} object is registered
|
||||
* via {@code addItemListener}.
|
||||
* <li>Item events are enabled via {@code enableEvents}.
|
||||
* </ul>
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -403,11 +403,11 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
|
||||
/**
|
||||
* Returns a string representing the state of this
|
||||
* <code>CheckBoxMenuItem</code>. This
|
||||
* {@code CheckBoxMenuItem}. This
|
||||
* method is intended to be used only for debugging purposes, and the
|
||||
* content and format of the returned string may vary between
|
||||
* implementations. The returned string may be empty but may not be
|
||||
* <code>null</code>.
|
||||
* {@code null}.
|
||||
*
|
||||
* @return the parameter string of this check box menu item
|
||||
*/
|
||||
@ -426,18 +426,18 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
|
||||
/**
|
||||
* Writes default serializable fields to stream. Writes
|
||||
* a list of serializable <code>ItemListeners</code>
|
||||
* a list of serializable {@code ItemListeners}
|
||||
* as optional data. The non-serializable
|
||||
* <code>ItemListeners</code> are detected and
|
||||
* {@code ItemListeners} are detected and
|
||||
* no attempt is made to serialize them.
|
||||
*
|
||||
* @param s the <code>ObjectOutputStream</code> to write
|
||||
* @serialData <code>null</code> terminated sequence of
|
||||
* 0 or more pairs; the pair consists of a <code>String</code>
|
||||
* and an <code>Object</code>; the <code>String</code> indicates
|
||||
* @param s the {@code ObjectOutputStream} to write
|
||||
* @serialData {@code null} terminated sequence of
|
||||
* 0 or more pairs; the pair consists of a {@code String}
|
||||
* and an {@code Object}; the {@code String} indicates
|
||||
* the type of object and is one of the following:
|
||||
* <code>itemListenerK</code> indicating an
|
||||
* <code>ItemListener</code> object
|
||||
* {@code itemListenerK} indicating an
|
||||
* {@code ItemListener} object
|
||||
*
|
||||
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
|
||||
* @see java.awt.Component#itemListenerK
|
||||
@ -453,12 +453,12 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads the <code>ObjectInputStream</code> and if it
|
||||
* isn't <code>null</code> adds a listener to receive
|
||||
* item events fired by the <code>Checkbox</code> menu item.
|
||||
* Reads the {@code ObjectInputStream} and if it
|
||||
* isn't {@code null} adds a listener to receive
|
||||
* item events fired by the {@code Checkbox} menu item.
|
||||
* Unrecognized keys or values will be ignored.
|
||||
*
|
||||
* @param s the <code>ObjectInputStream</code> to read
|
||||
* @param s the {@code ObjectInputStream} to read
|
||||
* @serial
|
||||
* @see removeActionListener()
|
||||
* @see addActionListener()
|
||||
@ -515,7 +515,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
|
||||
* subclassed by menu component developers.
|
||||
* <p>
|
||||
* This class implements accessibility support for the
|
||||
* <code>CheckboxMenuItem</code> class. It provides an implementation
|
||||
* {@code CheckboxMenuItem} class. It provides an implementation
|
||||
* of the Java Accessibility API appropriate to checkbox menu item
|
||||
* user-interface elements.
|
||||
* @since 1.3
|
||||
|
@ -36,7 +36,7 @@ import javax.accessibility.*;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>Choice</code> class presents a pop-up menu of choices.
|
||||
* The {@code Choice} class presents a pop-up menu of choices.
|
||||
* The current choice is displayed as the title of the menu.
|
||||
* <p>
|
||||
* The following code example produces a pop-up menu:
|
||||
@ -54,17 +54,17 @@ import javax.accessibility.*;
|
||||
* <img src="doc-files/Choice-1.gif" alt="The following text describes the graphic"
|
||||
* style="float:center; margin: 7px 10px;">
|
||||
* <p>
|
||||
* In the picture, <code>"Green"</code> is the current choice.
|
||||
* In the picture, {@code "Green"} is the current choice.
|
||||
* Pushing the mouse button down on the object causes a menu to
|
||||
* appear with the current choice highlighted.
|
||||
* <p>
|
||||
* Some native platforms do not support arbitrary resizing of
|
||||
* <code>Choice</code> components and the behavior of
|
||||
* <code>setSize()/getSize()</code> is bound by
|
||||
* {@code Choice} components and the behavior of
|
||||
* {@code setSize()/getSize()} is bound by
|
||||
* such limitations.
|
||||
* Native GUI <code>Choice</code> components' size are often bound by such
|
||||
* Native GUI {@code Choice} components' size are often bound by such
|
||||
* attributes as font size and length of items contained within
|
||||
* the <code>Choice</code>.
|
||||
* the {@code Choice}.
|
||||
*
|
||||
* @author Sami Shaio
|
||||
* @author Arthur van Hoff
|
||||
@ -72,8 +72,8 @@ import javax.accessibility.*;
|
||||
*/
|
||||
public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
/**
|
||||
* The items for the <code>Choice</code>.
|
||||
* This can be a <code>null</code> value.
|
||||
* The items for the {@code Choice}.
|
||||
* This can be a {@code null} value.
|
||||
* @serial
|
||||
* @see #add(String)
|
||||
* @see #addItem(String)
|
||||
@ -85,7 +85,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
Vector<String> pItems;
|
||||
|
||||
/**
|
||||
* The index of the current choice for this <code>Choice</code>
|
||||
* The index of the current choice for this {@code Choice}
|
||||
* or -1 if nothing is selected.
|
||||
* @serial
|
||||
* @see #getSelectedItem()
|
||||
@ -117,7 +117,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
* <p>
|
||||
* By default, the first item added to the choice menu becomes the
|
||||
* selected item, until a different selection is made by the user
|
||||
* by calling one of the <code>select</code> methods.
|
||||
* by calling one of the {@code select} methods.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
@ -131,7 +131,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Constructs a name for this component. Called by
|
||||
* <code>getName</code> when the name is <code>null</code>.
|
||||
* {@code getName} when the name is {@code null}.
|
||||
*/
|
||||
String constructComponentName() {
|
||||
synchronized (Choice.class) {
|
||||
@ -140,9 +140,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the <code>Choice</code>'s peer. This peer allows us
|
||||
* Creates the {@code Choice}'s peer. This peer allows us
|
||||
* to change the look
|
||||
* of the <code>Choice</code> without changing its functionality.
|
||||
* of the {@code Choice} without changing its functionality.
|
||||
* @see java.awt.Component#getToolkit()
|
||||
*/
|
||||
public void addNotify() {
|
||||
@ -154,9 +154,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of items in this <code>Choice</code> menu.
|
||||
* Returns the number of items in this {@code Choice} menu.
|
||||
*
|
||||
* @return the number of items in this <code>Choice</code> menu
|
||||
* @return the number of items in this {@code Choice} menu
|
||||
* @see #getItem
|
||||
* @since 1.1
|
||||
*/
|
||||
@ -169,7 +169,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
*
|
||||
* @return the number of items in this {@code Choice} menu
|
||||
* @deprecated As of JDK version 1.1,
|
||||
* replaced by <code>getItemCount()</code>.
|
||||
* replaced by {@code getItemCount()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public int countItems() {
|
||||
@ -178,7 +178,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Gets the string at the specified index in this
|
||||
* <code>Choice</code> menu.
|
||||
* {@code Choice} menu.
|
||||
*
|
||||
* @param index the index at which to begin
|
||||
* @return the item at the specified index
|
||||
@ -197,10 +197,10 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to this <code>Choice</code> menu.
|
||||
* Adds an item to this {@code Choice} menu.
|
||||
* @param item the item to be added
|
||||
* @exception NullPointerException if the item's value is
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
* @since 1.1
|
||||
*/
|
||||
public void add(String item) {
|
||||
@ -209,12 +209,12 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Obsolete as of Java 2 platform v1.1. Please use the
|
||||
* <code>add</code> method instead.
|
||||
* {@code add} method instead.
|
||||
* <p>
|
||||
* Adds an item to this <code>Choice</code> menu.
|
||||
* Adds an item to this {@code Choice} menu.
|
||||
* @param item the item to be added
|
||||
* @exception NullPointerException if the item's value is equal to
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
*/
|
||||
public void addItem(String item) {
|
||||
synchronized (this) {
|
||||
@ -226,14 +226,14 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an item to this <code>Choice</code>,
|
||||
* but does not invalidate the <code>Choice</code>.
|
||||
* Inserts an item to this {@code Choice},
|
||||
* but does not invalidate the {@code Choice}.
|
||||
* Client methods must provide their own synchronization before
|
||||
* invoking this method.
|
||||
* @param item the item to be added
|
||||
* @param index the new item position
|
||||
* @exception NullPointerException if the item's value is equal to
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
*/
|
||||
private void insertNoInvalidate(String item, int index) {
|
||||
if (item == null) {
|
||||
@ -255,10 +255,10 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
/**
|
||||
* Inserts the item into this choice at the specified position.
|
||||
* Existing items at an index greater than or equal to
|
||||
* <code>index</code> are shifted up by one to accommodate
|
||||
* the new item. If <code>index</code> is greater than or
|
||||
* {@code index} are shifted up by one to accommodate
|
||||
* the new item. If {@code index} is greater than or
|
||||
* equal to the number of items in this choice,
|
||||
* <code>item</code> is added to the end of this choice.
|
||||
* {@code item} is added to the end of this choice.
|
||||
* <p>
|
||||
* If the item is the first one being added to the choice,
|
||||
* then the item becomes selected. Otherwise, if the
|
||||
@ -266,7 +266,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
* item in the choice becomes the selected item. If the
|
||||
* selected item was no among those shifted, it remains
|
||||
* the selected item.
|
||||
* @param item the non-<code>null</code> item to be inserted
|
||||
* @param item the non-{@code null} item to be inserted
|
||||
* @param index the position at which the item should be inserted
|
||||
* @exception IllegalArgumentException if index is less than 0
|
||||
*/
|
||||
@ -286,14 +286,14 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the first occurrence of <code>item</code>
|
||||
* from the <code>Choice</code> menu. If the item
|
||||
* Removes the first occurrence of {@code item}
|
||||
* from the {@code Choice} menu. If the item
|
||||
* being removed is the currently selected item,
|
||||
* then the first item in the choice becomes the
|
||||
* selected item. Otherwise, the currently selected
|
||||
* item remains selected (and the selected index is
|
||||
* updated accordingly).
|
||||
* @param item the item to remove from this <code>Choice</code> menu
|
||||
* @param item the item to remove from this {@code Choice} menu
|
||||
* @exception IllegalArgumentException if the item doesn't
|
||||
* exist in the choice menu
|
||||
* @since 1.1
|
||||
@ -336,8 +336,8 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an item from the <code>Choice</code> at the
|
||||
* specified position, but does not invalidate the <code>Choice</code>.
|
||||
* Removes an item from the {@code Choice} at the
|
||||
* specified position, but does not invalidate the {@code Choice}.
|
||||
* Client methods must provide their
|
||||
* own synchronization before invoking this method.
|
||||
* @param position the position of the item
|
||||
@ -389,7 +389,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Returns an array (length 1) containing the currently selected
|
||||
* item. If this choice has no items, returns <code>null</code>.
|
||||
* item. If this choice has no items, returns {@code null}.
|
||||
* @see ItemSelectable
|
||||
*/
|
||||
public synchronized Object[] getSelectedObjects() {
|
||||
@ -414,14 +414,14 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected item in this <code>Choice</code> menu to be the
|
||||
* Sets the selected item in this {@code Choice} menu to be the
|
||||
* item at the specified position.
|
||||
*
|
||||
* <p>Note that this method should be primarily used to
|
||||
* initially select an item in this component.
|
||||
* Programmatically calling this method will <i>not</i> trigger
|
||||
* an <code>ItemEvent</code>. The only way to trigger an
|
||||
* <code>ItemEvent</code> is by user interaction.
|
||||
* an {@code ItemEvent}. The only way to trigger an
|
||||
* {@code ItemEvent} is by user interaction.
|
||||
*
|
||||
* @param pos the position of the selected item
|
||||
* @exception IllegalArgumentException if the specified
|
||||
@ -444,7 +444,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected item in this <code>Choice</code> menu
|
||||
* Sets the selected item in this {@code Choice} menu
|
||||
* to be the item whose name is equal to the specified string.
|
||||
* If more than one item matches (is equal to) the specified string,
|
||||
* the one with the smallest index is selected.
|
||||
@ -452,8 +452,8 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
* <p>Note that this method should be primarily used to
|
||||
* initially select an item in this component.
|
||||
* Programmatically calling this method will <i>not</i> trigger
|
||||
* an <code>ItemEvent</code>. The only way to trigger an
|
||||
* <code>ItemEvent</code> is by user interaction.
|
||||
* an {@code ItemEvent}. The only way to trigger an
|
||||
* {@code ItemEvent} is by user interaction.
|
||||
*
|
||||
* @param str the specified string
|
||||
* @see #getSelectedItem
|
||||
@ -468,9 +468,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Adds the specified item listener to receive item events from
|
||||
* this <code>Choice</code> menu. Item events are sent in response
|
||||
* to user input, but not in response to calls to <code>select</code>.
|
||||
* If l is <code>null</code>, no exception is thrown and no action
|
||||
* this {@code Choice} menu. Item events are sent in response
|
||||
* to user input, but not in response to calls to {@code select}.
|
||||
* If l is {@code null}, no exception is thrown and no action
|
||||
* is performed.
|
||||
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
|
||||
* >AWT Threading Issues</a> for details on AWT's threading model.
|
||||
@ -492,8 +492,8 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Removes the specified item listener so that it no longer receives
|
||||
* item events from this <code>Choice</code> menu.
|
||||
* If l is <code>null</code>, no exception is thrown and no
|
||||
* item events from this {@code Choice} menu.
|
||||
* If l is {@code null}, no exception is thrown and no
|
||||
* action is performed.
|
||||
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
|
||||
* >AWT Threading Issues</a> for details on AWT's threading model.
|
||||
@ -515,7 +515,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
* Returns an array of all the item listeners
|
||||
* registered on this choice.
|
||||
*
|
||||
* @return all of this choice's <code>ItemListener</code>s
|
||||
* @return all of this choice's {@code ItemListener}s
|
||||
* or an empty array if no item
|
||||
* listeners are currently registered
|
||||
*
|
||||
@ -532,16 +532,16 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
/**
|
||||
* Returns an array of all the objects currently registered
|
||||
* as <code><em>Foo</em>Listener</code>s
|
||||
* upon this <code>Choice</code>.
|
||||
* upon this {@code Choice}.
|
||||
* <code><em>Foo</em>Listener</code>s are registered using the
|
||||
* <code>add<em>Foo</em>Listener</code> method.
|
||||
*
|
||||
* <p>
|
||||
* You can specify the <code>listenerType</code> argument
|
||||
* You can specify the {@code listenerType} argument
|
||||
* with a class literal, such as
|
||||
* <code><em>Foo</em>Listener.class</code>.
|
||||
* For example, you can query a
|
||||
* <code>Choice</code> <code>c</code>
|
||||
* {@code Choice c}
|
||||
* for its item listeners with the following code:
|
||||
*
|
||||
* <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre>
|
||||
@ -550,14 +550,14 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
*
|
||||
* @param listenerType the type of listeners requested; this parameter
|
||||
* should specify an interface that descends from
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
* @return an array of all objects registered as
|
||||
* <code><em>Foo</em>Listener</code>s on this choice,
|
||||
* or an empty array if no such
|
||||
* listeners have been added
|
||||
* @exception ClassCastException if <code>listenerType</code>
|
||||
* @exception ClassCastException if {@code listenerType}
|
||||
* doesn't specify a class or interface that implements
|
||||
* <code>java.util.EventListener</code>
|
||||
* {@code java.util.EventListener}
|
||||
*
|
||||
* @see #getItemListeners
|
||||
* @since 1.3
|
||||
@ -586,10 +586,10 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Processes events on this choice. If the event is an
|
||||
* instance of <code>ItemEvent</code>, it invokes the
|
||||
* <code>processItemEvent</code> method. Otherwise, it calls its
|
||||
* superclass's <code>processEvent</code> method.
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* instance of {@code ItemEvent}, it invokes the
|
||||
* {@code processItemEvent} method. Otherwise, it calls its
|
||||
* superclass's {@code processEvent} method.
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -607,19 +607,19 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes item events occurring on this <code>Choice</code>
|
||||
* Processes item events occurring on this {@code Choice}
|
||||
* menu by dispatching them to any registered
|
||||
* <code>ItemListener</code> objects.
|
||||
* {@code ItemListener} objects.
|
||||
* <p>
|
||||
* This method is not called unless item events are
|
||||
* enabled for this component. Item events are enabled
|
||||
* when one of the following occurs:
|
||||
* <ul>
|
||||
* <li>An <code>ItemListener</code> object is registered
|
||||
* via <code>addItemListener</code>.
|
||||
* <li>Item events are enabled via <code>enableEvents</code>.
|
||||
* <li>An {@code ItemListener} object is registered
|
||||
* via {@code addItemListener}.
|
||||
* <li>Item events are enabled via {@code enableEvents}.
|
||||
* </ul>
|
||||
* <p>Note that if the event parameter is <code>null</code>
|
||||
* <p>Note that if the event parameter is {@code null}
|
||||
* the behavior is unspecified and may result in an
|
||||
* exception.
|
||||
*
|
||||
@ -638,13 +638,13 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the state of this <code>Choice</code>
|
||||
* Returns a string representing the state of this {@code Choice}
|
||||
* menu. This method is intended to be used only for debugging purposes,
|
||||
* and the content and format of the returned string may vary between
|
||||
* implementations. The returned string may be empty but may not be
|
||||
* <code>null</code>.
|
||||
* {@code null}.
|
||||
*
|
||||
* @return the parameter string of this <code>Choice</code> menu
|
||||
* @return the parameter string of this {@code Choice} menu
|
||||
*/
|
||||
protected String paramString() {
|
||||
return super.paramString() + ",current=" + getSelectedItem();
|
||||
@ -662,18 +662,18 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* Writes default serializable fields to stream. Writes
|
||||
* a list of serializable <code>ItemListeners</code>
|
||||
* a list of serializable {@code ItemListeners}
|
||||
* as optional data. The non-serializable
|
||||
* <code>ItemListeners</code> are detected and
|
||||
* {@code ItemListeners} are detected and
|
||||
* no attempt is made to serialize them.
|
||||
*
|
||||
* @param s the <code>ObjectOutputStream</code> to write
|
||||
* @serialData <code>null</code> terminated sequence of 0
|
||||
* or more pairs; the pair consists of a <code>String</code>
|
||||
* and an <code>Object</code>; the <code>String</code> indicates
|
||||
* @param s the {@code ObjectOutputStream} to write
|
||||
* @serialData {@code null} terminated sequence of 0
|
||||
* or more pairs; the pair consists of a {@code String}
|
||||
* and an {@code Object}; the {@code String} indicates
|
||||
* the type of object and is one of the following:
|
||||
* <code>itemListenerK</code> indicating an
|
||||
* <code>ItemListener</code> object
|
||||
* {@code itemListenerK} indicating an
|
||||
* {@code ItemListener} object
|
||||
*
|
||||
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
|
||||
* @see java.awt.Component#itemListenerK
|
||||
@ -689,15 +689,15 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the <code>ObjectInputStream</code> and if it
|
||||
* isn't <code>null</code> adds a listener to receive
|
||||
* item events fired by the <code>Choice</code> item.
|
||||
* Reads the {@code ObjectInputStream} and if it
|
||||
* isn't {@code null} adds a listener to receive
|
||||
* item events fired by the {@code Choice} item.
|
||||
* Unrecognized keys or values will be ignored.
|
||||
*
|
||||
* @param s the <code>ObjectInputStream</code> to read
|
||||
* @param s the {@code ObjectInputStream} to read
|
||||
* @exception HeadlessException if
|
||||
* <code>GraphicsEnvironment.isHeadless</code> returns
|
||||
* <code>true</code>
|
||||
* {@code GraphicsEnvironment.isHeadless} returns
|
||||
* {@code true}
|
||||
* @serial
|
||||
* @see #removeItemListener(ItemListener)
|
||||
* @see #addItemListener(ItemListener)
|
||||
@ -733,14 +733,14 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
|
||||
/**
|
||||
* Gets the <code>AccessibleContext</code> associated with this
|
||||
* <code>Choice</code>. For <code>Choice</code> components,
|
||||
* the <code>AccessibleContext</code> takes the form of an
|
||||
* <code>AccessibleAWTChoice</code>. A new <code>AccessibleAWTChoice</code>
|
||||
* Gets the {@code AccessibleContext} associated with this
|
||||
* {@code Choice}. For {@code Choice} components,
|
||||
* the {@code AccessibleContext} takes the form of an
|
||||
* {@code AccessibleAWTChoice}. A new {@code AccessibleAWTChoice}
|
||||
* instance is created if necessary.
|
||||
*
|
||||
* @return an <code>AccessibleAWTChoice</code> that serves as the
|
||||
* <code>AccessibleContext</code> of this <code>Choice</code>
|
||||
* @return an {@code AccessibleAWTChoice} that serves as the
|
||||
* {@code AccessibleContext} of this {@code Choice}
|
||||
* @since 1.3
|
||||
*/
|
||||
public AccessibleContext getAccessibleContext() {
|
||||
@ -752,7 +752,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
|
||||
|
||||
/**
|
||||
* This class implements accessibility support for the
|
||||
* <code>Choice</code> class. It provides an implementation of the
|
||||
* {@code Choice} class. It provides an implementation of the
|
||||
* Java Accessibility API appropriate to choice user-interface elements.
|
||||
* @since 1.3
|
||||
*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user