[multiple changes]
2004-04-09 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkPanelPeer.java (connectSignals): Remove method. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c: Remove unused code. 2004-04-02 Olga Rodimina <rodimina@redhat.com> * Makefile.am: Added new file. * Makefile.in: Regenerate. * javax/swing/ImageIcon.java: (ImageIcon(file)): set description of the icon to the file name * javax/swing/JCheckBoxMenuItem.java: Mostly Implemented. Work in progress. * javax/swing/JRadioButtonMenuItem.java: Reimplement constructors to use JToggleButtonModel. * javax/swing/plaf/basic/BasicIconFactory.java: (getCheckBoxMenuItemIcon): return check box icon. * javax/swing/plaf/basic/BasicMenuItemUI.java: paint menu item selected only when it is armed and pressed. 2004-04-02 David Jee <djee@redhat.com> * gnu/java/awt/peer/gtk/GtkMenuItemPeer.java (GtkMenuItemPeer): Only connect signals if this isn't a Menu peer. * java/awt/Component.java (add): Set the parent of the popup as this component. * java/awt/PopupMenu.java (addNotify): Create popup menu when peer is null. (show): Call addNotify() if peer is null. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c (Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show): Set the button argument for gtk_menu_popup() as zero. This causes the popup menu to respond to any mouse button. 2004-03-31 Olga Rodimina <rodimina@redhat.com> * Makefile.am: Added new file. * Makefile.in: Regenerate. * javax/swing/JRadioButtonMenuItem.java: Implemented. * javax/swing/plaf/basic/BasicIconFactory.java: (getRadioButtonMenuItemIcon): Return radio button icon. * javax/swing/plaf/basic/BasicMenuItemUI.java: (getPreferredSize): Add size of checkIcon if it exists. (installDefaults): Don't initialize checkIcon. It's value will be set in subclasses. (uninstallDefaults): remove uninstallation of checkIcon. (paint): Moved code to paintMenuItem(). (paintMenuItem): Implemented. * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java: UI delegate for JRadioButtonMenuItem. 2004-03-29 Olga Rodimina <rodimina@redhat.com> * javax/swing/plaf/basic/BasicMenuItemUI.java: Corrected position of the accelerator. 2004-03-29 Olga Rodimina <rodimina@redhat.com> * Makefile.am: Added new file. * Makefile.in: Regenerate. * javax/swing/JMenuItem.java: Partly implemented. Work in progress * javax/swing/plaf/basic/BasicLookAndFeel.java: Changed default value of acceleratorDelimiter. * javax/swing/plaf/basic/BasicMenuItemUI.java: New class. Partly implemented. 2004-03-26 Mark Wielaard <mark@klomp.org> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c (item_activate): Declare label before use. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (gtkSetFont): Removed unused variable label. (addExposeFilter): Declare variables before use. (removeExposeFilter): Likewise. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (ok_clicked): Declare str_fileName before use. 2004-03-26 David Jee <djee@redhat.com> * gnu/java/awt/peer/gtk/GtkMenuPeer.java (addSeparator): Remove. * java/awt/Menu.java (separator): Remove static final MenuItem field. (separatorLabel): New static final String field. (addSeparator): Do not use peer method; use add(MenuItem) instead. Use separatorLabel to denote that it is a separator. (insertSeparator): Create a new MenuItem with separatorLabel, instead of reusing the static separator instance, because a MenuItem instance can't be added more than once without being cloned. * java/awt/peer/MenuPeer.java (addSeparator): Remove from interface. 2004-03-26 David Jee <djee@redhat.com> * gnu/java/awt/peer/gtk/GtkMenuItemPeer.java (connectSignals): New native method declaration. (GtkMenuItemPeer): Connect signals if the parent is a Menu. * java/awt/MenuItem.java (getActionCommand): Return the label if the action command is not set. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c (Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu): Use gtk_menu_shell_append(). * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c (item_activate): Fix argument type. (Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create): Do not connect signal here. (Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals): New method. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c (Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create): Check if a label is given. Add the menu widget's top-level GtkWindow to the global window group, so it can grab the pointer. (Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem): Use gtk_menu_shell_append(). 2004-03-23 Graydon Hoare <graydon@redhat.com> * java/text/AttributedString.java (addAttribute): Fix off-by-one. (getIterator): Likewise. * java/text/AttributedStringIterator.java (getRunLimit): Correct logic. (getRunStart): Likewise. (getAttribute): Fix inequality. (getAttributes): Likewise. * testsuite/libjava.mauve/xfails: Remove AttributedString xfail. 2004-03-23 Kim Ho <kho@redhat.com> * javax/swing/plaf/basic/BasicTabbedPaneUI.java: (calculateSizes): Return real width and height. 2004-03-23 Kim Ho <kho@redhat.com> * javax/swing/plaf/basic/BasicTabbedPaneUI.java (calculateTabRects): Set the selectedRun before trying to rotate tabs. 2004-03-23 Kim Ho <kho@redhat.com> * Makefile.am: New file * Makefile.in: Regenerate * java/awt/Graphics.java: (drawRect): Draw to the correct point. * javax/swing/DefaultSingleSelectionModel.java (isSelected): Return true if the selected index is not -1. * javax/swing/JLabel.java: Do not change mnemonic index if text is null. * javax/swing/JProgressBar.java: Use JComponent's EventListenerList. * javax/swing/JScrollBar.java: Ditto. * javax/swing/JSlider.java: Ditto. * javax/swing/JTabbedPane.java: Reimplement. * javax/swing/plaf/basic/BasicLookAndFeel.java: Add defaults for TabbedPane. * javax/swing/plaf/basic/BasicArrowButton.java: Implement * javax/swing/plaf/basic/BasicProgressBarUI.java: (paintDeterminate): Don't paint String if it's empty. (paintIndeterminate): ditto. * javax/swing/plaf/basic/BasicTabbedPaneUI.java: Reimplement. 2004-03-19 Michael Koch <konqueror@gmx.de> * java/awt/image/AffineTransformOp.java (AffineTransformOp): Made public. * javax/swing/JComponent.java (listenerList): Made protected. (accessibleContext): Likewise. * javax/swing/JList.java (valueChanged): Dont use internal fields of ListSelectionEvent. * javax/swing/JViewport.java (getView): Dont use internal fields of Component. (addImpl): Likewise. * javax/swing/Timer.java (isRunning): Made public. (start): Likewise. (stop): Likewise. * javax/swing/UIDefaults.java (getInt): Made public. * javax/swing/plaf/basic/BasicListUI.java (mousePressed): Dont use internal fields of MouseEvent. (propertyChanged): Dont use internal fields of PropertyChangeEvent. * javax/swing/plaf/basic/BasicScrollBarUI.java (arrowIcon): Made static. * javax/swing/plaf/basic/BasicViewportUI.java (stateChanged): Dont use internal field on ChangeEvent. * javax/swing/text/JTextComponent.java (getUI): Call UIManager.getUI(). (updateUI): Use getUI(). 2004-03-19 Graydon Hoare <graydon@redhat.com> * javax/swing/JComponent.java: Turn off double buffer by default. * javax/swing/plaf/basic/BasicViewportUI.java: Clear rects before painting. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable): Use cairo to copy areas. (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip): Initialize and set clip region. 2004-03-15 Thomas Fitzsimmons <fitzsim@redhat.com> * java/applet/Applet.java (preferredSize): Override deprecated variant of getPreferredSize. (minimumSize): Override deprecated variant of getMinimumSize. 2004-03-15 Olga Rodimina <rodimina@redhat.com> * gnu/java/awt/peer/gtk/GdkGraphics2D.java (drawImage(img,xform,bgcolor,obs)): New Method. Helper function that every drawImage method will use. (drawRaster): Added new parameter, bgcolor. All transparent pixels are changed to bgcolor before image is drawn. (drawRenderedImage): Fixed to use changed drawRaster(). (drawImage(image,xform,obs): Fixed to use new helper function (drawImage(image,op,x,y)): Ditto. (drawImage (img,x,y,observer)): Ditto. ((PainterThread) bgcolor): New Field. ((PainterThread) (setPixels)): Changed all transparent pixels to bgcolor. (drawImage(img,x,y,width,height,bgcolor,observer)): Fixed FIXME - all the transparent pixels are changed to the specified bgcolor. (drawImage(img, x, y, width, height, observer): Changed to use function above. (drawImage (img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer)): Fixed FIXME- changed all transparent pixels to bgcolor. (drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer)): Changed to use function above. 2004-03-14 Thomas Fitzsimmons <fitzsim@redhat.com> * java/applet/Applet.java (dimensions): New field. (getDimensions): New method. (getPreferredSize): Call getDimensions. (getMinimumSize): Likewise. 2004-03-13 Thomas Fitzsimmons <fitzsim@redhat.com> * jni/classpath/jcl.c: Include stdlib.h, not malloc.h. * jni/classpath/jnilink.c: Likewise. * java/applet/Applet.java (getPreferredSize): New method. (getMinimumSize): New method. From-SVN: r80762
This commit is contained in:
parent
2d49ce6797
commit
31e632d3e4
48 changed files with 6600 additions and 1142 deletions
|
@ -1,3 +1,264 @@
|
|||
2004-04-09 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/GtkPanelPeer.java (connectSignals):
|
||||
Remove method.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c: Remove
|
||||
unused code.
|
||||
|
||||
2004-04-02 Olga Rodimina <rodimina@redhat.com>
|
||||
|
||||
* Makefile.am: Added new file.
|
||||
* Makefile.in: Regenerate.
|
||||
* javax/swing/ImageIcon.java:
|
||||
(ImageIcon(file)): set description of the icon
|
||||
to the file name
|
||||
* javax/swing/JCheckBoxMenuItem.java:
|
||||
Mostly Implemented. Work in progress.
|
||||
* javax/swing/JRadioButtonMenuItem.java:
|
||||
Reimplement constructors to use JToggleButtonModel.
|
||||
* javax/swing/plaf/basic/BasicIconFactory.java:
|
||||
(getCheckBoxMenuItemIcon): return check box
|
||||
icon.
|
||||
* javax/swing/plaf/basic/BasicMenuItemUI.java:
|
||||
paint menu item selected only when it is armed and
|
||||
pressed.
|
||||
|
||||
2004-04-02 David Jee <djee@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
|
||||
(GtkMenuItemPeer): Only connect signals if this isn't a Menu peer.
|
||||
* java/awt/Component.java
|
||||
(add): Set the parent of the popup as this component.
|
||||
* java/awt/PopupMenu.java
|
||||
(addNotify): Create popup menu when peer is null.
|
||||
(show): Call addNotify() if peer is null.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
|
||||
(Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show): Set the button
|
||||
argument for gtk_menu_popup() as zero. This causes the popup menu to
|
||||
respond to any mouse button.
|
||||
|
||||
2004-03-31 Olga Rodimina <rodimina@redhat.com>
|
||||
|
||||
* Makefile.am: Added new file.
|
||||
* Makefile.in: Regenerate.
|
||||
* javax/swing/JRadioButtonMenuItem.java:
|
||||
Implemented.
|
||||
* javax/swing/plaf/basic/BasicIconFactory.java:
|
||||
(getRadioButtonMenuItemIcon): Return
|
||||
radio button icon.
|
||||
* javax/swing/plaf/basic/BasicMenuItemUI.java:
|
||||
(getPreferredSize): Add size of checkIcon if it
|
||||
exists.
|
||||
(installDefaults): Don't initialize checkIcon.
|
||||
It's value will be set in subclasses.
|
||||
(uninstallDefaults): remove uninstallation of
|
||||
checkIcon.
|
||||
(paint): Moved code to paintMenuItem().
|
||||
(paintMenuItem): Implemented.
|
||||
* javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java:
|
||||
UI delegate for JRadioButtonMenuItem.
|
||||
|
||||
2004-03-29 Olga Rodimina <rodimina@redhat.com>
|
||||
|
||||
* javax/swing/plaf/basic/BasicMenuItemUI.java:
|
||||
Corrected position of the accelerator.
|
||||
|
||||
2004-03-29 Olga Rodimina <rodimina@redhat.com>
|
||||
|
||||
* Makefile.am: Added new file.
|
||||
* Makefile.in: Regenerate.
|
||||
* javax/swing/JMenuItem.java: Partly
|
||||
implemented. Work in progress
|
||||
* javax/swing/plaf/basic/BasicLookAndFeel.java:
|
||||
Changed default value of acceleratorDelimiter.
|
||||
* javax/swing/plaf/basic/BasicMenuItemUI.java:
|
||||
New class. Partly implemented.
|
||||
|
||||
2004-03-26 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
|
||||
(item_activate): Declare label before use.
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
|
||||
(gtkSetFont): Removed unused variable label.
|
||||
(addExposeFilter): Declare variables before use.
|
||||
(removeExposeFilter): Likewise.
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
|
||||
(ok_clicked): Declare str_fileName before use.
|
||||
|
||||
2004-03-26 David Jee <djee@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/GtkMenuPeer.java
|
||||
(addSeparator): Remove.
|
||||
* java/awt/Menu.java
|
||||
(separator): Remove static final MenuItem field.
|
||||
(separatorLabel): New static final String field.
|
||||
(addSeparator): Do not use peer method; use add(MenuItem) instead.
|
||||
Use separatorLabel to denote that it is a separator.
|
||||
(insertSeparator): Create a new MenuItem with separatorLabel, instead
|
||||
of reusing the static separator instance, because a MenuItem instance
|
||||
can't be added more than once without being cloned.
|
||||
* java/awt/peer/MenuPeer.java
|
||||
(addSeparator): Remove from interface.
|
||||
|
||||
2004-03-26 David Jee <djee@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
|
||||
(connectSignals): New native method declaration.
|
||||
(GtkMenuItemPeer): Connect signals if the parent is a Menu.
|
||||
* java/awt/MenuItem.java
|
||||
(getActionCommand): Return the label if the action command is not set.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
|
||||
(Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu): Use
|
||||
gtk_menu_shell_append().
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
|
||||
(item_activate): Fix argument type.
|
||||
(Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create): Do not connect
|
||||
signal here.
|
||||
(Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals): New
|
||||
method.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
|
||||
(Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create): Check if a label is
|
||||
given. Add the menu widget's top-level GtkWindow to the global window
|
||||
group, so it can grab the pointer.
|
||||
(Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem): Use
|
||||
gtk_menu_shell_append().
|
||||
|
||||
2004-03-23 Graydon Hoare <graydon@redhat.com>
|
||||
|
||||
* java/text/AttributedString.java
|
||||
(addAttribute): Fix off-by-one.
|
||||
(getIterator): Likewise.
|
||||
* java/text/AttributedStringIterator.java
|
||||
(getRunLimit): Correct logic.
|
||||
(getRunStart): Likewise.
|
||||
(getAttribute): Fix inequality.
|
||||
(getAttributes): Likewise.
|
||||
* testsuite/libjava.mauve/xfails: Remove AttributedString xfail.
|
||||
|
||||
2004-03-23 Kim Ho <kho@redhat.com>
|
||||
|
||||
* javax/swing/plaf/basic/BasicTabbedPaneUI.java:
|
||||
(calculateSizes): Return real width and height.
|
||||
|
||||
2004-03-23 Kim Ho <kho@redhat.com>
|
||||
|
||||
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
|
||||
(calculateTabRects): Set the selectedRun before
|
||||
trying to rotate tabs.
|
||||
|
||||
2004-03-23 Kim Ho <kho@redhat.com>
|
||||
|
||||
* Makefile.am: New file
|
||||
* Makefile.in: Regenerate
|
||||
* java/awt/Graphics.java: (drawRect):
|
||||
Draw to the correct point.
|
||||
* javax/swing/DefaultSingleSelectionModel.java
|
||||
(isSelected): Return true if the selected index
|
||||
is not -1.
|
||||
* javax/swing/JLabel.java: Do not change mnemonic
|
||||
index if text is null.
|
||||
* javax/swing/JProgressBar.java: Use JComponent's
|
||||
EventListenerList.
|
||||
* javax/swing/JScrollBar.java: Ditto.
|
||||
* javax/swing/JSlider.java: Ditto.
|
||||
* javax/swing/JTabbedPane.java: Reimplement.
|
||||
* javax/swing/plaf/basic/BasicLookAndFeel.java:
|
||||
Add defaults for TabbedPane.
|
||||
* javax/swing/plaf/basic/BasicArrowButton.java:
|
||||
Implement
|
||||
* javax/swing/plaf/basic/BasicProgressBarUI.java:
|
||||
(paintDeterminate): Don't paint String if it's
|
||||
empty.
|
||||
(paintIndeterminate): ditto.
|
||||
* javax/swing/plaf/basic/BasicTabbedPaneUI.java:
|
||||
Reimplement.
|
||||
|
||||
2004-03-19 Michael Koch <konqueror@gmx.de>
|
||||
|
||||
* java/awt/image/AffineTransformOp.java
|
||||
(AffineTransformOp): Made public.
|
||||
* javax/swing/JComponent.java
|
||||
(listenerList): Made protected.
|
||||
(accessibleContext): Likewise.
|
||||
* javax/swing/JList.java
|
||||
(valueChanged): Dont use internal fields of ListSelectionEvent.
|
||||
* javax/swing/JViewport.java
|
||||
(getView): Dont use internal fields of Component.
|
||||
(addImpl): Likewise.
|
||||
* javax/swing/Timer.java
|
||||
(isRunning): Made public.
|
||||
(start): Likewise.
|
||||
(stop): Likewise.
|
||||
* javax/swing/UIDefaults.java
|
||||
(getInt): Made public.
|
||||
* javax/swing/plaf/basic/BasicListUI.java
|
||||
(mousePressed): Dont use internal fields of MouseEvent.
|
||||
(propertyChanged): Dont use internal fields of PropertyChangeEvent.
|
||||
* javax/swing/plaf/basic/BasicScrollBarUI.java
|
||||
(arrowIcon): Made static.
|
||||
* javax/swing/plaf/basic/BasicViewportUI.java
|
||||
(stateChanged): Dont use internal field on ChangeEvent.
|
||||
* javax/swing/text/JTextComponent.java
|
||||
(getUI): Call UIManager.getUI().
|
||||
(updateUI): Use getUI().
|
||||
|
||||
2004-03-19 Graydon Hoare <graydon@redhat.com>
|
||||
|
||||
* javax/swing/JComponent.java: Turn off double buffer by default.
|
||||
* javax/swing/plaf/basic/BasicViewportUI.java: Clear rects before painting.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
|
||||
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable):
|
||||
Use cairo to copy areas.
|
||||
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip):
|
||||
Initialize and set clip region.
|
||||
|
||||
2004-03-15 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* java/applet/Applet.java (preferredSize): Override deprecated
|
||||
variant of getPreferredSize.
|
||||
(minimumSize): Override deprecated variant of getMinimumSize.
|
||||
|
||||
2004-03-15 Olga Rodimina <rodimina@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/GdkGraphics2D.java
|
||||
(drawImage(img,xform,bgcolor,obs)): New Method.
|
||||
Helper function that every drawImage method will
|
||||
use.
|
||||
(drawRaster): Added new parameter, bgcolor. All
|
||||
transparent pixels are changed to bgcolor before
|
||||
image is drawn.
|
||||
(drawRenderedImage): Fixed to use changed drawRaster().
|
||||
(drawImage(image,xform,obs): Fixed to use new helper function
|
||||
(drawImage(image,op,x,y)): Ditto.
|
||||
(drawImage (img,x,y,observer)): Ditto.
|
||||
((PainterThread) bgcolor): New Field.
|
||||
((PainterThread) (setPixels)): Changed all transparent pixels
|
||||
to bgcolor.
|
||||
(drawImage(img,x,y,width,height,bgcolor,observer)):
|
||||
Fixed FIXME - all the transparent pixels are
|
||||
changed to the specified bgcolor.
|
||||
(drawImage(img, x, y, width, height, observer): Changed to
|
||||
use function above.
|
||||
(drawImage (img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer)):
|
||||
Fixed FIXME- changed all transparent pixels to bgcolor.
|
||||
(drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer)):
|
||||
Changed to use function above.
|
||||
|
||||
2004-03-14 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* java/applet/Applet.java (dimensions): New field.
|
||||
(getDimensions): New method.
|
||||
(getPreferredSize): Call getDimensions.
|
||||
(getMinimumSize): Likewise.
|
||||
|
||||
2004-03-13 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* jni/classpath/jcl.c: Include stdlib.h, not malloc.h.
|
||||
* jni/classpath/jnilink.c: Likewise.
|
||||
|
||||
* java/applet/Applet.java (getPreferredSize): New method.
|
||||
(getMinimumSize): New method.
|
||||
|
||||
2004-04-15 Bryce McKinlay <mckinlay@redhat.com>
|
||||
|
||||
* prims.cc (_Jv_AllocObject): Remove `size' argument.
|
||||
|
|
|
@ -1326,17 +1326,21 @@ javax/swing/border/TitledBorder.java \
|
|||
javax/swing/GrayFilter.java \
|
||||
javax/swing/AbstractAction.java \
|
||||
javax/swing/AbstractButton.java \
|
||||
javax/swing/plaf/basic/BasicArrowButton.java \
|
||||
javax/swing/plaf/basic/BasicButtonListener.java \
|
||||
javax/swing/plaf/basic/BasicButtonUI.java \
|
||||
javax/swing/plaf/basic/BasicCheckBoxUI.java \
|
||||
javax/swing/plaf/basic/BasicGraphicsUtils.java \
|
||||
javax/swing/plaf/basic/BasicLabelUI.java \
|
||||
javax/swing/plaf/basic/BasicListUI.java \
|
||||
javax/swing/plaf/basic/BasicMenuItemUI.java \
|
||||
javax/swing/plaf/basic/BasicOptionPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicPanelUI.java \
|
||||
javax/swing/plaf/basic/BasicProgressBarUI.java \
|
||||
javax/swing/plaf/basic/BasicRootPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicRadioButtonUI.java \
|
||||
javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java \
|
||||
javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java \
|
||||
javax/swing/plaf/basic/BasicScrollBarUI.java \
|
||||
javax/swing/plaf/basic/BasicScrollPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicSeparatorUI.java \
|
||||
|
|
|
@ -1008,17 +1008,21 @@ javax/swing/border/TitledBorder.java \
|
|||
javax/swing/GrayFilter.java \
|
||||
javax/swing/AbstractAction.java \
|
||||
javax/swing/AbstractButton.java \
|
||||
javax/swing/plaf/basic/BasicArrowButton.java \
|
||||
javax/swing/plaf/basic/BasicButtonListener.java \
|
||||
javax/swing/plaf/basic/BasicButtonUI.java \
|
||||
javax/swing/plaf/basic/BasicCheckBoxUI.java \
|
||||
javax/swing/plaf/basic/BasicGraphicsUtils.java \
|
||||
javax/swing/plaf/basic/BasicLabelUI.java \
|
||||
javax/swing/plaf/basic/BasicListUI.java \
|
||||
javax/swing/plaf/basic/BasicMenuItemUI.java \
|
||||
javax/swing/plaf/basic/BasicOptionPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicPanelUI.java \
|
||||
javax/swing/plaf/basic/BasicProgressBarUI.java \
|
||||
javax/swing/plaf/basic/BasicRootPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicRadioButtonUI.java \
|
||||
javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java \
|
||||
javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java \
|
||||
javax/swing/plaf/basic/BasicScrollBarUI.java \
|
||||
javax/swing/plaf/basic/BasicScrollPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicSeparatorUI.java \
|
||||
|
@ -4533,18 +4537,22 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
|||
.deps/javax/swing/plaf/TextUI.P .deps/javax/swing/plaf/ToolBarUI.P \
|
||||
.deps/javax/swing/plaf/ToolTipUI.P .deps/javax/swing/plaf/TreeUI.P \
|
||||
.deps/javax/swing/plaf/UIResource.P .deps/javax/swing/plaf/ViewportUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicArrowButton.P \
|
||||
.deps/javax/swing/plaf/basic/BasicBorders.P \
|
||||
.deps/javax/swing/plaf/basic/BasicButtonListener.P \
|
||||
.deps/javax/swing/plaf/basic/BasicButtonUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicCheckBoxUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicGraphicsUtils.P \
|
||||
.deps/javax/swing/plaf/basic/BasicIconFactory.P \
|
||||
.deps/javax/swing/plaf/basic/BasicLabelUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicListUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicLookAndFeel.P \
|
||||
.deps/javax/swing/plaf/basic/BasicMenuItemUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicOptionPaneUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicPanelUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicProgressBarUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicRadioButtonUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicRootPaneUI.P \
|
||||
.deps/javax/swing/plaf/basic/BasicScrollBarUI.P \
|
||||
|
|
|
@ -201,7 +201,7 @@ public class GdkGraphics2D extends Graphics2D
|
|||
// draw current buffered image to the pixmap associated
|
||||
// with it.
|
||||
|
||||
drawImage (bimage, new AffineTransform (1,0,0,1,0,0), null);
|
||||
drawImage (bimage, new AffineTransform (1,0,0,1,0,0), bg, null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,6 +440,69 @@ public class GdkGraphics2D extends Graphics2D
|
|||
}
|
||||
|
||||
|
||||
private boolean drawImage(Image img,
|
||||
AffineTransform xform,
|
||||
Color bgcolor,
|
||||
ImageObserver obs)
|
||||
{
|
||||
if (img instanceof GtkOffScreenImage &&
|
||||
img.getGraphics () instanceof GdkGraphics2D &&
|
||||
(xform == null
|
||||
|| xform.getType () == AffineTransform.TYPE_IDENTITY
|
||||
|| xform.getType () == AffineTransform.TYPE_TRANSLATION)
|
||||
)
|
||||
{
|
||||
// we are being asked to flush a double buffer from Gdk
|
||||
GdkGraphics2D g2 = (GdkGraphics2D) img.getGraphics ();
|
||||
gdkDrawDrawable (g2, (int)xform.getTranslateX(), (int)xform.getTranslateY());
|
||||
|
||||
if (isBufferedImageGraphics ())
|
||||
updateBufferedImage();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// In this case, xform is an AffineTransform that transforms bounding
|
||||
// box of the specified image from image space to user space. However
|
||||
// when we pass this transform to cairo, cairo will use this transform
|
||||
// to map "user coordinates" to "pixel" coordinates, which is the
|
||||
// other way around. Therefore to get the "user -> pixel" transform
|
||||
// that cairo wants from "image -> user" transform that we currently
|
||||
// have, we will need to invert the transformation matrix.
|
||||
|
||||
AffineTransform invertedXform = new AffineTransform();
|
||||
|
||||
try
|
||||
{
|
||||
invertedXform = xform.createInverse();
|
||||
if (img instanceof BufferedImage)
|
||||
{
|
||||
// draw an image which has actually been loaded
|
||||
// into memory fully
|
||||
|
||||
BufferedImage b = (BufferedImage) img;
|
||||
return drawRaster (b.getColorModel (),
|
||||
b.getData (),
|
||||
invertedXform,
|
||||
bgcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin progressive loading in a separate thread
|
||||
new PainterThread (this, img, invertedXform, bgcolor);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (NoninvertibleTransformException e)
|
||||
{
|
||||
throw new ImagingOpException("Unable to invert transform "
|
||||
+ xform.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
////// Implementation of Graphics2D Methods //////
|
||||
|
@ -965,7 +1028,8 @@ public class GdkGraphics2D extends Graphics2D
|
|||
}
|
||||
|
||||
private boolean drawRaster (ColorModel cm, Raster r,
|
||||
AffineTransform imageToUser)
|
||||
AffineTransform imageToUser,
|
||||
Color bgcolor)
|
||||
{
|
||||
if (r == null)
|
||||
return false;
|
||||
|
@ -1012,6 +1076,18 @@ public class GdkGraphics2D extends Graphics2D
|
|||
pixels = pixels2;
|
||||
}
|
||||
|
||||
// change all transparent pixels in the image to the
|
||||
// specified bgcolor
|
||||
|
||||
if (bgcolor != null)
|
||||
{
|
||||
for (int i = 0; i < pixels.length; i++)
|
||||
{
|
||||
if (cm.getAlpha (pixels[i]) == 0)
|
||||
pixels[i] = bgcolor.getRGB ();
|
||||
}
|
||||
}
|
||||
|
||||
stateSave ();
|
||||
translate (x, y);
|
||||
drawPixels (pixels, r.getWidth (), r.getHeight (), r.getWidth (), i2u);
|
||||
|
@ -1026,7 +1102,7 @@ public class GdkGraphics2D extends Graphics2D
|
|||
public void drawRenderedImage(RenderedImage image,
|
||||
AffineTransform xform)
|
||||
{
|
||||
drawRaster (image.getColorModel(), image.getData(), xform);
|
||||
drawRaster (image.getColorModel(), image.getData(), xform, bg);
|
||||
}
|
||||
|
||||
public void drawRenderableImage(RenderableImage image,
|
||||
|
@ -1039,60 +1115,7 @@ public class GdkGraphics2D extends Graphics2D
|
|||
AffineTransform xform,
|
||||
ImageObserver obs)
|
||||
{
|
||||
if (img instanceof GtkOffScreenImage &&
|
||||
img.getGraphics () instanceof GdkGraphics2D &&
|
||||
(xform == null
|
||||
|| xform.getType () == AffineTransform.TYPE_IDENTITY
|
||||
|| xform.getType () == AffineTransform.TYPE_TRANSLATION)
|
||||
)
|
||||
{
|
||||
// we are being asked to flush a double buffer from Gdk
|
||||
GdkGraphics2D g2 = (GdkGraphics2D) img.getGraphics ();
|
||||
gdkDrawDrawable (g2, (int)xform.getTranslateX(), (int)xform.getTranslateY());
|
||||
|
||||
if (isBufferedImageGraphics ())
|
||||
updateBufferedImage();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// In this case, xform is an AffineTransform that transforms bounding
|
||||
// box of the specified image from image space to user space. However
|
||||
// when we pass this transform to cairo, cairo will use this transform
|
||||
// to map "user coordinates" to "pixel" coordinates, which is the
|
||||
// other way around. Therefore to get the "user -> pixel" transform
|
||||
// that cairo wants from "image -> user" transform that we currently
|
||||
// have, we will need to invert the transformation matrix.
|
||||
|
||||
AffineTransform invertedXform = new AffineTransform();
|
||||
|
||||
try
|
||||
{
|
||||
invertedXform = xform.createInverse();
|
||||
if (img instanceof BufferedImage)
|
||||
{
|
||||
// draw an image which has actually been loaded
|
||||
// into memory fully
|
||||
BufferedImage b = (BufferedImage) img;
|
||||
return drawRaster (b.getColorModel (),
|
||||
b.getData (),
|
||||
invertedXform);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin progressive loading in a separate thread
|
||||
new PainterThread (this, img, invertedXform);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (NoninvertibleTransformException e)
|
||||
{
|
||||
throw new ImagingOpException("Unable to invert transform "
|
||||
+ xform.toString());
|
||||
}
|
||||
}
|
||||
return drawImage(img, xform, bg, obs);
|
||||
}
|
||||
|
||||
public void drawImage(BufferedImage image,
|
||||
|
@ -1101,13 +1124,13 @@ public class GdkGraphics2D extends Graphics2D
|
|||
int y)
|
||||
{
|
||||
Image filtered = op.filter(image, null);
|
||||
drawImage(filtered, new AffineTransform(1f,0f,0f,1f,x,y), null);
|
||||
drawImage(filtered, new AffineTransform(1f,0f,0f,1f,x,y), bg, null);
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int x, int y,
|
||||
ImageObserver observer)
|
||||
{
|
||||
return drawImage(img, new AffineTransform(1f,0f,0f,1f,x,y), observer);
|
||||
return drawImage(img, new AffineTransform(1f,0f,0f,1f,x,y), bg, observer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1130,11 +1153,14 @@ public class GdkGraphics2D extends Graphics2D
|
|||
Image image;
|
||||
ColorModel defaultModel;
|
||||
AffineTransform xform;
|
||||
Color bgcolor;
|
||||
|
||||
public PainterThread (GdkGraphics2D g, Image im, AffineTransform xf)
|
||||
public PainterThread (GdkGraphics2D g, Image im,
|
||||
AffineTransform xf, Color bg)
|
||||
{
|
||||
image = im;
|
||||
xform = xf;
|
||||
bgcolor = bg;
|
||||
this.gr = (GdkGraphics2D) g.create ();
|
||||
new Thread (this).start ();
|
||||
}
|
||||
|
@ -1184,6 +1210,18 @@ public class GdkGraphics2D extends Graphics2D
|
|||
else
|
||||
pixels2 = pixels;
|
||||
|
||||
// change all transparent pixels in the image to the
|
||||
// specified bgcolor
|
||||
|
||||
if (bgcolor != null)
|
||||
{
|
||||
for (int i = 0; i < pixels2.length; i++)
|
||||
{
|
||||
if (model.getAlpha (pixels2[i]) == 0)
|
||||
pixels2[i] = bgcolor.getRGB ();
|
||||
}
|
||||
}
|
||||
|
||||
double[] xf = new double[6];
|
||||
xform.getMatrix(xf);
|
||||
gr.drawPixels (pixels2, w, h, scansize, xf);
|
||||
|
@ -1347,22 +1385,21 @@ public class GdkGraphics2D extends Graphics2D
|
|||
Color bgcolor, ImageObserver observer)
|
||||
{
|
||||
|
||||
// FIXME: change all the transparent pixels in the image to
|
||||
// bgcolor.
|
||||
double scaleX = width / (double) img.getWidth (observer);
|
||||
double scaleY = height / (double) img.getHeight (observer);
|
||||
|
||||
return drawImage (img,
|
||||
new AffineTransform(scaleX, 0f, 0f, scaleY, x, y),
|
||||
bgcolor,
|
||||
observer);
|
||||
|
||||
return drawImage (img, x, y, width, height, observer);
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int x, int y, int width, int height,
|
||||
ImageObserver observer)
|
||||
{
|
||||
|
||||
double scaleX = width / (double) img.getWidth (observer);
|
||||
double scaleY = height / (double) img.getHeight (observer);
|
||||
|
||||
return drawImage (img,
|
||||
new AffineTransform(scaleX, 0f, 0f, scaleY, x, y),
|
||||
observer);
|
||||
return drawImage (img, x, y, width, height, bg, observer);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1371,18 +1408,6 @@ public class GdkGraphics2D extends Graphics2D
|
|||
Color bgcolor, ImageObserver observer)
|
||||
{
|
||||
|
||||
// FIXME: change all transparent pixels in the image to
|
||||
// bgcolor
|
||||
|
||||
return drawImage (img, dx1, dy1, dx2, dy2,
|
||||
sx1, sy1, sx2, sy2, observer);
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
|
||||
int sx1, int sy1, int sx2, int sy2,
|
||||
ImageObserver observer)
|
||||
{
|
||||
|
||||
Image subImage;
|
||||
|
||||
int sourceWidth = sx2 - sx1;
|
||||
|
@ -1420,8 +1445,18 @@ public class GdkGraphics2D extends Graphics2D
|
|||
}
|
||||
|
||||
return drawImage(subImage, new AffineTransform(scaleX, 0, 0,
|
||||
scaleY, dx1, dy1),
|
||||
observer);
|
||||
scaleY, dx1, dy1),
|
||||
bgcolor,
|
||||
observer);
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
|
||||
int sx1, int sy1, int sx2, int sy2,
|
||||
ImageObserver observer)
|
||||
{
|
||||
|
||||
return drawImage (img, dx1, dy1, dx2, dy2,
|
||||
sx1, sy1, sx2, sy2, bg, observer);
|
||||
}
|
||||
|
||||
public void drawOval(int x, int y, int width, int height)
|
||||
|
|
|
@ -50,6 +50,7 @@ public class GtkMenuItemPeer extends GtkMenuComponentPeer
|
|||
implements MenuItemPeer
|
||||
{
|
||||
native void create (String label);
|
||||
public native void connectSignals ();
|
||||
|
||||
public GtkMenuItemPeer (MenuItem item)
|
||||
{
|
||||
|
@ -57,6 +58,9 @@ public class GtkMenuItemPeer extends GtkMenuComponentPeer
|
|||
create (item.getLabel ());
|
||||
setEnabled (item.isEnabled ());
|
||||
setParent (item);
|
||||
|
||||
if (item.getParent() instanceof Menu && ! (item instanceof Menu))
|
||||
connectSignals();
|
||||
}
|
||||
|
||||
void setParent (MenuItem item)
|
||||
|
|
|
@ -95,10 +95,5 @@ public class GtkMenuPeer extends GtkMenuItemPeer
|
|||
addItem (item, key, shiftModifier);
|
||||
}
|
||||
|
||||
public void addSeparator ()
|
||||
{
|
||||
addItem (new MenuItem ("-"));
|
||||
}
|
||||
|
||||
native public void delItem (int index);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ public class GtkPanelPeer extends GtkContainerPeer
|
|||
{
|
||||
native void create ();
|
||||
native void connectJObject ();
|
||||
native void connectSignals ();
|
||||
|
||||
public GtkPanelPeer (Panel p)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,11 @@ public class Applet extends Panel
|
|||
/** The applet stub for this applet. */
|
||||
private transient AppletStub stub;
|
||||
|
||||
/**
|
||||
* The dimensions passed to this applet through its HTML tag.
|
||||
*/
|
||||
private transient Dimension dimensions;
|
||||
|
||||
/**
|
||||
* The accessibility context for this applet.
|
||||
*
|
||||
|
@ -457,6 +462,41 @@ public class Applet extends Panel
|
|||
s.defaultReadObject();
|
||||
}
|
||||
|
||||
private Dimension getDimensions ()
|
||||
{
|
||||
if (dimensions == null)
|
||||
{
|
||||
int width = Integer.parseInt(stub.getParameter("width"));
|
||||
int height = Integer.parseInt(stub.getParameter("height"));
|
||||
|
||||
dimensions = new Dimension(width, height);
|
||||
}
|
||||
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@link Dimension} representing the
|
||||
* applet's width and height parameters.
|
||||
*
|
||||
* @return the applet's preferred size
|
||||
*/
|
||||
public Dimension preferredSize()
|
||||
{
|
||||
return getDimensions ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@link Dimension} representing the
|
||||
* applet's width and height parameters.
|
||||
*
|
||||
* @return the applet's minimum size
|
||||
*/
|
||||
public Dimension minimumSize()
|
||||
{
|
||||
return getDimensions ();
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides accessibility support for Applets, and is the
|
||||
* runtime type returned by {@link #getAccessibleContext()}.
|
||||
|
|
|
@ -3816,6 +3816,12 @@ public abstract class Component
|
|||
if (popups == null)
|
||||
popups = new Vector();
|
||||
popups.add(popup);
|
||||
|
||||
if (popup.parent != null)
|
||||
popup.parent.remove(popup);
|
||||
popup.parent = this;
|
||||
if (peer != null)
|
||||
popup.addNotify();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -417,7 +417,7 @@ draw3DRect(int x, int y, int width, int height, boolean raised)
|
|||
drawLine(x1, y2, x1, y1);
|
||||
setColor(br);
|
||||
drawLine(x2, y1, x2, y2);
|
||||
drawLine(x2, y1, x1, y2);
|
||||
drawLine(x2, y2, x1, y2);
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ private boolean isHelpMenu;
|
|||
// From the serialization spec. FIXME: what should it be?
|
||||
private int menuSerializedDataVersion;
|
||||
|
||||
static final MenuItem separator = new MenuItem("-");
|
||||
static final String separatorLabel = "-";
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
@ -295,8 +295,7 @@ insert(String label, int index)
|
|||
public void
|
||||
addSeparator()
|
||||
{
|
||||
if (peer != null)
|
||||
((MenuPeer) peer).addSeparator();
|
||||
add(new MenuItem(separatorLabel));
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -314,7 +313,7 @@ addSeparator()
|
|||
public void
|
||||
insertSeparator(int index)
|
||||
{
|
||||
insert(separator, index);
|
||||
insert(new MenuItem(separatorLabel), index);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -310,7 +310,10 @@ deleteShortcut()
|
|||
public String
|
||||
getActionCommand()
|
||||
{
|
||||
return(actionCommand);
|
||||
if (actionCommand == null)
|
||||
return label;
|
||||
else
|
||||
return actionCommand;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -105,7 +105,7 @@ PopupMenu(String label)
|
|||
public void
|
||||
addNotify()
|
||||
{
|
||||
if (peer != null)
|
||||
if (peer == null)
|
||||
peer = getToolkit ().createPopupMenu (this);
|
||||
super.addNotify ();
|
||||
}
|
||||
|
@ -123,6 +123,8 @@ addNotify()
|
|||
public void
|
||||
show(Component component, int x, int y)
|
||||
{
|
||||
if (getPeer() == null)
|
||||
this.addNotify();
|
||||
PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
|
||||
if (pmp != null)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,6 @@ import java.awt.MenuItem;
|
|||
public interface MenuPeer extends MenuItemPeer
|
||||
{
|
||||
void addItem (MenuItem item);
|
||||
void addSeparator ();
|
||||
void delItem (int index);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ exception statement from your version. */
|
|||
|
||||
package java.text;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
|
@ -219,26 +220,7 @@ AttributedString(AttributedCharacterIterator aci, int begin_index,
|
|||
// Get the valid attribute list
|
||||
Set all_attribs = aci.getAllAttributeKeys();
|
||||
if (attributes != null)
|
||||
{
|
||||
Set valid_attribs = new HashSet();
|
||||
Iterator iter = all_attribs.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Object obj = iter.next();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < attributes.length; i++)
|
||||
if (obj.equals(attributes[0]))
|
||||
break;
|
||||
|
||||
if (i == attributes.length)
|
||||
continue;
|
||||
|
||||
valid_attribs.add(obj);
|
||||
}
|
||||
|
||||
all_attribs = valid_attribs;
|
||||
}
|
||||
all_attribs.retainAll(Arrays.asList(attributes));
|
||||
|
||||
// Loop through and extract the attributes
|
||||
char c = aci.setIndex(begin_index);
|
||||
|
@ -320,7 +302,7 @@ AttributedString(AttributedCharacterIterator aci, int begin_index,
|
|||
public void
|
||||
addAttribute(AttributedCharacterIterator.Attribute attrib, Object value)
|
||||
{
|
||||
addAttribute(attrib, value, 0, sci.getEndIndex() - 1);
|
||||
addAttribute(attrib, value, 0, sci.getEndIndex());
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -389,8 +371,7 @@ addAttributes(Map attributes, int begin_index, int end_index)
|
|||
public AttributedCharacterIterator
|
||||
getIterator()
|
||||
{
|
||||
return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex() - 1,
|
||||
null));
|
||||
return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(), null));
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -409,7 +390,7 @@ getIterator()
|
|||
public AttributedCharacterIterator
|
||||
getIterator(AttributedCharacterIterator.Attribute[] attributes)
|
||||
{
|
||||
return(getIterator(attributes, 0, sci.getEndIndex() - 1));
|
||||
return(getIterator(attributes, 0, sci.getEndIndex()));
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -221,39 +221,28 @@ getRunLimit(AttributedCharacterIterator.Attribute attrib)
|
|||
public synchronized int
|
||||
getRunLimit(Set attribute_set)
|
||||
{
|
||||
int orig_index = ci.getIndex();
|
||||
int run_limit;
|
||||
boolean hit = false;
|
||||
int runLimit = ci.getEndIndex ();
|
||||
int pos = ci.getIndex ();
|
||||
|
||||
do
|
||||
for (int i = 0; i < attribs.length; ++i)
|
||||
{
|
||||
run_limit = ci.getIndex();
|
||||
|
||||
Map attribute_map = getAttributes();
|
||||
|
||||
boolean found = false;
|
||||
Iterator iter = attribute_set.iterator();
|
||||
while(iter.hasNext())
|
||||
if (!attribute_map.containsKey(iter.next()))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (found)
|
||||
break;
|
||||
if (pos >= attribs[i].begin_index &&
|
||||
pos <= attribs[i].end_index)
|
||||
{
|
||||
Iterator iter = attribute_set.iterator();
|
||||
while(iter.hasNext())
|
||||
if (attribs[i].attribs.containsKey(iter.next()))
|
||||
{
|
||||
hit = true;
|
||||
runLimit = Math.min(runLimit, attribs[i].end_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (ci.next() != CharacterIterator.DONE);
|
||||
|
||||
boolean hit_end = (ci.previous() == CharacterIterator.DONE);
|
||||
|
||||
ci.setIndex(orig_index);
|
||||
|
||||
if (run_limit == orig_index)
|
||||
return(-1); // No characters match the given attributes
|
||||
// else if (!hit_end)
|
||||
// --run_limit;
|
||||
|
||||
return(run_limit);
|
||||
if (hit)
|
||||
return runLimit;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -281,35 +270,28 @@ getRunStart(AttributedCharacterIterator.Attribute attrib)
|
|||
public int
|
||||
getRunStart(Set attribute_set)
|
||||
{
|
||||
int orig_index = ci.getIndex();
|
||||
int run_start;
|
||||
boolean hit = false;
|
||||
int runBegin = 0;
|
||||
int pos = ci.getIndex ();
|
||||
|
||||
do
|
||||
for (int i = 0; i < attribs.length; ++i)
|
||||
{
|
||||
run_start = ci.getIndex();
|
||||
|
||||
Map attribute_map = getAttributes();
|
||||
|
||||
Iterator iter = attribute_set.iterator();
|
||||
while(iter.hasNext())
|
||||
if (!attribute_map.containsKey(iter.next()))
|
||||
break;
|
||||
|
||||
if (iter.hasNext())
|
||||
break;
|
||||
if (pos >= attribs[i].begin_index &&
|
||||
pos <= attribs[i].end_index)
|
||||
{
|
||||
Iterator iter = attribute_set.iterator();
|
||||
while(iter.hasNext())
|
||||
if (attribs[i].attribs.containsKey(iter.next()))
|
||||
{
|
||||
hit = true;
|
||||
runBegin = Math.max(runBegin, attribs[i].begin_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (ci.previous() != CharacterIterator.DONE);
|
||||
|
||||
boolean hit_beginning = (ci.previous() == CharacterIterator.DONE);
|
||||
|
||||
ci.setIndex(orig_index);
|
||||
|
||||
if (run_start == orig_index)
|
||||
return(-1); // No characters match the given attributes
|
||||
else if (!hit_beginning)
|
||||
++run_start;
|
||||
|
||||
return(run_start);
|
||||
if (hit)
|
||||
return runBegin;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -115,7 +115,7 @@ public class DefaultSingleSelectionModel
|
|||
*/
|
||||
public boolean isSelected ()
|
||||
{
|
||||
return (index == -1);
|
||||
return (index != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,10 @@ public class ImageIcon implements Icon
|
|||
|
||||
public ImageIcon(String s)
|
||||
{
|
||||
this(s, "");
|
||||
// if description is not specified, then file name becomes
|
||||
// desciption for this icon
|
||||
|
||||
this(s, s);
|
||||
}
|
||||
|
||||
public ImageIcon(String file,
|
||||
|
|
|
@ -39,206 +39,135 @@ package javax.swing;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.accessibility.Accessible;
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.accessibility.AccessibleRole;
|
||||
|
||||
/**
|
||||
* JCheckBoxMenuItem
|
||||
* @author Andrew Selkirk
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, Accessible
|
||||
|
||||
public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
|
||||
Accessible
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private static final String uiClassID = "CheckBoxMenuItemUI";
|
||||
private boolean state;
|
||||
private Object[] selectedObjects;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Classes ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JCheckBoxMenuItem()
|
||||
{
|
||||
this(null, null);
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* AccessibleJCheckBoxMenuItem
|
||||
*/
|
||||
protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem {
|
||||
public JCheckBoxMenuItem(Icon icon)
|
||||
{
|
||||
this(null, icon);
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JCheckBoxMenuItem(String text)
|
||||
{
|
||||
this(text, null);
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
public JCheckBoxMenuItem(Action action)
|
||||
{
|
||||
this();
|
||||
setAction(action);
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JCheckBoxMenuItem(String text, Icon icon)
|
||||
{
|
||||
this(text, icon, false);
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor AccessibleJCheckBoxMenuItem
|
||||
* @param component TODO
|
||||
*/
|
||||
protected AccessibleJCheckBoxMenuItem(JCheckBoxMenuItem component) {
|
||||
super(component);
|
||||
// TODO
|
||||
} // AccessibleJCheckBoxMenuItem()
|
||||
public JCheckBoxMenuItem(String text, boolean state)
|
||||
{
|
||||
this(text, null, state);
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
public JCheckBoxMenuItem(String text, Icon icon, boolean state)
|
||||
{
|
||||
super(text, icon);
|
||||
setModel(new JToggleButton.ToggleButtonModel());
|
||||
this.state = state;
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException
|
||||
{
|
||||
// TODO
|
||||
} // writeObject()
|
||||
|
||||
/**
|
||||
* getAccessibleRole
|
||||
* @returns AccessibleRole
|
||||
*/
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.CHECK_BOX;
|
||||
} // getAccessibleRole()
|
||||
public String getUIClassID()
|
||||
{
|
||||
return uiClassID;
|
||||
} // getUIClassID()
|
||||
|
||||
public boolean getState()
|
||||
{
|
||||
return state;
|
||||
} // getState()
|
||||
|
||||
} // AccessibleJCheckBoxMenuItem
|
||||
public synchronized void setState(boolean state)
|
||||
{
|
||||
this.state = state;
|
||||
} // setState()
|
||||
|
||||
public Object[] getSelectedObjects()
|
||||
{
|
||||
return selectedObjects;
|
||||
} // getSelectedObjects()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public void requestFocus()
|
||||
{
|
||||
// TODO
|
||||
} // requestFocus()
|
||||
|
||||
/**
|
||||
* uiClassID
|
||||
*/
|
||||
private static final String uiClassID = "CheckBoxMenuItemUI";
|
||||
protected String paramString()
|
||||
{
|
||||
return "JCheckBoxMenuItem";
|
||||
} // paramString()
|
||||
|
||||
public AccessibleContext getAccessibleContext()
|
||||
{
|
||||
if (accessibleContext == null)
|
||||
{
|
||||
accessibleContext = new AccessibleJCheckBoxMenuItem(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
return accessibleContext;
|
||||
} // getAccessibleContext()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
*/
|
||||
public JCheckBoxMenuItem() {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
* @param icon TODO
|
||||
*/
|
||||
public JCheckBoxMenuItem(Icon icon) {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
* @param text TODO
|
||||
*/
|
||||
public JCheckBoxMenuItem(String text) {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
* @param action TODO
|
||||
*/
|
||||
public JCheckBoxMenuItem(Action action) {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
* @param text TODO
|
||||
* @param icon TODO
|
||||
*/
|
||||
public JCheckBoxMenuItem(String text, Icon icon) {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
* @param text TODO
|
||||
* @param state TODO
|
||||
*/
|
||||
public JCheckBoxMenuItem(String text, boolean state) {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JCheckBoxMenuItem
|
||||
* @param text TODO
|
||||
* @param icon TODO
|
||||
* @param state TODO
|
||||
*/
|
||||
public JCheckBoxMenuItem(String text, Icon icon, boolean state) {
|
||||
// TODO
|
||||
} // JCheckBoxMenuItem()
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* writeObject
|
||||
* @param stream TODO
|
||||
* @exception IOException TODO
|
||||
*/
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException {
|
||||
// TODO
|
||||
} // writeObject()
|
||||
|
||||
/**
|
||||
* getUIClassID
|
||||
* @returns String
|
||||
*/
|
||||
public String getUIClassID() {
|
||||
return uiClassID;
|
||||
} // getUIClassID()
|
||||
|
||||
/**
|
||||
* getState
|
||||
* @returns boolean
|
||||
*/
|
||||
public boolean getState() {
|
||||
return false; // TODO
|
||||
} // getState()
|
||||
|
||||
/**
|
||||
* setState
|
||||
* @param state TODO
|
||||
*/
|
||||
public synchronized void setState(boolean state) {
|
||||
// TODO
|
||||
} // setState()
|
||||
|
||||
/**
|
||||
* getSelectedObjects
|
||||
* @returns Object[]
|
||||
*/
|
||||
public Object[] getSelectedObjects() {
|
||||
return null; // TODO
|
||||
} // getSelectedObjects()
|
||||
|
||||
/**
|
||||
* requestFocus
|
||||
*/
|
||||
public void requestFocus() {
|
||||
// TODO
|
||||
} // requestFocus()
|
||||
|
||||
/**
|
||||
* paramString
|
||||
* @returns String
|
||||
*/
|
||||
protected String paramString() {
|
||||
return null; // TODO
|
||||
} // paramString()
|
||||
|
||||
/**
|
||||
* getAccessibleContext
|
||||
* @returns AccessibleContext
|
||||
*/
|
||||
public AccessibleContext getAccessibleContext() {
|
||||
if (accessibleContext == null) {
|
||||
accessibleContext = new AccessibleJCheckBoxMenuItem(this);
|
||||
} // if
|
||||
return accessibleContext;
|
||||
} // getAccessibleContext()
|
||||
//-------------------------------------------------------------
|
||||
// Classes ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected AccessibleJCheckBoxMenuItem(JCheckBoxMenuItem component)
|
||||
{
|
||||
super(component);
|
||||
|
||||
// TODO
|
||||
} // AccessibleJCheckBoxMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public AccessibleRole getAccessibleRole()
|
||||
{
|
||||
return AccessibleRole.CHECK_BOX;
|
||||
} // getAccessibleRole()
|
||||
} // AccessibleJCheckBoxMenuItem
|
||||
} // JCheckBoxMenuItem
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class JComponent extends Container implements Serializable
|
|||
Border border;
|
||||
JToolTip tooltip;
|
||||
String tool_tip_text;
|
||||
boolean use_double_buffer, opaque;
|
||||
boolean use_double_buffer = false, opaque;
|
||||
Image doubleBuffer;
|
||||
int doubleBufferWidth = -1;
|
||||
int doubleBufferHeight = -1;
|
||||
|
|
|
@ -289,7 +289,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
|
|||
String oldText = labelText;
|
||||
labelText = text;
|
||||
firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, labelText);
|
||||
if (labelText.length() <= underlinedChar)
|
||||
if (labelText != null && labelText.length() <= underlinedChar)
|
||||
setDisplayedMnemonicIndex(labelText.length() - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ package javax.swing;
|
|||
import java.awt.Component;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
|
@ -48,6 +49,7 @@ import java.io.ObjectOutputStream;
|
|||
import javax.accessibility.Accessible;
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.accessibility.AccessibleRole;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.MenuDragMouseEvent;
|
||||
|
@ -56,418 +58,259 @@ import javax.swing.event.MenuKeyEvent;
|
|||
import javax.swing.event.MenuKeyListener;
|
||||
import javax.swing.plaf.MenuItemUI;
|
||||
|
||||
/**
|
||||
* JMenuItem
|
||||
* @author Andrew Selkirk
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JMenuItem extends AbstractButton implements Accessible, MenuElement {
|
||||
public class JMenuItem extends AbstractButton implements Accessible,
|
||||
MenuElement
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private static final String uiClassID = "MenuItemUI";
|
||||
private KeyStroke accelerator;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Classes ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JMenuItem()
|
||||
{
|
||||
this(null, null);
|
||||
} // JMenuItem()
|
||||
|
||||
/**
|
||||
* AccessibleJMenuItem
|
||||
*/
|
||||
protected class AccessibleJMenuItem extends AccessibleAbstractButton
|
||||
implements ChangeListener {
|
||||
public JMenuItem(Icon icon)
|
||||
{
|
||||
this(null, icon);
|
||||
} // JMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JMenuItem(String text)
|
||||
{
|
||||
this(text, null);
|
||||
} // JMenuItem()
|
||||
|
||||
public JMenuItem(Action action)
|
||||
{
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JMenuItem(String text, Icon icon)
|
||||
{
|
||||
super(text, icon);
|
||||
} // JMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor AccessibleJMenuItem
|
||||
* @param component TODO
|
||||
*/
|
||||
AccessibleJMenuItem(JMenuItem component) {
|
||||
super(component);
|
||||
// TODO
|
||||
} // AccessibleJMenuItem()
|
||||
public JMenuItem(String text, int mnemonic)
|
||||
{
|
||||
super(text, null);
|
||||
setMnemonic(mnemonic);
|
||||
} // JMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
// TODO
|
||||
} // readObject()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException
|
||||
{
|
||||
// TODO
|
||||
} // writeObject()
|
||||
|
||||
/**
|
||||
* stateChanged
|
||||
* @param event TODO
|
||||
*/
|
||||
public void stateChanged(ChangeEvent event) {
|
||||
// TODO
|
||||
} // stateChanged()
|
||||
protected void init(String text, Icon icon)
|
||||
{
|
||||
// TODO
|
||||
} // init()
|
||||
|
||||
/**
|
||||
* getAccessibleRole
|
||||
* @returns AccessibleRole
|
||||
*/
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.MENU_ITEM;
|
||||
} // getAccessibleRole()
|
||||
public void setUI(MenuItemUI ui)
|
||||
{
|
||||
super.setUI(ui);
|
||||
} // setUI()
|
||||
|
||||
public void updateUI()
|
||||
{
|
||||
MenuItemUI mi = ((MenuItemUI) UIManager.getUI(this));
|
||||
setUI(mi);
|
||||
invalidate();
|
||||
} // updateUI()
|
||||
|
||||
} // AccessibleJMenuItem
|
||||
public String getUIClassID()
|
||||
{
|
||||
return uiClassID;
|
||||
} // getUIClassID()
|
||||
|
||||
public boolean isArmed()
|
||||
{
|
||||
return getModel().isArmed();
|
||||
} // isArmed()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public void setArmed(boolean armed)
|
||||
{
|
||||
getModel().setArmed(armed);
|
||||
} // setArmed()
|
||||
|
||||
/**
|
||||
* uiClassID
|
||||
*/
|
||||
private static final String uiClassID = "MenuItemUI";
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
setEnabled(enabled);
|
||||
} // setEnabled()
|
||||
|
||||
/**
|
||||
* accelerator
|
||||
*/
|
||||
private KeyStroke accelerator;
|
||||
public KeyStroke getAccelerator()
|
||||
{
|
||||
return accelerator;
|
||||
} // getAccelerator()
|
||||
|
||||
public void setAccelerator(KeyStroke keystroke)
|
||||
{
|
||||
this.accelerator = keystroke;
|
||||
} // setAccelerator()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected void configurePropertiesFromAction(Action action)
|
||||
{
|
||||
super.configurePropertiesFromAction(action);
|
||||
|
||||
/**
|
||||
* Constructor JMenuItem
|
||||
*/
|
||||
public JMenuItem() {
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
if (action == null)
|
||||
setAccelerator(null);
|
||||
else
|
||||
setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
|
||||
|
||||
} // configurePropertiesFromAction()
|
||||
|
||||
/**
|
||||
* Constructor JMenuItem
|
||||
* @param icon TODO
|
||||
*/
|
||||
public JMenuItem(Icon icon) {
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
protected PropertyChangeListener createActionPropertyChangeListener(Action action)
|
||||
{
|
||||
return null;
|
||||
} // createActionPropertyChangeListener()
|
||||
|
||||
/**
|
||||
* Constructor JMenuItem
|
||||
* @param text TODO
|
||||
*/
|
||||
public JMenuItem(String text) {
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
public void processMouseEvent(MouseEvent event, MenuElement[] path,
|
||||
MenuSelectionManager manager)
|
||||
{
|
||||
// TODO
|
||||
} // processMouseEvent()
|
||||
|
||||
/**
|
||||
* Constructor JMenuItem
|
||||
* @param action TODO
|
||||
*/
|
||||
public JMenuItem(Action action) {
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
public void processKeyEvent(KeyEvent event, MenuElement[] path,
|
||||
MenuSelectionManager manager)
|
||||
{
|
||||
// TODO
|
||||
} // processKeyEvent()
|
||||
|
||||
/**
|
||||
* Constructor JMenuItem
|
||||
* @param text TODO
|
||||
* @param icon TODO
|
||||
*/
|
||||
public JMenuItem(String text, Icon icon) {
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
public void processMenuDragMouseEvent(MenuDragMouseEvent event)
|
||||
{
|
||||
} // processMenuDragMouseEvent()
|
||||
|
||||
/**
|
||||
* Constructor JMenuItem
|
||||
* @param text TODO
|
||||
* @param mnemonic TODO
|
||||
*/
|
||||
public JMenuItem(String text, int mnemonic) {
|
||||
// TODO
|
||||
} // JMenuItem()
|
||||
public void processMenuKeyEvent(MenuKeyEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // processMenuKeyEvent()
|
||||
|
||||
protected void fireMenuDragMouseEntered(MenuDragMouseEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuDragMouseEntered()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected void fireMenuDragMouseExited(MenuDragMouseEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuDragMouseExited()
|
||||
|
||||
/**
|
||||
* readObject
|
||||
* @param stream TODO
|
||||
* @exception IOException TODO
|
||||
* @exception ClassNotFoundException TODO
|
||||
*/
|
||||
private void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException {
|
||||
// TODO
|
||||
} // readObject()
|
||||
protected void fireMenuDragMouseDragged(MenuDragMouseEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuDragMouseDragged()
|
||||
|
||||
/**
|
||||
* writeObject
|
||||
* @param stream TODO
|
||||
* @exception IOException TODO
|
||||
*/
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException {
|
||||
// TODO
|
||||
} // writeObject()
|
||||
protected void fireMenuDragMouseReleased(MenuDragMouseEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuDragMouseReleased()
|
||||
|
||||
/**
|
||||
* init
|
||||
* @param text TODO
|
||||
* @param icon TODO
|
||||
*/
|
||||
protected void init(String text, Icon icon) {
|
||||
// TODO
|
||||
} // init()
|
||||
protected void fireMenuKeyPressed(MenuKeyEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuKeyPressed()
|
||||
|
||||
/**
|
||||
* setUI
|
||||
* @param ui TODO
|
||||
*/
|
||||
public void setUI(MenuItemUI ui) {
|
||||
super.setUI(ui);
|
||||
// TODO
|
||||
} // setUI()
|
||||
protected void fireMenuKeyReleased(MenuKeyEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuKeyReleased()
|
||||
|
||||
/**
|
||||
* updateUI
|
||||
*/
|
||||
public void updateUI() {
|
||||
setUI((MenuItemUI) UIManager.get(this));
|
||||
invalidate();
|
||||
} // updateUI()
|
||||
protected void fireMenuKeyTyped(MenuKeyEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // fireMenuKeyTyped()
|
||||
|
||||
/**
|
||||
* getUIClassID
|
||||
* @returns String
|
||||
*/
|
||||
public String getUIClassID() {
|
||||
return uiClassID;
|
||||
} // getUIClassID()
|
||||
public void menuSelectionChanged(boolean changed)
|
||||
{
|
||||
// TODO
|
||||
} // menuSelectionChanged()
|
||||
|
||||
/**
|
||||
* isArmed
|
||||
* @returns boolean
|
||||
*/
|
||||
public boolean isArmed() {
|
||||
return false; // TODO
|
||||
} // isArmed()
|
||||
public MenuElement[] getSubElements()
|
||||
{
|
||||
return null; // TODO
|
||||
} // getSubElements()
|
||||
|
||||
/**
|
||||
* setArmed
|
||||
* @param armed TODO
|
||||
*/
|
||||
public void setArmed(boolean armed) {
|
||||
// TODO
|
||||
} // setArmed()
|
||||
public Component getComponent()
|
||||
{
|
||||
return null; // TODO
|
||||
} // getComponent()
|
||||
|
||||
/**
|
||||
* setEnabled
|
||||
* @param enabled TODO
|
||||
*/
|
||||
public void setEnabled(boolean enabled) {
|
||||
// TODO
|
||||
} // setEnabled()
|
||||
public void addMenuDragMouseListener(MenuDragMouseListener listener)
|
||||
{
|
||||
// TODO
|
||||
} // addMenuDragMouseListener()
|
||||
|
||||
/**
|
||||
* getAccelerator
|
||||
* @returns KeyStroke
|
||||
*/
|
||||
public KeyStroke getAccelerator() {
|
||||
return null; // TODO
|
||||
} // getAccelerator()
|
||||
public void removeMenuDragMouseListener(MenuDragMouseListener listener)
|
||||
{
|
||||
} // removeMenuDragMouseListener()
|
||||
|
||||
/**
|
||||
* setAccelerator
|
||||
* @param keystroke TODO
|
||||
*/
|
||||
public void setAccelerator(KeyStroke keystroke) {
|
||||
// TODO
|
||||
} // setAccelerator()
|
||||
public void addMenuKeyListener(MenuKeyListener listener)
|
||||
{
|
||||
} // addMenuKeyListener()
|
||||
|
||||
/**
|
||||
* configurePropertiesFromAction
|
||||
* @param action TODO
|
||||
*/
|
||||
protected void configurePropertiesFromAction(Action action) {
|
||||
// TODO
|
||||
} // configurePropertiesFromAction()
|
||||
public void removeMenuKeyListener(MenuKeyListener listener)
|
||||
{
|
||||
} // removeMenuKeyListener()
|
||||
|
||||
/**
|
||||
* createActionPropertyChangeListener
|
||||
* @param action TODO
|
||||
* @returns PropertyChangeListener
|
||||
*/
|
||||
protected PropertyChangeListener createActionPropertyChangeListener(Action action) {
|
||||
return null; // TODO
|
||||
} // createActionPropertyChangeListener()
|
||||
protected String paramString()
|
||||
{
|
||||
return "JMenuItem";
|
||||
} // paramString()
|
||||
|
||||
/**
|
||||
* processMouseEvent
|
||||
* @param event TODO
|
||||
* @param path TODO
|
||||
* @param manager TODO
|
||||
*/
|
||||
public void processMouseEvent(MouseEvent event, MenuElement[] path,
|
||||
MenuSelectionManager manager) {
|
||||
// TODO
|
||||
} // processMouseEvent()
|
||||
public AccessibleContext getAccessibleContext()
|
||||
{
|
||||
if (accessibleContext == null)
|
||||
{
|
||||
accessibleContext = new AccessibleJMenuItem(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* processKeyEvent
|
||||
* @param event TODO
|
||||
* @param path TODO
|
||||
* @param manager TODO
|
||||
*/
|
||||
public void processKeyEvent(KeyEvent event, MenuElement[] path,
|
||||
MenuSelectionManager manager) {
|
||||
// TODO
|
||||
} // processKeyEvent()
|
||||
return accessibleContext;
|
||||
} // getAccessibleContext()
|
||||
|
||||
/**
|
||||
* processMenuDragMouseEvent
|
||||
* @param event TODO
|
||||
*/
|
||||
public void processMenuDragMouseEvent(MenuDragMouseEvent event) {
|
||||
// TODO
|
||||
} // processMenuDragMouseEvent()
|
||||
//-------------------------------------------------------------
|
||||
// Classes ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected class AccessibleJMenuItem extends AccessibleAbstractButton
|
||||
implements ChangeListener
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
AccessibleJMenuItem(JMenuItem component)
|
||||
{
|
||||
super(component);
|
||||
|
||||
/**
|
||||
* processMenuKeyEvent
|
||||
* @param event TODO
|
||||
*/
|
||||
public void processMenuKeyEvent(MenuKeyEvent event) {
|
||||
// TODO
|
||||
} // processMenuKeyEvent()
|
||||
|
||||
/**
|
||||
* fireMenuDragMouseEntered
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuDragMouseEntered(MenuDragMouseEvent event) {
|
||||
// TODO
|
||||
} // fireMenuDragMouseEntered()
|
||||
|
||||
/**
|
||||
* fireMenuDragMouseExited
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuDragMouseExited(MenuDragMouseEvent event) {
|
||||
// TODO
|
||||
} // fireMenuDragMouseExited()
|
||||
|
||||
/**
|
||||
* fireMenuDragMouseDragged
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuDragMouseDragged(MenuDragMouseEvent event) {
|
||||
// TODO
|
||||
} // fireMenuDragMouseDragged()
|
||||
|
||||
/**
|
||||
* fireMenuDragMouseReleased
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuDragMouseReleased(MenuDragMouseEvent event) {
|
||||
// TODO
|
||||
} // fireMenuDragMouseReleased()
|
||||
|
||||
/**
|
||||
* fireMenuKeyPressed
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuKeyPressed(MenuKeyEvent event) {
|
||||
// TODO
|
||||
} // fireMenuKeyPressed()
|
||||
|
||||
/**
|
||||
* fireMenuKeyReleased
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuKeyReleased(MenuKeyEvent event) {
|
||||
// TODO
|
||||
} // fireMenuKeyReleased()
|
||||
|
||||
/**
|
||||
* fireMenuKeyTyped
|
||||
* @param event TODO
|
||||
*/
|
||||
protected void fireMenuKeyTyped(MenuKeyEvent event) {
|
||||
// TODO
|
||||
} // fireMenuKeyTyped()
|
||||
|
||||
/**
|
||||
* menuSelectionChanged
|
||||
* @param changed TODO
|
||||
*/
|
||||
public void menuSelectionChanged(boolean changed) {
|
||||
// TODO
|
||||
} // menuSelectionChanged()
|
||||
|
||||
/**
|
||||
* getSubElements
|
||||
* @returns MenuElement[]
|
||||
*/
|
||||
public MenuElement[] getSubElements() {
|
||||
return null; // TODO
|
||||
} // getSubElements()
|
||||
|
||||
/**
|
||||
* getComponent
|
||||
* @returns Component
|
||||
*/
|
||||
public Component getComponent() {
|
||||
return null; // TODO
|
||||
} // getComponent()
|
||||
|
||||
/**
|
||||
* addMenuDragMouseListener
|
||||
* @param listener TODO
|
||||
*/
|
||||
public void addMenuDragMouseListener(MenuDragMouseListener listener) {
|
||||
// TODO
|
||||
} // addMenuDragMouseListener()
|
||||
|
||||
/**
|
||||
* removeMenuDragMouseListener
|
||||
* @param listener TODO
|
||||
*/
|
||||
public void removeMenuDragMouseListener(MenuDragMouseListener listener) {
|
||||
// TODO
|
||||
} // removeMenuDragMouseListener()
|
||||
|
||||
/**
|
||||
* addMenuKeyListener
|
||||
* @param listener TODO
|
||||
*/
|
||||
public void addMenuKeyListener(MenuKeyListener listener) {
|
||||
// TODO
|
||||
} // addMenuKeyListener()
|
||||
|
||||
/**
|
||||
* removeMenuKeyListener
|
||||
* @param listener TODO
|
||||
*/
|
||||
public void removeMenuKeyListener(MenuKeyListener listener) {
|
||||
// TODO
|
||||
} // removeMenuKeyListener()
|
||||
|
||||
/**
|
||||
* paramString
|
||||
* @returns String
|
||||
*/
|
||||
protected String paramString() {
|
||||
return null; // TODO
|
||||
} // paramString()
|
||||
|
||||
/**
|
||||
* getAccessibleContext
|
||||
* @returns AccessibleContext
|
||||
*/
|
||||
public AccessibleContext getAccessibleContext() {
|
||||
if (accessibleContext == null) {
|
||||
accessibleContext = new AccessibleJMenuItem(this);
|
||||
} // if
|
||||
return accessibleContext;
|
||||
} // getAccessibleContext()
|
||||
// TODO
|
||||
} // AccessibleJMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public void stateChanged(ChangeEvent event)
|
||||
{
|
||||
// TODO
|
||||
} // stateChanged()
|
||||
|
||||
public AccessibleRole getAccessibleRole()
|
||||
{
|
||||
return AccessibleRole.MENU_ITEM;
|
||||
} // getAccessibleRole()
|
||||
} // AccessibleJMenuItem
|
||||
} // JMenuItem
|
||||
|
|
|
@ -185,9 +185,6 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
/** Fired in a PropertyChangeEvent when the "indeterminate" property changes. */
|
||||
public static final String INDETERMINATE_CHANGED_PROPERTY = "indeterminate";
|
||||
|
||||
/** A list of ChangeListeners registered with this ProgressBar. */
|
||||
private transient EventListenerList changeListenerList;
|
||||
|
||||
/** Whether the ProgressBar is determinate. */
|
||||
private transient boolean indeterminate = false;
|
||||
|
||||
|
@ -260,7 +257,6 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
this.orientation = orientation;
|
||||
changeListener = createChangeListener();
|
||||
model.addChangeListener(changeListener);
|
||||
changeListenerList = new EventListenerList();
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
@ -275,7 +271,6 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
this.model = model;
|
||||
changeListener = createChangeListener();
|
||||
model.addChangeListener(changeListener);
|
||||
changeListenerList = new EventListenerList();
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
@ -511,7 +506,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
*/
|
||||
public void addChangeListener(ChangeListener listener)
|
||||
{
|
||||
changeListenerList.add(ChangeListener.class, listener);
|
||||
listenerList.add(ChangeListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -521,7 +516,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
*/
|
||||
public void removeChangeListener(ChangeListener listener)
|
||||
{
|
||||
changeListenerList.remove(ChangeListener.class, listener);
|
||||
listenerList.remove(ChangeListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -532,7 +527,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
*/
|
||||
public ChangeListener[] getChangeListeners()
|
||||
{
|
||||
return (ChangeListener[]) changeListenerList.getListenerList();
|
||||
return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -542,7 +537,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
|
|||
*/
|
||||
protected void fireStateChanged()
|
||||
{
|
||||
Object[] changeListeners = changeListenerList.getListenerList();
|
||||
Object[] changeListeners = listenerList.getListenerList();
|
||||
if (changeEvent == null)
|
||||
changeEvent = new ChangeEvent(this);
|
||||
for (int i = changeListeners.length - 2; i >= 0; i -= 2)
|
||||
|
|
|
@ -39,186 +39,118 @@ package javax.swing;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.accessibility.Accessible;
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.accessibility.AccessibleRole;
|
||||
|
||||
/**
|
||||
* JRadioButtonMenuItem
|
||||
* @author Andrew Selkirk
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class JRadioButtonMenuItem extends JMenuItem implements Accessible
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private static final String uiClassID = "RadioButtonMenuItemUI";
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Classes ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JRadioButtonMenuItem()
|
||||
{
|
||||
this(null, null);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* AccessibleJRadioButtonMenuItem
|
||||
*/
|
||||
protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem {
|
||||
public JRadioButtonMenuItem(Icon icon)
|
||||
{
|
||||
this(null, icon);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JRadioButtonMenuItem(String text)
|
||||
{
|
||||
this(text, null);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor AccessibleJRadioButtonMenuItem
|
||||
* @param component TODO
|
||||
*/
|
||||
protected AccessibleJRadioButtonMenuItem(JRadioButtonMenuItem component) {
|
||||
super(component);
|
||||
// TODO
|
||||
} // AccessibleJRadioButtonMenuItem()
|
||||
public JRadioButtonMenuItem(Action action)
|
||||
{
|
||||
this();
|
||||
setAction(action);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
public JRadioButtonMenuItem(String text, Icon icon)
|
||||
{
|
||||
this(text, icon, false);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public JRadioButtonMenuItem(String text, boolean selected)
|
||||
{
|
||||
this(text, null, selected);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* getAccessibleRole
|
||||
* @returns AccessibleRole
|
||||
*/
|
||||
public AccessibleRole getAccessibleRole() {
|
||||
return AccessibleRole.RADIO_BUTTON;
|
||||
} // getAccessibleRole()
|
||||
public JRadioButtonMenuItem(Icon icon, boolean selected)
|
||||
{
|
||||
this(null, icon, selected);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
public JRadioButtonMenuItem(String text, Icon icon, boolean selected)
|
||||
{
|
||||
super(text, icon);
|
||||
setModel(new JToggleButton.ToggleButtonModel());
|
||||
model.setSelected(selected);
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
} // AccessibleJRadioButtonMenuItem
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException
|
||||
{
|
||||
// TODO
|
||||
} // writeObject()
|
||||
|
||||
public String getUIClassID()
|
||||
{
|
||||
return uiClassID;
|
||||
} // getUIClassID()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Variables --------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public void requestFocus()
|
||||
{
|
||||
// TODO
|
||||
} // requestFocus()
|
||||
|
||||
/**
|
||||
* uiClassID
|
||||
*/
|
||||
private static final String uiClassID = "RadioButtonMenuItemUI";
|
||||
protected String paramString()
|
||||
{
|
||||
return "JRadioButtonMenuItem";
|
||||
} // paramString()
|
||||
|
||||
public AccessibleContext getAccessibleContext()
|
||||
{
|
||||
if (accessibleContext == null)
|
||||
{
|
||||
accessibleContext = new AccessibleJRadioButtonMenuItem(this);
|
||||
}
|
||||
return accessibleContext;
|
||||
} // getAccessibleContext()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
*/
|
||||
public JRadioButtonMenuItem() {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param icon TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(Icon icon) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param text TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(String text) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param action TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(Action action) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param text TODO
|
||||
* @param icon TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(String text, Icon icon) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param text TODO
|
||||
* @param selected TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(String text, boolean selected) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param icon TODO
|
||||
* @param selected TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(Icon icon, boolean selected) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
/**
|
||||
* Constructor JRadioButtonMenuItem
|
||||
* @param text TODO
|
||||
* @param icon TODO
|
||||
* @param selected TODO
|
||||
*/
|
||||
public JRadioButtonMenuItem(String text, Icon icon, boolean selected) {
|
||||
// TODO
|
||||
} // JRadioButtonMenuItem()
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* writeObject
|
||||
* @param stream TODO
|
||||
* @exception IOException TODO
|
||||
*/
|
||||
private void writeObject(ObjectOutputStream stream) throws IOException {
|
||||
// TODO
|
||||
} // writeObject()
|
||||
|
||||
/**
|
||||
* getUIClassID
|
||||
* @returns String
|
||||
*/
|
||||
public String getUIClassID() {
|
||||
return uiClassID;
|
||||
} // getUIClassID()
|
||||
|
||||
/**
|
||||
* requestFocus
|
||||
*/
|
||||
public void requestFocus() {
|
||||
// TODO
|
||||
} // requestFocus()
|
||||
|
||||
/**
|
||||
* paramString
|
||||
* @returns String
|
||||
*/
|
||||
protected String paramString() {
|
||||
return null; // TODO
|
||||
} // paramString()
|
||||
|
||||
/**
|
||||
* getAccessibleContext
|
||||
* @returns AccessibleContext
|
||||
*/
|
||||
public AccessibleContext getAccessibleContext() {
|
||||
if (accessibleContext == null) {
|
||||
accessibleContext = new AccessibleJRadioButtonMenuItem(this);
|
||||
} // if
|
||||
return accessibleContext;
|
||||
} // getAccessibleContext()
|
||||
//-------------------------------------------------------------
|
||||
// Classes ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Initialization ---------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
protected AccessibleJRadioButtonMenuItem(JRadioButtonMenuItem component)
|
||||
{
|
||||
super(component);
|
||||
|
||||
// TODO
|
||||
} // AccessibleJRadioButtonMenuItem()
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Methods ----------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
public AccessibleRole getAccessibleRole()
|
||||
{
|
||||
return AccessibleRole.RADIO_BUTTON;
|
||||
} // getAccessibleRole()
|
||||
} // AccessibleJRadioButtonMenuItem
|
||||
} // JRadioButtonMenuItem
|
||||
|
|
|
@ -176,12 +176,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
/** How much the thumb moves when moving in a unit. */
|
||||
protected int unitIncrement = 1;
|
||||
|
||||
/** A list of all ChangeListeners attached to the scroll bar. */
|
||||
private transient EventListenerList changeListenerList;
|
||||
|
||||
/** A list of all AdjustmentListeners attached to the scroll bar. */
|
||||
private transient EventListenerList adjustmentListenerList;
|
||||
|
||||
/** The ChangeListener that listens to the model. */
|
||||
private transient ChangeListener changeListener;
|
||||
|
||||
|
@ -228,8 +222,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
+ " is not a legal orientation");
|
||||
this.orientation = orientation;
|
||||
changeListener = createChangeListener();
|
||||
changeListenerList = new EventListenerList();
|
||||
adjustmentListenerList = new EventListenerList();
|
||||
model.addChangeListener(changeListener);
|
||||
updateUI();
|
||||
}
|
||||
|
@ -586,7 +578,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
private void fireStateChanged()
|
||||
{
|
||||
Object[] changeListeners = changeListenerList.getListenerList();
|
||||
Object[] changeListeners = listenerList.getListenerList();
|
||||
if (changeEvent == null)
|
||||
changeEvent = new ChangeEvent(this);
|
||||
for (int i = changeListeners.length - 2; i >= 0; i -= 2)
|
||||
|
@ -603,7 +595,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
public void addChangeListener(ChangeListener listener)
|
||||
{
|
||||
changeListenerList.add(ChangeListener.class, listener);
|
||||
listenerList.add(ChangeListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -613,7 +605,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
public void removeChangeListener(ChangeListener listener)
|
||||
{
|
||||
changeListenerList.remove(ChangeListener.class, listener);
|
||||
listenerList.remove(ChangeListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -624,7 +616,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
public ChangeListener[] getChangeListeners()
|
||||
{
|
||||
return (ChangeListener[]) changeListenerList.getListenerList();
|
||||
return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -634,7 +626,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
public void addAdjustmentListener(AdjustmentListener listener)
|
||||
{
|
||||
adjustmentListenerList.add(AdjustmentListener.class, listener);
|
||||
listenerList.add(AdjustmentListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -644,7 +636,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
public void removeAdjustmentListener(AdjustmentListener listener)
|
||||
{
|
||||
adjustmentListenerList.remove(AdjustmentListener.class, listener);
|
||||
listenerList.remove(AdjustmentListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -655,7 +647,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
public AdjustmentListener[] getAdjustmentListeners()
|
||||
{
|
||||
return (AdjustmentListener[]) adjustmentListenerList.getListenerList();
|
||||
return (AdjustmentListener[]) listenerList.getListeners(AdjustmentListener.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,7 +662,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
|
|||
*/
|
||||
protected void fireAdjustmentValueChanged(int id, int type, int value)
|
||||
{
|
||||
Object[] adjustmentListeners = adjustmentListenerList.getListenerList();
|
||||
Object[] adjustmentListeners = listenerList.getListenerList();
|
||||
AdjustmentEvent adjustmentEvent = new AdjustmentEvent(this,
|
||||
AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
|
||||
AdjustmentEvent.TRACK,
|
||||
|
|
|
@ -253,9 +253,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
*/
|
||||
private transient Dictionary labelTable;
|
||||
|
||||
/** A list of all ChangeListeners listening to this slider. */
|
||||
private transient EventListenerList changeListenerList;
|
||||
|
||||
/** The model used to describe the slider. */
|
||||
protected BoundedRangeModel sliderModel;
|
||||
|
||||
|
@ -342,7 +339,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
throw new IllegalArgumentException(orientation + " is not a legal orientation");
|
||||
this.orientation = orientation;
|
||||
changeListener = createChangeListener();
|
||||
changeListenerList = new EventListenerList();
|
||||
sliderModel.addChangeListener(changeListener);
|
||||
updateUI();
|
||||
}
|
||||
|
@ -359,7 +355,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
else
|
||||
sliderModel = model;
|
||||
changeListener = createChangeListener();
|
||||
changeListenerList = new EventListenerList();
|
||||
sliderModel.addChangeListener(changeListener);
|
||||
updateUI();
|
||||
}
|
||||
|
@ -453,7 +448,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
*/
|
||||
public void addChangeListener(ChangeListener listener)
|
||||
{
|
||||
changeListenerList.add(ChangeListener.class, listener);
|
||||
listenerList.add(ChangeListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -463,7 +458,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
*/
|
||||
public void removeChangeListener(ChangeListener listener)
|
||||
{
|
||||
changeListenerList.remove(ChangeListener.class, listener);
|
||||
listenerList.remove(ChangeListener.class, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -473,7 +468,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
*/
|
||||
protected void fireStateChanged()
|
||||
{
|
||||
Object[] changeListeners = changeListenerList.getListenerList();
|
||||
Object[] changeListeners = listenerList.getListenerList();
|
||||
if (changeEvent == null)
|
||||
changeEvent = new ChangeEvent(this);
|
||||
for (int i = changeListeners.length - 2; i >= 0; i -= 2)
|
||||
|
@ -491,7 +486,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
|
|||
*/
|
||||
public ChangeListener[] getChangeListeners()
|
||||
{
|
||||
return (ChangeListener[]) changeListenerList.getListenerList();
|
||||
return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load diff
363
libjava/javax/swing/plaf/basic/BasicArrowButton.java
Normal file
363
libjava/javax/swing/plaf/basic/BasicArrowButton.java
Normal file
|
@ -0,0 +1,363 @@
|
|||
/* BasicArrowButton.java
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package javax.swing.plaf.basic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
|
||||
/**
|
||||
* This class draws simple arrow buttons for the Basic Look and Feel.
|
||||
*/
|
||||
public class BasicArrowButton extends JButton implements SwingConstants
|
||||
{
|
||||
/**
|
||||
* A private helper class that draws icons.
|
||||
*/
|
||||
private class arrowIcon implements Icon
|
||||
{
|
||||
/** The polygon that describes the icon. */
|
||||
private Polygon arrow;
|
||||
|
||||
/** The size of the icon. */
|
||||
private int size = 10;
|
||||
|
||||
/**
|
||||
* Creates a new arrowIcon object using the given arrow polygon.
|
||||
*
|
||||
* @param arrow The polygon that describes the arrow.
|
||||
*/
|
||||
public arrowIcon(Polygon arrow)
|
||||
{
|
||||
this.arrow = arrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height of the icon.
|
||||
*
|
||||
* @return The height of the icon.
|
||||
*/
|
||||
public int getIconHeight()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width of the icon.
|
||||
*
|
||||
* @return The width of the icon.
|
||||
*/
|
||||
public int getIconWidth()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size of the icon.
|
||||
*
|
||||
* @param size The size of the icon.
|
||||
*/
|
||||
public void setSize(int size)
|
||||
{
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the arrow polygon.
|
||||
*
|
||||
* @param arrow The arrow polygon.
|
||||
*/
|
||||
public void setArrow(Polygon arrow)
|
||||
{
|
||||
this.arrow = arrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the icon.
|
||||
*
|
||||
* @param c The Component to paint for.
|
||||
* @param g The Graphics object to draw with.
|
||||
* @param x The X coordinate to draw at.
|
||||
* @param y The Y coordinate to draw at.
|
||||
*/
|
||||
public void paintIcon(Component c, Graphics g, int x, int y)
|
||||
{
|
||||
Color arrowColor;
|
||||
if (c.isEnabled())
|
||||
arrowColor = darkShadow;
|
||||
else
|
||||
arrowColor = shadow;
|
||||
|
||||
paintIconImpl(g, x, y, arrowColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does the actual painting work.
|
||||
*
|
||||
* @param g The Graphics object to paint with.
|
||||
* @param x The x coordinate to paint at.
|
||||
* @param y The y coordinate to paint at.
|
||||
* @param arrowColor The color to paint the arrow with.
|
||||
*/
|
||||
public void paintIconImpl(Graphics g, int x, int y, Color arrowColor)
|
||||
{
|
||||
g.translate(x, y);
|
||||
|
||||
Color saved = g.getColor();
|
||||
|
||||
g.setColor(arrowColor);
|
||||
|
||||
g.fillPolygon(arrow);
|
||||
|
||||
g.setColor(saved);
|
||||
g.translate(-x, -y);
|
||||
}
|
||||
}
|
||||
|
||||
/** The direction to point in. */
|
||||
protected int direction;
|
||||
|
||||
/** The color the arrow is painted in if disabled and the bottom and
|
||||
* right edges of the button. */
|
||||
private transient Color shadow = Color.BLACK;
|
||||
|
||||
/** The color the arrow is painted in if enabled and the bottom and
|
||||
* right edges of the button. */
|
||||
private transient Color darkShadow = Color.BLACK;
|
||||
|
||||
/** The top and left edges of the button. */
|
||||
private transient Color highlight = Color.BLACK;
|
||||
|
||||
/**
|
||||
* Creates a new BasicArrowButton object.
|
||||
*
|
||||
* @param direction The direction the arrow points in.
|
||||
*/
|
||||
public BasicArrowButton(int direction)
|
||||
{
|
||||
super();
|
||||
setDirection(direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new BasicArrowButton object with the given colors and
|
||||
* direction.
|
||||
*
|
||||
* @param direction The direction to point in.
|
||||
* @param background The background color.
|
||||
* @param shadow The shadow color.
|
||||
* @param darkShadow The dark shadow color.
|
||||
* @param highlight The highlight color.
|
||||
*/
|
||||
public BasicArrowButton(int direction, Color background, Color shadow,
|
||||
Color darkShadow, Color highlight)
|
||||
{
|
||||
this(direction);
|
||||
setBackground(background);
|
||||
this.shadow = shadow;
|
||||
this.darkShadow = darkShadow;
|
||||
this.highlight = highlight;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the direction of the arrow.
|
||||
*
|
||||
* @return The direction of the arrow.
|
||||
*/
|
||||
public int getDirection()
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method changes the direction of the arrow.
|
||||
*
|
||||
* @param dir The new direction of the arrow.
|
||||
*/
|
||||
public void setDirection(int dir)
|
||||
{
|
||||
Polygon arrow = getArrow(dir, 10);
|
||||
if (getIcon() == null)
|
||||
setIcon(new arrowIcon(arrow));
|
||||
else
|
||||
((arrowIcon) getIcon()).setArrow(arrow);
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method paints the arrow button.
|
||||
*
|
||||
* @param g The Graphics object to paint with.
|
||||
*/
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
super.paint(g);
|
||||
Rectangle bounds = getBounds();
|
||||
|
||||
Color saved = g.getColor();
|
||||
g.setColor(highlight);
|
||||
|
||||
g.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height);
|
||||
g.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);
|
||||
|
||||
g.setColor(shadow);
|
||||
|
||||
g.drawLine(bounds.x + 1, bounds.y + bounds.height - 1,
|
||||
bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
|
||||
g.drawLine(bounds.x + bounds.width - 1, bounds.y + 1,
|
||||
bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
|
||||
|
||||
g.setColor(darkShadow);
|
||||
|
||||
g.drawLine(bounds.x, bounds.y + bounds.height, bounds.x + bounds.width,
|
||||
bounds.y + bounds.height);
|
||||
g.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width,
|
||||
bounds.y + bounds.height);
|
||||
|
||||
g.setColor(saved);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the preferred size of the arrow button.
|
||||
*
|
||||
* @return The preferred size.
|
||||
*/
|
||||
public Dimension getPreferredSize()
|
||||
{
|
||||
return new Dimension(getIcon().getIconWidth(), getIcon().getIconHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the minimum size of the arrow button.
|
||||
*
|
||||
* @return The minimum size.
|
||||
*/
|
||||
public Dimension getMinimumSize()
|
||||
{
|
||||
return getPreferredSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the maximum size of the arrow button.
|
||||
*
|
||||
* @return The maximum size.
|
||||
*/
|
||||
public Dimension getMaximumSize()
|
||||
{
|
||||
return getPreferredSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* The method paints a triangle with the given size and direction at
|
||||
* the given x and y coordinates.
|
||||
*
|
||||
* @param g The Graphics object to paint with.
|
||||
* @param x The x coordinate to paint at.
|
||||
* @param y The y coordinate to paint at.
|
||||
* @param size The size of the icon.
|
||||
* @param direction The direction of the icon.
|
||||
* @param isEnabled Whether it is enabled.
|
||||
*/
|
||||
public void paintTriangle(Graphics g, int x, int y, int size, int direction,
|
||||
boolean isEnabled)
|
||||
{
|
||||
Polygon arrow = getArrow(direction, size);
|
||||
arrowIcon arrowI = new arrowIcon(arrow);
|
||||
arrowI.setSize(size);
|
||||
|
||||
Color arrowColor;
|
||||
if (isEnabled())
|
||||
arrowColor = darkShadow;
|
||||
else
|
||||
arrowColor = shadow;
|
||||
|
||||
arrowI.paintIconImpl(g, x, y, arrowColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a private helper that creates polygons for a given size
|
||||
* and direction.
|
||||
*
|
||||
* @param direction The direction of the arrow.
|
||||
* @param size The size of the arrow.
|
||||
*
|
||||
* @return A new arrow polygon.
|
||||
*/
|
||||
private Polygon getArrow(int direction, int size)
|
||||
{
|
||||
Polygon arrow;
|
||||
double dsize = (double) size;
|
||||
|
||||
int two = (int) (dsize * 2 / 10);
|
||||
int three = (int) (dsize * 3 / 10);
|
||||
int five = (int) (dsize * 5 / 10);
|
||||
int seven = (int) (dsize * 7 / 10);
|
||||
int eight = (int) (dsize * 8 / 10);
|
||||
switch (direction)
|
||||
{
|
||||
case NORTH:
|
||||
arrow = new Polygon(new int[] { two, five, eight },
|
||||
new int[] { seven, three, seven }, 3);
|
||||
break;
|
||||
case SOUTH:
|
||||
arrow = new Polygon(new int[] { two, five, eight },
|
||||
new int[] { three, seven, three }, 3);
|
||||
break;
|
||||
case EAST:
|
||||
case RIGHT:
|
||||
arrow = new Polygon(new int[] { three, seven, three },
|
||||
new int[] { two, five, eight }, 3);
|
||||
break;
|
||||
case WEST:
|
||||
case LEFT:
|
||||
arrow = new Polygon(new int[] { seven, three, seven },
|
||||
new int[] { two, five, eight }, 3);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid direction given.");
|
||||
}
|
||||
return arrow;
|
||||
}
|
||||
}
|
77
libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
Normal file
77
libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* BasicCheckBoxMenuItemUI.java
|
||||
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package javax.swing.plaf.basic;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.MenuElement;
|
||||
import javax.swing.MenuSelectionManager;
|
||||
import javax.swing.UIDefaults;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
|
||||
|
||||
public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
|
||||
{
|
||||
public static ComponentUI createUI(final JComponent c)
|
||||
{
|
||||
return new BasicCheckBoxMenuItemUI();
|
||||
}
|
||||
|
||||
protected String getPropertyPrefix()
|
||||
{
|
||||
return null; // TODO
|
||||
}
|
||||
|
||||
protected void installDefaults()
|
||||
{
|
||||
super.installDefaults();
|
||||
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
checkIcon = defaults.getIcon("CheckBoxMenuItem.checkIcon");
|
||||
}
|
||||
|
||||
void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement[] path,
|
||||
MenuSelectionManager manager)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -196,11 +196,11 @@ public class BasicIconFactory implements Serializable
|
|||
}
|
||||
public static Icon getCheckBoxMenuItemIcon()
|
||||
{
|
||||
return new DummyIcon();
|
||||
return getCheckBoxIcon();
|
||||
}
|
||||
public static Icon getRadioButtonMenuItemIcon()
|
||||
{
|
||||
return new DummyIcon();
|
||||
return getRadioButtonIcon();
|
||||
}
|
||||
public static Icon createEmptyFrameIcon()
|
||||
{
|
||||
|
|
|
@ -501,7 +501,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
|
|||
"MenuBar.windowBindings", new Object[] {
|
||||
"F10", "takeFocus"
|
||||
},
|
||||
"MenuItem.acceleratorDelimiter", "+",
|
||||
"MenuItem.acceleratorDelimiter", "-",
|
||||
"MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12),
|
||||
"MenuItem.acceleratorForeground", new ColorUIResource(Color.black),
|
||||
"MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white),
|
||||
|
@ -703,9 +703,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
|
|||
"ctrl UP", "requestFocus",
|
||||
"ctrl KP_UP", "requestFocus"
|
||||
}),
|
||||
"TabbedPane.background", new ColorUIResource(Color.lightGray),
|
||||
"TabbedPane.background", new ColorUIResource(Color.GRAY),
|
||||
"TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3),
|
||||
"TabbedPane.darkShadow", new ColorUIResource(Color.black),
|
||||
"TabbedPane.darkShadow", new ColorUIResource(Color.darkGray),
|
||||
"TabbedPane.focus", new ColorUIResource(Color.black),
|
||||
"TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
|
||||
"LEFT", "navigateLeft",
|
||||
|
@ -725,8 +725,10 @@ public abstract class BasicLookAndFeel extends LookAndFeel
|
|||
"TabbedPane.lightHighlight", new ColorUIResource(Color.white),
|
||||
"TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
|
||||
"TabbedPane.shadow", new ColorUIResource(Color.gray),
|
||||
"TabbedPane.tabAreaInsets", new InsetsUIResource(3, 2, 0, 2),
|
||||
"TabbedPane.tabInsets", new InsetsUIResource(0, 4, 1, 4),
|
||||
"TabbedPane.tabbedPaneTabAreaInsets", new InsetsUIResource(3, 2, 1, 2),
|
||||
"TabbedPane.tabbedPaneTabInsets", new InsetsUIResource(1, 4, 1, 4),
|
||||
"TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2),
|
||||
"TabbedPane.tabbedPaneTabPadInsets", new InsetsUIResource(1, 1, 1, 1),
|
||||
"TabbedPane.tabRunOverlay", new Integer(2),
|
||||
"TabbedPane.textIconGap", new Integer(4),
|
||||
"Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
|
||||
|
|
647
libjava/javax/swing/plaf/basic/BasicMenuItemUI.java
Normal file
647
libjava/javax/swing/plaf/basic/BasicMenuItemUI.java
Normal file
|
@ -0,0 +1,647 @@
|
|||
/* BasicMenuItemUI.java
|
||||
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package javax.swing.plaf.basic;
|
||||
|
||||
import java.awt.AWTKeyStroke;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.ButtonModel;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.MenuElement;
|
||||
import javax.swing.MenuSelectionManager;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIDefaults;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.MenuDragMouseEvent;
|
||||
import javax.swing.event.MenuDragMouseListener;
|
||||
import javax.swing.event.MenuKeyEvent;
|
||||
import javax.swing.event.MenuKeyListener;
|
||||
import javax.swing.event.MouseInputListener;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.MenuItemUI;
|
||||
|
||||
|
||||
public class BasicMenuItemUI extends MenuItemUI
|
||||
{
|
||||
/** Font to be used when displaying menu item's accelerator. */
|
||||
protected Font acceleratorFont;
|
||||
|
||||
/** Color to be used when displaying menu item's accelerator. */
|
||||
protected Color acceleratorForeground;
|
||||
|
||||
/** Color to be used when displaying menu item's accelerator
|
||||
* when menu item is selected.
|
||||
*/
|
||||
protected Color acceleratorSelectionForeground;
|
||||
|
||||
/**
|
||||
* Icon that is displayed after the text to indicated that this menu
|
||||
* contains submenu.
|
||||
*/
|
||||
protected Icon arrowIcon;
|
||||
|
||||
/**
|
||||
* Icon that is displayed before the text. This icon is only used in
|
||||
* JCheckBoxMenuItem or JRadioBoxMenuItem.
|
||||
*/
|
||||
protected Icon checkIcon;
|
||||
|
||||
/** Number of spaces between icon and text. */
|
||||
protected int defaultTextIconGap = 4;
|
||||
|
||||
/** Color of the text when menu item is disabled*/
|
||||
protected Color disabledForeground;
|
||||
|
||||
/** The menu Drag mouse listener listening to the menu item. */
|
||||
protected MenuDragMouseListener menuDragMouseListener;
|
||||
|
||||
/** The menu item itself*/
|
||||
protected JMenuItem menuItem;
|
||||
|
||||
/** Menu Key listener listening to the menu item. */
|
||||
protected MenuKeyListener menuKeyListener;
|
||||
|
||||
/** mouse input listener listening to menu item. */
|
||||
protected MouseInputListener mouseInputListener;
|
||||
|
||||
/** Indicates if border should be painted */
|
||||
protected boolean oldBorderPainted;
|
||||
|
||||
/** Color of text that is used when menu item is selected */
|
||||
protected Color selectionBackground;
|
||||
|
||||
/** Color of the background that is used when menu item is selected.*/
|
||||
protected Color selectionForeground;
|
||||
|
||||
/** String that separates description of the modifiers and the key*/
|
||||
private String acceleratorDelimiter;
|
||||
|
||||
/** Number of spaces between accelerator and menu item's label. */
|
||||
private int defaultAcceleratorLabelGap = 4;
|
||||
|
||||
// Constructor Summary
|
||||
BasicMenuItemUI()
|
||||
{
|
||||
mouseInputListener = createMouseInputListener(menuItem);
|
||||
menuDragMouseListener = createMenuDragMouseListener(menuItem);
|
||||
menuKeyListener = createMenuKeyListener(menuItem);
|
||||
}
|
||||
|
||||
// Method Summary
|
||||
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
|
||||
{
|
||||
return new MenuDragMouseHandler();
|
||||
}
|
||||
|
||||
protected MenuKeyListener createMenuKeyListener(JComponent c)
|
||||
{
|
||||
return new MenuKeyHandler();
|
||||
}
|
||||
|
||||
protected MouseInputListener createMouseInputListener(JComponent c)
|
||||
{
|
||||
return new MouseInputHandler();
|
||||
}
|
||||
|
||||
public static ComponentUI createUI(JComponent c)
|
||||
{
|
||||
return new BasicMenuItemUI();
|
||||
}
|
||||
|
||||
protected void doClick(MenuSelectionManager msm)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public Dimension getMaximumSize(JComponent c)
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize(JComponent c)
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public MenuElement[] getPath()
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,
|
||||
Icon arrowIcon,
|
||||
int defaultTextIconGap)
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize(JComponent c)
|
||||
{
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b,
|
||||
defaultTextIconGap);
|
||||
|
||||
// if menu item has accelerator then take accelerator's size into account
|
||||
// when calculating preferred size.
|
||||
|
||||
KeyStroke accelerator = ((JMenuItem) c).getAccelerator();
|
||||
Rectangle rect;
|
||||
if (accelerator != null)
|
||||
{
|
||||
rect = getAcceleratorRect(accelerator,
|
||||
b.getToolkit().getFontMetrics(acceleratorFont));
|
||||
|
||||
// add width of accelerator's text
|
||||
d.width = d.width + rect.width + defaultAcceleratorLabelGap;
|
||||
|
||||
// adjust the heigth of the preferred size if necessary
|
||||
if (d.height < rect.height)
|
||||
d.height = rect.height;
|
||||
}
|
||||
|
||||
if (checkIcon != null)
|
||||
{
|
||||
d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap;
|
||||
if (checkIcon.getIconHeight() > d.height)
|
||||
d.height = checkIcon.getIconHeight();
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
protected String getPropertyPrefix()
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void installComponents(JMenuItem menuItem)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
protected void installDefaults()
|
||||
{
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
|
||||
menuItem.setBackground(defaults.getColor("MenuItem.background"));
|
||||
menuItem.setBorder(defaults.getBorder("MenuItem.border"));
|
||||
menuItem.setFont(defaults.getFont("MenuItem.font"));
|
||||
menuItem.setForeground(defaults.getColor("MenuItem.foreground"));
|
||||
menuItem.setMargin(defaults.getInsets("MenuItem.margin"));
|
||||
acceleratorFont = defaults.getFont("MenuItem.acceleratorFont");
|
||||
acceleratorForeground = defaults.getColor("MenuItem.acceleratorForeground");
|
||||
acceleratorSelectionForeground = defaults.getColor("MenuItem.acceleratorSelectionForeground");
|
||||
arrowIcon = defaults.getIcon("MenuItem.arrowIcon");
|
||||
selectionBackground = defaults.getColor("MenuItem.selectionBackground");
|
||||
selectionForeground = defaults.getColor("MenuItem.selectionForeground");
|
||||
acceleratorDelimiter = defaults.getString("MenuItem.acceleratorDelimiter");
|
||||
}
|
||||
|
||||
protected void installKeyboardActions()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
protected void installListeners()
|
||||
{
|
||||
menuItem.addMouseListener(mouseInputListener);
|
||||
menuItem.addMenuDragMouseListener(menuDragMouseListener);
|
||||
menuItem.addMenuKeyListener(menuKeyListener);
|
||||
}
|
||||
|
||||
public void installUI(JComponent c)
|
||||
{
|
||||
super.installUI(c);
|
||||
menuItem = (JMenuItem) c;
|
||||
installDefaults();
|
||||
installListeners();
|
||||
}
|
||||
|
||||
public void paint(Graphics g, JComponent c)
|
||||
{
|
||||
paintMenuItem(g, c, checkIcon, arrowIcon, c.getBackground(),
|
||||
c.getForeground(), defaultTextIconGap);
|
||||
}
|
||||
|
||||
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
|
||||
{
|
||||
Dimension size = getPreferredSize(menuItem);
|
||||
Color foreground = g.getColor();
|
||||
g.setColor(bgColor);
|
||||
g.drawRect(0, 0, size.width, size.height);
|
||||
g.setColor(foreground);
|
||||
}
|
||||
|
||||
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon,
|
||||
Icon arrowIcon, Color background,
|
||||
Color foreground, int defaultTextIconGap)
|
||||
{
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
Rectangle tr = new Rectangle(); // text rectangle
|
||||
Rectangle ir = new Rectangle(); // icon rectangle
|
||||
Rectangle vr = new Rectangle(); // view rectangle
|
||||
Rectangle br = new Rectangle(); // border rectangle
|
||||
Rectangle ar = new Rectangle(); // accelerator rectangle
|
||||
Rectangle cr = new Rectangle(); // checkIcon rectangle
|
||||
|
||||
int vertAlign = b.getVerticalAlignment();
|
||||
int horAlign = b.getHorizontalAlignment();
|
||||
int vertTextPos = b.getVerticalTextPosition();
|
||||
int horTextPos = b.getHorizontalTextPosition();
|
||||
|
||||
Font f = c.getFont();
|
||||
g.setFont(f);
|
||||
FontMetrics fm = g.getFontMetrics(f);
|
||||
SwingUtilities.calculateInnerArea(b, br);
|
||||
SwingUtilities.calculateInsetArea(br, b.getMargin(), vr);
|
||||
paintBackground(g, (JMenuItem) c, c.getBackground());
|
||||
|
||||
if ((b.getModel().isArmed() && b.getModel().isPressed()))
|
||||
{
|
||||
if (((AbstractButton) b).isContentAreaFilled())
|
||||
{
|
||||
g.setColor(b.getBackground().darker());
|
||||
g.fillRect(br.x, br.y, br.width, br.height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((AbstractButton) b).isContentAreaFilled())
|
||||
{
|
||||
g.setColor(b.getBackground());
|
||||
g.fillRect(br.x, br.y, br.width, br.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (checkIcon != null)
|
||||
{
|
||||
SwingUtilities.layoutCompoundLabel(c, fm, null, checkIcon, vertAlign,
|
||||
horAlign, vertTextPos, horTextPos,
|
||||
vr, cr, tr, defaultTextIconGap);
|
||||
checkIcon.paintIcon(c, g, cr.x, cr.y);
|
||||
|
||||
// We need to calculate position of the menu text and position of
|
||||
// user menu icon if there exists one relative to the check icon.
|
||||
// So we need to adjust view rectangle s.t. its starting point is at
|
||||
// checkIcon.width + defaultTextIconGap.
|
||||
|
||||
vr.x = cr.x + cr.width + defaultTextIconGap;
|
||||
}
|
||||
|
||||
if (arrowIcon != null)
|
||||
{
|
||||
// FIXME: if this menu contains a submenu, we need to draw arrow icon
|
||||
// here as well
|
||||
}
|
||||
|
||||
|
||||
// paint text and user menu icon if it exists
|
||||
SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), b.getIcon(),
|
||||
vertAlign, horAlign, vertTextPos,
|
||||
horTextPos, vr, ir, tr,
|
||||
defaultTextIconGap);
|
||||
|
||||
paintText(g, (JMenuItem) c, tr, b.getText());
|
||||
|
||||
// paint icon
|
||||
// FIXME: should paint different icon at different button state's.
|
||||
// i.e disabled icon when button is disabled.. etc.
|
||||
|
||||
/*
|
||||
Icon i = b.getIcon();
|
||||
if (i != null)
|
||||
{
|
||||
int x = ir.x;
|
||||
int y = ir.y;
|
||||
i.paintIcon(c, g, x, y);
|
||||
}
|
||||
*/
|
||||
|
||||
// paint accelerator
|
||||
String acceleratorText = "";
|
||||
if (((JMenuItem) c).getAccelerator() != null)
|
||||
{
|
||||
acceleratorText = getAcceleratorText(((JMenuItem) c).getAccelerator());
|
||||
fm = g.getFontMetrics(acceleratorFont);
|
||||
ar.width = fm.stringWidth(acceleratorText);
|
||||
ar.x = br.width - ar.width;
|
||||
vr.x = br.width - ar.width;
|
||||
|
||||
SwingUtilities.layoutCompoundLabel(c, fm, acceleratorText, null,
|
||||
vertAlign, horAlign, vertTextPos,
|
||||
horTextPos, vr, ir, ar,
|
||||
defaultTextIconGap);
|
||||
|
||||
paintAccelerator(g, (JMenuItem) c, ar, acceleratorText);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect,
|
||||
String text)
|
||||
{
|
||||
Font f = menuItem.getFont();
|
||||
g.setFont(f);
|
||||
FontMetrics fm = g.getFontMetrics(f);
|
||||
g.setColor(menuItem.getForeground());
|
||||
|
||||
BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
|
||||
textRect.y + fm.getAscent());
|
||||
}
|
||||
|
||||
protected void uninstallComponents(JMenuItem menuItem)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
protected void uninstallDefaults()
|
||||
{
|
||||
menuItem.setForeground(null);
|
||||
menuItem.setBackground(null);
|
||||
menuItem.setBorder(null);
|
||||
menuItem.setMargin(null);
|
||||
menuItem.setBackground(null);
|
||||
menuItem.setBorder(null);
|
||||
menuItem.setFont(null);
|
||||
menuItem.setForeground(null);
|
||||
menuItem.setMargin(null);
|
||||
acceleratorFont = null;
|
||||
acceleratorForeground = null;
|
||||
acceleratorSelectionForeground = null;
|
||||
arrowIcon = null;
|
||||
selectionBackground = null;
|
||||
selectionForeground = null;
|
||||
acceleratorDelimiter = null;
|
||||
}
|
||||
|
||||
protected void uninstallKeyboardActions()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
protected void uninstallListeners()
|
||||
{
|
||||
menuItem.removeMouseListener(mouseInputListener);
|
||||
menuItem.removeMenuDragMouseListener(menuDragMouseListener);
|
||||
menuItem.removeMenuKeyListener(menuKeyListener);
|
||||
}
|
||||
|
||||
public void uninstallUI(JComponent c)
|
||||
{
|
||||
uninstallListeners();
|
||||
uninstallDefaults();
|
||||
menuItem = null;
|
||||
}
|
||||
|
||||
public void update(Graphics g, JComponent c)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
private String getAcceleratorText(KeyStroke accelerator)
|
||||
{
|
||||
|
||||
// convert keystroke into string format
|
||||
|
||||
String modifiersText = "";
|
||||
int modifiers = accelerator.getModifiers();
|
||||
char keyChar = accelerator.getKeyChar();
|
||||
int keyCode = accelerator.getKeyCode();
|
||||
|
||||
if (modifiers != 0)
|
||||
modifiersText = KeyEvent.getKeyModifiersText(modifiers) +
|
||||
acceleratorDelimiter;
|
||||
|
||||
if (keyCode == KeyEvent.VK_UNDEFINED)
|
||||
return modifiersText + keyChar;
|
||||
else
|
||||
return modifiersText + KeyEvent.getKeyText(keyCode);
|
||||
}
|
||||
|
||||
private Rectangle getAcceleratorRect(KeyStroke accelerator, FontMetrics fm)
|
||||
{
|
||||
int width = fm.stringWidth(getAcceleratorText(accelerator));
|
||||
int height = fm.getHeight();
|
||||
return new Rectangle(0, 0, width, height);
|
||||
}
|
||||
|
||||
private void paintAccelerator(Graphics g, JMenuItem menuItem, Rectangle acceleratorRect,
|
||||
String acceleratorText)
|
||||
{
|
||||
g.setFont(acceleratorFont);
|
||||
FontMetrics fm = g.getFontMetrics(acceleratorFont);
|
||||
g.setColor(acceleratorForeground);
|
||||
BasicGraphicsUtils.drawString(g, acceleratorText, 0, acceleratorRect.x,
|
||||
acceleratorRect.y + fm.getAscent());
|
||||
}
|
||||
|
||||
protected class MouseInputHandler implements MouseInputListener
|
||||
{
|
||||
protected MouseInputHandler()
|
||||
{
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e)
|
||||
{
|
||||
if (e.getSource() instanceof AbstractButton)
|
||||
{
|
||||
AbstractButton button = (AbstractButton) e.getSource();
|
||||
ButtonModel model = button.getModel();
|
||||
|
||||
if (button.isRolloverEnabled())
|
||||
{
|
||||
model.setRollover(true);
|
||||
}
|
||||
|
||||
if (model.isPressed() &&
|
||||
((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0))
|
||||
{
|
||||
model.setArmed(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.setArmed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e)
|
||||
{
|
||||
if (e.getSource() instanceof AbstractButton)
|
||||
{
|
||||
AbstractButton button = (AbstractButton) e.getSource();
|
||||
ButtonModel model = button.getModel();
|
||||
|
||||
if (button.isRolloverEnabled())
|
||||
{
|
||||
model.setRollover(false);
|
||||
}
|
||||
|
||||
model.setArmed(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseMoved(MouseEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
if (e.getSource() instanceof AbstractButton)
|
||||
{
|
||||
AbstractButton button = (AbstractButton) e.getSource();
|
||||
ButtonModel model = button.getModel();
|
||||
|
||||
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0)
|
||||
{
|
||||
// It is important that these transitions happen in this order.
|
||||
model.setArmed(true);
|
||||
model.setPressed(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
|
||||
if (e.getSource() instanceof AbstractButton)
|
||||
{
|
||||
AbstractButton button = (AbstractButton) e.getSource();
|
||||
ButtonModel model = button.getModel();
|
||||
|
||||
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0)
|
||||
{
|
||||
// It is important that these transitions happen in this order.
|
||||
model.setPressed(false);
|
||||
model.setArmed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected class MenuDragMouseHandler implements MenuDragMouseListener
|
||||
{
|
||||
public void menuDragMouseDragged(MenuDragMouseEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void menuDragMouseEntered(MenuDragMouseEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void menuDragMouseExited(MenuDragMouseEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void menuDragMouseReleased(MenuDragMouseEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected class MenuKeyHandler implements MenuKeyListener
|
||||
{
|
||||
public void menuKeyPressed(MenuKeyEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void menuKeyReleased(MenuKeyEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
public void menuKeyTyped(MenuKeyEvent e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
protected class PropertyChangeHandler
|
||||
{
|
||||
public void propertyChange(PropertyChangeEvent evt)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
|
@ -573,7 +573,7 @@ public class BasicProgressBarUI extends ProgressBarUI
|
|||
}
|
||||
}
|
||||
|
||||
if (progressBar.isStringPainted())
|
||||
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
|
||||
paintString(g, 0, 0, or.width, or.height, amountFull, insets);
|
||||
g.setColor(saved);
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ public class BasicProgressBarUI extends ProgressBarUI
|
|||
g.setColor(c.getForeground());
|
||||
g.fill3DRect(box.x, box.y, box.width, box.height, true);
|
||||
|
||||
if (progressBar.isStringPainted())
|
||||
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
|
||||
paintString(g, 0, 0, or.width, or.height,
|
||||
getAmountFull(insets, or.width, or.height), insets);
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/* BasicRadioButtonMenuItemUI.java
|
||||
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package javax.swing.plaf.basic;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.UIDefaults;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.MenuElement;
|
||||
import javax.swing.MenuSelectionManager;
|
||||
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
|
||||
|
||||
public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
|
||||
{
|
||||
|
||||
public BasicRadioButtonMenuItemUI()
|
||||
{
|
||||
super();
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
checkIcon = defaults.getIcon("RadioButtonMenuItem.checkIcon");
|
||||
}
|
||||
|
||||
public static ComponentUI createUI(JComponent b)
|
||||
{
|
||||
return new BasicRadioButtonMenuItemUI();
|
||||
}
|
||||
|
||||
protected String getPropertyPrefix()
|
||||
{
|
||||
return null;
|
||||
// TODO
|
||||
}
|
||||
|
||||
void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement[] path,
|
||||
MenuSelectionManager manager)
|
||||
{
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -127,6 +127,7 @@ public class BasicViewportUI extends ViewportUI
|
|||
|
||||
Point pos = v.getViewPosition();
|
||||
Rectangle viewBounds = view.getBounds();
|
||||
Rectangle portBounds = v.getBounds();
|
||||
|
||||
if (backingStoreImage == null
|
||||
|| backingStoreWidth != viewBounds.width
|
||||
|
@ -138,6 +139,32 @@ public class BasicViewportUI extends ViewportUI
|
|||
}
|
||||
|
||||
Graphics g2 = backingStoreImage.getGraphics();
|
||||
|
||||
|
||||
if (c.getBackground() != null)
|
||||
{
|
||||
// fill the backing store background
|
||||
java.awt.Color save = g2.getColor();
|
||||
g2.setColor(c.getBackground());
|
||||
g2.fillRect (0, 0, backingStoreWidth, backingStoreHeight);
|
||||
g2.setColor(save);
|
||||
|
||||
// fill the viewport background
|
||||
save = g.getColor();
|
||||
g.setColor(c.getBackground());
|
||||
g.fillRect (0, 0, portBounds.width, portBounds.height);
|
||||
g.setColor(save);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the backing store background
|
||||
g2.clearRect(0, 0, backingStoreWidth, backingStoreHeight);
|
||||
|
||||
// clear the viewport background
|
||||
g.clearRect(0, 0, portBounds.width, portBounds.height);
|
||||
}
|
||||
|
||||
view.paint(g2);
|
||||
g2 = null;
|
||||
g.drawImage(backingStoreImage,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* jcl.c
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,7 +37,7 @@ exception statement from your version. */
|
|||
|
||||
#include <stdio.h>
|
||||
#include <jcl.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x) /* nothing */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* JNILINK 1.1: JNI version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -40,7 +40,7 @@ exception statement from your version. */
|
|||
#include <string.h>
|
||||
#include <jcl.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define GETCLASS(c) *(jclass*)(c)
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ grab_current_drawable (GtkWidget *widget, GdkDrawable **draw, GdkWindow **win)
|
|||
}
|
||||
|
||||
*draw = *win;
|
||||
gdk_window_get_internal_paint_info (*win, draw, 0, 0);
|
||||
gdk_window_get_internal_paint_info (*win, draw, 0, 0);
|
||||
g_object_ref (*draw);
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
|
|||
|
||||
if (gr->debug) printf ("constructing offscreen drawable of size (%d,%d)\n",
|
||||
width, height);
|
||||
|
||||
|
||||
gr->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
|
||||
gdk_rgb_get_visual ()->depth);
|
||||
g_assert (gr->drawable != NULL);
|
||||
|
@ -371,9 +371,12 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
|
|||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
|
||||
(JNIEnv *env, jobject self, jobject other, jint x, jint y)
|
||||
{
|
||||
GdkRectangle clipRect;
|
||||
struct graphics2d *src = NULL, *dst = NULL;
|
||||
gint s_height, s_width, d_height, d_width, height, width;
|
||||
cairo_matrix_t *matrix;
|
||||
GdkGC *gc;
|
||||
cairo_operator_t tmp_op;
|
||||
|
||||
src = (struct graphics2d *)NSA_GET_G2D_PTR (env, other);
|
||||
dst = (struct graphics2d *)NSA_GET_G2D_PTR (env, self);
|
||||
|
@ -386,19 +389,33 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
|
|||
gdk_drawable_get_size (src->drawable, &s_width, &s_height);
|
||||
gdk_drawable_get_size (dst->drawable, &d_width, &d_height);
|
||||
width = min (s_width, d_width);
|
||||
height = min (s_width, d_height);
|
||||
height = min (s_height, d_height);
|
||||
gdk_threads_leave ();
|
||||
|
||||
gc = gdk_gc_new (dst->drawable);
|
||||
g_assert (gc != NULL);
|
||||
begin_drawing_operation(dst);
|
||||
|
||||
gdk_draw_drawable(dst->drawable, gc, src->drawable,
|
||||
0, 0, x, y, width, height);
|
||||
matrix = cairo_matrix_create ();
|
||||
cairo_surface_get_matrix (src->surface, matrix);
|
||||
cairo_matrix_translate (matrix, (double)-x, (double)-y);
|
||||
cairo_surface_set_matrix (src->surface, matrix);
|
||||
|
||||
tmp_op = cairo_current_operator (dst->cr);
|
||||
cairo_set_operator(dst->cr, CAIRO_OPERATOR_SRC);
|
||||
cairo_show_surface (dst->cr, src->surface, width, height);
|
||||
cairo_set_operator(dst->cr, tmp_op);
|
||||
|
||||
cairo_matrix_translate (matrix, (double)x, (double)y);
|
||||
cairo_surface_set_matrix (src->surface, matrix);
|
||||
cairo_matrix_destroy (matrix);
|
||||
|
||||
end_drawing_operation(dst);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_flush ();
|
||||
|
||||
g_object_unref (gc);
|
||||
gdk_threads_leave ();
|
||||
|
||||
if (src->debug) printf ("copied %d x %d pixels from offscreen drawable\n", width, height);
|
||||
gdk_threads_leave ();
|
||||
|
||||
}
|
||||
|
||||
static jintArray
|
||||
|
@ -1215,7 +1232,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
|
|||
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
|
||||
g_assert (gr != NULL);
|
||||
if (gr->debug) printf ("cairo_clip\n");
|
||||
cairo_clip (gr->cr);
|
||||
cairo_init_clip (gr->cr);
|
||||
cairo_clip (gr->cr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter
|
||||
|
|
|
@ -249,9 +249,10 @@ static void
|
|||
item_activate (GtkItem *item __attribute__((unused)),
|
||||
struct item_event_hook_info *ie)
|
||||
{
|
||||
jstring label;
|
||||
gdk_threads_leave ();
|
||||
|
||||
jstring label = (*gdk_env)->NewStringUTF (gdk_env, ie->label);
|
||||
label = (*gdk_env)->NewStringUTF (gdk_env, ie->label);
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, ie->peer_obj,
|
||||
choicePostItemEventID,
|
||||
label,
|
||||
|
|
|
@ -136,7 +136,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_requestFocus
|
|||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_grab_focus (GTK_WIDGET (ptr));
|
||||
// gtk_widget_grab_focus (GTK_WIDGET (ptr));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkSetFont
|
|||
{
|
||||
const char *font_name;
|
||||
void *ptr;
|
||||
GtkWidget *label;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
@ -632,12 +631,13 @@ filter_expose_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
|
|||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
g_assert (gref);
|
||||
GtkObject *filterobj;
|
||||
GtkWidget *vbox, *layout;
|
||||
GList *children;
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
|
||||
g_assert (gref);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
|
@ -675,12 +675,13 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilt
|
|||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
g_assert (gref);
|
||||
GtkObject *filterobj;
|
||||
GtkWidget *vbox, *layout;
|
||||
GList *children;
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
|
||||
g_assert (gref);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
|
|
|
@ -186,6 +186,7 @@ ok_clicked (GtkButton *button __attribute__((unused)),
|
|||
static jmethodID hideID;
|
||||
void *ptr;
|
||||
G_CONST_RETURN gchar *fileName;
|
||||
jstring str_fileName;
|
||||
|
||||
ptr = NSA_GET_PTR (gdk_env, peer_obj);
|
||||
|
||||
|
@ -204,7 +205,7 @@ ok_clicked (GtkButton *button __attribute__((unused)),
|
|||
gdk_threads_leave ();
|
||||
|
||||
/* Set the Java object field 'file' with this value. */
|
||||
jstring str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName);
|
||||
str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName);
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, peer_obj, gtkSetFilenameID, str_fileName);
|
||||
|
||||
/* We can hide the dialog now (and unblock show) */
|
||||
|
|
|
@ -66,7 +66,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
|
|||
menu = NSA_GET_PTR (env, menupeer);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_menu_bar_append (GTK_MENU_BAR (mbar), GTK_WIDGET (menu));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (mbar), GTK_WIDGET (menu));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,18 +41,16 @@ exception statement from your version. */
|
|||
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
|
||||
|
||||
static void item_activate (GtkMenuItem *item __attribute__((unused)),
|
||||
jobject *peer_obj);
|
||||
jobject peer_obj);
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
|
||||
(JNIEnv *env, jobject obj, jstring label)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
const char *str;
|
||||
jobject *gref;
|
||||
|
||||
/* Create global reference and save it for future use */
|
||||
NSA_SET_GLOBAL_REF (env, obj);
|
||||
gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, label, NULL);
|
||||
|
||||
|
@ -63,10 +61,6 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
|
|||
else
|
||||
widget = gtk_menu_item_new_with_label (str);
|
||||
|
||||
/* Connect activate hook */
|
||||
g_signal_connect (G_OBJECT (widget), "activate",
|
||||
GTK_SIGNAL_FUNC (item_activate), *gref);
|
||||
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
@ -76,6 +70,22 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
|
|||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
g_assert (gref);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
g_signal_connect (G_OBJECT (ptr), "activate",
|
||||
G_CALLBACK (item_activate), *gref);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
|
||||
(JNIEnv *env, jobject obj, jstring label)
|
||||
{
|
||||
|
@ -104,9 +114,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
|
|||
}
|
||||
|
||||
static void
|
||||
item_activate (GtkMenuItem *item __attribute__((unused)), jobject *peer_obj)
|
||||
item_activate (GtkMenuItem *item __attribute__((unused)), jobject peer_obj)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, peer_obj,
|
||||
postMenuActionEventID);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,10 +101,21 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
|
|||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
menu_title = gtk_menu_item_new_with_label (str);
|
||||
if (str != NULL)
|
||||
menu_title = gtk_menu_item_new_with_label (str);
|
||||
else
|
||||
menu_title = gtk_menu_item_new();
|
||||
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu);
|
||||
|
||||
gtk_widget_show (menu);
|
||||
// Allow this menu to grab the pointer.
|
||||
GtkWidget *toplevel = gtk_widget_get_toplevel (menu);
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
{
|
||||
gtk_window_group_add_window (global_gtk_window_group,
|
||||
GTK_WINDOW(toplevel));
|
||||
}
|
||||
|
||||
gtk_widget_show (menu_title);
|
||||
|
||||
NSA_SET_PTR (env, obj, menu_title);
|
||||
|
@ -125,8 +136,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
|
|||
|
||||
gdk_threads_enter ();
|
||||
|
||||
menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
|
||||
gtk_menu_append (menu, GTK_WIDGET (ptr2));
|
||||
menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(ptr1));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL(menu), GTK_WIDGET (ptr2));
|
||||
|
||||
if (key)
|
||||
{
|
||||
|
|
|
@ -58,14 +58,6 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
|
|||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
typedef struct _GtkLayoutChild GtkLayoutChild;
|
||||
|
||||
struct _GtkLayoutChild {
|
||||
GtkWidget *widget;
|
||||
gint x;
|
||||
gint y;
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectJObject
|
||||
(JNIEnv *env, jobject obj)
|
||||
|
@ -80,59 +72,3 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectJObject
|
|||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectSignals
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
g_assert (gref);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
|
||||
/* FIXME: If we don't need this then remove this method. */
|
||||
/* g_signal_connect (G_OBJECT (ptr), "size_request", GTK_SIGNAL_FUNC (sr), */
|
||||
/* NULL); */
|
||||
gdk_threads_leave ();
|
||||
|
||||
/* Connect the superclass signals. */
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
|
||||
}
|
||||
|
||||
/* FIXME: The following doesn't seem to be used.
|
||||
Is not declared as a native function in GtkPanelPeer.java */
|
||||
/*
|
||||
* Make a new panel.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_gtkPanelNew
|
||||
(JNIEnv *env, jobject obj, jobject parent_obj)
|
||||
{
|
||||
GtkWidget *layout;
|
||||
void *parent;
|
||||
|
||||
/* Create global reference and save it for future use */
|
||||
NSA_SET_GLOBAL_REF (env, obj);
|
||||
|
||||
parent = NSA_GET_PTR (env, parent_obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
layout = gtk_layout_new (NULL, NULL);
|
||||
|
||||
set_parent (layout, GTK_CONTAINER (parent));
|
||||
|
||||
gtk_widget_realize (layout);
|
||||
|
||||
connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
|
||||
|
||||
set_visible (layout, 1);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, layout);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
|
|||
|
||||
gdk_threads_enter ();
|
||||
gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu),
|
||||
NULL, NULL, menu_pos, p, 3, time);
|
||||
NULL, NULL, menu_pos, p, 0, time);
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (p);
|
||||
|
|
|
@ -32,7 +32,6 @@ FAIL: gnu.testlet.java.lang.String.getBytes13: String.getBytes("UnicodeLittleUnm
|
|||
FAIL: gnu.testlet.java.lang.String.getBytes14: String.getBytes("ISO8859_15") (number 1)
|
||||
FAIL: gnu.testlet.java.lang.String.getBytes14: String.getBytes("UTF-16BE") (number 1)
|
||||
FAIL: gnu.testlet.java.lang.String.getBytes14: String.getBytes("UTF-16LE") (number 1)
|
||||
FAIL: gnu.testlet.java.text.AttributedString.Test: Attribute key count (number 1)
|
||||
FAIL: gnu.testlet.java.text.DateFormatSymbols.Test: patterns (number 2)
|
||||
FAIL: gnu.testlet.java.text.SimpleDateFormat.getAndSet2DigitYearStart: get2DigitYearStart() initial (number 1)
|
||||
FAIL: gnu.testlet.java.text.DateFormatSymbols.Test: invalid locale (number 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue