aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-21 13:54:25 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-21 13:54:25 +0000
commit86865f1751e2cb6f13b78b0e00f6723a28716ad9 (patch)
treeecc99f09d902993f49ec5ed29dd095fa3fdd76ce /libjava
parent610a02190561061108a812c7ecc6d5e76c910276 (diff)
2003-07-21 Steven Bosscher <steven@gcc.gnu.org>
Diego Novillo <dnovillo@redhat.com> * Makefile.in (install-po): Check if $CATALOGS is empty to avoid buggy shells. * basic-block.h (rtl_verify_flow_info): Remove. (tree_verify_flow_info): Remove. (verify_flow_info): Declare. * builtins.c: Rearrange to simplify merges. Add #if 0 around expand_ functions that are not used in the branch and move new code to the end of the file. * c-opts.c (c_common_handle_option): Move handling of -fdump- to opts.c. * cfgloopmanip.c (loop_split_edge_with_NULL): Remove. Update all users. * common.opt: Add all the tree-ssa switches. * opts.c: Handle them. * flags.h (flag_tree_cp): Remove unused variable. (enum pta_type): Move from tree-must-alias.h (flag_tree_points_to): Likewise. * toplev.c (flag_tree_cp): Remove unused variable. * tree-cfg.c: Move cfg_hooks structures and functions for trees from cfghooks.c. * tree-mudflap.c (mudflap_enqueue_decl): Don't use %D to avoid warning about format specifiers. 2003-07-21 Diego Novillo <dnovillo@redhat.com> * gimplify.c (gimplify_function_tree): Move gimplification of the function body ... (gimplify_body): ... here. * tree-simple.h (gimplify_body): Declare. * tree-inline.c (initialize_inlined_parameters): If the emitted assignment is not in GIMPLE form, gimplify the body of assignments emitted. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@69631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog1286
-rw-r--r--libjava/Makefile.am19
-rw-r--r--libjava/Makefile.in47
-rw-r--r--libjava/aclocal.m4266
-rwxr-xr-xlibjava/configure1026
-rw-r--r--libjava/configure.in6
-rw-r--r--libjava/gcj/Makefile.in6
-rw-r--r--libjava/glib.m4196
-rw-r--r--libjava/gnu/awt/j2d/IntegerGraphicsState.java4
-rw-r--r--libjava/gnu/awt/xlib/XGraphics.java4
-rw-r--r--libjava/gnu/gcj/convert/Output_EUCJIS.java7
-rw-r--r--libjava/gnu/gcj/convert/Output_SJIS.java7
-rw-r--r--libjava/gnu/gcj/convert/Output_UTF8.java9
-rw-r--r--libjava/gnu/gcj/convert/UnicodeToBytes.java13
-rw-r--r--libjava/gnu/gcj/convert/natIconv.cc3
-rw-r--r--libjava/gnu/gcj/protocol/http/Handler.java10
-rw-r--r--libjava/gnu/gcj/xlib/GC.java5
-rw-r--r--libjava/gnu/gcj/xlib/natFont.cc18
-rw-r--r--libjava/gnu/gcj/xlib/natGC.cc18
-rw-r--r--libjava/gnu/java/lang/ArrayHelper.java59
-rw-r--r--libjava/gnu/java/lang/ClassHelper.java344
-rw-r--r--libjava/gnu/java/nio/DatagramChannelImpl.java96
-rw-r--r--libjava/gnu/java/nio/FileChannelImpl.java18
-rw-r--r--libjava/gnu/java/nio/MappedByteFileBuffer.java449
-rw-r--r--libjava/gnu/java/nio/SelectorImpl.java39
-rw-r--r--libjava/gnu/java/nio/ServerSocketChannelImpl.java29
-rw-r--r--libjava/gnu/java/nio/SocketChannelImpl.java108
-rw-r--r--libjava/gnu/java/nio/natFileChannelImpl.cc9
-rw-r--r--libjava/gnu/java/nio/natMappedByteFileBuffer.cc148
-rw-r--r--libjava/gnu/java/nio/natSocketChannelImpl.cc172
-rw-r--r--libjava/gnu/java/rmi/server/UnicastRemoteCall.java2
-rw-r--r--libjava/gnu/java/security/x509/X509Certificate.java7
-rw-r--r--libjava/gtk.m4194
-rw-r--r--libjava/include/Makefile.in6
-rw-r--r--libjava/include/default-signal.h3
-rw-r--r--libjava/include/dwarf2-signal.h12
-rw-r--r--libjava/include/i386-signal.h3
-rw-r--r--libjava/include/posix-threads.h4
-rw-r--r--libjava/include/posix.h13
-rw-r--r--libjava/include/s390-signal.h3
-rw-r--r--libjava/include/sparc-signal.h3
-rw-r--r--libjava/include/win32-signal.h3
-rw-r--r--libjava/include/x86_64-signal.h21
-rw-r--r--libjava/java/awt/Button.java1
-rw-r--r--libjava/java/awt/Checkbox.java9
-rw-r--r--libjava/java/awt/CheckboxMenuItem.java5
-rw-r--r--libjava/java/awt/Choice.java5
-rw-r--r--libjava/java/awt/Container.java1
-rw-r--r--libjava/java/awt/Dialog.java43
-rw-r--r--libjava/java/awt/EventQueue.java6
-rw-r--r--libjava/java/awt/FileDialog.java3
-rw-r--r--libjava/java/awt/Font.java27
-rw-r--r--libjava/java/awt/Frame.java102
-rw-r--r--libjava/java/awt/Graphics.java40
-rw-r--r--libjava/java/awt/Label.java1
-rw-r--r--libjava/java/awt/List.java2
-rw-r--r--libjava/java/awt/Menu.java18
-rw-r--r--libjava/java/awt/MenuItem.java3
-rw-r--r--libjava/java/awt/Panel.java4
-rw-r--r--libjava/java/awt/PopupMenu.java5
-rw-r--r--libjava/java/awt/Rectangle.java1
-rw-r--r--libjava/java/awt/Robot.java5
-rw-r--r--libjava/java/awt/ScrollPane.java9
-rw-r--r--libjava/java/awt/ScrollPaneAdjustable.java21
-rw-r--r--libjava/java/awt/Scrollbar.java25
-rw-r--r--libjava/java/awt/TextArea.java3
-rw-r--r--libjava/java/awt/TextField.java1
-rw-r--r--libjava/java/awt/Toolkit.java5
-rw-r--r--libjava/java/awt/Window.java67
-rw-r--r--libjava/java/awt/color/ColorSpace.java2
-rw-r--r--libjava/java/awt/datatransfer/DataFlavor.java1
-rw-r--r--libjava/java/awt/datatransfer/StringSelection.java6
-rw-r--r--libjava/java/awt/dnd/DragSource.java3
-rw-r--r--libjava/java/awt/dnd/DragSourceContext.java3
-rw-r--r--libjava/java/awt/event/HierarchyEvent.java6
-rw-r--r--libjava/java/awt/event/MouseWheelEvent.java1
-rw-r--r--libjava/java/awt/font/GraphicAttribute.java2
-rw-r--r--libjava/java/awt/font/ImageGraphicAttribute.java2
-rw-r--r--libjava/java/awt/im/InputContext.java1
-rw-r--r--libjava/java/awt/im/InputSubset.java6
-rw-r--r--libjava/java/awt/image/BufferedImage.java13
-rw-r--r--libjava/java/awt/image/ColorModel.java51
-rw-r--r--libjava/java/awt/image/ComponentColorModel.java3
-rw-r--r--libjava/java/awt/image/DataBufferByte.java2
-rw-r--r--libjava/java/awt/image/DataBufferInt.java2
-rw-r--r--libjava/java/awt/image/DataBufferUShort.java2
-rw-r--r--libjava/java/awt/image/DirectColorModel.java4
-rw-r--r--libjava/java/awt/image/IndexColorModel.java88
-rw-r--r--libjava/java/awt/image/PixelGrabber.java8
-rw-r--r--libjava/java/awt/image/Raster.java4
-rw-r--r--libjava/java/awt/image/WritableRaster.java8
-rw-r--r--libjava/java/awt/peer/ComponentPeer.java17
-rw-r--r--libjava/java/awt/print/PageFormat.java3
-rw-r--r--libjava/java/awt/print/PrinterJob.java3
-rw-r--r--libjava/java/beans/beancontext/BeanContextSupport.java2
-rw-r--r--libjava/java/io/BufferedReader.java3
-rw-r--r--libjava/java/io/File.java48
-rw-r--r--libjava/java/io/FileOutputStream.java3
-rw-r--r--libjava/java/io/LineNumberReader.java37
-rw-r--r--libjava/java/io/ObjectInputStream.java84
-rw-r--r--libjava/java/io/ObjectOutputStream.java81
-rw-r--r--libjava/java/io/ObjectStreamField.java24
-rw-r--r--libjava/java/io/OutputStreamWriter.java9
-rw-r--r--libjava/java/io/PrintStream.java262
-rw-r--r--libjava/java/io/PushbackInputStream.java6
-rw-r--r--libjava/java/io/RandomAccessFile.java4
-rw-r--r--libjava/java/io/natFileDescriptorPosix.cc2
-rw-r--r--libjava/java/lang/ClassLoader.java1
-rw-r--r--libjava/java/lang/System.java9
-rw-r--r--libjava/java/lang/natString.cc12
-rw-r--r--libjava/java/lang/natVMSecurityManager.cc8
-rw-r--r--libjava/java/lang/w_exp.c134
-rw-r--r--libjava/java/net/Authenticator.java531
-rw-r--r--libjava/java/net/ContentHandler.java126
-rw-r--r--libjava/java/net/ContentHandlerFactory.java27
-rw-r--r--libjava/java/net/DatagramSocket.java45
-rw-r--r--libjava/java/net/DatagramSocketImpl.java45
-rw-r--r--libjava/java/net/DatagramSocketImplFactory.java7
-rw-r--r--libjava/java/net/FileNameMap.java21
-rw-r--r--libjava/java/net/HttpURLConnection.java12
-rw-r--r--libjava/java/net/Inet4Address.java9
-rw-r--r--libjava/java/net/Inet6Address.java11
-rw-r--r--libjava/java/net/InetAddress.java172
-rw-r--r--libjava/java/net/InetSocketAddress.java24
-rw-r--r--libjava/java/net/MulticastSocket.java3
-rw-r--r--libjava/java/net/NetPermission.java18
-rw-r--r--libjava/java/net/NetworkInterface.java18
-rw-r--r--libjava/java/net/PasswordAuthentication.java126
-rw-r--r--libjava/java/net/PlainDatagramSocketImpl.java135
-rw-r--r--libjava/java/net/PlainSocketImpl.java218
-rw-r--r--libjava/java/net/ServerSocket.java95
-rw-r--r--libjava/java/net/Socket.java140
-rw-r--r--libjava/java/net/SocketImpl.java51
-rw-r--r--libjava/java/net/SocketImplFactory.java19
-rw-r--r--libjava/java/net/SocketOptions.java17
-rw-r--r--libjava/java/net/SocketPermission.java9
-rw-r--r--libjava/java/net/URL.java86
-rw-r--r--libjava/java/net/URLClassLoader.java4
-rw-r--r--libjava/java/net/URLConnection.java64
-rw-r--r--libjava/java/net/URLStreamHandler.java26
-rw-r--r--libjava/java/net/URLStreamHandlerFactory.java23
-rw-r--r--libjava/java/nio/Buffer.java9
-rw-r--r--libjava/java/nio/ByteBufferImpl.java2
-rw-r--r--libjava/java/nio/CharBufferImpl.java2
-rw-r--r--libjava/java/nio/DirectByteBufferImpl.java9
-rw-r--r--libjava/java/nio/DoubleBufferImpl.java2
-rw-r--r--libjava/java/nio/FloatBufferImpl.java2
-rw-r--r--libjava/java/nio/IntBufferImpl.java2
-rw-r--r--libjava/java/nio/LongBufferImpl.java2
-rw-r--r--libjava/java/nio/MappedByteBuffer.java1
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java2
-rw-r--r--libjava/java/nio/ShortBufferImpl.java2
-rw-r--r--libjava/java/nio/channels/Channels.java1
-rw-r--r--libjava/java/nio/channels/FileChannel.java2
-rw-r--r--libjava/java/nio/channels/ServerSocketChannel.java5
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelector.java2
-rw-r--r--libjava/java/nio/natDirectByteBufferImpl.cc24
-rw-r--r--libjava/java/rmi/server/SkeletonNotFoundException.java3
-rw-r--r--libjava/java/rmi/server/UnicastRemoteObject.java5
-rw-r--r--libjava/java/security/BasicPermission.java5
-rw-r--r--libjava/java/security/Certificate.java8
-rw-r--r--libjava/java/security/Security.java49
-rw-r--r--libjava/java/security/cert/PolicyQualifierInfo.java2
-rw-r--r--libjava/java/text/CollationElementIterator.java5
-rw-r--r--libjava/java/text/DateFormat.java14
-rw-r--r--libjava/java/text/DecimalFormat.java13
-rw-r--r--libjava/java/text/Format.java2
-rw-r--r--libjava/java/text/SimpleDateFormat.java30
-rw-r--r--libjava/java/util/Locale.java31
-rw-r--r--libjava/java/util/PropertyResourceBundle.java1
-rw-r--r--libjava/java/util/SimpleTimeZone.java9
-rw-r--r--libjava/java/util/logging/Handler.java2
-rw-r--r--libjava/java/util/prefs/AbstractPreferences.java4
-rw-r--r--libjava/java/util/prefs/Preferences.java12
-rw-r--r--libjava/java/util/prefs/PreferencesFactory.java3
-rw-r--r--libjava/java/util/zip/Deflater.java5
-rw-r--r--libjava/java/util/zip/DeflaterOutputStream.java32
-rw-r--r--libjava/java/util/zip/Inflater.java196
-rw-r--r--libjava/java/util/zip/InflaterInputStream.java4
-rw-r--r--libjava/java/util/zip/ZipEntry.java3
-rw-r--r--libjava/java/util/zip/ZipFile.java2
-rw-r--r--libjava/java/util/zip/ZipInputStream.java3
-rw-r--r--libjava/java/util/zip/ZipOutputStream.java7
-rw-r--r--libjava/javax/naming/CompositeName.java2
-rw-r--r--libjava/javax/naming/CompoundName.java2
-rw-r--r--libjava/javax/naming/InitialContext.java10
-rw-r--r--libjava/javax/naming/LinkRef.java3
-rw-r--r--libjava/javax/naming/NamingException.java1
-rw-r--r--libjava/javax/naming/NamingSecurityException.java4
-rw-r--r--libjava/javax/naming/ReferralException.java2
-rw-r--r--libjava/javax/naming/StringRefAddr.java1
-rw-r--r--libjava/javax/naming/directory/Attribute.java4
-rw-r--r--libjava/javax/naming/directory/BasicAttribute.java12
-rw-r--r--libjava/javax/naming/directory/BasicAttributes.java8
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java4
-rw-r--r--libjava/javax/naming/spi/NamingManager.java4
-rw-r--r--libjava/javax/security/auth/x500/X500Principal.java1
-rw-r--r--libjava/javax/swing/AbstractAction.java12
-rw-r--r--libjava/javax/swing/AbstractButton.java37
-rw-r--r--libjava/javax/swing/AbstractCellEditor.java10
-rw-r--r--libjava/javax/swing/AbstractListModel.java13
-rw-r--r--libjava/javax/swing/BorderFactory.java674
-rw-r--r--libjava/javax/swing/Box.java5
-rw-r--r--libjava/javax/swing/BoxLayout.java10
-rw-r--r--libjava/javax/swing/ButtonGroup.java8
-rw-r--r--libjava/javax/swing/DefaultButtonModel.java17
-rw-r--r--libjava/javax/swing/DefaultListModel.java10
-rw-r--r--libjava/javax/swing/DefaultListSelectionModel.java10
-rw-r--r--libjava/javax/swing/FocusManager.java10
-rw-r--r--libjava/javax/swing/ImageIcon.java14
-rw-r--r--libjava/javax/swing/InputMap.java14
-rw-r--r--libjava/javax/swing/JApplet.java19
-rw-r--r--libjava/javax/swing/JButton.java2
-rw-r--r--libjava/javax/swing/JCheckBox.java6
-rw-r--r--libjava/javax/swing/JCheckBoxMenuItem.java3
-rw-r--r--libjava/javax/swing/JColorChooser.java19
-rw-r--r--libjava/javax/swing/JComboBox.java10
-rw-r--r--libjava/javax/swing/JComponent.java134
-rw-r--r--libjava/javax/swing/JDesktopPane.java3
-rw-r--r--libjava/javax/swing/JDialog.java17
-rw-r--r--libjava/javax/swing/JEditorPane.java18
-rw-r--r--libjava/javax/swing/JFileChooser.java21
-rw-r--r--libjava/javax/swing/JFormattedTextField.java1
-rw-r--r--libjava/javax/swing/JFrame.java17
-rw-r--r--libjava/javax/swing/JInternalFrame.java22
-rw-r--r--libjava/javax/swing/JLabel.java15
-rw-r--r--libjava/javax/swing/JLayeredPane.java6
-rw-r--r--libjava/javax/swing/JList.java29
-rw-r--r--libjava/javax/swing/JMenuBar.java6
-rw-r--r--libjava/javax/swing/JMenuItem.java26
-rw-r--r--libjava/javax/swing/JOptionPane.java12
-rw-r--r--libjava/javax/swing/JPanel.java13
-rw-r--r--libjava/javax/swing/JPasswordField.java2
-rw-r--r--libjava/javax/swing/JPopupMenu.java3
-rw-r--r--libjava/javax/swing/JProgressBar.java3
-rw-r--r--libjava/javax/swing/JRadioButton.java6
-rw-r--r--libjava/javax/swing/JRadioButtonMenuItem.java3
-rw-r--r--libjava/javax/swing/JRootPane.java17
-rw-r--r--libjava/javax/swing/JScrollBar.java4
-rw-r--r--libjava/javax/swing/JScrollPane.java9
-rw-r--r--libjava/javax/swing/JSeparator.java3
-rw-r--r--libjava/javax/swing/JSlider.java20
-rw-r--r--libjava/javax/swing/JTabbedPane.java17
-rw-r--r--libjava/javax/swing/JTable.java7
-rw-r--r--libjava/javax/swing/JTextField.java10
-rw-r--r--libjava/javax/swing/JToggleButton.java10
-rw-r--r--libjava/javax/swing/JToolBar.java3
-rw-r--r--libjava/javax/swing/JToolTip.java7
-rw-r--r--libjava/javax/swing/JTree.java23
-rw-r--r--libjava/javax/swing/JViewport.java12
-rw-r--r--libjava/javax/swing/JWindow.java24
-rw-r--r--libjava/javax/swing/KeyStroke.java6
-rw-r--r--libjava/javax/swing/ListSelectionModel.java4
-rw-r--r--libjava/javax/swing/LookAndFeel.java4
-rw-r--r--libjava/javax/swing/MenuSelectionManager.java38
-rw-r--r--libjava/javax/swing/RepaintManager.java10
-rw-r--r--libjava/javax/swing/ScrollPaneLayout.java11
-rw-r--r--libjava/javax/swing/SizeRequirements.java4
-rw-r--r--libjava/javax/swing/SwingConstants.java5
-rw-r--r--libjava/javax/swing/SwingUtilities.java34
-rw-r--r--libjava/javax/swing/Timer.java50
-rw-r--r--libjava/javax/swing/ToggleButtonModel.java8
-rw-r--r--libjava/javax/swing/UIDefaults.java4
-rw-r--r--libjava/javax/swing/UIManager.java57
-rw-r--r--libjava/javax/swing/border/AbstractBorder.java224
-rw-r--r--libjava/javax/swing/border/BevelBorder.java541
-rw-r--r--libjava/javax/swing/border/Border.java73
-rw-r--r--libjava/javax/swing/border/CompoundBorder.java229
-rw-r--r--libjava/javax/swing/border/EmptyBorder.java233
-rw-r--r--libjava/javax/swing/border/EtchedBorder.java384
-rw-r--r--libjava/javax/swing/border/LineBorder.java318
-rw-r--r--libjava/javax/swing/border/MatteBorder.java373
-rw-r--r--libjava/javax/swing/border/TitledBorder.java1123
-rw-r--r--libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java11
-rw-r--r--libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java4
-rw-r--r--libjava/javax/swing/colorchooser/ColorSelectionModel.java6
-rw-r--r--libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java12
-rw-r--r--libjava/javax/swing/event/AncestorEvent.java151
-rw-r--r--libjava/javax/swing/event/HyperlinkEvent.java268
-rw-r--r--libjava/javax/swing/event/InternalFrameAdapter.java5
-rw-r--r--libjava/javax/swing/event/InternalFrameEvent.java138
-rw-r--r--libjava/javax/swing/event/ListDataEvent.java143
-rw-r--r--libjava/javax/swing/event/MouseInputAdapter.java2
-rw-r--r--libjava/javax/swing/event/SwingPropertyChangeSupport.java2
-rw-r--r--libjava/javax/swing/event/TableModelEvent.java271
-rw-r--r--libjava/javax/swing/event/TreeWillExpandListener.java36
-rw-r--r--libjava/javax/swing/event/UndoableEditEvent.java2
-rw-r--r--libjava/javax/swing/filechooser/FileFilter.java4
-rw-r--r--libjava/javax/swing/filechooser/FileSystemView.java6
-rw-r--r--libjava/javax/swing/filechooser/FileView.java6
-rw-r--r--libjava/javax/swing/plaf/ActionMapUIResource.java44
-rw-r--r--libjava/javax/swing/plaf/BorderUIResource.java954
-rw-r--r--libjava/javax/swing/plaf/ButtonUI.java13
-rw-r--r--libjava/javax/swing/plaf/ColorChooserUI.java37
-rw-r--r--libjava/javax/swing/plaf/ColorUIResource.java76
-rw-r--r--libjava/javax/swing/plaf/ComboBoxUI.java102
-rw-r--r--libjava/javax/swing/plaf/ComponentInputMapUIResource.java50
-rw-r--r--libjava/javax/swing/plaf/ComponentUI.java342
-rw-r--r--libjava/javax/swing/plaf/DesktopIconUI.java35
-rw-r--r--libjava/javax/swing/plaf/DesktopPaneUI.java36
-rw-r--r--libjava/javax/swing/plaf/DimensionUIResource.java30
-rw-r--r--libjava/javax/swing/plaf/FileChooserUI.java163
-rw-r--r--libjava/javax/swing/plaf/FontUIResource.java63
-rw-r--r--libjava/javax/swing/plaf/IconUIResource.java69
-rw-r--r--libjava/javax/swing/plaf/InputMapUIResource.java41
-rw-r--r--libjava/javax/swing/plaf/InsetsUIResource.java35
-rw-r--r--libjava/javax/swing/plaf/InternalFrameUI.java38
-rw-r--r--libjava/javax/swing/plaf/LabelUI.java21
-rw-r--r--libjava/javax/swing/plaf/ListUI.java74
-rw-r--r--libjava/javax/swing/plaf/MenuBarUI.java38
-rw-r--r--libjava/javax/swing/plaf/MenuItemUI.java38
-rw-r--r--libjava/javax/swing/plaf/OptionPaneUI.java39
-rw-r--r--libjava/javax/swing/plaf/PanelUI.java20
-rw-r--r--libjava/javax/swing/plaf/PopupMenuUI.java110
-rw-r--r--libjava/javax/swing/plaf/ProgressBarUI.java38
-rw-r--r--libjava/javax/swing/plaf/RootPaneUI.java37
-rw-r--r--libjava/javax/swing/plaf/ScrollBarUI.java37
-rw-r--r--libjava/javax/swing/plaf/ScrollPaneUI.java38
-rw-r--r--libjava/javax/swing/plaf/SeparatorUI.java37
-rw-r--r--libjava/javax/swing/plaf/SliderUI.java38
-rw-r--r--libjava/javax/swing/plaf/SplitPaneUI.java162
-rw-r--r--libjava/javax/swing/plaf/TabbedPaneUI.java86
-rw-r--r--libjava/javax/swing/plaf/TableHeaderUI.java38
-rw-r--r--libjava/javax/swing/plaf/TableUI.java38
-rw-r--r--libjava/javax/swing/plaf/TextUI.java262
-rw-r--r--libjava/javax/swing/plaf/ToolBarUI.java38
-rw-r--r--libjava/javax/swing/plaf/ToolTipUI.java38
-rw-r--r--libjava/javax/swing/plaf/TreeUI.java171
-rw-r--r--libjava/javax/swing/plaf/ViewportUI.java20
-rw-r--r--libjava/javax/swing/plaf/basic/BasicBorders.java1756
-rw-r--r--libjava/javax/swing/plaf/basic/BasicButtonUI.java13
-rw-r--r--libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java10
-rw-r--r--libjava/javax/swing/plaf/basic/BasicDefaults.java13
-rw-r--r--libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java645
-rw-r--r--libjava/javax/swing/plaf/basic/BasicLabelUI.java9
-rw-r--r--libjava/javax/swing/plaf/basic/BasicListUI.java19
-rw-r--r--libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java19
-rw-r--r--libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java9
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTextUI.java15
-rw-r--r--libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java9
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTreeUI.java197
-rw-r--r--libjava/javax/swing/table/AbstractTableModel.java10
-rw-r--r--libjava/javax/swing/table/DefaultTableCellRenderer.java3
-rw-r--r--libjava/javax/swing/table/DefaultTableColumnModel.java20
-rw-r--r--libjava/javax/swing/table/DefaultTableModel.java8
-rw-r--r--libjava/javax/swing/table/TableColumn.java8
-rw-r--r--libjava/javax/swing/text/JTextComponent.java18
-rw-r--r--libjava/javax/swing/tree/AbstractLayoutCache.java11
-rw-r--r--libjava/javax/swing/tree/DefaultMutableTreeNode.java13
-rw-r--r--libjava/javax/swing/tree/DefaultTreeCellEditor.java29
-rw-r--r--libjava/javax/swing/tree/DefaultTreeCellRenderer.java13
-rw-r--r--libjava/javax/swing/tree/DefaultTreeModel.java12
-rw-r--r--libjava/javax/swing/tree/DefaultTreeSelectionModel.java19
-rw-r--r--libjava/javax/swing/tree/FixedHeightLayoutCache.java8
-rw-r--r--libjava/javax/swing/tree/TreeCellEditor.java2
-rw-r--r--libjava/javax/swing/tree/TreeModel.java4
-rw-r--r--libjava/javax/swing/tree/TreeNode.java4
-rw-r--r--libjava/javax/swing/tree/TreePath.java7
-rw-r--r--libjava/javax/swing/tree/TreeSelectionModel.java2
-rw-r--r--libjava/javax/swing/tree/VariableHeightLayoutCache.java8
-rw-r--r--libjava/javax/swing/undo/AbstractUndoableEdit.java2
-rw-r--r--libjava/javax/swing/undo/CompoundEdit.java2
-rw-r--r--libjava/javax/swing/undo/StateEdit.java5
-rw-r--r--libjava/javax/swing/undo/UndoManager.java5
-rw-r--r--libjava/javax/swing/undo/UndoableEditSupport.java7
-rw-r--r--libjava/jni.cc158
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c4
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c50
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c46
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c12
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c30
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c15
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c18
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c153
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c259
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c80
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c82
-rw-r--r--libjava/jni/gtk-peer/gthread-jni.c458
-rw-r--r--libjava/jni/gtk-peer/gthread-jni.h1
-rw-r--r--libjava/prims.cc57
-rw-r--r--libjava/testsuite/ChangeLog20
-rw-r--r--libjava/testsuite/Makefile.in6
-rw-r--r--libjava/testsuite/libjava.mauve/mauve.exp3
-rw-r--r--libjava/testsuite/libjava.mauve/xfails10
384 files changed, 15703 insertions, 7201 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index abe6dfbaf67..0377102851a 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,8 +1,1294 @@
+2003-07-01 Michael Koch <konqueror@gmx.de>
+
+ * gnu/gcj/convert/natIconv.cc
+ (iconv_init): Fixed possible memory leak by releasing allocated iconv
+ handle.
+
+2003-06-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * glib-2.0.m4: New file.
+ * gtk-2.0.m4: New file.
+ * glib.m4: Remove.
+ * gtk.m4: Remove.
+ * configure.in: Update AM_PATH_GTK macro call to
+ AM_PATH_GTK_2_0. Likewise for AM_PATH_GLIB.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,
+ jni/gtk-peer/gthread-jni.c,
+ jni/gtk-peer/gthread-jni.h:
+ New versions from classpath.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+ * gcj/Makefile.in: Regenerate.
+ * include/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+
+2003-06-30 Gary Benson <gbenson@redhat.com>
+
+ For PR libgcj/11349:
+ * javax/naming/spi/NamingManager.java (getURLContext): Use
+ correct name for factory class.
+
+2003-06-28 Michael Koch <konqueror@gmx.de>
+
+ * java/io/PrintStream.java
+ (checkError): Call flush() instead of direct flushing of the Writer
+ object.
+ (print): Call print(String) instead of direct print method of the
+ Writer Object.
+ (println): Call println(String) instead of direct println method of the
+ Writer Object.
+ (write): Simplified.
+
+2003-06-28 Michael Koch <konqueror@gmx.de>
+
+ * java/net/ServerSocket.java
+ (setChannel): New method.
+ * java/net/Socket.java
+ (setChannel): New method.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/beans/beancontext/BeanContextSupport.java:
+ New version from classpath.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Window.java,
+ java/awt/font/GraphicAttribute.java,
+ java/awt/font/ImageGraphicAttribute.java,
+ java/awt/image/DataBufferByte.java,
+ java/awt/image/DataBufferInt.java,
+ java/awt/image/DataBufferUShort.java,
+ java/awt/image/DirectColorModel.java,
+ java/awt/image/PixelGrabber.java:
+ New versions from classpath.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/security/Certificate.java
+ (getGuarantor): Removed wrong @deprecated tag.
+ (getPrincipal): Likewise.
+ (getPublicKey): Likewise.
+ (encode): Likewise.
+ (decode): Likewise.
+ (getFormat): Likewise.
+ (toString): Likewise.
+ * java/security/cert/PolicyQualifierInfo.java
+ (PolicyQualifierInfo): Made final.
+ * javax/security/auth/x500/X500Principal.java
+ (serialVersionUID): New member variable.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/text/Format.java
+ (serialVersionUID): Fixed value.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/net/Inet4Address.java
+ (Inet4Address): Made package-private.
+ * java/net/Inet6Address.java
+ (Inet4Address): Made package-private.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/io/RandomAccessFile.java
+ (readLine): Removed wrong @deprecated tag.
+ (getChannel): Made final.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/FileChannelImpl.java
+ (write): Removed.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/ByteBufferImpl.java
+ (ByteBufferImpl): Made it a package-private class
+ * java/nio/CharBufferImpl.java
+ (CharBufferImpl): Made it a package-private class
+ * java/nio/DirectByteBufferImpl.java
+ (DirectByteBufferImpl): Made it a package-private class
+ * java/nio/DoubleBufferImpl.java
+ (DoubleBufferImpl): Made it a package-private class
+ * java/nio/FloatBufferImpl.java
+ (FloatBufferImpl): Made it a package-private class
+ * java/nio/IntBufferImpl.java
+ (IntBufferImpl): Made it a package-private class
+ * java/nio/LongBufferImpl.java
+ (LongBufferImpl): Made it a package-private class
+ * java/nio/ShortBufferImpl.java
+ (ShortBufferImpl): Made it a package-private class
+ * java/nio/channels/FileChannel.java
+ (write): Made final.
+ * java/nio/channels/ServerSocketChannel.java
+ (ServerSocketChanne): Made protected.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/naming/CompositeName.java
+ (serialVersionUID): New member variable.
+ * javax/naming/CompoundName.java
+ (serialVersionUID): New member variable.
+ * javax/naming/InitialContext.java
+ (InitialContext): Throws NamingException.
+ (init): Likewise.
+ * javax/naming/LinkRef.java
+ (serialVersionUID): New member variable.
+ (gteLinkName): Throws NamingException.
+ * javax/naming/NamingException.java
+ (serialVersionUID): New member variable.
+ * javax/naming/NamingSecurityException.java
+ (NamingSecurityException): Made abstract.
+ (serialVersionUID): New member variable.
+ * javax/naming/ReferralException.java
+ (serialVersionUID): New member variable.
+ * javax/naming/StringRefAddr.java
+ (serialVersionUID): New member variable.
+ * javax/naming/directory/BasicAttribute.java:
+ Reworked imports.
+ (serialVersionUID): New member variable.
+ (get): Throws NamingException.
+ (getAll): Throws NamingException.
+ * javax/naming/directory/BasicAttributes.java:
+ Reworked imports.
+ (serialVersionUID): New member variable.
+ * javax/naming/ldap/UnsolicitedNotificationEvent.java
+ (serialVersionUID): New member variable.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * Makefile.am
+ (awt_java_source_files): Added new files:
+ javax/swing/Popup.java,
+ javax/swing/PopupFactory.java
+ * Makefile.in: Regenerated.
+
+2003-06-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JWindow.java,
+ javax/swing/event/AncestorEvent.java,
+ javax/swing/event/HyperlinkEvent.java,
+ javax/swing/event/InternalFrameEvent.java,
+ javax/swing/event/ListDataEvent.java,
+ javax/swing/event/TableModelEvent.java,
+ javax/swing/plaf/PopupMenuUI.java,
+ javax/swing/plaf/SplitPaneUI.java,
+ javax/swing/plaf/TabbedPaneUI.java,
+ javax/swing/plaf/TextUI.java,
+ javax/swing/plaf/TreeUI.java,
+ javax/swing/plaf/basic/BasicTextUI.java,
+ javax/swing/plaf/basic/BasicTreeUI.java:
+ New versions from classpath.
+ * javax/swing/Popup.java,
+ javax/swing/PopupFactory.jav:
+ New source files from classpath.
+ * javax/swing/plaf/doc-files/TreeUI-1.png:
+ New binary files from classpath.
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * Makefile.am
+ (awt_java_source_files): Added javax/swing/plaf/SpinnerUI.java.
+ * Makefile.in: Regenerated.
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/ActionMapUIResource.java,
+ javax/swing/plaf/BorderUIResource.java,
+ javax/swing/plaf/ButtonUI.java,
+ javax/swing/plaf/ColorChooserUI.java,
+ javax/swing/plaf/ColorUIResource.java,
+ javax/swing/plaf/ComboBoxUI.java,
+ javax/swing/plaf/ComponentInputMapUIResource.java,
+ javax/swing/plaf/ComponentUI.java,
+ javax/swing/plaf/DesktopIconUI.java,
+ javax/swing/plaf/DesktopPaneUI.java,
+ javax/swing/plaf/DimensionUIResource.java,
+ javax/swing/plaf/FileChooserUI.java,
+ javax/swing/plaf/FontUIResource.java,
+ javax/swing/plaf/IconUIResource.java,
+ javax/swing/plaf/InputMapUIResource.java,
+ javax/swing/plaf/InsetsUIResource.java,
+ javax/swing/plaf/InternalFrameUI.java,
+ javax/swing/plaf/LabelUI.java,
+ javax/swing/plaf/ListUI.java,
+ javax/swing/plaf/MenuBarUI.java,
+ javax/swing/plaf/MenuItemUI.java,
+ javax/swing/plaf/OptionPaneUI.java,
+ javax/swing/plaf/PanelUI.java,
+ javax/swing/plaf/ProgressBarUI.java,
+ javax/swing/plaf/RootPaneUI.java,
+ javax/swing/plaf/ScrollBarUI.java,
+ javax/swing/plaf/ScrollPaneUI.java,
+ javax/swing/plaf/SeparatorUI.java,
+ javax/swing/plaf/SliderUI.java,
+ javax/swing/plaf/TableHeaderUI.java,
+ javax/swing/plaf/TableUI.java,
+ javax/swing/plaf/ToolBarUI.java,
+ javax/swing/plaf/ToolTipUI.java,
+ javax/swing/plaf/ViewportUI.java:
+ New versions from classpath.
+ * javax/swing/plaf/SpinnerUI.java:
+ New file from classpath
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/ColorModel.java:
+ New version from classpath.
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * java/net/PlainDatagramSocketImpl.java:
+ Partly merged with classpath, this mainly adds documentation.
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * java/io/ObjectInputStream.java
+ (readClassDescriptor): New method.
+ (readObject): Moved functionality to readClassDescriptor().
+ * java/io/ObjectOutputStream.java
+ (writeClassDescriptor): New method.
+ (writeObject): Moved functionality to writeClassDescriptor().
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicListUI.java,
+ javax/swing/plaf/basic/BasicOptionPaneUI.java:
+ Added missing methods.
+
+2003-06-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/event/AncestorEvent.java
+ javax/swing/event/HyperlinkEvent.java
+ javax/swing/event/InternalFrameEvent.java
+ javax/swing/event/ListDataEvent.java
+ javax/swing/event/TableModelEvent.java:
+ Compile fixes.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URL.java:
+ Renamed "handler" to "ph" in the whole file to match classpaths
+ version.
+ * java/net/URLStreamHandler.java:
+ (equals): Renamed "handler" to "ph".
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/event/AncestorEvent.java,
+ javax/swing/event/HyperlinkEvent.java,
+ javax/swing/event/InternalFrameEvent.java,
+ javax/swing/event/ListDataEvent.java,
+ javax/swing/event/TableModelEvent.java,
+ javax/swing/event/TreeWillExpandListener.java,
+ javax/swing/plaf/ComponentUI.java,
+ javax/swing/plaf/DesktopIconUI.java,
+ javax/swing/plaf/DesktopPaneUI.java,
+ javax/swing/plaf/DimensionUIResource.java,
+ javax/swing/plaf/FileChooserUI.java,
+ javax/swing/plaf/FontUIResource.java,
+ javax/swing/plaf/IconUIResource.java,
+ javax/swing/plaf/InputMapUIResource.java,
+ javax/swing/plaf/InsetsUIResource.java,
+ javax/swing/plaf/InternalFrameUI.java,
+ javax/swing/plaf/LabelUI.java,
+ javax/swing/plaf/ListUI.java,
+ javax/swing/plaf/MenuBarUI.java,
+ javax/swing/plaf/MenuItemUI.java,
+ javax/swing/plaf/OptionPaneUI.java,
+ javax/swing/plaf/PanelUI.java,
+ javax/swing/plaf/ProgressBarUI.java,
+ javax/swing/plaf/doc-files/ComponentUI-1.dia,
+ javax/swing/plaf/doc-files/ComponentUI-1.png:
+ New versions from classpath.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/Buffer.java
+ (cap): Made package-private.
+ (pos): Likewise.
+ (limit): Likewise.
+ (mark): Likewise.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * java/net/SocketImpl.java
+ (shutdownInput): Made it non-abstract method throwing an exception
+ like in SUNs JRE.
+ (shutdownOutput): Likewise.
+ * java/net/SocketInputStream.java,
+ java/net/SocketOutputStream.java:
+ New files from classpath.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Font.java,
+ java/awt/Window.java,
+ java/awt/color/ColorSpace.java,
+ java/awt/datatransfer/StringSelection.java,
+ java/awt/image/ColorModel.java:
+ New versions from classpath.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * Makefile.am
+ (awt_java_source_files): Added new files:
+ javax/swing/plaf/basic/BasicSplitPaneDivider.java,
+ javax/swing/plaf/basic/BasicSplitPaneUI.java
+ * Makefile.in: Regenerated.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/JTextComponent.java:
+ New version from classpath.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/Timer.java,
+ javax/swing/plaf/ActionMapUIResource.java,
+ javax/swing/plaf/ButtonUI.java,
+ javax/swing/plaf/ColorChooserUI.java,
+ javax/swing/plaf/ColorUIResource.java,
+ javax/swing/plaf/ComboBoxUI.java,
+ javax/swing/plaf/ComponentInputMapUIResource.java,
+ javax/swing/plaf/basic/BasicBorders.java:
+ New versions from classpath.
+ * javax/swing/plaf/basic/BasicSplitPaneDivider.java.
+ javax/swing/plaf/basic/BasicSplitPaneUI.java:
+ New file from classpath.
+ * javax/swing/plaf/basic/doc-files/BasicBorders-1.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders-2.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.FieldBorder-1.png,
+ javax/swing/plaf/doc-files/ComponentUI-1.dia,
+ javax/swing/plaf/doc-files/ComponentUI-1.png:
+ New binary files from classpath.
+
+2003-06-24 Michael Koch <konqueror@gmx.de>
+
+ * java/io/LineNumberReader.java
+ (skip): Dont do line number accounting here as this is already done in
+ read(), simplified.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * java/io/File.java
+ (static): Load javaio lib if existing (only in classpath).
+ (File): Revised documentation to show the correct argument name.
+ (createTempFile): Partly merged with classpath.
+ (compareTo): Simplified.
+ (lastModified): Throw exception if time < 0.
+ (deleteOnExit): Revised documentation.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * java/net/PlainSocketImpl.java:
+ Reformatted.
+ (PlainSocketImpl): Merged class documentaion with classpath.
+ (in): Moved.
+ (out): Moved.
+ (PlainSocketImpl): New empty constructor.
+ (finalize): Moved.
+ (setOption): Merged documentation from classpath.
+ (getOption): Likewise.
+ (create): Likewise.
+ (connect): Likewise.
+ (bind): Likewise.
+ (listen): Likewise.
+ (accept): Likewise.
+ (available): Likewise.
+ (close): Likewise.
+ (read): Likewise.
+ (write): Likewise.
+ (getInputStream): Made synchronozed to get sure that only one stream
+ object can be created for this socket, merged documentation from
+ classpath.
+ (getOutputStream): Likewise.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * java/net/PlainSocketImpl.java:
+ Reformatting.
+ (static): New implicit method.
+ (read): Made package private.
+ (write): Likewise.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * java/util/SimpleTimeZone.java:
+ Removed unneeded import, reformatting.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * java/text/DateFormat.java,
+ java/text/SimpleDateFormat.java,
+ java/util/Locale.java:
+ New versions from classpath.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/SpinnerModel.java:
+ New file from classpath.
+ * javax/swing/border/LineBorder.java,
+ javax/swing/border/SoftBevelBorder.java,
+ javax/swing/plaf/BorderUIResource.java,
+ javax/swing/plaf/basic/BasicBorders.java:
+ New versions from classpath.
+ * javax/swing/plaf/basic/doc-files/BasicBorders.MenuBarBorder-1.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.RadioButtonBorder-1.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-1.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-2.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneDividerBorder-1.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.ToggleButtonBorder-1.png:
+ New binary files from classpath.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
+ * java/util/logging/LogRecord.java,
+ java/util/logging/Logger.java,
+ java/util/logging/SocketHandler.java,
+ java/util/logging/SimpleFormatter.java,
+ java/util/logging/Formatter.java,
+ java/util/logging/ErrorManager.java,
+ java/util/logging/Handler.java,
+ java/util/logging/FileHandler.java,
+ java/util/logging/LogManager.java,
+ java/util/logging/Level.java,
+ java/util/logging/ConsoleHandler.java,
+ java/util/logging/StreamHandler.java,
+ java/util/logging/LoggingPermission.java,
+ java/util/logging/Filter.java,
+ java/util/logging/MemoryHandler.java,
+ java/util/logging/XMLFormatter.java:
+ New files from classpath.
+
+2003-06-20 Michael Koch <konqueror@gmx.de>
+
+ * java/io/ObjectStreamField.java
+ (unshared): new member variable.
+ (ObjectStreamField): New constructor.
+ (isUnshared): New method.
+
+2003-06-20 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URLStreamHandler.java
+ (hostsEqual): Rewritten.
+
+2003-06-20 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/MappedByteFileBuffer.java,
+ gnu/java/nio/natMappedByteFileBuffer.cc:
+ Removed
+ * java/nio/MappedByteBufferImpl.java:
+ New file.
+ * gnu/java/nio/FileChannelImpl.java:
+ Use MappedByteBufferImpl instead of MappedByteFileBuffer.
+ * Makefile.am
+ (ordinary_java_source_files): Removed
+ gnu/java/nio/MappedByteFileBuffer.java and added
+ java/nio/MappedByteBufferImpl.java.
+ (nat_source_files): Removed gnu/java/nio/natMappedByteFileBuffer.cc
+ * Makefile.in: Regenerated.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/DatagramChannelImpl.java
+ (fd): Removed.
+ (blocking): New member variable.
+ (socket): Likewise.
+ (DatagramChannelImpl): Throws IOException, initialize socket.
+ (socket):Implemented.
+ (implCloseSelectableChannel): Throws IOException, implemented.
+ (implConfigureBlocking): Likewise.
+ (connect): Likewise.
+ (disconnect): Likewise.
+ (isConnected): Likewise.
+ (write): Likewise.
+ (read): Likewise.
+ (receive): Throws IOException.
+ (send): Likewise.
+ * gnu/java/nio/SocketChannelImpl.java
+ (read): Implemented.
+ (write): Implemented.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java,
+ javax/swing/JInternalFrame.java,
+ javax/swing/MenuSelectionManager.java,
+ javax/swing/SwingUtilities.java,
+ javax/swing/ToggleButtonModel.java:
+ New versions from classpath.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * java/text/CollationElementIterator.java
+ (NULLORDER): Initialize with -1 as JDK documentation says.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * java/net/HttpURLConnection.java,
+ java/net/Inet4Address.java,
+ java/net/Inet6Address.java,
+ java/net/SocketImpl.java,
+ java/net/URLClassLoader.java:
+ Reworked import statements.
+ * java/net/InetAddress.java
+ (getByAddress): Simplified.
+ * java/net/ServerSocket.java
+ (ServerSocket): Moved special handling during bind operation to
+ bind().
+ (bind): Handle different cases when trying to bind a socket.
+ * java/net/URLConnection.java
+ (getHeaderFieldDate): Merged with classpath.
+ (getHeaderFieldInt): Likewise.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * java/util/zip/InflaterInputStream.java
+ (InflaterInputStream): Throw NullPointerException if in is null (as
+ JDK does).
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Font.java
+ javax/swing/UIManager.java
+ javax/swing/border/AbstractBorder.java
+ javax/swing/border/BevelBorder.java
+ javax/swing/border/Border.java
+ javax/swing/border/CompoundBorder.java
+ javax/swing/border/EmptyBorder.java
+ javax/swing/border/EtchedBorder.java
+ javax/swing/border/LineBorder.java
+ javax/swing/border/MatteBorder.java
+ javax/swing/border/TitledBorder.java
+ javax/swing/plaf/BorderUIResource.java
+ javax/swing/plaf/basic/BasicBorders.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/BasicRadioButtonUI.java
+ javax/swing/plaf/basic/BasicToggleButtonUI.java:
+ New versions from classpath.
+ * javax/swing/border/SoftBevelBorder.java:
+ New file from classpath.
+ * javax/swing/border/doc-files/LineBorder-1.png,
+ javax/swing/border/doc-files/BevelBorder-1.png,
+ javax/swing/border/doc-files/BevelBorder-2.png,
+ javax/swing/border/doc-files/BevelBorder-3.png,
+ javax/swing/border/doc-files/EmptyBorder-1.png,
+ javax/swing/border/doc-files/EtchedBorder-1.png,
+ javax/swing/border/doc-files/EtchedBorder-2.png,
+ javax/swing/border/doc-files/MatteBorder-1.png,
+ javax/swing/border/doc-files/MatteBorder-2.png,
+ javax/swing/border/doc-files/MatteBorder-3.png,
+ javax/swing/border/doc-files/MatteBorder-4.png,
+ javax/swing/border/doc-files/MatteBorder-5.png,
+ javax/swing/border/doc-files/MatteBorder-6.png,
+ javax/swing/border/doc-files/SoftBevelBorder-1.png,
+ javax/swing/border/doc-files/SoftBevelBorder-2.png,
+ javax/swing/border/doc-files/SoftBevelBorder-3.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.MarginBorder-1.png,
+ javax/swing/plaf/basic/doc-files/BasicBorders.ButtonBorder-1.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-1.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-2.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-3.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-4.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-5.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-6.png,
+ javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-7.png:
+ New binary files from classpath.
+ * Makefile.am
+ (awt_java_source_files): Added
+ javax/swing/border/SoftBevelBorder.java.
+ * Makefile.in: Regenerated.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/security/x509/X509Certificate.java
+ (writeReplace): Merged from classpath.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/FileChannelImpl.java
+ (map_address): Made public.
+ (FileChannelImpl): Merged with classpath.
+ * gnu/java/nio/natFileChannelImpl.cc
+ (nio_mmap_file): Commented out unused arguments.
+ (nio_unmmap_file): Likewise.
+ (niu_msync): Likewise.
+
+2003-06-19 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/IndexColorModel.java:
+ New version from classpath.
+
+2003-06-18 Tom Tromey <tromey@redhat.com>
+
+ * java/net/Inet6Address.java (isAnyLocalAddress): Don't use "=="
+ on arrays.
+ (isLoopbackAddress): Likewise.
+ * java/net/Inet4Address.java (isAnyLocalAddress): Don't use "=="
+ on arrays.
+
+2003-06-18 Matt Kraai <kraai@alumni.cmu.edu>
+
+ * java/lang/natVMSecurityManager.cc (getClassContext):
+ Use maxlen instead of len for loop bound.
+
+2003-06-18 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/SelectorImpl.java
+ (register): Use fd with value 0 for now, will be fixed later.
+ * gnu/java/nio/ServerSocketChannelImpl.java
+ (fd): Removed.
+ (local_port): Removed.
+ (InetSocketAddress): Removed.
+ (ServerSocketChannelImpl): Just initialize internal socket object.
+ (implCloseSelectableChannel): Close internal socket object.
+ (implConfigureBlocking): Added comment.
+ (accept): Use jaba.net stuff to accept socket.
+ * gnu/java/nio/SocketChannelImpl.java
+ (fd): Removed.
+ (local_port): Removed.
+ (InetSocketAddress): Removed.
+ (SocketCreate): Removed.
+ (SocketConnect): Removed.
+ (SocketBind): Removed.
+ (SocketListen): Removed.
+ (SocketAvailable): Removed.
+ (SocketClose): Removed.
+ (SocketRead): Removed.
+ (SocketWrite): Removed.
+ (SocketChannelImpl): Just initialize internal socket object.
+ (implCloseSelectableChannel): Close internal socket object.
+ (implConfigureBlocking): Fixed implementation, added comment.
+ (connect): Use internal socket object to connect.
+ (socket): No need for sanity checks.
+ (read): Comment out some stuff, this will be reimplemented in the next
+ commit.
+ (write): Likewise.
+ * gnu/java/nio/natFileChannelImpl.cc
+ (nio_mmap_file): Line wrapped.
+ * gnu/java/nio/natSocketChannelImpl.cc: Removed.
+ * Makefile.am
+ (nat_source_files): Removeded gnu/java/nio/natSocketChannelImpl.cc.
+ * Makefile.in: Regenerated.
+
+2003-06-18 Michael Koch <konqueror@gmx.de>
+
+ * java/util/Locale.java
+ (equals): Merged from classpath.
+
+2003-06-18 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetAddress.java:
+ Reformatted to better match classpath's version.
+ * java/net/URL.java
+ (equals): Simplified.
+ * java/net/URLConnection.java
+ (setDoInput): Revised documentation.
+ (getDefaultUseCaches): Likewise.
+ (setRequestProperty): Added @since tag.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * java/net/InetSocketAddress.java
+ (InetSocketAddress): Use wildcard address if addr is null.
+ (InetSocketAddress): Dont duplicate implementation.
+ (InetSocketAddress): Throw exception when hostname is null.
+ * java/net/Socket.java:
+ Reworked imports.
+ (Socket): Throw exception when raddr is null, handle case when laddr
+ is null.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/DirectByteBufferImpl.java
+ (address): Made package private.
+ (DirectByteBufferImpl): New constructor.
+ * java/nio/natDirectByteBufferImpl.cc
+ (allocateImpl): Moved to java.nio namespace, implemented.
+ (freeImpl): Likewise.
+ (getImpl): Likewise.
+ (putImpl): Likewise.
+ * jni.cc
+ (_Jv_JNI_NewDirectByteBuffer): Implemented.
+ (_Jv_JNI_GetDirectBufferAddress): Implemented.
+ (_Jv_JNI_GetDirectBufferCapacity): Implemented.
+
+2003-06-17 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ * include/powerpc-signal.h: New File.
+ * configure.in: Use it.
+ * configure: Regenerated.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * java/util/Locale.java
+ (getDisplayLanguage): Made it final.
+ (getDisplayCountry): Likewise.
+ (getDisplayVariant): Likewise.
+ (getDisplayName): Likewise.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * java/util/PropertyResourceBundle.java:
+ Removed unneeded import.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * java/util/prefs/AbstractPreferences.java,
+ java/util/prefs/PreferencesFactory.java:
+ Reworked imports, removed unused imports.
+ * java/util/prefs/Preferences.java
+ (systemNodeForPackage): Method takes a Class not an Object.
+ (userNodeForPackage): Likewise.
+ (nodeForPackage): Likewise.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/security/x509/X509Certificate.java:
+ Explicitely import used classes.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * java/util/zip/ZipEntry.java,
+ java/util/zip/ZipFile.java,
+ java/util/zip/ZipInputStream.java,
+ java/util/zip/ZipOutputStream.java:
+ Reworked imports, only import used classes.
+
+2003-06-17 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/lang/ArrayHelper.java,
+ gnu/java/lang/ClassHelper.java:
+ Reformatted to match classpath's versions.
+
+2003-06-14 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/FileChannelImpl.java
+ (map_address): Removed incorrect comment.
+ * gnu/java/nio/SelectorImpl.java
+ (register): Remove code duplication and code for file channel handling.
+ * gnu/java/nio/ServerSocketChannelImpl.java
+ (serverSocket): Renamed from sock_object.
+ (ServerSocketChannel): Initialize serverSocket.
+ (socket): Return serverSocket.
+ * gnu/java/nio/SocketChannelImpl.java
+ (socket): Renamed from sock_object.
+ (isConnectionPenging): Simplified.
+ (socket): Return socket.
+2003-06-14 Michael Koch <konqueror@gmx.de>
+
+ * java/security/BasicPermission.java:
+ New version from classpath.
+
+2003-06-14 Michael Koch <konqueror@gmx.de>
+
+ * javax/naming/directory/Attribute.java:
+ New version from classpath.
+
+2003-06-14 Michael Koch <konqueror@gmx.de>
+
+ * java/io/BufferedReader.java,
+ java/io/FileOutputStream.java:
+ New versions from classpath.
+
+2003-06-12 Andrew Haley <aph@redhat.com>
+
+ * prims.cc (catch_segv): Create exception in handler.
+ (catch_fpe): Likewise.
+ (_Jv_divI, _Jv_remI, _Jv_divJ, _Jv_remJ): Likewise.
+ (_Jv_ThrowSignal): Remove.
+
+ * include/x86_64-signal.h (INIT_SEGV): Delete reference to nullp.
+ * include/default-signal.h (INIT_SEGV, INIT_FPE): Delete reference
+ to nullp and arithexception.
+ * include/dwarf2-signal.h (INIT_SEGV, INIT_FPE): Likewise.
+ * include/i386-signal.h (INIT_SEGV, INIT_FPE): Likewise.
+ * include/s390-signal.h (INIT_SEGV, INIT_FPE): Likewise.
+ * include/sparc-signal.h (INIT_SEGV, INIT_FPE): Likewise.
+ * include/win32-signal.h (INIT_SEGV, INIT_FPE): Likewise.
+
+2003-06-11 Andrew Haley <aph@redhat.com>
+
+ * jni.cc (_Jv_JNI_check_types): New.
+ (_Jv_JNI_SetPrimgitiveArrayRegion): Check array type.
+ (_Jv_JNI_GetPrimitiveArrayRegion): Ditto.
+ (_Jv_JNI_GetPrimitiveArrayElements): Ditto.
+ (_Jv_JNI_ReleasePrimitiveArrayElements): Ditto.
+
+ * java/lang/natVMSecurityManager.cc (getClassContext): Fix
+ infinite loop.
+
+2003-06-11 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java (loadClass): Not deprecated.
+ * java/io/PrintStream.java: Not deprecated.
+
+2003-06-11 Scott Gilbertson <scottg@mantatest.com>
+
+ * gnu/awt/j2d/IntegerGraphicsState.java (drawOval): implemented.
+ (fillOval): implemented
+ * gnu/awt/xlib/XGraphics.java (drawArc): implemented.
+ (fillArc): implemented.
+ * gnu/gcj/xlib/GC.java (drawArc): added native method.
+ (fillArc): added native method.
+ * gnu/gcj/xlib/natGC.cc (drawArc): added native method.
+ (fillArc): added native method.
+
+2003-06-11 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/im/InputSubset.java:
+ New version from classpath.
+
+2003-06-11 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractAction.java,
+ javax/swing/AbstractButton.java,
+ javax/swing/AbstractCellEditor.java,
+ javax/swing/AbstractListModel.java,
+ javax/swing/BorderFactory.java,
+ javax/swing/Box.java,
+ javax/swing/BoxLayout.java,
+ javax/swing/ButtonGroup.java,
+ javax/swing/DefaultButtonModel.java,
+ javax/swing/DefaultListModel.java,
+ javax/swing/DefaultListSelectionModel.java,
+ javax/swing/FocusManager.java,
+ javax/swing/ImageIcon.java,
+ javax/swing/InputMap.java,
+ javax/swing/JApplet.java,
+ javax/swing/JButton.java,
+ javax/swing/JCheckBox.java,
+ javax/swing/JCheckBoxMenuItem.java,
+ javax/swing/JColorChooser.java,
+ javax/swing/JComboBox.java,
+ javax/swing/JComponent.java,
+ javax/swing/JDesktopPane.java,
+ javax/swing/JDialog.java,
+ javax/swing/JEditorPane.java,
+ javax/swing/JFileChooser.java,
+ javax/swing/JFormattedTextField.java,
+ javax/swing/JFrame.java,
+ javax/swing/JLabel.java,
+ javax/swing/JLayeredPane.java,
+ javax/swing/JList.java,
+ javax/swing/JMenuBar.java,
+ javax/swing/JMenuItem.java,
+ javax/swing/JOptionPane.java,
+ javax/swing/JPanel.java,
+ javax/swing/JPasswordField.java,
+ javax/swing/JPopupMenu.java,
+ javax/swing/JProgressBar.java,
+ javax/swing/JRadioButton.java,
+ javax/swing/JRadioButtonMenuItem.java,
+ javax/swing/JRootPane.java,
+ javax/swing/JScrollBar.java,
+ javax/swing/JScrollPane.java,
+ javax/swing/JSeparator.java,
+ javax/swing/JSlider.java,
+ javax/swing/JTabbedPane.java,
+ javax/swing/JTable.java,
+ javax/swing/JTextField.java,
+ javax/swing/JToggleButton.java,
+ javax/swing/JToolBar.java,
+ javax/swing/JToolTip.java,
+ javax/swing/JTree.java,
+ javax/swing/JViewport.java,
+ javax/swing/JWindow.java,
+ javax/swing/KeyStroke.java,
+ javax/swing/ListSelectionModel.java,
+ javax/swing/LookAndFeel.java,
+ javax/swing/RepaintManager.java,
+ javax/swing/ScrollPaneLayout.java,
+ javax/swing/SizeRequirements.java,
+ javax/swing/SwingConstants.java,
+ javax/swing/Timer.java,
+ javax/swing/UIDefaults.java,
+ javax/swing/UIManager.java,
+ javax/swing/border/AbstractBorder.java,
+ javax/swing/border/CompoundBorder.java,
+ javax/swing/colorchooser/AbstractColorChooserPanel.java,
+ javax/swing/colorchooser/ColorChooserComponentFactory.java,
+ javax/swing/colorchooser/ColorSelectionModel.java,
+ javax/swing/colorchooser/DefaultColorSelectionModel.java,
+ javax/swing/event/AncestorEvent.java,
+ javax/swing/event/HyperlinkEvent.java,
+ javax/swing/event/InternalFrameAdapter.java,
+ javax/swing/event/InternalFrameEvent.java,
+ javax/swing/event/ListDataEvent.java,
+ javax/swing/event/MouseInputAdapter.java,
+ javax/swing/event/SwingPropertyChangeSupport.java,
+ javax/swing/event/TableModelEvent.java,
+ javax/swing/event/TreeWillExpandListener.java,
+ javax/swing/event/UndoableEditEvent.java,
+ javax/swing/filechooser/FileFilter.java,
+ javax/swing/filechooser/FileSystemView.java,
+ javax/swing/filechooser/FileView.java,
+ javax/swing/plaf/BorderUIResource.java,
+ javax/swing/plaf/basic/BasicDefaults.java,
+ javax/swing/table/AbstractTableModel.java,
+ javax/swing/table/DefaultTableCellRenderer.java,
+ javax/swing/table/DefaultTableColumnModel.java,
+ javax/swing/table/DefaultTableModel.java,
+ javax/swing/table/TableColumn.java,
+ javax/swing/text/JTextComponent.java,
+ javax/swing/tree/AbstractLayoutCache.java,
+ javax/swing/tree/DefaultMutableTreeNode.java,
+ javax/swing/tree/DefaultTreeCellEditor.java,
+ javax/swing/tree/DefaultTreeCellRenderer.java,
+ javax/swing/tree/DefaultTreeModel.java,
+ javax/swing/tree/DefaultTreeSelectionModel.java,
+ javax/swing/tree/FixedHeightLayoutCache.java,
+ javax/swing/tree/TreeCellEditor.java,
+ javax/swing/tree/TreeModel.java,
+ javax/swing/tree/TreeNode.java,
+ javax/swing/tree/TreePath.java,
+ javax/swing/tree/TreeSelectionModel.java,
+ javax/swing/tree/VariableHeightLayoutCache.java,
+ javax/swing/undo/AbstractUndoableEdit.java,
+ javax/swing/undo/CompoundEdit.java,
+ javax/swing/undo/StateEdit.java,
+ javax/swing/undo/UndoManager.java,
+ javax/swing/undo/UndoableEditSupport.java:
+ New versions from classpath.
+ * javax/swing/table/JTableHeader.java:
+ New file from classpath.
+ * Makefile.am
+ (java_awt_sources): Added javax/swing/table/JTableHeader.java.
+ * Makefile.in: Regenerated.
+
+2003-06-11 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/MappedByteBuffer.java,
+ java/nio/channels/Channels.java,
+ java/nio/channels/ServerSocketChannel.java,
+ java/nio/channels/spi/AbstractSelector.java:
+ Removed unneeded imports.
+
+2003-06-11 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java:
+ Partly merged with classpath.
+
+2003-06-11 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Frame.java,
+ java/awt/Graphics.java,
+ java/awt/Menu.java,
+ java/awt/Robot.java,
+ java/awt/image/ColorModel.java:
+ New versions from classpath.
+
+2003-06-10 Michael Koch <konqueror@gmx.de>
+
+ * java/io/PrintStream.java:
+ Merged version from classpath.
+ (close): Removed sychronized keyword. This class is not garantied to
+ be thread-safe.
+ (write): Likewise.
+
+2003-06-09 Tom Tromey <tromey@redhat.com>
+
+ * gnu/gcj/xlib/natFont.cc (getAscent): Correctly access "ascent"
+ field.
+ (getDescent): Likewise, for "descent".
+
+2003-06-09 Scott Gilbertson <scottg@mantatest.com>
+
+ * gnu/gcj/xlib/natFont.cc (getMaxAscent): adjusted return value.
+ (getMaxDescent): adjusted return value.
+ (getAscent): modified to use metrics for 'O'.
+ (getDescent): modified to use metrics for 'y'.
+
+2003-06-08 Anthony Green <green@redhat.com>
+
+ * java/net/URLStreamHandler.java (sameFile): Fix port value
+ comparison.
+ * java/net/URL.java (handler): Make package private.
+ * gnu/gcj/protocol/http/Handler.java (getDefaultPort): New method.
+
+2003-06-07 Tom Tromey <tromey@redhat.com>
+
+ For PR libgcj/11085:
+ * java/text/SimpleDateFormat.java (parse(String,ParsePosition)):
+ Limit number of characters in numeric field when required.
+ * java/text/DecimalFormat.java (parse(String,ParsePosition)):
+ Respect maximumIntegerDigits.
+
+2003-06-08 Michael Koch <konqueror@gmx.de>
+
+ * java/net/Socket.java
+ (Socket): Dont initialize inputShutdown and outputShutdown twice,
+ call bind() and connect() to actually do the bind and connect tasks.
+ (bind): Connect to canonical address if bindpoint is null, create
+ socket and bind it to bindpoint.
+ (connect): Check for exceptions.
+
+2003-06-08 Michael Koch <konqueror@gmx.de>
+
+ * java/net/DatagramSocket.java
+ (DatagramSocket): No need to set SO_REUSEADDRESS here. This belongs
+ into the Multicast constructors.
+ * java/net/DatagramSocketImpl.java
+ (getOption): Removed.
+ (setOption): Removed.
+ * java/net/MulticastSocket.java
+ (MulticastSocket): Call setReuseAddress (true).
+ * java/net/SocketImpl.java
+ (getOption): Removed.
+ (setOption): Removed.
+
+2003-06-07 Jeff Sturm <jsturm@one-point.com>
+
+ PR libgcj/10886:
+ * gnu/java/rmi/server/UnicastRemoteCall.java (returnValue):
+ Test for empty vector.
+
+2003-06-06 Mark Wielaard <mark@klomp.org>
+
+ * java/security/Security.java (secprops): Initialize.
+ (loadProviders): Return boolean.
+ (static): Check result of loadProvider calls. If necessary
+ display WARNING and fallback to Gnu provider.
+
+2002-06-06 James Clark <jjc@jclark.com>
+
+ Fix for PR libgcj/8738:
+ * gnu/gcj/convert/UnicodeToBytes.java (havePendingBytes): New method.
+ * gnu/gcj/convert/Output_SJIS.java (havePendingBytes): Likewise.
+ * gnu/gcj/convert/Output_EUCJIS.java (havePendingBytes): Likewise.
+ * gnu/gcj/convert/Output_UTF8.java (havePendingBytes): Likewise.
+ (write): Always decrease avail when count is increased.
+ * java/lang/natString.cc (getBytes): Check converter havePendingBytes()
+ and whether output buffer is full before increasing size.
+
+2002-06-06 Mark Wielaard <mark@klomp dot org>
+
+ * java/io/PrintStream.java (writeChars(char[],int, int)):
+ Check converter.havePendingBytes().
+ (writeChars(String,int,int)): Likewise.
+ * java/io/OutputStreamWriter.java (writeChars(char[], int, int)):
+ Check converter.havePendingBytes() and flush buffer when stalled.
+
+2003-06-07 Michael Koch <konqueror@gmx.de>
+
+ * include/posix.h
+ (O_DSYNC): Define O_DSYNC on platforms not
+ supporting O_FSYNC (newlib).
+
+2003-06-06 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/Toolkit.java (getDefaultToolkit): Add exception cause to
+ AWTError.
+
+2003-06-06 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java:
+ More compile fixes from my stupid work yesterday.
+
+2003-06-05 Matt Kraai <kraai@alumni.cmu.edu>
+
+ * java/lang/w_exp.c (o_threshold, u_threshold): Define only
+ if _IEEE_LIBM is undefined.
+
+2002-06-05 Loren J. Rittle <ljrittle@acm.org>
+
+ * libjava/include/posix.h (O_SYNC): Define if not available
+ and a reasonable, perhaps more conservative, replacement exists.
+ (O_DSYNC): Likewise.
+ * java/io/natFileDescriptorPosix.cc (open): Revert last patch.
+
+2003-06-05 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/BorderUIResource.java,
+ javax/swing/plaf/basic/BasicDefaults.java,
+ javax/swing/plaf/basic/BasicOptionPaneUI.java:
+ More compile fixes for latest Border commit. I should not commit
+ something in this heat here ...
+
+2003-06-05 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/border/BevelBorder.java
+ (BevelBorder): Removed.
+ * javax/swing/border/EmptyBorder.java:
+ Reformatted.
+ (EmptyBorder): Removed.
+ (getBorderInsets): Dont use l, r, t and b.
+ * javax/swing/border/EtchedBorder.java
+ (EtchedBorder): Removed.
+ * javax/swing/border/LineBorder.java
+ (LineBorder): Removed.
+ * javax/swing/border/MatteBorder.java
+ (MatteBorder): Removed.
+ * javax/swing/border/TitledBorder.java
+ (defaultBorder): Use other default for now.
+ (defaultFont): Likewise.
+ (defaultColor): Likewise.
+
+2003-06-05 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/border/Border.java:
+ New version from classpath.
+
+2003-06-05 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/border/AbstractBorder.java,
+ javax/swing/border/BevelBorder.java,
+ javax/swing/border/CompoundBorder.java,
+ javax/swing/border/EmptyBorder.java,
+ javax/swing/border/EtchedBorder.java,
+ javax/swing/border/LineBorder.java,
+ javax/swing/border/MatteBorder.java,
+ javax/swing/border/TitledBorder.java:
+ New versions from Classpath.
+
+2003-06-05 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Button.java,
+ java/awt/Checkbox.java,
+ java/awt/CheckboxMenuItem.java,
+ java/awt/Choice.java,
+ java/awt/Container.java,
+ java/awt/Dialog.java,
+ java/awt/EventQueue.java,
+ java/awt/FileDialog.java,
+ java/awt/Frame.java,
+ java/awt/Label.java,
+ java/awt/List.java,
+ java/awt/Menu.java,
+ java/awt/MenuItem.java,
+ java/awt/Panel.java,
+ java/awt/PopupMenu.java,
+ java/awt/Rectangle.java,
+ java/awt/ScrollPane.java,
+ java/awt/Scrollbar.java,
+ java/awt/TextArea.java,
+ java/awt/TextField.java,
+ java/awt/Window.java,
+ java/awt/datatransfer/DataFlavor.java,
+ java/awt/dnd/DragSource.java,
+ java/awt/dnd/DragSourceContext.java,
+ java/awt/event/HierarchyEvent.java,
+ java/awt/event/MouseWheelEvent.java,
+ java/awt/im/InputContext.java,
+ java/awt/image/BufferedImage.java,
+ java/awt/image/ComponentColorModel.java,
+ java/awt/image/Raster.java,
+ java/awt/image/WritableRaster.java,
+ java/awt/peer/ComponentPeer.java,
+ java/awt/print/PageFormat.java,
+ java/awt/print/PrinterJob.java:
+ New versions from Classpath.
+
+2003-06-05 Scott Gilbertson <scottg@mantatest.com>
+
+ * java/text/SimpleDateFormat.java (SimpleDateFormat): Added
+ numberFormat.setParseIntegerOnly(true).
+
+2003-06-05 Bert Deknuydt <Bert.Deknuydt@esat.kuleuven.ac.be>
+
+ * include/posix-threads.h: Include <machine/pal.h> on OSF.
+
2003-06-03 Andrew Haley <aph@redhat.com>
* include/x86_64-signal.h (MAKE_THROW_FRAME): Mark sigcontext on
stack volatile to prevent optimization from removing it.
+2003-05-27 Michael Koch <konqueror@gmx.de>
+
+ * java/util/zip/Deflater.java
+ (FILTERED): Merged documentation from classpath.
+ * java/util/zip/DeflaterOutputStream.java
+ (DeflaterOutputStream): Merged documentation and argument validity
+ check from classpath.
+ (deflate): Merged documentation from classpath.
+ (finish): Likewise.
+ * java/util/zip/Inflater.java
+ (Inflater): Merged class documentation from classpath.
+ (zstream): Reordered.
+ (is_finished): Reordered.
+ (dict_needed): Reordered.
+ (Inflater): Reordered, merged documentation from classpath.
+ (end): Likewise.
+ (finalize): Merged documentation from classpath.
+ (finished): Likewise.
+ (getAdler): Likewise.
+ (getRemaining): Likewise.
+ (getTotalIn): Likewise.
+ (getTotalOut): Likewise.
+ (inflate): Likewise.
+ (needsDictionary): Likewise.
+ (needsInput): Likewise.
+ (reset): Likewise.
+ (setDictionary): Likewise.
+ (setInput): Likewise.
+
+2003-05-27 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URLConnection.java
+ (getHeaderFieldInt): Merged with classpath.
+
+2003-05-27 Michael Koch <konqueror@gmx.de>
+
+ * java/io/PrintStream.java
+ (PrintStream): Reformatted.
+ (PrintStream): New method, merged from classpath.
+ (write): Reformatted.
+
+2003-05-27 Michael Koch <konqueror@gmx.de>
+
+ * java/lang/System.java:
+ Explicitely import needed classes.
+
+2003-05-26 Michael Koch <konqueror@gmx.de>
+
+ * java/net/NetPermission.java,
+ java/net/NetworkInterface.java,
+ java/net/PasswordAuthentication.java,
+ java/net/SocketPermission.java:
+ New versions from classpath.
+
+2003-05-25 Michael Koch <konqueror@gmx.de>
+
+ * java/io/PushbackInputStream.java,
+ java/net/Authenticator.java,
+ java/net/ContentHandler.java,
+ java/net/ContentHandlerFactory.java,
+ java/net/DatagramSocket.java,
+ java/net/DatagramSocketImpl.java,
+ java/net/DatagramSocketImplFactory.java,
+ java/net/FileNameMap.java,
+ java/net/SocketImplFactory.java,
+ java/net/SocketOptions.java,
+ java/net/URLStreamHandlerFactory.java:
+ Merged new versions from classpath.
+
+2003-05-25 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Checkbox.java,
+ java/awt/Dialog.java,
+ java/awt/Font.java,
+ java/awt/Frame.java,
+ java/awt/ScrollPaneAdjustable.java,
+ java/awt/Scrollbar.java,
+ java/awt/Window.java:
+ New versions from classpath.
+
2003-05-22 Jeff Sturm <jsturm@one-point.com>
PR libgcj/10838:
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index af64941ce95..07d6db3cabc 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -748,8 +748,8 @@ gnu/awt/j2d/MappedRaster.java \
gnu/java/awt/BitMaskExtent.java \
gnu/java/awt/Buffers.java \
gnu/java/awt/ComponentDataBlitOp.java \
-gnu/java/awt/GLightweightPeer.java \
gnu/java/awt/EventModifier.java \
+gnu/java/awt/GLightweightPeer.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/beans/editors/ColorEditor.java \
@@ -1144,14 +1144,15 @@ javax/rmi/CORBA/UtilDelegate.java \
javax/rmi/CORBA/Util.java \
javax/rmi/CORBA/ValueHandler.java \
javax/swing/border/AbstractBorder.java \
+javax/swing/border/BevelBorder.java \
javax/swing/border/Border.java \
javax/swing/border/CompoundBorder.java \
javax/swing/border/EmptyBorder.java \
-javax/swing/border/MatteBorder.java \
-javax/swing/border/TitledBorder.java \
-javax/swing/border/BevelBorder.java \
javax/swing/border/EtchedBorder.java \
javax/swing/border/LineBorder.java \
+javax/swing/border/MatteBorder.java \
+javax/swing/border/SoftBevelBorder.java \
+javax/swing/border/TitledBorder.java \
javax/swing/GrayFilter.java \
javax/swing/AbstractAction.java \
javax/swing/AbstractButton.java \
@@ -1165,6 +1166,8 @@ javax/swing/plaf/basic/BasicOptionPaneUI.java \
javax/swing/plaf/basic/BasicPanelUI.java \
javax/swing/plaf/basic/BasicRadioButtonUI.java \
javax/swing/plaf/basic/BasicScrollPaneUI.java \
+javax/swing/plaf/basic/BasicSplitPaneDivider.java \
+javax/swing/plaf/basic/BasicSplitPaneUI.java \
javax/swing/plaf/basic/BasicTabbedPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
@@ -1209,6 +1212,7 @@ javax/swing/plaf/RootPaneUI.java \
javax/swing/plaf/ScrollBarUI.java \
javax/swing/plaf/SeparatorUI.java \
javax/swing/plaf/SliderUI.java \
+javax/swing/plaf/SpinnerUI.java \
javax/swing/plaf/SplitPaneUI.java \
javax/swing/plaf/TableHeaderUI.java \
javax/swing/plaf/TableUI.java \
@@ -1226,6 +1230,7 @@ javax/swing/filechooser/FileView.java \
javax/swing/table/AbstractTableModel.java \
javax/swing/table/DefaultTableColumnModel.java \
javax/swing/table/DefaultTableModel.java \
+javax/swing/table/JTableHeader.java \
javax/swing/table/TableCellEditor.java \
javax/swing/table/TableCellRenderer.java \
javax/swing/table/TableColumn.java \
@@ -1429,6 +1434,8 @@ javax/swing/JSplitPane.java \
javax/swing/JTextPane.java \
javax/swing/JToolBar.java \
javax/swing/OverlayLayout.java \
+javax/swing/Popup.java \
+javax/swing/PopupFactory.java \
javax/swing/ProgressMonitor.java \
javax/swing/ProgressMonitorInputStream.java \
javax/swing/RepaintManager.java \
@@ -2099,7 +2106,6 @@ gnu/java/math/MPN.java \
gnu/java/nio/DatagramChannelImpl.java \
gnu/java/nio/FileChannelImpl.java \
gnu/java/nio/FileLockImpl.java \
-gnu/java/nio/MappedByteFileBuffer.java \
gnu/java/nio/PipeImpl.java \
gnu/java/nio/SelectionKeyImpl.java \
gnu/java/nio/SelectorImpl.java \
@@ -2242,6 +2248,7 @@ java/nio/LongBuffer.java \
java/nio/LongBufferImpl.java \
java/nio/LongViewBufferImpl.java \
java/nio/MappedByteBuffer.java \
+java/nio/MappedByteBufferImpl.java \
java/nio/ReadOnlyBufferException.java \
java/nio/ShortBuffer.java \
java/nio/ShortBufferImpl.java \
@@ -2565,9 +2572,7 @@ gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
gnu/java/nio/natFileChannelImpl.cc \
gnu/java/nio/natFileLockImpl.cc \
-gnu/java/nio/natMappedByteFileBuffer.cc \
gnu/java/nio/natSelectorImpl.cc \
-gnu/java/nio/natSocketChannelImpl.cc \
java/io/natFile.cc \
java/io/natFileDescriptor.cc \
java/io/natObjectInputStream.cc \
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index aaf32b544d5..a138372c59f 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -86,10 +86,11 @@ GCOBJS = @GCOBJS@
GCSPEC = @GCSPEC@
GCTESTSPEC = @GCTESTSPEC@
GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
GTK_CFLAGS = @GTK_CFLAGS@
-GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
@@ -115,6 +116,7 @@ OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
PLATFORMOBJS = @PLATFORMOBJS@
RANLIB = @RANLIB@
STRIP = @STRIP@
@@ -517,8 +519,8 @@ gnu/awt/j2d/MappedRaster.java \
gnu/java/awt/BitMaskExtent.java \
gnu/java/awt/Buffers.java \
gnu/java/awt/ComponentDataBlitOp.java \
-gnu/java/awt/GLightweightPeer.java \
gnu/java/awt/EventModifier.java \
+gnu/java/awt/GLightweightPeer.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/beans/editors/ColorEditor.java \
@@ -913,14 +915,15 @@ javax/rmi/CORBA/UtilDelegate.java \
javax/rmi/CORBA/Util.java \
javax/rmi/CORBA/ValueHandler.java \
javax/swing/border/AbstractBorder.java \
+javax/swing/border/BevelBorder.java \
javax/swing/border/Border.java \
javax/swing/border/CompoundBorder.java \
javax/swing/border/EmptyBorder.java \
-javax/swing/border/MatteBorder.java \
-javax/swing/border/TitledBorder.java \
-javax/swing/border/BevelBorder.java \
javax/swing/border/EtchedBorder.java \
javax/swing/border/LineBorder.java \
+javax/swing/border/MatteBorder.java \
+javax/swing/border/SoftBevelBorder.java \
+javax/swing/border/TitledBorder.java \
javax/swing/GrayFilter.java \
javax/swing/AbstractAction.java \
javax/swing/AbstractButton.java \
@@ -934,6 +937,8 @@ javax/swing/plaf/basic/BasicOptionPaneUI.java \
javax/swing/plaf/basic/BasicPanelUI.java \
javax/swing/plaf/basic/BasicRadioButtonUI.java \
javax/swing/plaf/basic/BasicScrollPaneUI.java \
+javax/swing/plaf/basic/BasicSplitPaneDivider.java \
+javax/swing/plaf/basic/BasicSplitPaneUI.java \
javax/swing/plaf/basic/BasicTabbedPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
@@ -978,6 +983,7 @@ javax/swing/plaf/RootPaneUI.java \
javax/swing/plaf/ScrollBarUI.java \
javax/swing/plaf/SeparatorUI.java \
javax/swing/plaf/SliderUI.java \
+javax/swing/plaf/SpinnerUI.java \
javax/swing/plaf/SplitPaneUI.java \
javax/swing/plaf/TableHeaderUI.java \
javax/swing/plaf/TableUI.java \
@@ -995,6 +1001,7 @@ javax/swing/filechooser/FileView.java \
javax/swing/table/AbstractTableModel.java \
javax/swing/table/DefaultTableColumnModel.java \
javax/swing/table/DefaultTableModel.java \
+javax/swing/table/JTableHeader.java \
javax/swing/table/TableCellEditor.java \
javax/swing/table/TableCellRenderer.java \
javax/swing/table/TableColumn.java \
@@ -1198,6 +1205,8 @@ javax/swing/JSplitPane.java \
javax/swing/JTextPane.java \
javax/swing/JToolBar.java \
javax/swing/OverlayLayout.java \
+javax/swing/Popup.java \
+javax/swing/PopupFactory.java \
javax/swing/ProgressMonitor.java \
javax/swing/ProgressMonitorInputStream.java \
javax/swing/RepaintManager.java \
@@ -1861,7 +1870,6 @@ gnu/java/math/MPN.java \
gnu/java/nio/DatagramChannelImpl.java \
gnu/java/nio/FileChannelImpl.java \
gnu/java/nio/FileLockImpl.java \
-gnu/java/nio/MappedByteFileBuffer.java \
gnu/java/nio/PipeImpl.java \
gnu/java/nio/SelectionKeyImpl.java \
gnu/java/nio/SelectorImpl.java \
@@ -2004,6 +2012,7 @@ java/nio/LongBuffer.java \
java/nio/LongBufferImpl.java \
java/nio/LongViewBufferImpl.java \
java/nio/MappedByteBuffer.java \
+java/nio/MappedByteBufferImpl.java \
java/nio/ReadOnlyBufferException.java \
java/nio/ShortBuffer.java \
java/nio/ShortBufferImpl.java \
@@ -2326,9 +2335,7 @@ gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
gnu/java/nio/natFileChannelImpl.cc \
gnu/java/nio/natFileLockImpl.cc \
-gnu/java/nio/natMappedByteFileBuffer.cc \
gnu/java/nio/natSelectorImpl.cc \
-gnu/java/nio/natSocketChannelImpl.cc \
java/io/natFile.cc \
java/io/natFileDescriptor.cc \
java/io/natObjectInputStream.cc \
@@ -2501,8 +2508,7 @@ gnu/gcj/runtime/natFinalizerThread.lo gnu/gcj/runtime/natFirstThread.lo \
gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \
gnu/gcj/runtime/natVMClassLoader.lo gnu/java/nio/natFileChannelImpl.lo \
-gnu/java/nio/natFileLockImpl.lo gnu/java/nio/natMappedByteFileBuffer.lo \
-gnu/java/nio/natSelectorImpl.lo gnu/java/nio/natSocketChannelImpl.lo \
+gnu/java/nio/natFileLockImpl.lo gnu/java/nio/natSelectorImpl.lo \
java/io/natFile.lo java/io/natFileDescriptor.lo \
java/io/natObjectInputStream.lo java/io/natVMObjectStreamClass.lo \
java/lang/natCharacter.lo java/lang/natClass.lo \
@@ -2965,8 +2971,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/locale/LocaleInformation_zh_TW.P \
.deps/gnu/java/math/MPN.P .deps/gnu/java/nio/DatagramChannelImpl.P \
.deps/gnu/java/nio/FileChannelImpl.P .deps/gnu/java/nio/FileLockImpl.P \
-.deps/gnu/java/nio/MappedByteFileBuffer.P .deps/gnu/java/nio/PipeImpl.P \
-.deps/gnu/java/nio/SelectionKeyImpl.P .deps/gnu/java/nio/SelectorImpl.P \
+.deps/gnu/java/nio/PipeImpl.P .deps/gnu/java/nio/SelectionKeyImpl.P \
+.deps/gnu/java/nio/SelectorImpl.P \
.deps/gnu/java/nio/SelectorProviderImpl.P \
.deps/gnu/java/nio/ServerSocketChannelImpl.P \
.deps/gnu/java/nio/SocketChannelImpl.P \
@@ -2981,9 +2987,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/nio/charset/UTF_8.P \
.deps/gnu/java/nio/natFileChannelImpl.P \
.deps/gnu/java/nio/natFileLockImpl.P \
-.deps/gnu/java/nio/natMappedByteFileBuffer.P \
.deps/gnu/java/nio/natSelectorImpl.P \
-.deps/gnu/java/nio/natSocketChannelImpl.P \
.deps/gnu/java/rmi/RMIMarshalledObjectInputStream.P \
.deps/gnu/java/rmi/RMIMarshalledObjectOutputStream.P \
.deps/gnu/java/rmi/dgc/DGCImpl.P .deps/gnu/java/rmi/dgc/DGCImpl_Skel.P \
@@ -3498,7 +3502,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/nio/IntBufferImpl.P .deps/java/nio/IntViewBufferImpl.P \
.deps/java/nio/InvalidMarkException.P .deps/java/nio/LongBuffer.P \
.deps/java/nio/LongBufferImpl.P .deps/java/nio/LongViewBufferImpl.P \
-.deps/java/nio/MappedByteBuffer.P \
+.deps/java/nio/MappedByteBuffer.P .deps/java/nio/MappedByteBufferImpl.P \
.deps/java/nio/ReadOnlyBufferException.P .deps/java/nio/ShortBuffer.P \
.deps/java/nio/ShortBufferImpl.P .deps/java/nio/ShortViewBufferImpl.P \
.deps/java/nio/channels/AlreadyConnectedException.P \
@@ -3995,7 +3999,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/MenuElement.P \
.deps/javax/swing/MenuSelectionManager.P \
.deps/javax/swing/MutableComboBoxModel.P \
-.deps/javax/swing/OverlayLayout.P .deps/javax/swing/ProgressMonitor.P \
+.deps/javax/swing/OverlayLayout.P .deps/javax/swing/Popup.P \
+.deps/javax/swing/PopupFactory.P .deps/javax/swing/ProgressMonitor.P \
.deps/javax/swing/ProgressMonitorInputStream.P \
.deps/javax/swing/Renderer.P .deps/javax/swing/RepaintManager.P \
.deps/javax/swing/RootPaneContainer.P \
@@ -4017,6 +4022,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/border/EtchedBorder.P \
.deps/javax/swing/border/LineBorder.P \
.deps/javax/swing/border/MatteBorder.P \
+.deps/javax/swing/border/SoftBevelBorder.P \
.deps/javax/swing/border/TitledBorder.P \
.deps/javax/swing/colorchooser/AbstractColorChooserPanel.P \
.deps/javax/swing/colorchooser/ColorChooserComponentFactory.P \
@@ -4094,7 +4100,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/plaf/ScrollBarUI.P \
.deps/javax/swing/plaf/ScrollPaneUI.P \
.deps/javax/swing/plaf/SeparatorUI.P .deps/javax/swing/plaf/SliderUI.P \
-.deps/javax/swing/plaf/SplitPaneUI.P \
+.deps/javax/swing/plaf/SpinnerUI.P .deps/javax/swing/plaf/SplitPaneUI.P \
.deps/javax/swing/plaf/TabbedPaneUI.P \
.deps/javax/swing/plaf/TableHeaderUI.P .deps/javax/swing/plaf/TableUI.P \
.deps/javax/swing/plaf/TextUI.P .deps/javax/swing/plaf/ToolBarUI.P \
@@ -4113,6 +4119,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/plaf/basic/BasicPanelUI.P \
.deps/javax/swing/plaf/basic/BasicRadioButtonUI.P \
.deps/javax/swing/plaf/basic/BasicScrollPaneUI.P \
+.deps/javax/swing/plaf/basic/BasicSplitPaneDivider.P \
+.deps/javax/swing/plaf/basic/BasicSplitPaneUI.P \
.deps/javax/swing/plaf/basic/BasicTabbedPaneUI.P \
.deps/javax/swing/plaf/basic/BasicTextUI.P \
.deps/javax/swing/plaf/basic/BasicToggleButtonUI.P \
@@ -4123,6 +4131,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/table/DefaultTableCellRenderer.P \
.deps/javax/swing/table/DefaultTableColumnModel.P \
.deps/javax/swing/table/DefaultTableModel.P \
+.deps/javax/swing/table/JTableHeader.P \
.deps/javax/swing/table/TableCellEditor.P \
.deps/javax/swing/table/TableCellRenderer.P \
.deps/javax/swing/table/TableColumn.P \
@@ -4277,7 +4286,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 \
- ./acinclude.m4 ./aclocal.m4 ./glib.m4 ./gtk.m4 \
+ ./acinclude.m4 ./aclocal.m4 ./glib-2.0.m4 ./gtk-2.0.m4 \
./libart.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
diff --git a/libjava/aclocal.m4 b/libjava/aclocal.m4
index eea585e50f9..ef532589313 100644
--- a/libjava/aclocal.m4
+++ b/libjava/aclocal.m4
@@ -435,58 +435,70 @@ done<<>>dnl>>)
changequote([,]))])
# Configure paths for GTK+
-# Owen Taylor 97-11-3
+# Owen Taylor 1997-2001
-dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
+dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
+dnl pass to pkg-config
dnl
-AC_DEFUN(AM_PATH_GTK,
+AC_DEFUN(AM_PATH_GTK_2_0,
[dnl
-dnl Get the cflags and libraries from the gtk-config script
+dnl Get the cflags and libraries from pkg-config
dnl
-AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
- gtk_config_prefix="$withval", gtk_config_prefix="")
-AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
- gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
-AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
+AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
, enable_gtktest=yes)
+ pkg_config_args=gtk+-2.0
for module in . $4
do
case "$module" in
gthread)
- gtk_config_args="$gtk_config_args gthread"
+ pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
- if test x$gtk_config_exec_prefix != x ; then
- gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
- if test x${GTK_CONFIG+set} != xset ; then
- GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
- fi
+ no_gtk=""
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ if test x$PKG_CONFIG != xno ; then
+ if pkg-config --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_gtk=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_gtk=yes
fi
- if test x$gtk_config_prefix != x ; then
- gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
- if test x${GTK_CONFIG+set} != xset ; then
- GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
- fi
+
+ min_gtk_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+ enable_gtktest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+ :
+ else
+ no_gtk=yes
+ fi
fi
- AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
- min_gtk_version=ifelse([$1], ,0.99.7,$1)
- AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
- no_gtk=""
- if test "$GTK_CONFIG" = "no" ; then
- no_gtk=yes
- else
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
- gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+ if test x"$no_gtk" = x ; then
+ GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+ GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+ gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+ gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+ gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
@@ -494,8 +506,8 @@ AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$GTK_LIBS $LIBS"
dnl
-dnl Now check if the installed GTK is sufficiently new. (Also sanity
-dnl checks the results of gtk-config to some extent
+dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
dnl
rm -f conf.gtktest
AC_TRY_RUN([
@@ -522,19 +534,17 @@ main ()
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
- printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf ("*** was found! If gtk-config was correct, then it is best\n");
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
- printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
- printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
}
-#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_micro_version != GTK_MICRO_VERSION))
@@ -544,7 +554,6 @@ main ()
printf("*** library (version %d.%d.%d)\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
}
-#endif /* defined (GTK_MAJOR_VERSION) ... */
else
{
if ((gtk_major_version > major) ||
@@ -562,10 +571,10 @@ main ()
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
- printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+ printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
@@ -578,20 +587,20 @@ main ()
fi
fi
if test "x$no_gtk" = x ; then
- AC_MSG_RESULT(yes)
+ AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
- if test "$GTK_CONFIG" = "no" ; then
- echo "*** The gtk-config script installed by GTK could not be found"
- echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GTK_CONFIG environment variable to the"
- echo "*** full path to gtk-config."
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://pkgconfig.sourceforge.net"
else
if test -f conf.gtktest ; then
:
else
- echo "*** Could not run GTK test program, checking why..."
+ echo "*** Could not run GTK+ test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
AC_TRY_LINK([
@@ -599,23 +608,16 @@ main ()
#include <stdio.h>
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GTK or finding the wrong"
- echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+ echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+ echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***"
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
- echo "*** came with the system with the command"
- echo "***"
- echo "*** rpm --erase --nodeps gtk gtk-devel" ],
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GTK was incorrectly installed"
- echo "*** or that you have moved GTK since it was installed. In the latter case, you"
- echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
+ echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
@@ -630,62 +632,80 @@ main ()
])
# Configure paths for GLIB
-# Owen Taylor 97-11-3
+# Owen Taylor 1997-2001
-dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
-dnl gthread is specified in MODULES, pass to glib-config
+dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
+dnl gthread is specified in MODULES, pass to pkg-config
dnl
-AC_DEFUN(AM_PATH_GLIB,
+AC_DEFUN(AM_PATH_GLIB_2_0,
[dnl
-dnl Get the cflags and libraries from the glib-config script
+dnl Get the cflags and libraries from pkg-config
dnl
-AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
- glib_config_prefix="$withval", glib_config_prefix="")
-AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
- glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
-AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
+AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
, enable_glibtest=yes)
- if test x$glib_config_exec_prefix != x ; then
- glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
- if test x${GLIB_CONFIG+set} != xset ; then
- GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
- fi
- fi
- if test x$glib_config_prefix != x ; then
- glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
- if test x${GLIB_CONFIG+set} != xset ; then
- GLIB_CONFIG=$glib_config_prefix/bin/glib-config
- fi
- fi
-
+ pkg_config_args=glib-2.0
for module in . $4
do
case "$module" in
gmodule)
- glib_config_args="$glib_config_args gmodule"
+ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gobject)
+ pkg_config_args="$pkg_config_args gobject-2.0"
;;
gthread)
- glib_config_args="$glib_config_args gthread"
+ pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
- AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
- min_glib_version=ifelse([$1], ,0.99.7,$1)
- AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
no_glib=""
- if test "$GLIB_CONFIG" = "no" ; then
- no_glib=yes
+
+ if test x$PKG_CONFIG != xno ; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_glib=yes
+ PKG_CONFIG=no
+ fi
else
- GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
- GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
- glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+ no_glib=yes
+ fi
+
+ min_glib_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+ enable_glibtest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+ :
+ else
+ no_glib=yes
+ fi
+ fi
+
+ if test x"$no_glib" = x ; then
+ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_glibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
@@ -694,7 +714,7 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and ru
LIBS="$GLIB_LIBS $LIBS"
dnl
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
-dnl checks the results of glib-config to some extent
+dnl checks the results of pkg-config to some extent)
dnl
rm -f conf.glibtest
AC_TRY_RUN([
@@ -721,17 +741,16 @@ main ()
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
- printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
- printf ("*** was found! If glib-config was correct, then it is best\n");
- printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
- printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
- printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
}
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
@@ -759,10 +778,10 @@ main ()
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the glib-config shell script is\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
- printf("*** correct copy of glib-config. (In this case, you will have to\n");
+ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
@@ -775,20 +794,20 @@ main ()
fi
fi
if test "x$no_glib" = x ; then
- AC_MSG_RESULT(yes)
+ AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
- if test "$GLIB_CONFIG" = "no" ; then
- echo "*** The glib-config script installed by GLIB could not be found"
- echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GLIB_CONFIG environment variable to the"
- echo "*** full path to glib-config."
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
else
if test -f conf.glibtest ; then
:
else
echo "*** Could not run GLIB test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
AC_TRY_LINK([
@@ -803,26 +822,25 @@ main ()
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***"
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
- echo "*** came with the system with the command"
- echo "***"
- echo "*** rpm --erase --nodeps gtk gtk-devel" ],
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
- echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
- echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
+ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GLIB_CFLAGS=""
GLIB_LIBS=""
+ GLIB_GENMARSHAL=""
+ GOBJECT_QUERY=""
+ GLIB_MKENUMS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
+ AC_SUBST(GLIB_GENMARSHAL)
+ AC_SUBST(GOBJECT_QUERY)
+ AC_SUBST(GLIB_MKENUMS)
rm -f conf.glibtest
])
diff --git a/libjava/configure b/libjava/configure
index 2e5b34dc112..fa37b78b96a 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -66,17 +66,9 @@ ac_help="$ac_help
ac_help="$ac_help
--with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib"
ac_help="$ac_help
- --with-gtk-prefix=PFX Prefix where GTK is installed (optional)"
+ --disable-gtktest do not try to compile and run a test GTK+ program"
ac_help="$ac_help
- --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)"
-ac_help="$ac_help
- --disable-gtktest Do not try to compile and run a test GTK program"
-ac_help="$ac_help
- --with-glib-prefix=PFX Prefix where GLIB is installed (optional)"
-ac_help="$ac_help
- --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)"
-ac_help="$ac_help
- --disable-glibtest Do not try to compile and run a test GLIB program"
+ --disable-glibtest do not try to compile and run a test GLIB program"
ac_help="$ac_help
--with-libart-prefix=PFX Prefix where LIBART is installed (optional)"
ac_help="$ac_help
@@ -601,7 +593,7 @@ fi
ORIGINAL_LD_FOR_MULTILIBS=$LD
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:605: checking whether ln -s works" >&5
+echo "configure:597: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -654,7 +646,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:658: checking for a BSD compatible install" >&5
+echo "configure:650: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -707,7 +699,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:711: checking whether build environment is sane" >&5
+echo "configure:703: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -764,7 +756,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:768: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:760: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -797,12 +789,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:801: checking for Cygwin environment" >&5
+echo "configure:793: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 806 "configure"
+#line 798 "configure"
#include "confdefs.h"
int main() {
@@ -813,7 +805,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -830,19 +822,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:834: checking for mingw32 environment" >&5
+echo "configure:826: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 839 "configure"
+#line 831 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -969,7 +961,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:973: checking host system type" >&5
+echo "configure:965: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -990,7 +982,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:994: checking target system type" >&5
+echo "configure:986: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -1008,7 +1000,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1012: checking build system type" >&5
+echo "configure:1004: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1037,7 +1029,7 @@ test "$host_alias" != "$target_alias" &&
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1041: checking for $ac_word" >&5
+echo "configure:1033: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1067,7 +1059,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1071: checking for $ac_word" >&5
+echo "configure:1063: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1118,7 +1110,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1122: checking for $ac_word" >&5
+echo "configure:1114: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1151,7 +1143,7 @@ fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1155: checking whether we are using GNU C" >&5
+echo "configure:1147: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1160,7 +1152,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1179,7 +1171,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1183: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1175: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1228,7 +1220,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1232: checking for $ac_word" >&5
+echo "configure:1224: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_glibjava_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1263,7 +1255,7 @@ CXX=$glibjava_CXX
test -z "$glibjava_CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1267: checking whether we are using GNU C++" >&5
+echo "configure:1259: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1272,7 +1264,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -1287,7 +1279,7 @@ if test $ac_cv_prog_gxx = yes; then
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1291: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1283: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1336,7 +1328,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1340: checking for working aclocal" >&5
+echo "configure:1332: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1349,7 +1341,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1353: checking for working autoconf" >&5
+echo "configure:1345: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1362,7 +1354,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1366: checking for working automake" >&5
+echo "configure:1358: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1375,7 +1367,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1379: checking for working autoheader" >&5
+echo "configure:1371: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1388,7 +1380,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1392: checking for working makeinfo" >&5
+echo "configure:1384: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1407,7 +1399,7 @@ fi
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1411: checking build system type" >&5
+echo "configure:1403: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1428,7 +1420,7 @@ echo "$ac_t""$build" 1>&6
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1432: checking for $ac_word" >&5
+echo "configure:1424: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1460,7 +1452,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1464: checking for $ac_word" >&5
+echo "configure:1456: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1492,7 +1484,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1496: checking for $ac_word" >&5
+echo "configure:1488: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1524,7 +1516,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1528: checking for $ac_word" >&5
+echo "configure:1520: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1569,7 +1561,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1573: checking for a BSD compatible install" >&5
+echo "configure:1565: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1623,7 +1615,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1627: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1619: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -1649,7 +1641,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1653: checking for executable suffix" >&5
+echo "configure:1645: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1659,7 +1651,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1809,7 +1801,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1813: checking for ld used by GCC" >&5
+echo "configure:1805: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1839,10 +1831,10 @@ echo "configure:1813: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1843: checking for GNU ld" >&5
+echo "configure:1835: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1846: checking for non-GNU ld" >&5
+echo "configure:1838: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1877,7 +1869,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1881: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1873: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1894,7 +1886,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1898: checking for $LD option to reload object files" >&5
+echo "configure:1890: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1906,7 +1898,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1910: checking for BSD-compatible nm" >&5
+echo "configure:1902: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1944,7 +1936,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1948: checking how to recognise dependant libraries" >&5
+echo "configure:1940: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2117,13 +2109,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:2121: checking for object suffix" >&5
+echo "configure:2113: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:2127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -2147,7 +2139,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:2151: checking for ${ac_tool_prefix}file" >&5
+echo "configure:2143: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2209,7 +2201,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:2213: checking for file" >&5
+echo "configure:2205: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2280,7 +2272,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2284: checking for $ac_word" >&5
+echo "configure:2276: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2312,7 +2304,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2316: checking for $ac_word" >&5
+echo "configure:2308: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2347,7 +2339,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2351: checking for $ac_word" >&5
+echo "configure:2343: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2379,7 +2371,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2383: checking for $ac_word" >&5
+echo "configure:2375: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2446,8 +2438,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2450 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2442 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if test "$lt_cv_prog_gnu_ld" = yes; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
@@ -2480,7 +2472,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2496,7 +2488,7 @@ ia64-*-hpux*)
x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
case $host in
@@ -2540,7 +2532,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2544: checking whether the C compiler needs -belf" >&5
+echo "configure:2536: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2553,14 +2545,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2557 "configure"
+#line 2549 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2590,7 +2582,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
esac
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:2594: checking how to run the C++ preprocessor" >&5
+echo "configure:2586: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2603,12 +2595,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 2607 "configure"
+#line 2599 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2844,7 +2836,7 @@ INTERPRETER="$libgcj_interpreter"
echo $ac_n "checking for exception model to use""... $ac_c" 1>&6
-echo "configure:2848: checking for exception model to use" >&5
+echo "configure:2840: checking for exception model to use" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2859,7 +2851,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
:
else
cat > conftest.$ac_ext << EOF
-#line 2863 "configure"
+#line 2855 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -2870,7 +2862,7 @@ void foo()
EOF
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-S
-if { (eval echo configure:2874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2866: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
enable_sjlj_exceptions=yes
elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
@@ -2981,7 +2973,7 @@ case "$TARGET_ECOS" in
PLATFORMH=win32.h
echo $ac_n "checking whether 'ld' is at least 2.13""... $ac_c" 1>&6
-echo "configure:2985: checking whether 'ld' is at least 2.13" >&5
+echo "configure:2977: checking whether 'ld' is at least 2.13" >&5
LD_PROG=`$CC --print-prog-name=ld`
LD_VERSION=`$LD_PROG --version`
LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
@@ -3027,7 +3019,7 @@ esac
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3031: checking how to run the C preprocessor" >&5
+echo "configure:3023: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -3042,13 +3034,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 3046 "configure"
+#line 3038 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3044: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -3059,13 +3051,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 3063 "configure"
+#line 3055 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -3076,13 +3068,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 3080 "configure"
+#line 3072 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3086: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3078: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -3107,7 +3099,7 @@ fi
echo "$ac_t""$CPP" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 3111 "configure"
+#line 3103 "configure"
#include "confdefs.h"
#include <stdint.h>
EOF
@@ -3122,7 +3114,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3126 "configure"
+#line 3118 "configure"
#include "confdefs.h"
#include <inttypes.h>
EOF
@@ -3137,7 +3129,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3141 "configure"
+#line 3133 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -3152,7 +3144,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3156 "configure"
+#line 3148 "configure"
#include "confdefs.h"
#include <sys/config.h>
EOF
@@ -3169,7 +3161,7 @@ rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3173 "configure"
+#line 3165 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3184,7 +3176,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3188 "configure"
+#line 3180 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3244,7 +3236,7 @@ ZLIBTESTSPEC=
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:3248: checking for X" >&5
+echo "configure:3240: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -3306,12 +3298,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 3310 "configure"
+#line 3302 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3380,14 +3372,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3384 "configure"
+#line 3376 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:3391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -3493,17 +3485,17 @@ else
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:3497: checking whether -R must be followed by a space" >&5
+echo "configure:3489: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 3500 "configure"
+#line 3492 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -3519,14 +3511,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 3523 "configure"
+#line 3515 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@@ -3558,7 +3550,7 @@ rm -f conftest*
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:3562: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:3554: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3566,7 +3558,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3570 "configure"
+#line 3562 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3577,7 +3569,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:3581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3599,7 +3591,7 @@ fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:3603: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:3595: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3607,7 +3599,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3611 "configure"
+#line 3603 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3618,7 +3610,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:3622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3647,12 +3639,12 @@ fi
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:3651: checking for gethostbyname" >&5
+echo "configure:3643: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3656 "configure"
+#line 3648 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -3675,7 +3667,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:3679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -3696,7 +3688,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3700: checking for gethostbyname in -lnsl" >&5
+echo "configure:3692: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3704,7 +3696,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3708 "configure"
+#line 3700 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3715,7 +3707,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3745,12 +3737,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:3749: checking for connect" >&5
+echo "configure:3741: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3754 "configure"
+#line 3746 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -3773,7 +3765,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:3777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -3794,7 +3786,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:3798: checking for connect in -lsocket" >&5
+echo "configure:3790: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3802,7 +3794,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3806 "configure"
+#line 3798 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3813,7 +3805,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:3817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3837,12 +3829,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:3841: checking for remove" >&5
+echo "configure:3833: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3846 "configure"
+#line 3838 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -3865,7 +3857,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:3869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@@ -3886,7 +3878,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:3890: checking for remove in -lposix" >&5
+echo "configure:3882: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3894,7 +3886,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3898 "configure"
+#line 3890 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3905,7 +3897,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:3909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3929,12 +3921,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:3933: checking for shmat" >&5
+echo "configure:3925: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3938 "configure"
+#line 3930 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -3957,7 +3949,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:3961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@@ -3978,7 +3970,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:3982: checking for shmat in -lipc" >&5
+echo "configure:3974: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3986,7 +3978,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3990 "configure"
+#line 3982 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3997,7 +3989,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:4001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4030,7 +4022,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:4034: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:4026: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4038,7 +4030,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4042 "configure"
+#line 4034 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4049,7 +4041,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:4053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4147,7 +4139,7 @@ fi
libsubdir=.libs
echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
-echo "configure:4151: checking for garbage collector to use" >&5
+echo "configure:4143: checking for garbage collector to use" >&5
# Check whether --enable-java-gc or --disable-java-gc was given.
if test "${enable_java_gc+set}" = set; then
enableval="$enable_java_gc"
@@ -4200,7 +4192,7 @@ esac
echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
-echo "configure:4204: checking for thread model used by GCC" >&5
+echo "configure:4196: checking for thread model used by GCC" >&5
THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
echo "$ac_t""$THREADS" 1>&6
@@ -4409,12 +4401,12 @@ else
for ac_func in strerror ioctl select fstat open fsync sleep opendir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4413: checking for $ac_func" >&5
+echo "configure:4405: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4418 "configure"
+#line 4410 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4437,7 +4429,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4464,12 +4456,12 @@ done
for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4468: checking for $ac_func" >&5
+echo "configure:4460: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4473 "configure"
+#line 4465 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4492,7 +4484,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4519,12 +4511,12 @@ done
for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4523: checking for $ac_func" >&5
+echo "configure:4515: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4528 "configure"
+#line 4520 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4547,7 +4539,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4574,12 +4566,12 @@ done
for ac_func in nl_langinfo setlocale
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4578: checking for $ac_func" >&5
+echo "configure:4570: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4583 "configure"
+#line 4575 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4602,7 +4594,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4629,12 +4621,12 @@ done
for ac_func in inet_aton inet_addr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4633: checking for $ac_func" >&5
+echo "configure:4625: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4638 "configure"
+#line 4630 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4657,7 +4649,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4684,12 +4676,12 @@ done
for ac_func in inet_pton uname inet_ntoa
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4688: checking for $ac_func" >&5
+echo "configure:4680: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4693 "configure"
+#line 4685 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4712,7 +4704,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4739,12 +4731,12 @@ done
for ac_func in fork execvp pipe sigaction ftruncate
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4743: checking for $ac_func" >&5
+echo "configure:4735: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4748 "configure"
+#line 4740 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4767,7 +4759,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4795,17 +4787,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4799: checking for $ac_hdr" >&5
+echo "configure:4791: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4804 "configure"
+#line 4796 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4832,12 +4824,12 @@ fi
done
echo $ac_n "checking for backtrace""... $ac_c" 1>&6
-echo "configure:4836: checking for backtrace" >&5
+echo "configure:4828: checking for backtrace" >&5
if eval "test \"`echo '$''{'ac_cv_func_backtrace'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4841 "configure"
+#line 4833 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char backtrace(); below. */
@@ -4860,7 +4852,7 @@ backtrace();
; return 0; }
EOF
-if { (eval echo configure:4864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_backtrace=yes"
else
@@ -4904,7 +4896,7 @@ fi
echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
-echo "configure:4908: checking for dladdr in -ldl" >&5
+echo "configure:4900: checking for dladdr in -ldl" >&5
ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4912,7 +4904,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4916 "configure"
+#line 4908 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4923,7 +4915,7 @@ int main() {
dladdr()
; return 0; }
EOF
-if { (eval echo configure:4927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4953,7 +4945,7 @@ do
ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
-echo "configure:4957: checking for $ac_file" >&5
+echo "configure:4949: checking for $ac_file" >&5
if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5011,7 +5003,7 @@ fi
echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:5015: checking for iconv" >&5
+echo "configure:5007: checking for iconv" >&5
if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5019,7 +5011,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
cat > conftest.$ac_ext <<EOF
-#line 5023 "configure"
+#line 5015 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -5029,7 +5021,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:5033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_func_iconv=yes
else
@@ -5041,7 +5033,7 @@ rm -f conftest*
am_save_LIBS="$LIBS"
LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
cat > conftest.$ac_ext <<EOF
-#line 5045 "configure"
+#line 5037 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -5051,7 +5043,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:5055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_lib_iconv=yes
am_cv_func_iconv=yes
@@ -5072,13 +5064,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
EOF
echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:5076: checking for iconv declaration" >&5
+echo "configure:5068: checking for iconv declaration" >&5
if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5082 "configure"
+#line 5074 "configure"
#include "confdefs.h"
#include <stdlib.h>
@@ -5097,7 +5089,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:5101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_proto_iconv_arg1=""
else
@@ -5126,19 +5118,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:5130: checking for LC_MESSAGES" >&5
+echo "configure:5122: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5135 "configure"
+#line 5127 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:5142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@@ -5159,12 +5151,12 @@ EOF
fi
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:5163: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:5155: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5168 "configure"
+#line 5160 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -5172,7 +5164,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:5176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5168: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -5193,12 +5185,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:5197: checking for tm_zone in struct tm" >&5
+echo "configure:5189: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5202 "configure"
+#line 5194 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -5206,7 +5198,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:5210: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
@@ -5226,12 +5218,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:5230: checking for tzname" >&5
+echo "configure:5222: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5235 "configure"
+#line 5227 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -5241,7 +5233,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:5245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@@ -5266,12 +5258,12 @@ fi
for ac_func in gethostbyname_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5270: checking for $ac_func" >&5
+echo "configure:5262: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5275 "configure"
+#line 5267 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5294,7 +5286,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5321,7 +5313,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 5325 "configure"
+#line 5317 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -5341,7 +5333,7 @@ rm -f conftest*
*" -D_REENTRANT "*) ;;
*)
echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:5345: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+echo "configure:5337: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5354,14 +5346,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF
-#line 5358 "configure"
+#line 5350 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:5365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=no
else
@@ -5371,14 +5363,14 @@ else
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
cat > conftest.$ac_ext <<EOF
-#line 5375 "configure"
+#line 5367 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:5382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5374: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=yes
else
@@ -5413,12 +5405,12 @@ EOF
esac
echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:5417: checking for struct hostent_data" >&5
+echo "configure:5409: checking for struct hostent_data" >&5
if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5422 "configure"
+#line 5414 "configure"
#include "confdefs.h"
#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
@@ -5429,7 +5421,7 @@ int main() {
struct hostent_data data;
; return 0; }
EOF
-if { (eval echo configure:5433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_struct_hostent_data=yes
else
@@ -5461,7 +5453,7 @@ done
# to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C
# linkage check is enough, yet C++ code requires proper prototypes.)
cat > conftest.$ac_ext <<EOF
-#line 5465 "configure"
+#line 5457 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -5472,12 +5464,12 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
for ac_func in gethostbyaddr_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5476: checking for $ac_func" >&5
+echo "configure:5468: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5481 "configure"
+#line 5473 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5500,7 +5492,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5527,7 +5519,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 5531 "configure"
+#line 5523 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -5554,12 +5546,12 @@ rm -f conftest*
for ac_func in gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5558: checking for $ac_func" >&5
+echo "configure:5550: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5563 "configure"
+#line 5555 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5582,7 +5574,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5606,7 +5598,7 @@ EOF
EOF
cat > conftest.$ac_ext <<EOF
-#line 5610 "configure"
+#line 5602 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -5637,12 +5629,12 @@ done
for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5641: checking for $ac_func" >&5
+echo "configure:5633: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5646 "configure"
+#line 5638 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5665,7 +5657,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5695,12 +5687,12 @@ done
for ac_func in sched_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5699: checking for $ac_func" >&5
+echo "configure:5691: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5704 "configure"
+#line 5696 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5723,7 +5715,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5745,7 +5737,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:5749: checking for sched_yield in -lrt" >&5
+echo "configure:5741: checking for sched_yield in -lrt" >&5
ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5753,7 +5745,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5757 "configure"
+#line 5749 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5764,7 +5756,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:5768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5790,7 +5782,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:5794: checking for sched_yield in -lposix4" >&5
+echo "configure:5786: checking for sched_yield in -lposix4" >&5
ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5798,7 +5790,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5802 "configure"
+#line 5794 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5809,7 +5801,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:5813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5845,7 +5837,7 @@ done
# We can save a little space at runtime if the mutex has m_count
# or __m_count. This is a nice hack for Linux.
cat > conftest.$ac_ext <<EOF
-#line 5849 "configure"
+#line 5841 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -5854,7 +5846,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:5858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE_M_COUNT 1
@@ -5866,7 +5858,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 5870 "configure"
+#line 5862 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -5875,7 +5867,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:5879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE___M_COUNT 1
@@ -5895,12 +5887,12 @@ rm -f conftest*
for ac_func in gettimeofday time ftime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5899: checking for $ac_func" >&5
+echo "configure:5891: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5904 "configure"
+#line 5896 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5923,7 +5915,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5954,12 +5946,12 @@ done
for ac_func in memmove
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5958: checking for $ac_func" >&5
+echo "configure:5950: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5963 "configure"
+#line 5955 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5982,7 +5974,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6012,12 +6004,12 @@ done
for ac_func in memcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6016: checking for $ac_func" >&5
+echo "configure:6008: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6021 "configure"
+#line 6013 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6040,7 +6032,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6069,7 +6061,7 @@ done
fi
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:6073: checking for dlopen in -ldl" >&5
+echo "configure:6065: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6077,7 +6069,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6081 "configure"
+#line 6073 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6088,7 +6080,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:6092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6133,7 +6125,7 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:6137: checking for socket libraries" >&5
+echo "configure:6129: checking for socket libraries" >&5
if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6141,12 +6133,12 @@ else
gcj_checkBoth=0
unset ac_cv_func_connect
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:6145: checking for connect" >&5
+echo "configure:6137: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6150 "configure"
+#line 6142 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -6169,7 +6161,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:6173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -6192,7 +6184,7 @@ fi
if test "$gcj_checkSocket" = 1; then
unset ac_cv_func_connect
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:6196: checking for main in -lsocket" >&5
+echo "configure:6188: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6200,14 +6192,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6204 "configure"
+#line 6196 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:6211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6234,12 +6226,12 @@ fi
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:6238: checking for accept" >&5
+echo "configure:6230: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6243 "configure"
+#line 6235 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -6262,7 +6254,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:6266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
@@ -6289,12 +6281,12 @@ fi
gcj_oldLibs=$LIBS
LIBS="$LIBS $gcj_cv_lib_sockets"
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:6293: checking for gethostbyname" >&5
+echo "configure:6285: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6298 "configure"
+#line 6290 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -6317,7 +6309,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:6321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -6335,7 +6327,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:6339: checking for main in -lnsl" >&5
+echo "configure:6331: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6343,14 +6335,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6347 "configure"
+#line 6339 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:6354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6382,7 +6374,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
if test "$with_system_zlib" = yes; then
echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:6386: checking for deflate in -lz" >&5
+echo "configure:6378: checking for deflate in -lz" >&5
ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6390,7 +6382,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6394 "configure"
+#line 6386 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -6401,7 +6393,7 @@ int main() {
deflate()
; return 0; }
EOF
-if { (eval echo configure:6405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6426,23 +6418,7 @@ fi
# Test for Gtk stuff, if asked for.
if test "$use_gtk_awt" = yes; then
- # Check whether --with-gtk-prefix or --without-gtk-prefix was given.
-if test "${with_gtk_prefix+set}" = set; then
- withval="$with_gtk_prefix"
- gtk_config_prefix="$withval"
-else
- gtk_config_prefix=""
-fi
-
-# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given.
-if test "${with_gtk_exec_prefix+set}" = set; then
- withval="$with_gtk_exec_prefix"
- gtk_config_exec_prefix="$withval"
-else
- gtk_config_exec_prefix=""
-fi
-
-# Check whether --enable-gtktest or --disable-gtktest was given.
+ # Check whether --enable-gtktest or --disable-gtktest was given.
if test "${enable_gtktest+set}" = set; then
enableval="$enable_gtktest"
:
@@ -6451,41 +6427,31 @@ else
fi
+ pkg_config_args=gtk+-2.0
for module in .
do
case "$module" in
gthread)
- gtk_config_args="$gtk_config_args gthread"
+ pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
- if test x$gtk_config_exec_prefix != x ; then
- gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
- if test x${GTK_CONFIG+set} != xset ; then
- GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
- fi
- fi
- if test x$gtk_config_prefix != x ; then
- gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
- if test x${GTK_CONFIG+set} != xset ; then
- GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
- fi
- fi
+ no_gtk=""
- # Extract the first word of "gtk-config", so it can be a program name with args.
-set dummy gtk-config; ac_word=$2
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6480: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
+echo "configure:6446: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$GTK_CONFIG" in
+ case "$PKG_CONFIG" in
/*)
- ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path.
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
?:/*)
- ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path.
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a dos path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
@@ -6493,36 +6459,61 @@ else
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
- ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word"
+ ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
break
fi
done
IFS="$ac_save_ifs"
- test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no"
+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
-GTK_CONFIG="$ac_cv_path_GTK_CONFIG"
-if test -n "$GTK_CONFIG"; then
- echo "$ac_t""$GTK_CONFIG" 1>&6
+PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+if test -n "$PKG_CONFIG"; then
+ echo "$ac_t""$PKG_CONFIG" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- min_gtk_version=1.2.4
- echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:6515: checking for GTK - version >= $min_gtk_version" >&5
- no_gtk=""
- if test "$GTK_CONFIG" = "no" ; then
- no_gtk=yes
+
+ if test x$PKG_CONFIG != xno ; then
+ if pkg-config --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_gtk=yes
+ PKG_CONFIG=no
+ fi
else
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
- gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+ no_gtk=yes
+ fi
+
+ min_gtk_version=2.0.0
+ echo $ac_n "checking for GTK+ - version >= $min_gtk_version""... $ac_c" 1>&6
+echo "configure:6494: checking for GTK+ - version >= $min_gtk_version" >&5
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+ enable_gtktest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+ :
+ else
+ no_gtk=yes
+ fi
+ fi
+
+ if test x"$no_gtk" = x ; then
+ GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+ GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+ gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+ gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+ gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
@@ -6534,7 +6525,7 @@ echo "configure:6515: checking for GTK - version >= $min_gtk_version" >&5
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 6538 "configure"
+#line 6529 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
@@ -6560,19 +6551,17 @@ main ()
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
- printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf ("*** was found! If gtk-config was correct, then it is best\n");
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
- printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
- printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
}
-#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_micro_version != GTK_MICRO_VERSION))
@@ -6582,7 +6571,6 @@ main ()
printf("*** library (version %d.%d.%d)\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
}
-#endif /* defined (GTK_MAJOR_VERSION) ... */
else
{
if ((gtk_major_version > major) ||
@@ -6600,10 +6588,10 @@ main ()
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
- printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+ printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
@@ -6612,7 +6600,7 @@ main ()
}
EOF
-if { (eval echo configure:6616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -6629,24 +6617,24 @@ fi
fi
fi
if test "x$no_gtk" = x ; then
- echo "$ac_t""yes" 1>&6
+ echo "$ac_t""yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" 1>&6
:
else
echo "$ac_t""no" 1>&6
- if test "$GTK_CONFIG" = "no" ; then
- echo "*** The gtk-config script installed by GTK could not be found"
- echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GTK_CONFIG environment variable to the"
- echo "*** full path to gtk-config."
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://pkgconfig.sourceforge.net"
else
if test -f conf.gtktest ; then
:
else
- echo "*** Could not run GTK test program, checking why..."
+ echo "*** Could not run GTK+ test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6650 "configure"
+#line 6638 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
@@ -6656,30 +6644,23 @@ int main() {
return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
; return 0; }
EOF
-if { (eval echo configure:6660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GTK or finding the wrong"
- echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+ echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+ echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***"
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
- echo "*** came with the system with the command"
- echo "***"
- echo "*** rpm --erase --nodeps gtk gtk-devel"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GTK was incorrectly installed"
- echo "*** or that you have moved GTK since it was installed. In the latter case, you"
- echo "*** may want to edit the gtk-config script: $GTK_CONFIG"
+ echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."
fi
rm -f conftest*
CFLAGS="$ac_save_CFLAGS"
@@ -6694,23 +6675,7 @@ rm -f conftest*
rm -f conf.gtktest
- # Check whether --with-glib-prefix or --without-glib-prefix was given.
-if test "${with_glib_prefix+set}" = set; then
- withval="$with_glib_prefix"
- glib_config_prefix="$withval"
-else
- glib_config_prefix=""
-fi
-
-# Check whether --with-glib-exec-prefix or --without-glib-exec-prefix was given.
-if test "${with_glib_exec_prefix+set}" = set; then
- withval="$with_glib_exec_prefix"
- glib_config_exec_prefix="$withval"
-else
- glib_config_exec_prefix=""
-fi
-
-# Check whether --enable-glibtest or --disable-glibtest was given.
+ # Check whether --enable-glibtest or --disable-glibtest was given.
if test "${enable_glibtest+set}" = set; then
enableval="$enable_glibtest"
:
@@ -6719,44 +6684,35 @@ else
fi
- if test x$glib_config_exec_prefix != x ; then
- glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
- if test x${GLIB_CONFIG+set} != xset ; then
- GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
- fi
- fi
- if test x$glib_config_prefix != x ; then
- glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
- if test x${GLIB_CONFIG+set} != xset ; then
- GLIB_CONFIG=$glib_config_prefix/bin/glib-config
- fi
- fi
-
+ pkg_config_args=glib-2.0
for module in . gthread
do
case "$module" in
gmodule)
- glib_config_args="$glib_config_args gmodule"
+ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gobject)
+ pkg_config_args="$pkg_config_args gobject-2.0"
;;
gthread)
- glib_config_args="$glib_config_args gthread"
+ pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
- # Extract the first word of "glib-config", so it can be a program name with args.
-set dummy glib-config; ac_word=$2
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6751: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then
+echo "configure:6707: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$GLIB_CONFIG" in
+ case "$PKG_CONFIG" in
/*)
- ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a path.
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
?:/*)
- ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a dos path.
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a dos path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
@@ -6764,36 +6720,67 @@ else
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
- ac_cv_path_GLIB_CONFIG="$ac_dir/$ac_word"
+ ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
break
fi
done
IFS="$ac_save_ifs"
- test -z "$ac_cv_path_GLIB_CONFIG" && ac_cv_path_GLIB_CONFIG="no"
+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
-GLIB_CONFIG="$ac_cv_path_GLIB_CONFIG"
-if test -n "$GLIB_CONFIG"; then
- echo "$ac_t""$GLIB_CONFIG" 1>&6
+PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+if test -n "$PKG_CONFIG"; then
+ echo "$ac_t""$PKG_CONFIG" 1>&6
else
echo "$ac_t""no" 1>&6
fi
- min_glib_version=1.2.4
- echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6
-echo "configure:6786: checking for GLIB - version >= $min_glib_version" >&5
+
no_glib=""
- if test "$GLIB_CONFIG" = "no" ; then
- no_glib=yes
+
+ if test x$PKG_CONFIG != xno ; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_glib=yes
+ PKG_CONFIG=no
+ fi
else
- GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
- GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
- glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+ no_glib=yes
+ fi
+
+ min_glib_version=2.0.0
+ echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6
+echo "configure:6757: checking for GLIB - version >= $min_glib_version" >&5
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+ enable_glibtest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+ :
+ else
+ no_glib=yes
+ fi
+ fi
+
+ if test x"$no_glib" = x ; then
+ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
if test "x$enable_glibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
@@ -6805,7 +6792,7 @@ echo "configure:6786: checking for GLIB - version >= $min_glib_version" >&5
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 6809 "configure"
+#line 6796 "configure"
#include "confdefs.h"
#include <glib.h>
@@ -6831,17 +6818,16 @@ main ()
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
- printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
- printf ("*** was found! If glib-config was correct, then it is best\n");
- printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
- printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
- printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
}
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
@@ -6869,10 +6855,10 @@ main ()
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the glib-config shell script is\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
- printf("*** correct copy of glib-config. (In this case, you will have to\n");
+ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
@@ -6881,7 +6867,7 @@ main ()
}
EOF
-if { (eval echo configure:6885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -6898,24 +6884,24 @@ fi
fi
fi
if test "x$no_glib" = x ; then
- echo "$ac_t""yes" 1>&6
+ echo "$ac_t""yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" 1>&6
:
else
echo "$ac_t""no" 1>&6
- if test "$GLIB_CONFIG" = "no" ; then
- echo "*** The glib-config script installed by GLIB could not be found"
- echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GLIB_CONFIG environment variable to the"
- echo "*** full path to glib-config."
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
else
if test -f conf.glibtest ; then
:
else
echo "*** Could not run GLIB test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6919 "configure"
+#line 6905 "configure"
#include "confdefs.h"
#include <glib.h>
@@ -6925,7 +6911,7 @@ int main() {
return ((glib_major_version) || (glib_minor_version) || (glib_micro_version));
; return 0; }
EOF
-if { (eval echo configure:6929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
@@ -6935,20 +6921,13 @@ if { (eval echo configure:6929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && t
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***"
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
- echo "*** came with the system with the command"
- echo "***"
- echo "*** rpm --erase --nodeps gtk gtk-devel"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
- echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
- echo "*** may want to edit the glib-config script: $GLIB_CONFIG"
+ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."
fi
rm -f conftest*
CFLAGS="$ac_save_CFLAGS"
@@ -6957,10 +6936,16 @@ rm -f conftest*
fi
GLIB_CFLAGS=""
GLIB_LIBS=""
+ GLIB_GENMARSHAL=""
+ GOBJECT_QUERY=""
+ GLIB_MKENUMS=""
exit 1
fi
+
+
+
rm -f conf.glibtest
enable_libarttest=no
@@ -7005,7 +6990,7 @@ fi
# Extract the first word of "libart-config", so it can be a program name with args.
set dummy libart-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7009: checking for $ac_word" >&5
+echo "configure:6994: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_LIBART_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7040,7 +7025,7 @@ fi
min_libart_version=2.1.0
echo $ac_n "checking for LIBART - version >= $min_libart_version""... $ac_c" 1>&6
-echo "configure:7044: checking for LIBART - version >= $min_libart_version" >&5
+echo "configure:7029: checking for LIBART - version >= $min_libart_version" >&5
no_libart=""
if test "$LIBART_CONFIG" = "no" ; then
no_libart=yes
@@ -7064,7 +7049,7 @@ echo "configure:7044: checking for LIBART - version >= $min_libart_version" >&5
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 7068 "configure"
+#line 7053 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -7122,7 +7107,7 @@ int main ()
EOF
-if { (eval echo configure:7126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -7156,7 +7141,7 @@ fi
CFLAGS="$CFLAGS $LIBART_CFLAGS"
LIBS="$LIBS $LIBART_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7160 "configure"
+#line 7145 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -7166,7 +7151,7 @@ int main() {
return 0;
; return 0; }
EOF
-if { (eval echo configure:7170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding LIBART or finding the wrong"
@@ -7205,7 +7190,7 @@ rm -f conftest*
# requires -ldl.
if test "$GC" = boehm; then
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:7209: checking for main in -ldl" >&5
+echo "configure:7194: checking for main in -ldl" >&5
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7213,14 +7198,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7217 "configure"
+#line 7202 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:7224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7287,7 +7272,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcj; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7291: checking for $ac_word" >&5
+echo "configure:7276: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7319,7 +7304,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "gcj", so it can be a program name with args.
set dummy gcj; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7323: checking for $ac_word" >&5
+echo "configure:7308: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7381,13 +7366,13 @@ exec 5>>./config.log
CPPFLAGS=$GCJ_SAVE_CPPFLAGS
echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:7385: checking size of void *" >&5
+echo "configure:7370: checking size of void *" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 7391 "configure"
+#line 7376 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
@@ -7397,7 +7382,7 @@ int main() {
switch (0) case 0: case (sizeof (void *) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:7401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_void_p=$ac_size
else
@@ -7507,18 +7492,18 @@ EOF
echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6
-echo "configure:7511: checking for g++ -ffloat-store bug" >&5
+echo "configure:7496: checking for g++ -ffloat-store bug" >&5
save_CFLAGS="$CFLAGS"
CFLAGS="-x c++ -O2 -ffloat-store"
cat > conftest.$ac_ext <<EOF
-#line 7515 "configure"
+#line 7500 "configure"
#include "confdefs.h"
#include <math.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:7522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7507: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""no" 1>&6
else
@@ -7538,17 +7523,17 @@ for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7542: checking for $ac_hdr" >&5
+echo "configure:7527: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7547 "configure"
+#line 7532 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7537: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -7578,17 +7563,17 @@ for ac_hdr in dirent.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7582: checking for $ac_hdr" >&5
+echo "configure:7567: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7587 "configure"
+#line 7572 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -7618,17 +7603,17 @@ for ac_hdr in inttypes.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7622: checking for $ac_hdr" >&5
+echo "configure:7607: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7627 "configure"
+#line 7612 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -7664,12 +7649,12 @@ fi
done
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:7668: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:7653: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7673 "configure"
+#line 7658 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -7685,7 +7670,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:7689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -7707,12 +7692,12 @@ fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:7711: checking for ANSI C header files" >&5
+echo "configure:7696: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7716 "configure"
+#line 7701 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -7720,7 +7705,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -7737,7 +7722,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 7741 "configure"
+#line 7726 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -7755,7 +7740,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 7759 "configure"
+#line 7744 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -7776,7 +7761,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 7780 "configure"
+#line 7765 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -7787,7 +7772,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:7791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -7811,12 +7796,12 @@ EOF
fi
echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:7815: checking for ssize_t" >&5
+echo "configure:7800: checking for ssize_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7820 "configure"
+#line 7805 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -7845,9 +7830,9 @@ fi
echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:7849: checking for in_addr_t" >&5
+echo "configure:7834: checking for in_addr_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 7851 "configure"
+#line 7836 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -7861,7 +7846,7 @@ int main() {
in_addr_t foo;
; return 0; }
EOF
-if { (eval echo configure:7865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_IN_ADDR_T 1
@@ -7877,16 +7862,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:7881: checking whether struct ip_mreq is in netinet/in.h" >&5
+echo "configure:7866: checking whether struct ip_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 7883 "configure"
+#line 7868 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ip_mreq mreq;
; return 0; }
EOF
-if { (eval echo configure:7890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IP_MREQ 1
@@ -7902,16 +7887,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:7906: checking whether struct ipv6_mreq is in netinet/in.h" >&5
+echo "configure:7891: checking whether struct ipv6_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 7908 "configure"
+#line 7893 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ipv6_mreq mreq6;
; return 0; }
EOF
-if { (eval echo configure:7915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IPV6_MREQ 1
@@ -7927,16 +7912,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:7931: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:7916: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 7933 "configure"
+#line 7918 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct sockaddr_in6 addr6;
; return 0; }
EOF
-if { (eval echo configure:7940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_INET6 1
@@ -7952,9 +7937,9 @@ fi
rm -f conftest*
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:7956: checking for socklen_t in sys/socket.h" >&5
+echo "configure:7941: checking for socklen_t in sys/socket.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 7958 "configure"
+#line 7943 "configure"
#include "confdefs.h"
#define _POSIX_PII_SOCKET
#include <sys/types.h>
@@ -7963,7 +7948,7 @@ int main() {
socklen_t x = 5;
; return 0; }
EOF
-if { (eval echo configure:7967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SOCKLEN_T 1
@@ -7979,16 +7964,16 @@ fi
rm -f conftest*
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:7983: checking for tm_gmtoff in struct tm" >&5
+echo "configure:7968: checking for tm_gmtoff in struct tm" >&5
cat > conftest.$ac_ext <<EOF
-#line 7985 "configure"
+#line 7970 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
struct tm tim; tim.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:7992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define STRUCT_TM_HAS_GMTOFF 1
@@ -8001,16 +7986,16 @@ else
rm -rf conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
-echo "configure:8005: checking for global timezone variable" >&5
+echo "configure:7990: checking for global timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 8007 "configure"
+#line 7992 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
void i(){long z2 = 2*timezone;}
; return 0; }
EOF
-if { (eval echo configure:8014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_TIMEZONE 1
@@ -8023,16 +8008,16 @@ else
rm -rf conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking for global _timezone variable""... $ac_c" 1>&6
-echo "configure:8027: checking for global _timezone variable" >&5
+echo "configure:8012: checking for global _timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 8029 "configure"
+#line 8014 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
long z2 = _timezone;
; return 0; }
EOF
-if { (eval echo configure:8036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_UNDERSCORE_TIMEZONE 1
@@ -8054,19 +8039,19 @@ rm -f conftest*
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:8058: checking for working alloca.h" >&5
+echo "configure:8043: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8063 "configure"
+#line 8048 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:8070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -8087,12 +8072,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:8091: checking for alloca" >&5
+echo "configure:8076: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8096 "configure"
+#line 8081 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -8120,7 +8105,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:8124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -8152,12 +8137,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:8156: checking whether alloca needs Cray hooks" >&5
+echo "configure:8141: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8161 "configure"
+#line 8146 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -8182,12 +8167,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8186: checking for $ac_func" >&5
+echo "configure:8171: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8191 "configure"
+#line 8176 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -8210,7 +8195,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:8214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8237,7 +8222,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:8241: checking stack direction for C alloca" >&5
+echo "configure:8226: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8245,7 +8230,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 8249 "configure"
+#line 8234 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -8264,7 +8249,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:8268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -8285,21 +8270,21 @@ EOF
fi
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
+for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8293: checking for $ac_hdr" >&5
+echo "configure:8278: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8298 "configure"
+#line 8283 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -8328,12 +8313,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8332: checking for $ac_func" >&5
+echo "configure:8317: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8337 "configure"
+#line 8322 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -8356,7 +8341,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:8360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8381,7 +8366,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:8385: checking for working mmap" >&5
+echo "configure:8370: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8389,7 +8374,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 8393 "configure"
+#line 8378 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -8417,24 +8402,11 @@ else
#include <fcntl.h>
#include <sys/mman.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -8542,7 +8514,7 @@ main()
}
EOF
-if { (eval echo configure:8546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -8570,7 +8542,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:8574: checking for $ac_word" >&5
+echo "configure:8546: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8618,7 +8590,7 @@ case "${host}" in
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
powerpc-*-linux*)
- SIGNAL_HANDLER=include/dwarf2-signal.h
+ SIGNAL_HANDLER=include/powerpc-signal.h
;;
alpha*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
@@ -8899,12 +8871,14 @@ s%@USING_GCC_FALSE@%$USING_GCC_FALSE%g
s%@tool_include_dir@%$tool_include_dir%g
s%@gcc_version@%$gcc_version%g
s%@LIBICONV@%$LIBICONV%g
-s%@GTK_CONFIG@%$GTK_CONFIG%g
+s%@PKG_CONFIG@%$PKG_CONFIG%g
s%@GTK_CFLAGS@%$GTK_CFLAGS%g
s%@GTK_LIBS@%$GTK_LIBS%g
-s%@GLIB_CONFIG@%$GLIB_CONFIG%g
s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g
s%@GLIB_LIBS@%$GLIB_LIBS%g
+s%@GLIB_GENMARSHAL@%$GLIB_GENMARSHAL%g
+s%@GOBJECT_QUERY@%$GOBJECT_QUERY%g
+s%@GLIB_MKENUMS@%$GLIB_MKENUMS%g
s%@LIBART_CONFIG@%$LIBART_CONFIG%g
s%@LIBART_CFLAGS@%$LIBART_CFLAGS%g
s%@LIBART_LIBS@%$LIBART_LIBS%g
diff --git a/libjava/configure.in b/libjava/configure.in
index f1e0a39b222..f2ba05b5481 100644
--- a/libjava/configure.in
+++ b/libjava/configure.in
@@ -785,8 +785,8 @@ else
# Test for Gtk stuff, if asked for.
if test "$use_gtk_awt" = yes; then
- AM_PATH_GTK(1.2.4,,exit 1)
- AM_PATH_GLIB(1.2.4,,exit 1,gthread)
+ AM_PATH_GTK_2_0(2.0.0,,exit 1)
+ AM_PATH_GLIB_2_0(2.0.0,,exit 1,gthread)
dnl XXX Fix me when libart.m4 has the compile test fixed!
enable_libarttest=no
AM_PATH_LIBART(2.1.0,,exit 1)
@@ -1004,7 +1004,7 @@ case "${host}" in
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
powerpc-*-linux*)
- SIGNAL_HANDLER=include/dwarf2-signal.h
+ SIGNAL_HANDLER=include/powerpc-signal.h
;;
alpha*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
index 3c8dd1b7fa8..fa140875acd 100644
--- a/libjava/gcj/Makefile.in
+++ b/libjava/gcj/Makefile.in
@@ -87,10 +87,11 @@ GCOBJS = @GCOBJS@
GCSPEC = @GCSPEC@
GCTESTSPEC = @GCTESTSPEC@
GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
GTK_CFLAGS = @GTK_CFLAGS@
-GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
@@ -117,6 +118,7 @@ OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
PLATFORMOBJS = @PLATFORMOBJS@
RANLIB = @RANLIB@
STRIP = @STRIP@
diff --git a/libjava/glib.m4 b/libjava/glib.m4
deleted file mode 100644
index b8094bbfe05..00000000000
--- a/libjava/glib.m4
+++ /dev/null
@@ -1,196 +0,0 @@
-# Configure paths for GLIB
-# Owen Taylor 97-11-3
-
-dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
-dnl gthread is specified in MODULES, pass to glib-config
-dnl
-AC_DEFUN(AM_PATH_GLIB,
-[dnl
-dnl Get the cflags and libraries from the glib-config script
-dnl
-AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
- glib_config_prefix="$withval", glib_config_prefix="")
-AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
- glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
-AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
- , enable_glibtest=yes)
-
- if test x$glib_config_exec_prefix != x ; then
- glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
- if test x${GLIB_CONFIG+set} != xset ; then
- GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
- fi
- fi
- if test x$glib_config_prefix != x ; then
- glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
- if test x${GLIB_CONFIG+set} != xset ; then
- GLIB_CONFIG=$glib_config_prefix/bin/glib-config
- fi
- fi
-
- for module in . $4
- do
- case "$module" in
- gmodule)
- glib_config_args="$glib_config_args gmodule"
- ;;
- gthread)
- glib_config_args="$glib_config_args gthread"
- ;;
- esac
- done
-
- AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
- min_glib_version=ifelse([$1], ,0.99.7,$1)
- AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
- no_glib=""
- if test "$GLIB_CONFIG" = "no" ; then
- no_glib=yes
- else
- GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
- GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
- glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_glibtest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$GLIB_LIBS $LIBS"
-dnl
-dnl Now check if the installed GLIB is sufficiently new. (Also sanity
-dnl checks the results of glib-config to some extent
-dnl
- rm -f conf.glibtest
- AC_TRY_RUN([
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
- int major, minor, micro;
- char *tmp_version;
-
- system ("touch conf.glibtest");
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_glib_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_glib_version");
- exit(1);
- }
-
- if ((glib_major_version != $glib_config_major_version) ||
- (glib_minor_version != $glib_config_minor_version) ||
- (glib_micro_version != $glib_config_micro_version))
- {
- printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
- $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
- glib_major_version, glib_minor_version, glib_micro_version);
- printf ("*** was found! If glib-config was correct, then it is best\n");
- printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
- printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
- }
- else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
- (glib_minor_version != GLIB_MINOR_VERSION) ||
- (glib_micro_version != GLIB_MICRO_VERSION))
- {
- printf("*** GLIB header files (version %d.%d.%d) do not match\n",
- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
- printf("*** library (version %d.%d.%d)\n",
- glib_major_version, glib_minor_version, glib_micro_version);
- }
- else
- {
- if ((glib_major_version > major) ||
- ((glib_major_version == major) && (glib_minor_version > minor)) ||
- ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
- glib_major_version, glib_minor_version, glib_micro_version);
- printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
- printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
- printf("***\n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the glib-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
- printf("*** correct copy of glib-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_glib" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$GLIB_CONFIG" = "no" ; then
- echo "*** The glib-config script installed by GLIB could not be found"
- echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GLIB_CONFIG environment variable to the"
- echo "*** full path to glib-config."
- else
- if test -f conf.glibtest ; then
- :
- else
- echo "*** Could not run GLIB test program, checking why..."
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$LIBS $GLIB_LIBS"
- AC_TRY_LINK([
-#include <glib.h>
-#include <stdio.h>
-], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GLIB or finding the wrong"
- echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***"
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
- echo "*** came with the system with the command"
- echo "***"
- echo "*** rpm --erase --nodeps gtk gtk-devel" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
- echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
- echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GLIB_CFLAGS=""
- GLIB_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(GLIB_CFLAGS)
- AC_SUBST(GLIB_LIBS)
- rm -f conf.glibtest
-])
diff --git a/libjava/gnu/awt/j2d/IntegerGraphicsState.java b/libjava/gnu/awt/j2d/IntegerGraphicsState.java
index bfea6611ca5..3befcb41707 100644
--- a/libjava/gnu/awt/j2d/IntegerGraphicsState.java
+++ b/libjava/gnu/awt/j2d/IntegerGraphicsState.java
@@ -187,13 +187,13 @@ public class IntegerGraphicsState extends AbstractGraphicsState
public void drawOval(int x, int y,
int width, int height)
{
- throw new UnsupportedOperationException("not implemented yet");
+ drawArc (x, y, width, height, 0, 360);
}
public void fillOval(int x, int y,
int width, int height)
{
- throw new UnsupportedOperationException("not implemented yet");
+ fillArc (x, y, width, height, 0, 360);
}
public void drawArc(int x, int y,
diff --git a/libjava/gnu/awt/xlib/XGraphics.java b/libjava/gnu/awt/xlib/XGraphics.java
index 47ab2b85145..9f29fa5b94a 100644
--- a/libjava/gnu/awt/xlib/XGraphics.java
+++ b/libjava/gnu/awt/xlib/XGraphics.java
@@ -156,13 +156,13 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
public void drawArc(int x, int y, int width, int height, int
startAngle, int arcAngle)
{
- throw new UnsupportedOperationException("not implemented");
+ context.drawArc (x, y, width, height, startAngle, arcAngle);
}
public void fillArc(int x, int y, int width, int height, int
startAngle, int arcAngle)
{
- throw new UnsupportedOperationException("not implemented");
+ context.fillArc (x, y, width, height, startAngle, arcAngle);
}
public void drawPolyline(int[] xPoints, int[] yPoints, int
diff --git a/libjava/gnu/gcj/convert/Output_EUCJIS.java b/libjava/gnu/gcj/convert/Output_EUCJIS.java
index 0662239aa85..c0cc4378b26 100644
--- a/libjava/gnu/gcj/convert/Output_EUCJIS.java
+++ b/libjava/gnu/gcj/convert/Output_EUCJIS.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2003 Free Software Foundation
This file is part of libgcj.
@@ -22,6 +22,11 @@ public class Output_EUCJIS extends UnicodeToBytes
public native int write (String str, int inpos, int inlength, char[] work);
+ public boolean havePendingBytes()
+ {
+ return pending1 >= 0;
+ }
+
int pending1 = -1;
int pending2;
}
diff --git a/libjava/gnu/gcj/convert/Output_SJIS.java b/libjava/gnu/gcj/convert/Output_SJIS.java
index c5370642378..67470ba7803 100644
--- a/libjava/gnu/gcj/convert/Output_SJIS.java
+++ b/libjava/gnu/gcj/convert/Output_SJIS.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2003 Free Software Foundation
This file is part of libgcj.
@@ -22,5 +22,10 @@ public class Output_SJIS extends UnicodeToBytes
public native int write (String str, int inpos, int inlength, char[] work);
+ public boolean havePendingBytes()
+ {
+ return pending >= 0;
+ }
+
int pending = -1;
}
diff --git a/libjava/gnu/gcj/convert/Output_UTF8.java b/libjava/gnu/gcj/convert/Output_UTF8.java
index 01f5ce890e3..f54e7ebcfc2 100644
--- a/libjava/gnu/gcj/convert/Output_UTF8.java
+++ b/libjava/gnu/gcj/convert/Output_UTF8.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2003 Free Software Foundation
This file is part of libgcj.
@@ -104,6 +104,7 @@ public class Output_UTF8 extends UnicodeToBytes
{
value = (hi_part - 0xD800) * 0x400 + (ch - 0xDC00) + 0x10000;
buf[count++] = (byte) (0xF0 | (value >> 18));
+ avail--;
bytes_todo = 3;
hi_part = 0;
}
@@ -118,4 +119,10 @@ public class Output_UTF8 extends UnicodeToBytes
}
return inpos - start_pos;
}
+
+ public boolean havePendingBytes()
+ {
+ return bytes_todo > 0;
+ }
+
}
diff --git a/libjava/gnu/gcj/convert/UnicodeToBytes.java b/libjava/gnu/gcj/convert/UnicodeToBytes.java
index 8181cb83109..0785d7ea43e 100644
--- a/libjava/gnu/gcj/convert/UnicodeToBytes.java
+++ b/libjava/gnu/gcj/convert/UnicodeToBytes.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation
This file is part of libgcj.
@@ -146,6 +146,17 @@ public abstract class UnicodeToBytes extends IOConverter
return write(work, 0, srcEnd - inpos);
}
+ /**
+ * Returns true when the converter has consumed some bytes that are
+ * not yet converted to characters because further continuation
+ * bytes are needed. Defaults to false, should be overridden by
+ * decoders that internally store some bytes.
+ */
+ public boolean havePendingBytes()
+ {
+ return false;
+ }
+
/** Indicate that the converter is resuable.
* This class keeps track of converters on a per-encoding basis.
* When done with an encoder you may call this method to indicate
diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc
index 0ed8606f94b..7b7ec64488e 100644
--- a/libjava/gnu/gcj/convert/natIconv.cc
+++ b/libjava/gnu/gcj/convert/natIconv.cc
@@ -268,6 +268,9 @@ gnu::gcj::convert::IOConverter::iconv_init (void)
// Conversion must be complete for us to use the result.
if (r != (size_t) -1 && inc == 0 && outc == 0)
result = (c != 0xfeff);
+
+ // Release iconv handle.
+ iconv_close (handle);
}
#endif /* HAVE_ICONV */
return result;
diff --git a/libjava/gnu/gcj/protocol/http/Handler.java b/libjava/gnu/gcj/protocol/http/Handler.java
index ccf94e762c5..608d07eda02 100644
--- a/libjava/gnu/gcj/protocol/http/Handler.java
+++ b/libjava/gnu/gcj/protocol/http/Handler.java
@@ -1,6 +1,6 @@
// Handler.java - URLStreamHandler for http protocol.
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2003 Free Software Foundation
This file is part of libgcj.
@@ -16,7 +16,8 @@ import java.net.URLStreamHandler;
import java.io.IOException;
/**
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy
+ * @author Anthony Green <green@redhat.com>
* @date March 26, 1999.
*/
@@ -32,4 +33,9 @@ public class Handler extends URLStreamHandler
{
return new Connection(url);
}
+
+ protected int getDefaultPort ()
+ {
+ return 80;
+ }
}
diff --git a/libjava/gnu/gcj/xlib/GC.java b/libjava/gnu/gcj/xlib/GC.java
index 2c4d8a81f6a..021f53756fb 100644
--- a/libjava/gnu/gcj/xlib/GC.java
+++ b/libjava/gnu/gcj/xlib/GC.java
@@ -110,6 +110,11 @@ public class GC implements Cloneable
public native void fillRectangle(int x, int y, int w, int h);
public native void fillPolygon(int[] xPoints, int[] yPoints, int nPoints,
int translateX, int translateY);
+
+ public native void drawArc(int x, int y, int w, int h,
+ int startAngle, int arcAngle);
+ public native void fillArc(int x, int y, int w, int h,
+ int startAngle, int arcAngle);
/**
*
diff --git a/libjava/gnu/gcj/xlib/natFont.cc b/libjava/gnu/gcj/xlib/natFont.cc
index 0f8f43dc509..54ac655d17b 100644
--- a/libjava/gnu/gcj/xlib/natFont.cc
+++ b/libjava/gnu/gcj/xlib/natFont.cc
@@ -44,25 +44,35 @@ jint gnu::gcj::xlib::Font::getXIDFromStruct(gnu::gcj::RawData* structure)
jint gnu::gcj::xlib::Font::getMaxAscent()
{
XFontStruct* fontStruct = (XFontStruct*) structure;
- return fontStruct->max_bounds.ascent;
+ return fontStruct->max_bounds.ascent+1; // +1 to include the baseline
}
jint gnu::gcj::xlib::Font::getMaxDescent()
{
XFontStruct* fontStruct = (XFontStruct*) structure;
- return fontStruct->max_bounds.descent;
+ return fontStruct->max_bounds.descent-1; // -1 to exclude the baseline
}
jint gnu::gcj::xlib::Font::getAscent()
{
XFontStruct* fontStruct = (XFontStruct*) structure;
- return fontStruct->ascent;
+ jint returnValue = fontStruct->ascent;
+ if (fontStruct->min_byte1==0 && fontStruct->min_char_or_byte2<=(unsigned)'O')
+ returnValue = fontStruct
+ ->per_char[(unsigned)'O'-fontStruct->min_char_or_byte2]
+ .ascent;
+ return returnValue+1; // +1 to include the baseline
}
jint gnu::gcj::xlib::Font::getDescent()
{
XFontStruct* fontStruct = (XFontStruct*) structure;
- return fontStruct->ascent;
+ jint returnValue = fontStruct->descent;
+ if (fontStruct->min_byte1==0 && fontStruct->min_char_or_byte2<=(unsigned)'y')
+ returnValue = fontStruct
+ ->per_char[(unsigned)'y'-fontStruct->min_char_or_byte2]
+ .descent;
+ return returnValue-1; // -1 to exclude the baseline
}
jint gnu::gcj::xlib::Font::getStringWidth(java::lang::String* text)
diff --git a/libjava/gnu/gcj/xlib/natGC.cc b/libjava/gnu/gcj/xlib/natGC.cc
index 71f83f5dcce..fd9fca84564 100644
--- a/libjava/gnu/gcj/xlib/natGC.cc
+++ b/libjava/gnu/gcj/xlib/natGC.cc
@@ -147,6 +147,24 @@ void gnu::gcj::xlib::GC::fillRectangle(jint x, jint y, jint w, jint h)
// no fast fail
}
+void gnu::gcj::xlib::GC::drawArc(jint x, jint y, jint w, jint h,jint startAngle, jint arcAngle)
+{
+ Display* display = target->getDisplay();
+ ::Display* dpy = (::Display*) (display->display);
+ ::Drawable drawableXID = target->getXID();
+ ::GC gc = (::GC) structure;
+ XDrawArc(dpy, drawableXID, gc, x, y, w, h, startAngle * 64, arcAngle * 64);
+}
+
+void gnu::gcj::xlib::GC::fillArc(jint x, jint y, jint w, jint h,jint startAngle, jint arcAngle)
+{
+ Display* display = target->getDisplay();
+ ::Display* dpy = (::Display*) (display->display);
+ ::Drawable drawableXID = target->getXID();
+ ::GC gc = (::GC) structure;
+ XFillArc(dpy, drawableXID, gc, x, y, w, h, startAngle * 64, arcAngle * 64);
+}
+
void gnu::gcj::xlib::GC::fillPolygon(jintArray xPoints, jintArray yPoints,
jint nPoints,
jint translateX, jint translateY)
diff --git a/libjava/gnu/java/lang/ArrayHelper.java b/libjava/gnu/java/lang/ArrayHelper.java
index 271e248f523..0216caba167 100644
--- a/libjava/gnu/java/lang/ArrayHelper.java
+++ b/libjava/gnu/java/lang/ArrayHelper.java
@@ -1,5 +1,5 @@
-/* gnu.java.lang.ArrayHelper
- Copyright (C) 1998 Free Software Foundation, Inc.
+/* ArrayHelper.java -- Helper methods for handling array operations
+ Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,25 +39,42 @@ exception statement from your version. */
package gnu.java.lang;
/**
- ** ArrayHelper helps you do things with arrays.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class ArrayHelper {
- public static boolean contains(Object[] array, Object searchFor) {
- return indexOf(array,searchFor) != -1;
- }
+ * ArrayHelper helps you do things with arrays.
+ *
+ * @author John Keiser
+ */
+public class ArrayHelper
+{
+ /**
+ * Counterpart to java.util.Collection.contains.
+ *
+ * @param array the array to search
+ * @param searchFor the object to locate
+ * @return true if some array element <code>equals(searchFor)</code>
+ */
+ public static boolean contains(Object[] array, Object searchFor)
+ {
+ return indexOf(array, searchFor) != -1;
+ }
- public static int indexOf(Object[] array, Object searchFor) {
- for(int i=0;i<array.length;i++) {
- if(array[i].equals(searchFor)) {
- return i;
- }
- }
- return -1;
- }
+ /**
+ * Counterpart to java.util.Collection.indexOf.
+ *
+ * @param array the array to search
+ * @param searchFor the object to locate
+ * @return the index of the first equal object, or -1
+ */
+ public static int indexOf(Object[] array, Object searchFor)
+ {
+ for (int i = 0; i < array.length; i++)
+ {
+ if(array[i].equals(searchFor))
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
public static boolean equalsArray(Object[] a, Object[] b) {
if(a.length == b.length) {
diff --git a/libjava/gnu/java/lang/ClassHelper.java b/libjava/gnu/java/lang/ClassHelper.java
index 0d2ce5d4a77..16d699e3453 100644
--- a/libjava/gnu/java/lang/ClassHelper.java
+++ b/libjava/gnu/java/lang/ClassHelper.java
@@ -1,5 +1,5 @@
-/* gnu.java.lang.ClassHelper
- Copyright (C) 1998 Free Software Foundation, Inc.
+/* ClassHelper.java -- Utility methods to augment java.lang.Class
+ Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -42,202 +42,144 @@ import java.util.*;
import java.lang.reflect.*;
/**
- ** ClassHelper has various methods that ought to have been
- ** in class.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class ClassHelper {
- /** Strip the package part from the class name.
- ** @param clazz the class to get the truncated name from
- ** @return the truncated class name.
- **/
- public static String getTruncatedClassName(Class clazz) {
- return getTruncatedName(clazz.getName());
- }
- /** Strip the package part from the class name, or the
- ** class part from the method or field name.
- ** @param name the name to truncate.
- ** @return the truncated name.
- **/
- public static String getTruncatedName(String name) {
- int lastInd = name.lastIndexOf('.');
- if(lastInd == -1) {
- return name;
- } else {
- return name.substring(lastInd+1);
- }
- }
-
- /** Strip the last portion of the name (after the last
- ** dot).
- ** @param name the name to get package of.
- ** @return the package name. "" if no package.
- **/
- public static String getPackagePortion(String name) {
- int lastInd = name.lastIndexOf('.');
- if(lastInd == -1) {
- return "";
- } else {
- return name.substring(0,lastInd);
- }
- }
-
- static Hashtable allMethods = new Hashtable();
- static Hashtable allMethodsAtDeclaration = new Hashtable();
-
- /** Get all the methods, public, private and
- ** otherwise, from the class, getting them
- ** from the most recent class to find them.
- **/
- public static Method[] getAllMethods(Class clazz) {
- Method[] retval = (Method[])allMethods.get(clazz);
- if(retval == null) {
- Method[] superMethods;
- if(clazz.getSuperclass() != null) {
- superMethods = getAllMethods(clazz.getSuperclass());
- } else {
- superMethods = new Method[0];
- }
- Vector v = new Vector();
- Method[] currentMethods = clazz.getDeclaredMethods();
- for(int i=0;i<currentMethods.length;i++) {
- v.addElement(currentMethods[i]);
- }
- for(int i=0;i<superMethods.length;i++) {
- boolean addOK = true;
- for(int j=0;j<currentMethods.length;j++) {
- if(getTruncatedName(superMethods[i].getName()).equals(getTruncatedName(currentMethods[j].getName()))
- && ArrayHelper.equalsArray(superMethods[i].getParameterTypes(),currentMethods[j].getParameterTypes())) {
- addOK = false;
- }
- }
- if(addOK) {
- v.addElement(superMethods[i]);
- }
- }
-
- retval = new Method[v.size()];
- v.copyInto(retval);
- allMethods.put(clazz,retval);
- }
- return retval;
- }
-
- /** Get all the methods, public, private and
- ** otherwise, from the class, and get them from
- ** their point of declaration.
- **/
- public static Method[] getAllMethodsAtDeclaration(Class clazz) {
- Method[] retval = (Method[])allMethodsAtDeclaration.get(clazz);
- if(retval == null) {
- Method[] superMethods;
- if(clazz.getSuperclass() != null) {
- superMethods = getAllMethodsAtDeclaration(clazz.getSuperclass());
- } else {
- superMethods = new Method[0];
- }
- Vector v = new Vector();
- Method[] currentMethods = clazz.getDeclaredMethods();
- for(int i=0;i<superMethods.length;i++) {
- v.addElement(superMethods[i]);
- }
- for(int i=0;i<superMethods.length;i++) {
- boolean addOK = true;
- for(int j=0;j<currentMethods.length;j++) {
- if(getTruncatedName(superMethods[i].getName()).equals(getTruncatedName(currentMethods[j].getName()))
- && ArrayHelper.equalsArray(superMethods[i].getParameterTypes(),currentMethods[j].getParameterTypes())) {
- addOK = false;
- }
- }
- if(addOK) {
- v.addElement(superMethods[i]);
- }
- }
-
- retval = new Method[v.size()];
- v.copyInto(retval);
- allMethodsAtDeclaration.put(clazz,retval);
- }
- return retval;
- }
-
- static Hashtable allFields = new Hashtable();
- static Hashtable allFieldsAtDeclaration = new Hashtable();
-
- /** Get all the fields, public, private and
- ** otherwise, from the class, getting them
- ** from the most recent class to find them.
- **/
- public static Field[] getAllFields(Class clazz) {
- Field[] retval = (Field[])allFields.get(clazz);
- if(retval == null) {
- Field[] superFields;
- if(clazz.getSuperclass() != null) {
- superFields = getAllFields(clazz.getSuperclass());
- } else {
- superFields = new Field[0];
- }
- Vector v = new Vector();
- Field[] currentFields = clazz.getDeclaredFields();
- for(int i=0;i<currentFields.length;i++) {
- v.addElement(currentFields[i]);
- }
- for(int i=0;i<superFields.length;i++) {
- boolean addOK = true;
- for(int j=0;j<currentFields.length;j++) {
- if(getTruncatedName(superFields[i].getName()).equals(getTruncatedName(currentFields[j].getName()))) {
- addOK = false;
- }
- }
- if(addOK) {
- v.addElement(superFields[i]);
- }
- }
-
- retval = new Field[v.size()];
- v.copyInto(retval);
- allFields.put(clazz,retval);
- }
- return retval;
- }
-
- /** Get all the fields, public, private and
- ** otherwise, from the class, and get them from
- ** their point of declaration.
- **/
- public static Field[] getAllFieldsAtDeclaration(Class clazz) {
- Field[] retval = (Field[])allFieldsAtDeclaration.get(clazz);
- if(retval == null) {
- Field[] superFields;
- if(clazz.getSuperclass() != null) {
- superFields = getAllFieldsAtDeclaration(clazz.getSuperclass());
- } else {
- superFields = new Field[0];
- }
- Vector v = new Vector();
- Field[] currentFields = clazz.getDeclaredFields();
- for(int i=0;i<superFields.length;i++) {
- v.addElement(superFields[i]);
- }
- for(int i=0;i<superFields.length;i++) {
- boolean addOK = true;
- for(int j=0;j<currentFields.length;j++) {
- if(getTruncatedName(superFields[i].getName()).equals(getTruncatedName(currentFields[j].getName()))) {
- addOK = false;
- }
- }
- if(addOK) {
- v.addElement(superFields[i]);
- }
- }
-
- retval = new Field[v.size()];
- v.copyInto(retval);
- allFieldsAtDeclaration.put(clazz,retval);
- }
- return retval;
- }
+ * ClassHelper has various methods that ought to have been in Class.
+ *
+ * @author John Keiser
+ * @author Eric Blake <ebb9@email.byu.edu>
+ */
+public class ClassHelper
+{
+ /**
+ * Strip the package part from the class name.
+ *
+ * @param clazz the class to get the truncated name from
+ * @return the truncated class name
+ */
+ public static String getTruncatedClassName(Class clazz)
+ {
+ return getTruncatedName(clazz.getName());
+ }
+
+ /**
+ * Strip the package part from the class name, or the class part from
+ * the method or field name.
+ *
+ * @param name the name to truncate
+ * @return the truncated name
+ */
+ public static String getTruncatedName(String name)
+ {
+ int lastInd = name.lastIndexOf('.');
+ if (lastInd == -1)
+ return name;
+ return name.substring(lastInd + 1);
+ }
+
+ /**
+ * Strip the last portion of the name (after the last dot).
+ *
+ * @param name the name to get package of
+ * @return the package name, or "" if no package
+ */
+ public static String getPackagePortion(String name)
+ {
+ int lastInd = name.lastIndexOf('.');
+ if (lastInd == -1)
+ return "";
+ return name.substring(0, lastInd);
+ }
+
+ /** Cache of methods found in getAllMethods(). */
+ private static Map allMethods = new HashMap();
+
+ /**
+ * Get all the methods, public, private and otherwise, from the class,
+ * getting them from the most recent class to find them. This may not
+ * be quite the correct approach, as this includes methods that are not
+ * inherited or accessible from clazz, so beware.
+ *
+ * @param clazz the class to start at
+ * @return all methods declared or inherited in clazz
+ */
+ public static Method[] getAllMethods(Class clazz)
+ {
+ Method[] retval = (Method[]) allMethods.get(clazz);
+ if (retval == null)
+ {
+ Set methods = new HashSet();
+ Class c = clazz;
+ while (c != null)
+ {
+ Method[] currentMethods = c.getDeclaredMethods();
+ loop:
+ for (int i = 0; i < currentMethods.length; i++)
+ {
+ Method current = currentMethods[i];
+ int size = methods.size();
+ Iterator iter = methods.iterator();
+ while (--size >= 0)
+ {
+ Method override = (Method) iter.next();
+ if (current.getName().equals(override.getName())
+ && Arrays.equals(current.getParameterTypes(),
+ override.getParameterTypes())
+ && current.getReturnType() == override.getReturnType())
+ continue loop;
+ }
+ methods.add(current);
+ }
+ c = c.getSuperclass();
+ }
+ retval = new Method[methods.size()];
+ methods.toArray(retval);
+ allMethods.put(clazz, retval);
+ }
+ return retval;
+ }
+
+ /** Cache of fields found in getAllFields(). */
+ private static Map allFields = new HashMap();
+
+ /**
+ * Get all the fields, public, private and otherwise, from the class,
+ * getting them from the most recent class to find them. This may not
+ * be quite the correct approach, as this includes fields that are not
+ * inherited or accessible from clazz, so beware.
+ *
+ * @param clazz the class to start at
+ * @return all fields declared or inherited in clazz
+ */
+ public static Field[] getAllFields(Class clazz)
+ {
+ Field[] retval = (Field[]) allFields.get(clazz);
+ if (retval == null)
+ {
+ Set fields = new HashSet();
+ Class c = clazz;
+ while (c != null)
+ {
+ Field[] currentFields = c.getDeclaredFields();
+ loop:
+ for (int i = 0; i < currentFields.length; i++)
+ {
+ Field current = currentFields[i];
+ int size = fields.size();
+ Iterator iter = fields.iterator();
+ while (--size >= 0)
+ {
+ Field override = (Field) iter.next();
+ if (current.getName().equals(override.getName())
+ && current.getType() == override.getType())
+ continue loop;
+ }
+ fields.add(current);
+ }
+ c = c.getSuperclass();
+ }
+ retval = new Field[fields.size()];
+ fields.toArray(retval);
+ allFields.put(clazz, retval);
+ }
+ return retval;
+ }
}
diff --git a/libjava/gnu/java/nio/DatagramChannelImpl.java b/libjava/gnu/java/nio/DatagramChannelImpl.java
index a1e0be15912..dce7dabcdac 100644
--- a/libjava/gnu/java/nio/DatagramChannelImpl.java
+++ b/libjava/gnu/java/nio/DatagramChannelImpl.java
@@ -35,78 +35,120 @@ 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 gnu.java.nio;
+import java.io.IOException;
import java.net.DatagramSocket;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
+import java.nio.channels.NotYetConnectedException;
import java.nio.channels.spi.SelectorProvider;
public class DatagramChannelImpl extends DatagramChannel
{
- int fd;
-
+ boolean blocking = false;
+ DatagramSocket socket;
+
protected DatagramChannelImpl (SelectorProvider provider)
+ throws IOException
{
super (provider);
+ socket = new DatagramSocket ();
}
- protected void implCloseSelectableChannel ()
+ public DatagramSocket socket ()
{
+ return socket;
}
- protected void implConfigureBlocking (boolean block)
+ protected void implCloseSelectableChannel ()
+ throws IOException
{
+ socket.close ();
}
-
- public int write (ByteBuffer src)
+
+ protected void implConfigureBlocking (boolean blocking)
+ throws IOException
{
- return 0;
+ this.blocking = blocking; // FIXME
}
- public long write (ByteBuffer[] srcs, int offset, int length)
+ public DatagramChannel connect (SocketAddress remote)
+ throws IOException
{
- return 0;
+ socket.connect (remote);
+ return this;
}
-
- public int read (ByteBuffer dst)
+
+ public DatagramChannel disconnect ()
+ throws IOException
{
- return 0;
+ socket.disconnect ();
+ return this;
}
- public DatagramChannel connect (SocketAddress remote)
+ public boolean isConnected ()
{
- return null;
+ return socket.isConnected ();
}
- public DatagramChannel disconnect ()
+ public int write (ByteBuffer src)
+ throws IOException
{
- return null;
- }
+ if (!isConnected ())
+ throw new NotYetConnectedException ();
- public boolean isConnected ()
+ throw new Error ("Not implemented");
+ }
+
+ public long write (ByteBuffer[] srcs, int offset, int length)
+ throws IOException
{
- return false;
+ // FIXME: Should we throw an exception if offset and/or length
+ // have wrong values ?
+
+ long result = 0;
+
+ for (int i = offset; i < offset + length; i++)
+ result += write (srcs [i]);
+
+ return result;
+ }
+
+ public int read (ByteBuffer dst)
+ throws IOException
+ {
+ if (!isConnected ())
+ throw new NotYetConnectedException ();
+
+ throw new Error ("Not implemented");
}
public long read (ByteBuffer[] dsts, int offset, int length)
+ throws IOException
{
- return 0;
+ // FIXME: Should we throw an exception if offset and/or length
+ // have wrong values ?
+
+ long result = 0;
+
+ for (int i = offset; i < offset + length; i++)
+ result += read (dsts [i]);
+
+ return result;
}
public SocketAddress receive (ByteBuffer dst)
+ throws IOException
{
- return null;
+ throw new Error ("Not implemented");
}
public int send (ByteBuffer src, SocketAddress target)
+ throws IOException
{
- return 0;
- }
-
- public DatagramSocket socket ()
- {
- return null;
+ throw new Error ("Not implemented");
}
}
diff --git a/libjava/gnu/java/nio/FileChannelImpl.java b/libjava/gnu/java/nio/FileChannelImpl.java
index 79a7a58eb90..943bdd78652 100644
--- a/libjava/gnu/java/nio/FileChannelImpl.java
+++ b/libjava/gnu/java/nio/FileChannelImpl.java
@@ -35,6 +35,7 @@ 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 gnu.java.nio;
import java.io.EOFException;
@@ -45,6 +46,7 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
+import java.nio.MappedByteBufferImpl;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
@@ -64,9 +66,7 @@ import gnu.gcj.RawData;
public class FileChannelImpl extends FileChannel
{
- // GCJ LOCAL: This variable stores a pointer to the memory
- // where the file is mapped.
- RawData map_address;
+ public RawData map_address;
int length;
FileDescriptor fd;
@@ -86,7 +86,7 @@ public class FileChannelImpl extends FileChannel
public FileChannelImpl ()
{
- this (new FileDescriptor (-1), true, null);
+ this (new FileDescriptor (), true, null);
}
private native long implPosition ();
@@ -261,7 +261,7 @@ public class FileChannelImpl extends FileChannel
int cmode = mode.m;
map_address = nio_mmap_file (position, size, cmode);
length = (int) size;
- buf = new MappedByteFileBuffer (this);
+ buf = new MappedByteBufferImpl (this);
return buf;
}
@@ -272,16 +272,10 @@ public class FileChannelImpl extends FileChannel
FileChannelImpl ch = new FileChannelImpl ();
ch.map_address = map_address;
ch.length = (int) length;
- ch.buf = new MappedByteFileBuffer (ch);
+ ch.buf = new MappedByteBufferImpl (ch);
return ch.buf;
}
- public long write (ByteBuffer[] srcs)
- throws IOException
- {
- return write (srcs, 0, srcs.length);
- }
-
/**
* msync with the disk
*/
diff --git a/libjava/gnu/java/nio/MappedByteFileBuffer.java b/libjava/gnu/java/nio/MappedByteFileBuffer.java
deleted file mode 100644
index ec6c83c5d70..00000000000
--- a/libjava/gnu/java/nio/MappedByteFileBuffer.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/* MappedByteFileBuffer.java --
- Copyright (C) 2002 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 gnu.java.nio;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.LongBuffer;
-import java.nio.ShortBuffer;
-import java.nio.MappedByteBuffer;
-import java.io.IOException;
-import gnu.gcj.RawData;
-
-final public class MappedByteFileBuffer
- extends MappedByteBuffer
-{
- RawData map_address;
- boolean readOnly;
- boolean direct;
- public FileChannelImpl ch;
-
- public MappedByteFileBuffer (FileChannelImpl ch) throws IOException
- {
- super ((int) ch.size (), (int) ch.size (), 0, -1);
-
- this.ch = ch;
- map_address = ch.map_address;
-
- try
- {
- long si = ch.size () / 1;
- limit ((int) si);
- }
- catch (IOException e)
- {
- System.err.println ("failed to get size of file-channel's file");
- }
- }
-
- public MappedByteFileBuffer (MappedByteFileBuffer b)
- {
- // FIXME: fix last value
- super (b.capacity (), b.limit (), b.position (), -1);
-
- this.readOnly = b.isReadOnly ();
- this.ch = b.ch;
- map_address = b.map_address;
- limit (b.limit ());
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public static native byte nio_read_Byte_file_channel (FileChannelImpl ch,
- int index, int limit,
- RawData map_address);
- public static native void nio_write_Byte_file_channel (FileChannelImpl ch,
- int index, int limit,
- byte value,
- RawData map_address);
- public static native short nio_read_Short_file_channel (FileChannelImpl ch,
- int index, int limit,
- RawData map_address);
- public static native void nio_write_Short_file_channel (FileChannelImpl ch,
- int index, int limit,
- short value,
- RawData map_address);
- public static native char nio_read_Char_file_channel (FileChannelImpl ch,
- int index, int limit,
- RawData map_address);
- public static native void nio_write_Char_file_channel (FileChannelImpl ch,
- int index, int limit,
- char value,
- RawData map_address);
- public static native int nio_read_Int_file_channel (FileChannelImpl ch,
- int index, int limit,
- RawData map_address);
- public static native void nio_write_Int_file_channel (FileChannelImpl ch,
- int index, int limit,
- int value,
- RawData map_address);
- public static native long nio_read_Long_file_channel (FileChannelImpl ch,
- int index, int limit,
- RawData map_address);
- public static native void nio_write_Long_file_channel (FileChannelImpl ch,
- int index, int limit,
- long value,
- RawData map_address);
- public static native float nio_read_Float_file_channel (FileChannelImpl ch,
- int index, int limit,
- RawData map_address);
- public static native void nio_write_Float_file_channel (FileChannelImpl ch,
- int index, int limit,
- float value,
- RawData map_address);
- public static native double
- nio_read_Double_file_channel (FileChannelImpl ch, int index, int limit,
- RawData map_address);
- public static native void nio_write_Double_file_channel (FileChannelImpl ch,
- int index, int limit,
- double value,
- RawData map_address);
-
- final public byte get ()
- {
- byte a = MappedByteFileBuffer.nio_read_Byte_file_channel (ch, position (),
- limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer put (byte b)
- {
- MappedByteFileBuffer.nio_write_Byte_file_channel (ch, position (), limit (),
- b, map_address);
- position (position () + 1);
- return this;
- }
-
- final public byte get (int index)
- {
- byte a = MappedByteFileBuffer.nio_read_Byte_file_channel (ch, index,
- limit (),
- map_address);
- return a;
- }
-
- final public ByteBuffer put (int index, byte b)
- {
- MappedByteFileBuffer.nio_write_Byte_file_channel (ch, index, limit (), b,
- map_address);
- return this;
- }
-
- final public ByteBuffer compact ()
- {
- return this;
- }
-
- final public boolean isDirect ()
- {
- return direct;
- }
-
- final public ByteBuffer slice ()
- {
- MappedByteFileBuffer A = new MappedByteFileBuffer (this);
- return A;
- }
-
- public ByteBuffer duplicate ()
- {
- return new MappedByteFileBuffer (this);
- }
-
- public ByteBuffer asReadOnlyBuffer ()
- {
- MappedByteFileBuffer b = new MappedByteFileBuffer (this);
- b.readOnly = true;
- return b;
- }
-
- final public ByteBuffer asByteBuffer ()
- {
-// ByteBuffer res = new MappedByteFileBuffer (ch);
-// res.limit ((limit () * 1) / 1);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public byte getByte ()
- {
- byte a = nio_read_Byte_file_channel (ch, position (), limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putByte (byte value)
- {
- nio_write_Byte_file_channel (ch, position (), limit (), value, map_address);
- position (position () + 1);
- return this;
- }
-
- final public byte getByte (int index)
- {
- byte a = nio_read_Byte_file_channel (ch, index, limit(), map_address);
- return a;
- }
-
- final public ByteBuffer putByte (int index, byte value)
- {
- nio_write_Byte_file_channel (ch, index, limit (), value, map_address);
- return this;
- };
-
- final public CharBuffer asCharBuffer ()
- {
-// CharBuffer res = new MappedCharFileBuffer (ch);
-// res.limit ((limit () * 1) / 2);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public char getChar ()
- {
- char a = nio_read_Char_file_channel (ch, position (), limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putChar (char value)
- {
- nio_write_Char_file_channel (ch, position (), limit (), value, map_address);
- position (position () + 1);
- return this;
- }
-
- final public char getChar (int index)
- {
- char a = nio_read_Char_file_channel (ch, index, limit (), map_address);
- return a;
- }
-
- final public ByteBuffer putChar (int index, char value)
- {
- nio_write_Char_file_channel (ch, index, limit (), value, map_address);
- return this;
- };
-
- final public ShortBuffer asShortBuffer ()
- {
-// ShortBuffer res = new MappedShortFileBuffer (ch);
-// res.limit ((limit () * 1) / 2);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public short getShort ()
- {
- short a = nio_read_Short_file_channel (ch, position (), limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putShort (short value)
- {
- nio_write_Short_file_channel (ch, position (), limit (), value,
- map_address);
- position (position () + 1);
- return this;
- }
-
- final public short getShort (int index)
- {
- short a = nio_read_Short_file_channel (ch, index, limit (), map_address);
- return a;
- }
-
- final public ByteBuffer putShort (int index, short value)
- {
- nio_write_Short_file_channel (ch, index, limit (), value, map_address);
- return this;
- }
-
- final public IntBuffer asIntBuffer ()
- {
-// IntBuffer res = new MappedIntFileBuffer (ch);
-// res.limit ((limit () * 1) / 4);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public int getInt ()
- {
- int a = nio_read_Int_file_channel (ch, position (), limit (), map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putInt (int value)
- {
- nio_write_Int_file_channel (ch, position (), limit (), value, map_address);
- position (position () + 1);
- return this;
- }
-
- final public int getInt (int index)
- {
- int a = nio_read_Int_file_channel (ch, index, limit (), map_address);
- return a;
- }
-
- final public ByteBuffer putInt (int index, int value)
- {
- nio_write_Int_file_channel (ch, index, limit (), value, map_address);
- return this;
- }
-
- final public LongBuffer asLongBuffer ()
- {
-// LongBuffer res = new MappedLongFileBuffer (ch);
-// res.limit ((limit () * 1) / 8);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public long getLong ()
- {
- long a = nio_read_Long_file_channel (ch, position (), limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putLong (long value)
- {
- nio_write_Long_file_channel (ch, position (), limit (), value, map_address);
- position (position () + 1);
- return this;
- }
-
- final public long getLong (int index)
- {
- long a = nio_read_Long_file_channel (ch, index, limit (), map_address);
- return a;
- }
-
- final public ByteBuffer putLong (int index, long value)
- {
- nio_write_Long_file_channel (ch, index, limit (), value, map_address);
- return this;
- }
-
- final public FloatBuffer asFloatBuffer ()
- {
-// FloatBuffer res = new MappedFloatFileBuffer (ch);
-// res.limit ((limit () * 1) / 4);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public float getFloat ()
- {
- float a = nio_read_Float_file_channel (ch, position (), limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putFloat (float value)
- {
- nio_write_Float_file_channel (ch, position (), limit (), value,
- map_address);
- position (position () + 1);
- return this;
- }
-
- final public float getFloat (int index)
- {
- float a = nio_read_Float_file_channel (ch, index, limit (), map_address);
- return a;
- }
-
- final public ByteBuffer putFloat (int index, float value)
- {
- nio_write_Float_file_channel (ch, index, limit (), value, map_address);
- return this;
- }
-
- final public DoubleBuffer asDoubleBuffer ()
- {
-// DoubleBuffer res = new MappedDoubleFileBuffer (ch);
-// res.limit ((limit () * 1) / 8);
-// return res;
- throw new Error ("not implemented");
- }
-
- final public double getDouble ()
- {
- double a = nio_read_Double_file_channel (ch, position (), limit (),
- map_address);
- position (position () + 1);
- return a;
- }
-
- final public ByteBuffer putDouble (double value)
- {
- nio_write_Double_file_channel (ch, position (), limit (), value,
- map_address);
- position (position () + 1);
- return this;
- }
-
- final public double getDouble (int index)
- {
- double a = nio_read_Double_file_channel (ch, index, limit (), map_address);
- return a;
- }
-
- final public ByteBuffer putDouble (int index, double value)
- {
- nio_write_Double_file_channel (ch, index, limit (), value, map_address);
- return this;
- }
-}
diff --git a/libjava/gnu/java/nio/SelectorImpl.java b/libjava/gnu/java/nio/SelectorImpl.java
index e3eed255501..9f714cc70c5 100644
--- a/libjava/gnu/java/nio/SelectorImpl.java
+++ b/libjava/gnu/java/nio/SelectorImpl.java
@@ -250,50 +250,31 @@ public class SelectorImpl extends AbstractSelector
protected SelectionKey register (AbstractSelectableChannel ch, int ops,
Object att)
{
-// // filechannel is not selectable ?
-// if (ch instanceof FileChannelImpl)
-// {
-// FileChannelImpl fc = (FileChannelImpl) ch;
-// SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, fc.fd);
-// keys.add (impl);
-// impl.interestOps (ops);
-// impl.attach (att);
-// return impl;
-// }
-// else
-
+ SelectionKeyImpl result;
+
if (ch instanceof SocketChannelImpl)
{
SocketChannelImpl sc = (SocketChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd);
- add (impl);
- impl.interestOps (ops);
- impl.attach (att);
- return impl;
+ result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument
}
else if (ch instanceof DatagramChannelImpl)
{
DatagramChannelImpl dc = (DatagramChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, dc.fd);
- add (impl);
- impl.interestOps (ops);
- impl.attach (att);
- return impl;
+ result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument
}
else if (ch instanceof ServerSocketChannelImpl)
{
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd);
- add (impl);
- impl.interestOps (ops);
- impl.attach (att);
- return impl;
+ result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument
}
else
{
- System.err.println ("INTERNAL ERROR, no known channel type");
+ throw new InternalError ("No known channel type");
}
- return null;
+ add (result);
+ result.interestOps (ops);
+ result.attach (att);
+ return result;
}
}
diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
index 0b3fc66e981..05ad0aefc30 100644
--- a/libjava/gnu/java/nio/ServerSocketChannelImpl.java
+++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
@@ -35,11 +35,13 @@ 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 gnu.java.nio;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
+import java.net.Socket;
import java.net.SocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
@@ -47,27 +49,15 @@ import java.nio.channels.spi.SelectorProvider;
class ServerSocketChannelImpl extends ServerSocketChannel
{
- ServerSocket sock_object;
- int fd;
-// int local_port;
+ ServerSocket serverSocket;
boolean blocking = true;
boolean connected = false;
-// InetSocketAddress sa;
protected ServerSocketChannelImpl (SelectorProvider provider)
throws IOException
{
super (provider);
- fd = SocketChannelImpl.SocketCreate ();
-
- try
- {
- sock_object = new ServerSocket ();
- }
- catch (IOException e)
- {
- System.err.println ("ServerSocket could not be created.");
- }
+ serverSocket = new ServerSocket ();
}
public void finalizer()
@@ -87,25 +77,24 @@ class ServerSocketChannelImpl extends ServerSocketChannel
protected void implCloseSelectableChannel () throws IOException
{
connected = false;
- SocketChannelImpl.SocketClose (fd);
- fd = SocketChannelImpl.SocketCreate ();
+ serverSocket.close();
}
protected void implConfigureBlocking (boolean blocking) throws IOException
{
- this.blocking = blocking;
+ this.blocking = blocking; // FIXME
}
public SocketChannel accept () throws IOException
{
SocketChannelImpl result = new SocketChannelImpl (provider ());
- result.sa = new InetSocketAddress (0);
- //int res = SocketAccept (this,result);
+ Socket socket = serverSocket.accept();
+ //socket.setChannel (result); // FIXME
return result;
}
public ServerSocket socket ()
{
- return sock_object;
+ return serverSocket;
}
}
diff --git a/libjava/gnu/java/nio/SocketChannelImpl.java b/libjava/gnu/java/nio/SocketChannelImpl.java
index 48cf585cb05..b721c6d7d51 100644
--- a/libjava/gnu/java/nio/SocketChannelImpl.java
+++ b/libjava/gnu/java/nio/SocketChannelImpl.java
@@ -35,6 +35,7 @@ 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 gnu.java.nio;
import java.io.IOException;
@@ -50,31 +51,14 @@ import gnu.classpath.Configuration;
public class SocketChannelImpl extends SocketChannel
{
- Socket sock_object;
- int fd;
- int local_port;
+ Socket socket;
boolean blocking = true;
boolean connected = false;
- InetSocketAddress sa;
-
- static native int SocketCreate();
- static native int SocketConnect(int fd, InetAddress addr, int port);
- static native int SocketBind(int fd, InetAddress addr, int port);
- static native int SocketListen(int fd, int backlog);
- static native int SocketAvailable(int fd);
- static native int SocketClose(int fd);
- static native int SocketRead(int fd, byte b[], int off, int len);
- static native int SocketWrite(int fd, byte b[], int off, int len);
-
- public SocketChannelImpl(SelectorProvider provider)
+
+ public SocketChannelImpl (SelectorProvider provider)
{
- super(provider);
- fd = SocketCreate();
-
- if (fd == -1)
- {
- System.err.println("failed to create socket:"+fd);
- }
+ super (provider);
+ socket = new Socket ();
}
public void finalizer()
@@ -94,39 +78,22 @@ public class SocketChannelImpl extends SocketChannel
protected void implCloseSelectableChannel () throws IOException
{
connected = false;
- SocketClose(fd);
- fd = SocketCreate();
+ socket.close();
}
protected void implConfigureBlocking (boolean blocking) throws IOException
{
- if (this.blocking == blocking)
- return;
+ this.blocking = blocking; // FIXME
}
public boolean connect (SocketAddress remote) throws IOException
{
if (connected)
- {
- throw new AlreadyConnectedException ();
- }
-
- // ok, lets connect !
+ throw new AlreadyConnectedException();
- sa = (InetSocketAddress) remote;
-
- InetAddress addr = sa.getAddress();
- int port = sa.getPort();
- int err = SocketConnect(fd, addr, port);
-
- if (err < 0)
- {
- throw new IOException("Connection refused:"+err + ", connect="+err);
- }
-
- local_port = err;
+ socket.connect (remote, 50);
connected = true;
- return blocking;
+ return blocking; // FIXME
}
public boolean finishConnect ()
@@ -141,38 +108,31 @@ public class SocketChannelImpl extends SocketChannel
public boolean isConnectionPending ()
{
- if (blocking)
- return true;
-
- return false;
+ return blocking ? true : false;
}
public Socket socket ()
{
- if (sock_object != null)
- {
- //sock_object.ch = this;
- }
-
- return sock_object;
+ return socket;
}
public int read (ByteBuffer dst) throws IOException
{
+ byte[] data;
int bytes = 0;
- int len = 1024;
- byte[]b = new byte[len];
+ int len = dst.remaining ();
- bytes = SocketRead(fd, b, 0, len);
- dst.put(b, 0, bytes);
-
- if (bytes == 0)
+ if (!dst.hasArray ())
{
- // we've hit eof ?
- return -1;
+ data = new byte [len];
+ dst.get (data, 0, len);
}
-
- return bytes;
+ else
+ {
+ data = dst.array ();
+ }
+
+ return socket.getInputStream().read (data, 0, len);
}
public long read (ByteBuffer[] dsts, int offset, int length)
@@ -191,22 +151,22 @@ public class SocketChannelImpl extends SocketChannel
public int write (ByteBuffer src)
throws IOException
{
+ byte[] data;
int bytes = 0;
- int len = src.position();
-
- if (src.hasArray ())
+ int len = src.remaining ();
+
+ if (!src.hasArray ())
{
- byte[] b = src.array ();
- bytes = SocketWrite (fd, b, 0, len);
+ data = new byte [len];
+ src.get (data, 0, len);
}
else
{
- byte[] b = new byte [len];
- src.get (b, 0, len);
- bytes = SocketWrite (fd, b, 0, len);
+ data = src.array ();
}
-
- return bytes;
+
+ socket.getOutputStream().write (data, 0, len);
+ return len;
}
public long write (ByteBuffer[] srcs, int offset, int length)
diff --git a/libjava/gnu/java/nio/natFileChannelImpl.cc b/libjava/gnu/java/nio/natFileChannelImpl.cc
index 6275b6994d9..6119775d55a 100644
--- a/libjava/gnu/java/nio/natFileChannelImpl.cc
+++ b/libjava/gnu/java/nio/natFileChannelImpl.cc
@@ -73,19 +73,22 @@ gnu::java::nio::FileChannelImpl::implTruncate (jlong size)
}
gnu::gcj::RawData*
-gnu::java::nio::FileChannelImpl::nio_mmap_file (jlong pos, jlong size, jint /*mode*/)
+gnu::java::nio::FileChannelImpl::nio_mmap_file (jlong /*pos*/, jlong /*size*/,
+ jint /*mode*/)
{
throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
}
void
-gnu::java::nio::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData* map_address, jint size)
+gnu::java::nio::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData* /*address*/,
+ jint /*size*/)
{
throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
}
void
-gnu::java::nio::FileChannelImpl::nio_msync (gnu::gcj::RawData* map_address, jint length)
+gnu::java::nio::FileChannelImpl::nio_msync (gnu::gcj::RawData* /*map_address*/,
+ jint /*length*/)
{
throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));
}
diff --git a/libjava/gnu/java/nio/natMappedByteFileBuffer.cc b/libjava/gnu/java/nio/natMappedByteFileBuffer.cc
deleted file mode 100644
index e64e27c8829..00000000000
--- a/libjava/gnu/java/nio/natMappedByteFileBuffer.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-// natMappedByteFileBuffer.cc
-
-/* Copyright (C) 2003 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <config.h>
-
-#include <jvm.h>
-
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#include <gnu/gcj/RawData.h>
-#include <gnu/java/nio/MappedByteFileBuffer.h>
-#include <java/lang/Error.h>
-
-jbyte
-gnu::java::nio::MappedByteFileBuffer::nio_read_Byte_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-jchar
-gnu::java::nio::MappedByteFileBuffer::nio_read_Char_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-jdouble
-gnu::java::nio::MappedByteFileBuffer::nio_read_Double_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-jfloat
-gnu::java::nio::MappedByteFileBuffer::nio_read_Float_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-jint
-gnu::java::nio::MappedByteFileBuffer::nio_read_Int_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-jlong
-gnu::java::nio::MappedByteFileBuffer::nio_read_Long_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-jshort
-gnu::java::nio::MappedByteFileBuffer::nio_read_Short_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Byte_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jbyte,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Char_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jchar,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Double_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jdouble,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Float_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jfloat,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Int_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jint,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Long_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jlong,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
-
-void
-gnu::java::nio::MappedByteFileBuffer::nio_write_Short_file_channel
- (gnu::java::nio::FileChannelImpl*,
- jint, jint, jshort,
- gnu::gcj::RawData*)
-{
- throw new ::java::lang::Error (_Jv_NewStringUTF ("not implemented"));
-}
diff --git a/libjava/gnu/java/nio/natSocketChannelImpl.cc b/libjava/gnu/java/nio/natSocketChannelImpl.cc
deleted file mode 100644
index 480cc94e35a..00000000000
--- a/libjava/gnu/java/nio/natSocketChannelImpl.cc
+++ /dev/null
@@ -1,172 +0,0 @@
-// natSocketChannelImpl.cc
-
-/* Copyright (C) 2002, 2003 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <config.h>
-#include <platform.h>
-
-#include <errno.h>
-
-#include <gcj/cni.h>
-#include <gnu/java/nio/SocketChannelImpl.h>
-#include <java/io/IOException.h>
-#include <java/net/InetAddress.h>
-#include <java/net/SocketException.h>
-
-
-#ifdef DISABLE_JAVA_NET
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketCreate ()
-{
- throw new ::java::io::IOException (JvNewStringUTF ("SocketCreate not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketConnect (jint,
- ::java::net::InetAddress *,
- jint)
-{
- throw new ::java::io::IOException (JvNewStringUTF ("SocketConnect not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketBind (jint, ::java::net::InetAddress *,
- jint)
-{
- throw new ::java::io::IOException (JvNewStringUTF ("SocketBind not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketListen (jint, jint)
-{
- throw new ::java::io::IOException (JvNewStringUTF ("SocketList not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketAvailable (jint)
-{
- throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketAvailable: not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketClose (jint)
-{
- throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketClose: not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketRead (jint, jbyteArray, jint, jint)
-{
- throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketRead: not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketWrite (jint, jbyteArray, jint, jint)
-{
- throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketWrite: not implemented"));
-}
-
-#else // DISABLE_JAVA_NET
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketCreate ()
-{
- int sock = _Jv_socket (AF_INET, SOCK_STREAM, 0);
-
- if (sock < 0)
- {
- char* strerr = strerror (errno);
- throw new ::java::io::IOException (JvNewStringUTF (strerr));
- }
-
- return sock;
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketConnect (jint fd,
- ::java::net::InetAddress *addr,
- jint port)
-{
- throw new ::java::io::IOException (JvNewStringUTF ("SocketConnect not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketBind (jint fd,
- ::java::net::InetAddress *addr,
- jint port)
-{
- throw new ::java::io::IOException (JvNewStringUTF ("SocketBind not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketListen (jint fd, jint backlog)
-{
- int result = _Jv_listen (fd, backlog);
-
- if (result < 0)
- {
- char* strerr = strerror (errno);
- throw new ::java::io::IOException (JvNewStringUTF (strerr));
- }
-
- return result;
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketAvailable (jint /*fd*/)
-{
- throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketAvailable: not implemented"));
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketClose (jint fd)
-{
- int result = _Jv_close (fd);
-
- if (result < 0)
- {
- char* strerr = strerror (errno);
- throw new ::java::io::IOException (JvNewStringUTF (strerr));
- }
-
- return result;
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketRead (jint fd, jbyteArray data,
- jint offset, jint length)
-{
- int result = ::recv (fd, data, offset, length);
-
- if (result < 0)
- {
- char* strerr = strerror (errno);
- throw new ::java::io::IOException (JvNewStringUTF (strerr));
- }
-
- return result;
-}
-
-jint
-gnu::java::nio::SocketChannelImpl::SocketWrite (jint fd, jbyteArray data,
- jint offset, jint length)
-{
- int result = ::send (fd, data, offset, length);
-
- if (result < 0)
- {
- char* strerr = strerror (errno);
- throw new ::java::io::IOException (JvNewStringUTF (strerr));
- }
-
- return result;
-}
-
-#endif // DISABLE_JAVA_NET
diff --git a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java b/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
index 734002aaa65..68d1bfe01d8 100644
--- a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
+++ b/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
@@ -213,7 +213,7 @@ public class UnicastRemoteCall
Object returnValue()
{
- return vec.elementAt(0);
+ return (vec.size() > 0 ? vec.elementAt(0) : null);
}
Object[] getArguments()
diff --git a/libjava/gnu/java/security/x509/X509Certificate.java b/libjava/gnu/java/security/x509/X509Certificate.java
index bb66f2e67b6..1ec2e87c2c6 100644
--- a/libjava/gnu/java/security/x509/X509Certificate.java
+++ b/libjava/gnu/java/security/x509/X509Certificate.java
@@ -41,10 +41,13 @@ package gnu.java.security.x509;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.IOException;
+import java.io.ObjectStreamException;
import java.io.Serializable;
import java.math.BigInteger;
+import java.net.InetAddress;
+
import java.security.AlgorithmParameters;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
@@ -421,7 +424,7 @@ public class X509Certificate extends java.security.cert.X509Certificate
return subjectKey;
}
- public Object writeReplace() throws java.io.ObjectStreamException
+ protected Object writeReplace() throws ObjectStreamException
{
return super.writeReplace();
}
@@ -469,7 +472,7 @@ public class X509Certificate extends java.security.cert.X509Certificate
nameVal = new String((byte[]) name.getValue());
break;
case IP_ADDRESS:
- nameVal = java.net.InetAddress.getByAddress(
+ nameVal = InetAddress.getByAddress(
(byte[]) name.getValue()).getHostAddress();
break;
case REGISTERED_ID:
diff --git a/libjava/gtk.m4 b/libjava/gtk.m4
deleted file mode 100644
index b8cf4024af6..00000000000
--- a/libjava/gtk.m4
+++ /dev/null
@@ -1,194 +0,0 @@
-# Configure paths for GTK+
-# Owen Taylor 97-11-3
-
-dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
-dnl
-AC_DEFUN(AM_PATH_GTK,
-[dnl
-dnl Get the cflags and libraries from the gtk-config script
-dnl
-AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
- gtk_config_prefix="$withval", gtk_config_prefix="")
-AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
- gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
-AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
- , enable_gtktest=yes)
-
- for module in . $4
- do
- case "$module" in
- gthread)
- gtk_config_args="$gtk_config_args gthread"
- ;;
- esac
- done
-
- if test x$gtk_config_exec_prefix != x ; then
- gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
- if test x${GTK_CONFIG+set} != xset ; then
- GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
- fi
- fi
- if test x$gtk_config_prefix != x ; then
- gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
- if test x${GTK_CONFIG+set} != xset ; then
- GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
- fi
- fi
-
- AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
- min_gtk_version=ifelse([$1], ,0.99.7,$1)
- AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
- no_gtk=""
- if test "$GTK_CONFIG" = "no" ; then
- no_gtk=yes
- else
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
- gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_gtktest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$GTK_LIBS $LIBS"
-dnl
-dnl Now check if the installed GTK is sufficiently new. (Also sanity
-dnl checks the results of gtk-config to some extent
-dnl
- rm -f conf.gtktest
- AC_TRY_RUN([
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
- int major, minor, micro;
- char *tmp_version;
-
- system ("touch conf.gtktest");
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_gtk_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_gtk_version");
- exit(1);
- }
-
- if ((gtk_major_version != $gtk_config_major_version) ||
- (gtk_minor_version != $gtk_config_minor_version) ||
- (gtk_micro_version != $gtk_config_micro_version))
- {
- printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
- $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf ("*** was found! If gtk-config was correct, then it is best\n");
- printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
- printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
- }
-#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
- else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
- (gtk_minor_version != GTK_MINOR_VERSION) ||
- (gtk_micro_version != GTK_MICRO_VERSION))
- {
- printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
- GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
- printf("*** library (version %d.%d.%d)\n",
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- }
-#endif /* defined (GTK_MAJOR_VERSION) ... */
- else
- {
- if ((gtk_major_version > major) ||
- ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
- ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
- printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
- printf("***\n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
- printf("*** correct copy of gtk-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_gtk" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$GTK_CONFIG" = "no" ; then
- echo "*** The gtk-config script installed by GTK could not be found"
- echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GTK_CONFIG environment variable to the"
- echo "*** full path to gtk-config."
- else
- if test -f conf.gtktest ; then
- :
- else
- echo "*** Could not run GTK test program, checking why..."
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$LIBS $GTK_LIBS"
- AC_TRY_LINK([
-#include <gtk/gtk.h>
-#include <stdio.h>
-], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GTK or finding the wrong"
- echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***"
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
- echo "*** came with the system with the command"
- echo "***"
- echo "*** rpm --erase --nodeps gtk gtk-devel" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GTK was incorrectly installed"
- echo "*** or that you have moved GTK since it was installed. In the latter case, you"
- echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GTK_CFLAGS=""
- GTK_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(GTK_CFLAGS)
- AC_SUBST(GTK_LIBS)
- rm -f conf.gtktest
-])
diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in
index b5cb5dba9dc..1a38831cb19 100644
--- a/libjava/include/Makefile.in
+++ b/libjava/include/Makefile.in
@@ -87,10 +87,11 @@ GCOBJS = @GCOBJS@
GCSPEC = @GCSPEC@
GCTESTSPEC = @GCTESTSPEC@
GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
GTK_CFLAGS = @GTK_CFLAGS@
-GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
@@ -117,6 +118,7 @@ OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
PLATFORMOBJS = @PLATFORMOBJS@
RANLIB = @RANLIB@
STRIP = @STRIP@
diff --git a/libjava/include/default-signal.h b/libjava/include/default-signal.h
index 492f0cacdc7..1c50f5f7ec3 100644
--- a/libjava/include/default-signal.h
+++ b/libjava/include/default-signal.h
@@ -24,7 +24,6 @@ static void _name (int _dummy)
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
signal (SIGSEGV, catch_segv); \
} \
while (0)
@@ -32,8 +31,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
signal (SIGFPE, catch_fpe); \
} \
while (0)
diff --git a/libjava/include/dwarf2-signal.h b/libjava/include/dwarf2-signal.h
index 7dbcd9dfd2d..43f0cbe914f 100644
--- a/libjava/include/dwarf2-signal.h
+++ b/libjava/include/dwarf2-signal.h
@@ -143,7 +143,6 @@ extern "C" {
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct kernel_sigaction act; \
unsigned long stub = ((unsigned long)&__rt_sigreturn_stub); \
act.k_sa_sigaction = _Jv_catch_segv; \
@@ -158,8 +157,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct kernel_sigaction act; \
unsigned long stub = ((unsigned long)&__rt_sigreturn_stub); \
act.k_sa_sigaction = _Jv_catch_fpe; \
@@ -185,7 +182,6 @@ extern "C" {
do \
{ \
struct kernel_sigaction act; \
- nullp = new java::lang::NullPointerException (); \
act.k_sa_sigaction = _Jv_catch_segv; \
act.k_sa_mask = 0; \
act.k_sa_flags = SA_SIGINFO; \
@@ -197,8 +193,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct kernel_sigaction act; \
act.k_sa_sigaction = _Jv_catch_fpe; \
act.k_sa_mask = 0; \
@@ -212,7 +206,6 @@ while (0)
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct sigaction act; \
act.sa_sigaction = _Jv_catch_segv; \
sigemptyset (&act.sa_mask); \
@@ -224,8 +217,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct sigaction act; \
act.sa_sigaction = _Jv_catch_fpe; \
sigemptyset (&act.sa_mask); \
@@ -250,7 +241,6 @@ while (0)
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct sigaction act; \
act.sa_sigaction = _Jv_catch_segv; \
sigemptyset (&act.sa_mask); \
@@ -262,8 +252,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct sigaction act; \
act.sa_sigaction = _Jv_catch_fpe; \
sigemptyset (&act.sa_mask); \
diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h
index 6ad496c47a4..869a928332c 100644
--- a/libjava/include/i386-signal.h
+++ b/libjava/include/i386-signal.h
@@ -111,7 +111,6 @@ struct old_i386_kernel_sigaction {
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct old_i386_kernel_sigaction kact; \
kact.k_sa_handler = catch_segv; \
kact.k_sa_mask = 0; \
@@ -123,8 +122,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct old_i386_kernel_sigaction kact; \
kact.k_sa_handler = catch_fpe; \
kact.k_sa_mask = 0; \
diff --git a/libjava/include/posix-threads.h b/libjava/include/posix-threads.h
index e28da0b5aaf..6c8dcec933c 100644
--- a/libjava/include/posix-threads.h
+++ b/libjava/include/posix-threads.h
@@ -1,7 +1,7 @@
// -*- c++ -*-
// posix-threads.h - Defines for using POSIX threads.
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation
This file is part of libgcj.
@@ -247,6 +247,8 @@ _Jv_ThreadSelf (void)
#ifdef __FreeBSD__
#include <machine/pal.h>
#define PAL_rduniq PAL_rdunique
+#elif defined (__osf__)
+#include <machine/pal.h>
#else
#include <asm/pal.h>
#endif
diff --git a/libjava/include/posix.h b/libjava/include/posix.h
index ad937536a8e..52cc6d2cfde 100644
--- a/libjava/include/posix.h
+++ b/libjava/include/posix.h
@@ -48,6 +48,19 @@ details. */
#define _Jv_platform_solib_suffix ".so"
#endif
+// Some POSIX systems don't have O_SYNC and O_DYSNC so we define them here.
+// Needed in java/io/natFileDescriptorPosix.cc.
+#if !defined (O_SYNC) && defined (O_FSYNC)
+#define O_SYNC O_FSYNC
+#endif
+#if !defined (O_DSYNC) && defined (O_FSYNC)
+#define O_DSYNC O_FSYNC
+#endif
+// If O_DSYNC is still not defined, use O_SYNC (needed for newlib)
+#if !defined (O_DSYNC)
+#define O_DSYNC O_SYNC
+#endif
+
// Separator for file name components.
#define _Jv_platform_file_separator ((jchar) '/')
// Separator for path components.
diff --git a/libjava/include/s390-signal.h b/libjava/include/s390-signal.h
index 44777c0672b..8b9adae05a0 100644
--- a/libjava/include/s390-signal.h
+++ b/libjava/include/s390-signal.h
@@ -52,7 +52,6 @@ struct old_s390_kernel_sigaction {
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct old_s390_kernel_sigaction kact; \
kact.k_sa_handler = catch_segv; \
kact.k_sa_mask = 0; \
@@ -64,8 +63,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct old_s390_kernel_sigaction kact; \
kact.k_sa_handler = catch_fpe; \
kact.k_sa_mask = 0; \
diff --git a/libjava/include/sparc-signal.h b/libjava/include/sparc-signal.h
index 8694fc598ed..1676d26396b 100644
--- a/libjava/include/sparc-signal.h
+++ b/libjava/include/sparc-signal.h
@@ -45,7 +45,6 @@ while (0)
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct sigaction act; \
act.sa_sigaction = catch_segv; \
act.sa_flags = SA_SIGINFO | SA_NODEFER; \
@@ -57,8 +56,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
struct sigaction act; \
act.sa_flags = SA_SIGINFO | SA_NODEFER; \
act.sa_sigaction = catch_fpe; \
diff --git a/libjava/include/win32-signal.h b/libjava/include/win32-signal.h
index e12c3c36681..8d8a9e2d5bf 100644
--- a/libjava/include/win32-signal.h
+++ b/libjava/include/win32-signal.h
@@ -26,7 +26,6 @@ static void _name (int _dummy)
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
} \
while (0)
@@ -34,8 +33,6 @@ while (0)
#define INIT_FPE \
do \
{ \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
} \
while (0)
diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index e467437bc17..eb034473f9e 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -21,7 +21,7 @@ details. */
#define HANDLE_SEGV 1
#define SIGNAL_HANDLER(_name) \
-static void _Jv_##_name (int, siginfo_t *_sip, void *_p)
+static void _Jv_##_name (int, siginfo_t *, void *_p)
extern "C"
{
@@ -34,16 +34,16 @@ extern "C"
};
}
-#define MAKE_THROW_FRAME(_exception) \
-do \
-{ \
- /* Advance the program counter so that it is after the start of the \
- instruction: the x86_64 exception handler expects \
- the PC to point to the instruction after a call. */ \
- struct ucontext *_uc = (struct ucontext *)_p; \
+#define MAKE_THROW_FRAME(_exception) \
+do \
+{ \
+ /* Advance the program counter so that it is after the start of the \
+ instruction: the x86_64 exception handler expects \
+ the PC to point to the instruction after a call. */ \
+ struct ucontext *_uc = (struct ucontext *)_p; \
volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
- _sc->rip += 2; \
-} \
+ _sc->rip += 2; \
+} \
while (0)
#define RESTORE(name, syscall) RESTORE2 (name, syscall)
@@ -64,7 +64,6 @@ static void restore_rt (void) asm ("__restore_rt");
#define INIT_SEGV \
do \
{ \
- nullp = new java::lang::NullPointerException (); \
struct kernel_sigaction act; \
act.k_sa_sigaction = _Jv_catch_segv; \
sigemptyset (&act.k_sa_mask); \
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
index 989fbc95173..e4085e5f61e 100644
--- a/libjava/java/awt/Button.java
+++ b/libjava/java/awt/Button.java
@@ -41,7 +41,6 @@ package java.awt;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.peer.ButtonPeer;
-import java.awt.peer.ComponentPeer;
import java.lang.reflect.Array;
import java.util.EventListener;
diff --git a/libjava/java/awt/Checkbox.java b/libjava/java/awt/Checkbox.java
index 1268fe86eca..5e80e1661f6 100644
--- a/libjava/java/awt/Checkbox.java
+++ b/libjava/java/awt/Checkbox.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.CheckboxPeer;
-import java.awt.peer.ComponentPeer;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.peer.CheckboxPeer;
import java.io.Serializable;
/**
@@ -307,7 +306,11 @@ addNotify()
super.addNotify ();
}
-/*************************************************************************/
+ public ItemListener[] getItemListeners ()
+ {
+ return (ItemListener[])
+ AWTEventMulticaster.getListeners (item_listeners, ItemListener.class);
+ }
/**
* Adds a new listeners to the list of registered listeners for this object.
diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java
index 4f41568218a..c7df075b310 100644
--- a/libjava/java/awt/CheckboxMenuItem.java
+++ b/libjava/java/awt/CheckboxMenuItem.java
@@ -38,11 +38,10 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.CheckboxMenuItemPeer;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuComponentPeer;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.peer.CheckboxMenuItemPeer;
+import java.awt.peer.MenuItemPeer;
import java.util.EventListener;
/**
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index cb8bb036491..0b5e3d61dad 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -38,13 +38,12 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.ChoicePeer;
-import java.awt.peer.ComponentPeer;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.peer.ChoicePeer;
import java.io.Serializable;
-import java.util.Vector;
import java.util.EventListener;
+import java.util.Vector;
/**
* This class implements a drop down choice list.
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index 9bad369e53f..e27a10e095f 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -41,7 +41,6 @@ import java.awt.event.AWTEventListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.MouseEvent;
-import java.awt.peer.ComponentPeer;
import java.awt.peer.ContainerPeer;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeListener;
diff --git a/libjava/java/awt/Dialog.java b/libjava/java/awt/Dialog.java
index e7c40b14ae4..aba409812aa 100644
--- a/libjava/java/awt/Dialog.java
+++ b/libjava/java/awt/Dialog.java
@@ -39,16 +39,13 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.DialogPeer;
-import java.awt.peer.WindowPeer;
-import java.awt.peer.ContainerPeer;
-import java.awt.peer.ComponentPeer;
/**
- * A dialog box widget class.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
- */
+ * A dialog box widget class.
+ *
+ * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Tom Tromey <tromey@redhat.com>
+ */
public class Dialog extends Window
{
@@ -81,6 +78,11 @@ private boolean resizable;
*/
private String title;
+ /**
+ * This field indicates whether the dialog is undecorated or not.
+ */
+ private boolean undecorated = false;
+
/*************************************************************************/
/*
@@ -395,5 +397,30 @@ paramString()
",resizable=" + resizable + "," + super.paramString());
}
+ /**
+ * Returns whether this frame is undecorated or not.
+ *
+ * @since 1.4
+ */
+ public boolean isUndecorated ()
+ {
+ return undecorated;
+ }
+
+ /**
+ * Disables or enables decorations for this frame. This method can only be
+ * called while the frame is not displayable.
+ *
+ * @exception IllegalComponentStateException If this frame is displayable.
+ *
+ * @since 1.4
+ */
+ public void setUndecorated (boolean undecorated)
+ {
+ if (isDisplayable ())
+ throw new IllegalComponentStateException ();
+
+ this.undecorated = undecorated;
+ }
} // class Dialog
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java
index 90ba6eafcf1..d6204cefd9a 100644
--- a/libjava/java/awt/EventQueue.java
+++ b/libjava/java/awt/EventQueue.java
@@ -37,9 +37,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.*;
-import java.util.EmptyStackException;
+import java.awt.event.InvocationEvent;
import java.lang.reflect.InvocationTargetException;
+import java.util.EmptyStackException;
/* Written using on-line Java 2 Platform Standard Edition v1.3 API
* Specification, as well as "The Java Class Libraries", 2nd edition
@@ -376,4 +376,4 @@ public class EventQueue
// XXX For now, this ONLY does the current time.
return System.currentTimeMillis();
}
-} // class EventQueue
+}
diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java
index 764424c82c3..6ff2b766748 100644
--- a/libjava/java/awt/FileDialog.java
+++ b/libjava/java/awt/FileDialog.java
@@ -40,9 +40,6 @@ package java.awt;
import java.awt.peer.FileDialogPeer;
import java.awt.peer.DialogPeer;
-import java.awt.peer.WindowPeer;
-import java.awt.peer.ContainerPeer;
-import java.awt.peer.ComponentPeer;
import java.io.FilenameFilter;
/**
diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java
index 3723a4528ed..b887d8ea5ed 100644
--- a/libjava/java/awt/Font.java
+++ b/libjava/java/awt/Font.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.awt;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
import java.awt.peer.FontPeer;
import java.io.Serializable;
import java.util.StringTokenizer;
@@ -406,6 +408,8 @@ getStyle()
* Returns a native peer object for this font.
*
* @return A native peer object for this font.
+ *
+ * @deprecated
*/
public FontPeer
getPeer()
@@ -482,5 +486,28 @@ toString()
",size=" + size + ")");
}
+
+ /**
+ * Determines the line metrics for a run of text.
+ *
+ * @param str the text run to be measured.
+ *
+ * @param frc the font rendering parameters that are used for the
+ * measurement. The exact placement and size of text slightly
+ * depends on device-specific characteristics, for instance
+ * the device resolution or anti-aliasing. For this reason,
+ * the returned measurement will only be accurate if the
+ * passed <code>FontRenderContext</code> correctly reflects
+ * the relevant parameters. Hence, <code>frc</code> should be
+ * obtained from the same <code>Graphics2D</code> that will
+ * be used for drawing, and any rendering hints should be set
+ * to the desired values before obtaining <code>frc</code>.
+ *
+ * @see java.awt.Graphics2D#getFontRenderContext()
+ */
+ public LineMetrics getLineMetrics(String str, FontRenderContext frc)
+ {
+ throw new UnsupportedOperationException(); // FIXME
+ }
} // class Font
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
index c6742b0c321..82fed1656ae 100644
--- a/libjava/java/awt/Frame.java
+++ b/libjava/java/awt/Frame.java
@@ -39,9 +39,6 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FramePeer;
-import java.awt.peer.WindowPeer;
-import java.awt.peer.ContainerPeer;
-import java.awt.peer.ComponentPeer;
import java.util.Enumeration;
import java.util.Vector;
@@ -201,6 +198,16 @@ private int state;
*/
private String title = "";
+ /**
+ * Maximized bounds for this frame.
+ */
+ private Rectangle maximizedBounds;
+
+ /**
+ * This field indicates whether the frame is undecorated or not.
+ */
+ private boolean undecorated = false;
+
/*************************************************************************/
/*
@@ -456,14 +463,6 @@ paramString()
return(getClass().getName());
}
-public int
-getState()
-{
- /* FIXME: State might have changed in the peer... Must check. */
-
- return state;
-}
-
public static Frame[]
getFrames()
{
@@ -475,5 +474,86 @@ getFrames()
throw new UnsupportedOperationException(msg);
}
+ public void setState (int state)
+ {
+ int current_state = getExtendedState ();
+
+ if (state == NORMAL
+ && (current_state & ICONIFIED) != 0)
+ setExtendedState (current_state | ICONIFIED);
+
+ if (state == ICONIFIED
+ && (current_state & ~ICONIFIED) == 0)
+ setExtendedState (current_state & ~ICONIFIED);
+ }
+
+ public int getState ()
+ {
+ /* FIXME: State might have changed in the peer... Must check. */
+
+ return (state & ICONIFIED) != 0 ? ICONIFIED : NORMAL;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public void setExtendedState (int state)
+ {
+ this.state = state;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public int getExtendedState ()
+ {
+ return state;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public void setMaximizedBounds (Rectangle maximizedBounds)
+ {
+ this.maximizedBounds = maximizedBounds;
+ }
+
+ /**
+ * Returns the maximized bounds of this frame.
+ *
+ * @return the maximized rectangle, may be null.
+ *
+ * @since 1.4
+ */
+ public Rectangle getMaximizedBounds ()
+ {
+ return maximizedBounds;
+ }
+
+ /**
+ * Returns whether this frame is undecorated or not.
+ *
+ * @since 1.4
+ */
+ public boolean isUndecorated ()
+ {
+ return undecorated;
+ }
+
+ /**
+ * Disables or enables decorations for this frame. This method can only be
+ * called while the frame is not displayable.
+ *
+ * @exception IllegalComponentStateException If this frame is displayable.
+ *
+ * @since 1.4
+ */
+ public void setUndecorated (boolean undecorated)
+ {
+ if (!isDisplayable ())
+ throw new IllegalComponentStateException ();
+
+ this.undecorated = undecorated;
+ }
} // class Frame
diff --git a/libjava/java/awt/Graphics.java b/libjava/java/awt/Graphics.java
index 1b4581b64f0..c225b521a04 100644
--- a/libjava/java/awt/Graphics.java
+++ b/libjava/java/awt/Graphics.java
@@ -441,24 +441,6 @@ fill3DRect(int x, int y, int width, int height, boolean raised)
/*************************************************************************/
/**
- * Draws the outline of the specified rectangle with a 3D effect
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- * @param raised <code>true</code> if the rectangle appears raised,
- * <code>false</code> if it should appear etched.
- */
-public void
-drawRoundRect(int x, int y, int width, int height, boolean raised)
-{
- // FIXME: ???
-}
-
-/*************************************************************************/
-
-/**
* Draws an oval that just fits within the specified rectangle.
*
* @param x The X coordinate of the upper left corner of the rect.
@@ -615,28 +597,6 @@ drawChars(char data[], int offset, int length, int x, int y)
drawString(new String(data, offset, length), x, y);
}
-/*************************************************************************/
-
-/**
- * Draws the specified bytes as text starting at the specified point.
- *
- * @param data The array of bytes to draw.
- * @param offset The offset into the array to start drawing bytes from.
- * @param length The number of bytes to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public void
-drawChars(byte data[], int offset, int length, int x, int y)
-{
- drawString(new String(data, offset, length), x, y);
-}
-
-/*
-public abstract void drawString(AttributedCharacterIterator iterator,
- int x, int y)
-*/
-
public void
drawBytes(byte[] data, int offset, int length, int x, int y)
{
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
index 47f6733da16..37ff4ec5bd1 100644
--- a/libjava/java/awt/Label.java
+++ b/libjava/java/awt/Label.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.LabelPeer;
-import java.awt.peer.ComponentPeer;
import javax.accessibility.Accessible;
/**
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index b57cc89f555..2f4932ef29f 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -38,13 +38,11 @@ exception statement from your version. */
package java.awt;
-import java.io.Serializable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.peer.ListPeer;
-import java.awt.peer.ComponentPeer;
import java.util.EventListener;
import java.util.Vector;
import javax.accessibility.Accessible;
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
index 2ca9467e2b1..52244b9a1c4 100644
--- a/libjava/java/awt/Menu.java
+++ b/libjava/java/awt/Menu.java
@@ -39,11 +39,8 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.MenuPeer;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuComponentPeer;
import java.io.Serializable;
import java.util.Vector;
-import java.util.Enumeration;
/**
* This class represents a pull down or tear off menu in Java's AWT.
@@ -191,21 +188,6 @@ public int countItems ()
/*************************************************************************/
/**
- * Returns the number of items in this menu.
- *
- * @return The number of items in this menu.
- *
- * @deprecated This method is deprecated in favor of <code>getItemCount()</code>.
- */
-public int
-count()
-{
- return(items.size());
-}
-
-/*************************************************************************/
-
-/**
* Returns the item at the specified index.
*
* @return The item at the specified index.
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
index ffef30ecf8c..55e2666af91 100644
--- a/libjava/java/awt/MenuItem.java
+++ b/libjava/java/awt/MenuItem.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuComponentPeer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.peer.MenuItemPeer;
import java.lang.reflect.Array;
import java.util.EventListener;
diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java
index 23336bc6bd6..b84c0d0a6a3 100644
--- a/libjava/java/awt/Panel.java
+++ b/libjava/java/awt/Panel.java
@@ -38,10 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.PanelPeer;
-import java.awt.peer.ContainerPeer;
-import java.awt.peer.ComponentPeer;
-import java.io.Serializable;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java
index 75e565d3e9b..cde79e3f109 100644
--- a/libjava/java/awt/PopupMenu.java
+++ b/libjava/java/awt/PopupMenu.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.PopupMenuPeer;
import java.awt.peer.MenuPeer;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuComponentPeer;
+import java.awt.peer.PopupMenuPeer;
+
/**
* This class implement an AWT popup menu widget
*
diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java
index 451f116e6ce..48a2fbec0d4 100644
--- a/libjava/java/awt/Rectangle.java
+++ b/libjava/java/awt/Rectangle.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
diff --git a/libjava/java/awt/Robot.java b/libjava/java/awt/Robot.java
index cc0ab15c6e9..f633fc0b354 100644
--- a/libjava/java/awt/Robot.java
+++ b/libjava/java/awt/Robot.java
@@ -40,9 +40,13 @@ package java.awt;
import java.awt.image.BufferedImage;
+/**
+ * @since 1.3
+ */
/** STUB CLASS ONLY */
public class Robot
{
+ private GraphicsDevice screen;
private boolean waitForIdle;
private int autoDelay;
@@ -68,6 +72,7 @@ public class Robot
public Robot(GraphicsDevice screen) throws AWTException
{
this();
+ this.screen = screen;
}
public void mouseMove(int x, int y)
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index 930ace7d1b5..ceb45680514 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -39,9 +39,8 @@ exception statement from your version. */
package java.awt;
import java.awt.event.MouseEvent;
-import java.awt.peer.ScrollPanePeer;
-import java.awt.peer.ContainerPeer;
import java.awt.peer.ComponentPeer;
+import java.awt.peer.ScrollPanePeer;
import javax.accessibility.Accessible;
/**
@@ -367,8 +366,8 @@ removeNotify()
* @param index The index at which to add the child, which is ignored
* in this implementation.
*/
-public final void
-addImpl(Component component, Object constraints, int index)
+ protected final void addImpl (Component component, Object constraints,
+ int index)
{
Component[] list = getComponents();
if ((list != null) && (list.length > 0))
@@ -465,7 +464,7 @@ paramString()
*
* @since 1.4
*/
- public boolean eventTypeEnabled (int type)
+ protected boolean eventTypeEnabled (int type)
{
if (type == MouseEvent.MOUSE_WHEEL)
return wheelScrollingEnabled;
diff --git a/libjava/java/awt/ScrollPaneAdjustable.java b/libjava/java/awt/ScrollPaneAdjustable.java
index 13131f9c45b..700d060a0ae 100644
--- a/libjava/java/awt/ScrollPaneAdjustable.java
+++ b/libjava/java/awt/ScrollPaneAdjustable.java
@@ -63,6 +63,8 @@ public class ScrollPaneAdjustable
int blockIncrement = 1;
AdjustmentListener adjustmentListener;
+ private transient boolean valueIsAdjusting = false;
+
ScrollPaneAdjustable (ScrollPane sp, int orientation)
{
this.sp = sp;
@@ -175,5 +177,24 @@ public class ScrollPaneAdjustable
throw new Error ("not implemented");
}
+ /**
+ * Returns true if the value is in the process of changing.
+ *
+ * @since 1.4
+ */
+ public boolean getValueIsAdjusting ()
+ {
+ return valueIsAdjusting;
+ }
+
+ /**
+ * Sets the value of valueIsAdjusting.
+ *
+ * @since 1.4
+ */
+ public void setValueIsAdjusting (boolean valueIsAdjusting)
+ {
+ this.valueIsAdjusting = valueIsAdjusting;
+ }
} // class ScrollPaneAdjustable
diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java
index b9a81a53b0f..85ac117e683 100644
--- a/libjava/java/awt/Scrollbar.java
+++ b/libjava/java/awt/Scrollbar.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.ScrollbarPeer;
-import java.awt.peer.ComponentPeer;
import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent;
+import java.awt.peer.ScrollbarPeer;
import java.util.EventListener;
import javax.accessibility.Accessible;
@@ -119,6 +118,8 @@ private int visibleAmount;
// List of AdjustmentListener's.
private AdjustmentListener adjustment_listeners;
+private transient boolean valueIsAdjusting = false;
+
/*************************************************************************/
/*
@@ -725,5 +726,25 @@ paramString()
{
return (AdjustmentListener[]) getListeners (AdjustmentListener.class);
}
+
+ /**
+ * Returns true if the value is in the process of changing.
+ *
+ * @since 1.4
+ */
+ public boolean getValueIsAdjusting ()
+ {
+ return valueIsAdjusting;
+ }
+
+ /**
+ * Sets the value of valueIsAdjusting.
+ *
+ * @since 1.4
+ */
+ public void setValueIsAdjusting (boolean valueIsAdjusting)
+ {
+ this.valueIsAdjusting = valueIsAdjusting;
+ }
} // class Scrollbar
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
index ec87f87d491..f72475331f4 100644
--- a/libjava/java/awt/TextArea.java
+++ b/libjava/java/awt/TextArea.java
@@ -38,9 +38,8 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.TextAreaPeer;
-import java.awt.peer.TextComponentPeer;
import java.awt.peer.ComponentPeer;
+import java.awt.peer.TextAreaPeer;
/**
* This implements a multi-line text entry widget.
diff --git a/libjava/java/awt/TextField.java b/libjava/java/awt/TextField.java
index 13275e3104a..7575e24d4c1 100644
--- a/libjava/java/awt/TextField.java
+++ b/libjava/java/awt/TextField.java
@@ -41,7 +41,6 @@ package java.awt;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.peer.TextFieldPeer;
-import java.awt.peer.TextComponentPeer;
import java.awt.peer.ComponentPeer;
import java.util.EventListener;
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
index 36615944a20..6fd1413895b 100644
--- a/libjava/java/awt/Toolkit.java
+++ b/libjava/java/awt/Toolkit.java
@@ -496,9 +496,10 @@ public abstract class Toolkit
toolkit = (Toolkit) obj;
return toolkit;
}
- catch (Exception e)
+ catch (Throwable t)
{
- throw new AWTError("Cannot load AWT toolkit: " + e.getMessage());
+ AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name);
+ throw (AWTError) e.initCause(t);
}
}
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index d8a99542eaf..13ae133beee 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -43,29 +43,37 @@ import java.awt.event.WindowFocusListener;
import java.awt.event.WindowListener;
import java.awt.event.WindowStateListener;
import java.awt.peer.WindowPeer;
-import java.awt.peer.ComponentPeer;
import java.util.EventListener;
import java.util.Locale;
import java.util.ResourceBundle;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
/**
* This class represents a top-level window with no decorations.
*
- * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Aaron M. Renn <arenn@urbanophile.com>
* @author Warren Levy <warrenl@cygnus.com>
*/
-public class Window extends Container
+public class Window extends Container implements Accessible
{
+ private static final long serialVersionUID = 4497834738069338734L;
+
// Serialized fields, from Sun's serialization spec.
- // private FocusManager focusMgr; // FIXME: what is this?
private String warningString = null;
- private int state = 0;
private int windowSerializedDataVersion = 0; // FIXME
+ /** @since 1.2 */
+ // private FocusManager focusMgr; // FIXME: what is this?
+ /** @since 1.2 */
+ private int state = 0;
+ /** @since 1.4 */
+ private boolean focusableWindowState = true;
private transient WindowListener windowListener;
private transient WindowFocusListener windowFocusListener;
private transient WindowStateListener windowStateListener;
private transient GraphicsConfiguration graphicsConfiguration;
+ private transient AccessibleContext accessibleContext;
/**
* This (package access) constructor is used by subclasses that want
@@ -76,7 +84,7 @@ public class Window extends Container
Window()
{
setVisible(false);
- setLayout((LayoutManager) new BorderLayout());
+ setLayout(new BorderLayout());
}
Window(GraphicsConfiguration gc)
@@ -84,7 +92,7 @@ public class Window extends Container
this();
graphicsConfiguration = gc;
}
-
+
/**
* Initializes a new instance of <code>Window</code> with the specified
* parent. The window will initially be invisible.
@@ -582,7 +590,7 @@ public class Window extends Container
*/
public void applyResourceBundle(ResourceBundle rb)
{
- // FIXME
+ throw new Error ("Not implemented");
}
/**
@@ -597,12 +605,12 @@ public class Window extends Container
applyResourceBundle(rb);
}
- /*
public AccessibleContext getAccessibleContext()
{
// FIXME
+ //return null;
+ throw new Error ("Not implemented");
}
- */
/**
* Get graphics configuration. The implementation for Window will
@@ -645,4 +653,43 @@ public class Window extends Container
&& event.getID () == WindowEvent.WINDOW_STATE_CHANGED)
windowStateListener.windowStateChanged (event);
}
+
+ /**
+ * Returns whether this <code>Window</code> can get the focus or not.
+ *
+ * @since 1.4
+ */
+ public final boolean isFocusableWindow ()
+ {
+ if (getFocusableWindowState () == false)
+ return false;
+
+ if (this instanceof Dialog
+ || this instanceof Frame)
+ return true;
+
+ // FIXME: Implement more possible cases for returning true.
+
+ return false;
+ }
+
+ /**
+ * Returns the value of the focusableWindowState property.
+ *
+ * @since 1.4
+ */
+ public boolean getFocusableWindowState ()
+ {
+ return focusableWindowState;
+ }
+
+ /**
+ * Sets the value of the focusableWindowState property.
+ *
+ * @since 1.4
+ */
+ public void setFocusableWindowState (boolean focusableWindowState)
+ {
+ this.focusableWindowState = focusableWindowState;
+ }
}
diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java
index 8bf0a8196c0..905bf9cd769 100644
--- a/libjava/java/awt/color/ColorSpace.java
+++ b/libjava/java/awt/color/ColorSpace.java
@@ -128,7 +128,7 @@ public abstract class ColorSpace implements Serializable
public boolean isCS_sRGB()
{
- return false;
+ return type == CS_sRGB;
}
/**
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
index 2603b6e3954..e56f9759a50 100644
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/java/awt/datatransfer/DataFlavor.java
@@ -49,7 +49,6 @@ import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.charset.Charset;
/**
* This class represents a particular data format used for transferring
diff --git a/libjava/java/awt/datatransfer/StringSelection.java b/libjava/java/awt/datatransfer/StringSelection.java
index f6f0116272b..6db74503bb3 100644
--- a/libjava/java/awt/datatransfer/StringSelection.java
+++ b/libjava/java/awt/datatransfer/StringSelection.java
@@ -54,8 +54,10 @@ public class StringSelection implements Transferable, ClipboardOwner
*/
// List of flavors we support
-public static final DataFlavor[] supported_flavors
- = { DataFlavor.plainTextFlavor };
+// XXX: DataFlavor.plainTextFlavor is deprecated.
+static final DataFlavor[] supported_flavors
+ = { DataFlavor.stringFlavor,
+ DataFlavor.plainTextFlavor };
/*************************************************************************/
diff --git a/libjava/java/awt/dnd/DragSource.java b/libjava/java/awt/dnd/DragSource.java
index f6083f674f6..6ce93be277c 100644
--- a/libjava/java/awt/dnd/DragSource.java
+++ b/libjava/java/awt/dnd/DragSource.java
@@ -49,9 +49,6 @@ import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.SystemFlavorMap;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.peer.DragSourceContextPeer;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventListener;
diff --git a/libjava/java/awt/dnd/DragSourceContext.java b/libjava/java/awt/dnd/DragSourceContext.java
index 1760cd02065..02f4ac351cb 100644
--- a/libjava/java/awt/dnd/DragSourceContext.java
+++ b/libjava/java/awt/dnd/DragSourceContext.java
@@ -44,9 +44,6 @@ import java.awt.Image;
import java.awt.Point;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.peer.DragSourceContextPeer;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.TooManyListenersException;
diff --git a/libjava/java/awt/event/HierarchyEvent.java b/libjava/java/awt/event/HierarchyEvent.java
index fcb7db951d2..aadcc71703d 100644
--- a/libjava/java/awt/event/HierarchyEvent.java
+++ b/libjava/java/awt/event/HierarchyEvent.java
@@ -35,8 +35,12 @@ 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 java.awt.event;
-import java.awt.*;
+
+import java.awt.AWTEvent;
+import java.awt.Component;
+import java.awt.Container;
/**
* This class represents an event generated for an ancestor component which
diff --git a/libjava/java/awt/event/MouseWheelEvent.java b/libjava/java/awt/event/MouseWheelEvent.java
index be2366a19ee..88d31a5467a 100644
--- a/libjava/java/awt/event/MouseWheelEvent.java
+++ b/libjava/java/awt/event/MouseWheelEvent.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt.event;
import java.awt.Component;
-import java.awt.Point;
/**
* This event is generated for a mouse wheel rotation. The wheel (the middle
diff --git a/libjava/java/awt/font/GraphicAttribute.java b/libjava/java/awt/font/GraphicAttribute.java
index 377b8da4ccc..b4a92168b5c 100644
--- a/libjava/java/awt/font/GraphicAttribute.java
+++ b/libjava/java/awt/font/GraphicAttribute.java
@@ -63,7 +63,7 @@ public abstract class GraphicAttribute
public abstract float getAdvance ();
- public int getAlignment ()
+ public final int getAlignment ()
{
return alignment;
}
diff --git a/libjava/java/awt/font/ImageGraphicAttribute.java b/libjava/java/awt/font/ImageGraphicAttribute.java
index ca5b95fc633..9f691078d80 100644
--- a/libjava/java/awt/font/ImageGraphicAttribute.java
+++ b/libjava/java/awt/font/ImageGraphicAttribute.java
@@ -45,7 +45,7 @@ import java.awt.geom.Rectangle2D;
/**
* @author Michael Koch
*/
-public class ImageGraphicAttribute extends GraphicAttribute
+public final class ImageGraphicAttribute extends GraphicAttribute
{
private Image image;
diff --git a/libjava/java/awt/im/InputContext.java b/libjava/java/awt/im/InputContext.java
index e4431f9c374..6218847a079 100644
--- a/libjava/java/awt/im/InputContext.java
+++ b/libjava/java/awt/im/InputContext.java
@@ -46,7 +46,6 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.URL;
-import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
diff --git a/libjava/java/awt/im/InputSubset.java b/libjava/java/awt/im/InputSubset.java
index 10755fd49c7..fd03269a891 100644
--- a/libjava/java/awt/im/InputSubset.java
+++ b/libjava/java/awt/im/InputSubset.java
@@ -1,5 +1,5 @@
/* InputSubset.java -- subsets of Unicode important in text input
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,8 +46,8 @@ package java.awt.im;
* @since 1.2
* @status updated to 1.4
*/
-public final class InputSubset extends java.lang.Character.Subset
-{ // XXX - FIXME Use fully qualified extends as gcj 3.1 workaround.
+public final class InputSubset extends Character.Subset
+{
/**
* Constant for all Latin characters, including the characters in the
* BASIC_LATIN, LATIN_1_SUPPLEMENT, LATIN_EXTENDED_A, LATIN_EXTENDED_B
diff --git a/libjava/java/awt/image/BufferedImage.java b/libjava/java/awt/image/BufferedImage.java
index 5d72288f589..1fd7b9bfcf5 100644
--- a/libjava/java/awt/image/BufferedImage.java
+++ b/libjava/java/awt/image/BufferedImage.java
@@ -37,10 +37,15 @@ exception statement from your version. */
package java.awt.image;
-import java.awt.*;
-import java.awt.color.*;
-import java.util.*;
-
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.util.Hashtable;
+import java.util.Vector;
import gnu.java.awt.ComponentDataBlitOp;
/**
diff --git a/libjava/java/awt/image/ColorModel.java b/libjava/java/awt/image/ColorModel.java
index f798ee2c861..767b83f7dd0 100644
--- a/libjava/java/awt/image/ColorModel.java
+++ b/libjava/java/awt/image/ColorModel.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
This file is part of GNU Classpath.
@@ -76,7 +76,7 @@ import gnu.java.awt.Buffers;
* </ul>
*
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones <cbj@gnu.org>
*/
public abstract class ColorModel implements Transparency
{
@@ -113,7 +113,7 @@ public abstract class ColorModel implements Transparency
{
this(bits * 4, // total bits, sRGB, four channels
nArray(bits, 4), // bits for each channel
- null, // FIXME: should be sRGB
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
true, // has alpha
false, // not premultiplied
TRANSLUCENT,
@@ -155,6 +155,11 @@ public abstract class ColorModel implements Transparency
this.transferType = transferType;
}
+ public void finalize()
+ {
+ // Do nothing here.
+ }
+
/**
* Returns the default color model which in Sun's case is an instance
* of <code>DirectColorModel</code>.
@@ -226,7 +231,7 @@ public abstract class ColorModel implements Transparency
*
* @see #getRed(int)
*/
- public abstract int getGreen(int pixel);
+ public abstract int getGreen(int pixel);
/**
* Converts pixel value to sRGB and extract blue int sample
@@ -384,7 +389,7 @@ public abstract class ColorModel implements Transparency
*/
public Object getDataElements(int rgb, Object pixel)
{
- // FIXME: implement
+ // subclasses has to implement this method.
throw new UnsupportedOperationException();
}
@@ -403,8 +408,9 @@ public abstract class ColorModel implements Transparency
* according to the color model. Each component sample is stored
* as a separate element in the array.
*/
- public int[] getComponents(int pixel, int[] components, int offset) {
- // FIXME: implement
+ public int[] getComponents(int pixel, int[] components, int offset)
+ {
+ // subclasses has to implement this method.
throw new UnsupportedOperationException();
}
@@ -426,6 +432,7 @@ public abstract class ColorModel implements Transparency
*/
public int[] getComponents(Object pixel, int[] components, int offset)
{
+ // subclasses has to implement this method.
throw new UnsupportedOperationException();
}
@@ -476,6 +483,19 @@ public abstract class ColorModel implements Transparency
}
/**
+ * Convert unnormalized components to normalized components.
+ *
+ * @since 1.4
+ */
+ public float[] getNormalizedComponents (Object pixel,
+ float[] normComponents,
+ int normOffset)
+ {
+ // subclasses has to implement this method.
+ throw new UnsupportedOperationException();
+ }
+
+ /**
* Converts the unnormalized component samples from an array to a
* pixel value. I.e. composes the pixel from component samples, but
* does not perform any color conversion or scaling of the samples.
@@ -499,14 +519,28 @@ public abstract class ColorModel implements Transparency
*/
public int getDataElement(int[] components, int offset)
{
+ // subclasses has to implement this method.
throw new UnsupportedOperationException();
}
+ public int getDataElement (float[] components, int offset)
+ {
+ // subclasses has to implement this method.
+ throw new UnsupportedOperationException();
+ }
+
public Object getDataElements(int[] components, int offset, Object obj)
{
+ // subclasses has to implement this method.
throw new UnsupportedOperationException();
}
+ public int getDataElements (float[] components, Object obj)
+ {
+ // subclasses has to implement this method.
+ throw new UnsupportedOperationException();
+ }
+
public boolean equals(Object obj)
{
if (!(obj instanceof ColorModel)) return false;
@@ -589,8 +623,9 @@ public abstract class ColorModel implements Transparency
return sm.getTransferType() == transferType;
}
- public void finalize()
+ public final int getTransferType ()
{
+ return transferType;
}
/**
diff --git a/libjava/java/awt/image/ComponentColorModel.java b/libjava/java/awt/image/ComponentColorModel.java
index 090f49d8a0a..cc96ab15516 100644
--- a/libjava/java/awt/image/ComponentColorModel.java
+++ b/libjava/java/awt/image/ComponentColorModel.java
@@ -34,10 +34,11 @@ 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 java.awt.image;
-import java.awt.color.*;
import java.awt.Point;
+import java.awt.color.ColorSpace;
import gnu.java.awt.Buffers;
public class ComponentColorModel extends ColorModel
diff --git a/libjava/java/awt/image/DataBufferByte.java b/libjava/java/awt/image/DataBufferByte.java
index fe2e83beda1..84df5510607 100644
--- a/libjava/java/awt/image/DataBufferByte.java
+++ b/libjava/java/awt/image/DataBufferByte.java
@@ -49,7 +49,7 @@ package java.awt.image;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
-public class DataBufferByte extends DataBuffer
+public final class DataBufferByte extends DataBuffer
{
private byte[] data;
private byte[][] bankData;
diff --git a/libjava/java/awt/image/DataBufferInt.java b/libjava/java/awt/image/DataBufferInt.java
index 1de1f514897..54308fefd02 100644
--- a/libjava/java/awt/image/DataBufferInt.java
+++ b/libjava/java/awt/image/DataBufferInt.java
@@ -49,7 +49,7 @@ package java.awt.image;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
-public class DataBufferInt extends DataBuffer
+public final class DataBufferInt extends DataBuffer
{
private int[] data;
private int[][] bankData;
diff --git a/libjava/java/awt/image/DataBufferUShort.java b/libjava/java/awt/image/DataBufferUShort.java
index a3743fb4749..e11b4ab10b2 100644
--- a/libjava/java/awt/image/DataBufferUShort.java
+++ b/libjava/java/awt/image/DataBufferUShort.java
@@ -49,7 +49,7 @@ package java.awt.image;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
-public class DataBufferUShort extends DataBuffer
+public final class DataBufferUShort extends DataBuffer
{
private short[] data;
private short[][] bankData;
diff --git a/libjava/java/awt/image/DirectColorModel.java b/libjava/java/awt/image/DirectColorModel.java
index b502bdf3bca..9444e831f83 100644
--- a/libjava/java/awt/image/DirectColorModel.java
+++ b/libjava/java/awt/image/DirectColorModel.java
@@ -376,8 +376,8 @@ public class DirectColorModel extends PackedColorModel
return Buffers.getData(buffer);
}
- public ColorModel coerceData(WritableRaster raster,
- boolean isAlphaPremultiplied)
+ public final ColorModel coerceData (WritableRaster raster,
+ boolean isAlphaPremultiplied)
{
if (this.isAlphaPremultiplied == isAlphaPremultiplied)
return this;
diff --git a/libjava/java/awt/image/IndexColorModel.java b/libjava/java/awt/image/IndexColorModel.java
index 3e56f85e79f..066c8682acc 100644
--- a/libjava/java/awt/image/IndexColorModel.java
+++ b/libjava/java/awt/image/IndexColorModel.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt.image;
/**
- *
* @author C. Brian Jones (cbj@gnu.org)
*/
public class IndexColorModel extends ColorModel
@@ -47,7 +46,6 @@ public class IndexColorModel extends ColorModel
private int map_size;
private boolean opaque;
private int trans = -1;
-
private int[] rgb;
/**
@@ -63,7 +61,8 @@ public class IndexColorModel extends ColorModel
* @param blues the blue component of all colors
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues) {
+ byte[] blues)
+ {
this(bits, size, reds, greens, blues, (byte[])null);
}
@@ -81,7 +80,8 @@ public class IndexColorModel extends ColorModel
* @param trans the index of the transparent color
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues, int trans) {
+ byte[] blues, int trans)
+ {
this(bits, size, reds, greens, blues, (byte[])null);
this.trans = trans;
}
@@ -100,26 +100,31 @@ public class IndexColorModel extends ColorModel
* @param alphas the alpha component of all colors
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues, byte[] alphas) {
+ byte[] blues, byte[] alphas)
+ {
super(bits);
map_size = size;
opaque = (alphas == null);
rgb = new int[size];
- if (alphas == null) {
- for (int i = 0; i < size; i++) {
- rgb[i] = 0xff000000 |
- ((reds[i] & 0xff) << 16) |
- ((greens[i] & 0xff) << 8) |
- (blues[i] & 0xff);
+ if (alphas == null)
+ {
+ for (int i = 0; i < size; i++)
+ {
+ rgb[i] = (0xff000000
+ | ((reds[i] & 0xff) << 16)
+ | ((greens[i] & 0xff) << 8)
+ | (blues[i] & 0xff));
}
}
- else {
- for (int i = 0; i < size; i++) {
- rgb[i] = ((alphas[i] & 0xff) << 24 |
- ((reds[i] & 0xff) << 16) |
- ((greens[i] & 0xff) << 8) |
- (blues[i] & 0xff));
+ else
+ {
+ for (int i = 0; i < size; i++)
+ {
+ rgb[i] = ((alphas[i] & 0xff) << 24
+ | ((reds[i] & 0xff) << 16)
+ | ((greens[i] & 0xff) << 8)
+ | (blues[i] & 0xff));
}
}
}
@@ -137,7 +142,8 @@ public class IndexColorModel extends ColorModel
* @param hasAlpha <code>cmap</code> has alpha values
*/
public IndexColorModel(int bits, int size, byte[] cmap, int start,
- boolean hasAlpha) {
+ boolean hasAlpha)
+ {
this(bits, size, cmap, start, hasAlpha, -1);
}
@@ -155,49 +161,56 @@ public class IndexColorModel extends ColorModel
* @param trans the index of the transparent color
*/
public IndexColorModel(int bits, int size, byte[] cmap, int start,
- boolean hasAlpha, int trans) {
+ boolean hasAlpha, int trans)
+ {
super(bits);
map_size = size;
opaque = !hasAlpha;
this.trans = trans;
}
- public final int getMapSize() {
+ public final int getMapSize ()
+ {
return map_size;
}
/**
* Get the index of the transparent color in this color model
*/
- public final int getTransparentPixel() {
+ public final int getTransparentPixel ()
+ {
return trans;
}
/**
* <br>
*/
- public final void getReds(byte[] r) {
+ public final void getReds (byte[] r)
+ {
getComponents( r, 2 );
}
/**
* <br>
*/
- public final void getGreens(byte[] g) {
+ public final void getGreens (byte[] g)
+ {
getComponents( g, 1 );
}
/**
* <br>
*/
- public final void getBlues(byte[] b) {
+ public final void getBlues (byte[] b)
+ {
getComponents( b, 0 );
}
/**
* <br>
*/
- public final void getAlphas(byte[] a) {
+ public final void getAlphas (byte[] a)
+ {
getComponents( a, 3 );
}
@@ -210,54 +223,59 @@ public class IndexColorModel extends ColorModel
/**
* Get the red component of the given pixel.
- * <br>
*/
- public final int getRed(int pixel) {
+ public final int getRed (int pixel)
+ {
if( pixel < map_size )
return (int)(( generateMask( 2 ) & rgb[pixel]) >> (2 * pixel_bits ) );
+
return 0;
}
/**
* Get the green component of the given pixel.
- * <br>
*/
- public final int getGreen(int pixel) {
+ public final int getGreen (int pixel)
+ {
if( pixel < map_size )
return (int)(( generateMask( 1 ) & rgb[pixel]) >> (1 * pixel_bits ) );
+
return 0;
}
/**
* Get the blue component of the given pixel.
- * <br>
*/
- public final int getBlue(int pixel) {
+ public final int getBlue (int pixel)
+ {
if( pixel < map_size )
return (int)( generateMask( 0 ) & rgb[pixel]);
+
return 0;
}
/**
* Get the alpha component of the given pixel.
- * <br>
*/
- public final int getAlpha(int pixel) {
+ public final int getAlpha (int pixel)
+ {
if( pixel < map_size )
return (int)(( generateMask( 3 ) & rgb[pixel]) >> (3 * pixel_bits ) );
+
return 0;
}
/**
* Get the RGB color value of the given pixel using the default
* RGB color model.
- * <br>
*
* @param pixel a pixel value
*/
- public final int getRGB(int pixel) {
+ public final int getRGB (int pixel)
+ {
if( pixel < map_size )
return rgb[pixel];
+
return 0;
}
diff --git a/libjava/java/awt/image/PixelGrabber.java b/libjava/java/awt/image/PixelGrabber.java
index 24dd6d3fc49..b94ed8fbe86 100644
--- a/libjava/java/awt/image/PixelGrabber.java
+++ b/libjava/java/awt/image/PixelGrabber.java
@@ -336,8 +336,12 @@ public class PixelGrabber implements ImageConsumer
}
/**
- @deprecated by getStatus
- */
+ Get the status of the pixel grabbing representing by ImageObserver flags
+
+ @return the status
+
+ @specnote This method is not deprecated but getStatus is preferred to use
+ */
public synchronized int status()
{
return getStatus();
diff --git a/libjava/java/awt/image/Raster.java b/libjava/java/awt/image/Raster.java
index 52fff590850..1b3d2f03ddf 100644
--- a/libjava/java/awt/image/Raster.java
+++ b/libjava/java/awt/image/Raster.java
@@ -34,9 +34,11 @@ 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 java.awt.image;
-import java.awt.*;
+import java.awt.Point;
+import java.awt.Rectangle;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
diff --git a/libjava/java/awt/image/WritableRaster.java b/libjava/java/awt/image/WritableRaster.java
index 887ee8fa1cd..a8864408e70 100644
--- a/libjava/java/awt/image/WritableRaster.java
+++ b/libjava/java/awt/image/WritableRaster.java
@@ -34,9 +34,11 @@ 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 java.awt.image;
-import java.awt.*;
+import java.awt.Point;
+import java.awt.Rectangle;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
@@ -138,10 +140,10 @@ public class WritableRaster extends Raster
public void setRect(Raster srcRaster)
{
- setRect(srcRaster, 0, 0);
+ setRect(0, 0, srcRaster);
}
- public void setRect(Raster srcRaster, int dx, int dy)
+ public void setRect(int dx, int dy, Raster srcRaster)
{
Rectangle targetUnclipped = new Rectangle(srcRaster.getMinX()+dx,
srcRaster.getMinY()+dy,
diff --git a/libjava/java/awt/peer/ComponentPeer.java b/libjava/java/awt/peer/ComponentPeer.java
index e6f79d1d116..fc3c5f9e981 100644
--- a/libjava/java/awt/peer/ComponentPeer.java
+++ b/libjava/java/awt/peer/ComponentPeer.java
@@ -38,9 +38,22 @@ exception statement from your version. */
package java.awt.peer;
-import java.awt.*;
+import java.awt.AWTEvent;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Toolkit;
import java.awt.event.PaintEvent;
-import java.awt.image.*;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.VolatileImage;
public interface ComponentPeer
{
diff --git a/libjava/java/awt/print/PageFormat.java b/libjava/java/awt/print/PageFormat.java
index 7328ab5287e..d9ca50bea30 100644
--- a/libjava/java/awt/print/PageFormat.java
+++ b/libjava/java/awt/print/PageFormat.java
@@ -183,8 +183,7 @@ getImageableWidth()
*
* @return The imageable height of the paper.
*/
-public double
-getImageableHeigth()
+public double getImageableHeight()
{
return(paper.getImageableHeight());
}
diff --git a/libjava/java/awt/print/PrinterJob.java b/libjava/java/awt/print/PrinterJob.java
index ccaf5dcb782..3ad456788e4 100644
--- a/libjava/java/awt/print/PrinterJob.java
+++ b/libjava/java/awt/print/PrinterJob.java
@@ -98,8 +98,7 @@ getCopies();
*
* @param copies The number of copies to be printed.
*/
-public abstract void
-setCopies();
+public abstract void setCopies (int copies);
/*************************************************************************/
diff --git a/libjava/java/beans/beancontext/BeanContextSupport.java b/libjava/java/beans/beancontext/BeanContextSupport.java
index 5af299f5bb1..e9e26cc995a 100644
--- a/libjava/java/beans/beancontext/BeanContextSupport.java
+++ b/libjava/java/beans/beancontext/BeanContextSupport.java
@@ -82,7 +82,7 @@ public class BeanContextSupport extends BeanContextChildSupport
private static final long serialVersionUID = 3289144128843950629L;
}
- protected static class BCSIterator implements Iterator
+ protected static final class BCSIterator implements Iterator
{
public boolean hasNext ()
{
diff --git a/libjava/java/io/BufferedReader.java b/libjava/java/io/BufferedReader.java
index eb2e2d29efe..46c9e417b1b 100644
--- a/libjava/java/io/BufferedReader.java
+++ b/libjava/java/io/BufferedReader.java
@@ -164,6 +164,9 @@ public class BufferedReader extends Reader
*/
public void mark(int readLimit) throws IOException
{
+ if (readLimit < 0)
+ throw new IllegalArgumentException();
+
synchronized (lock)
{
checkStatus();
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java
index da0a9c55f11..ba18a596c2a 100644
--- a/libjava/java/io/File.java
+++ b/libjava/java/io/File.java
@@ -40,6 +40,7 @@ package java.io;
import java.net.MalformedURLException;
import java.net.URL;
+import gnu.classpath.Configuration;
import gnu.gcj.runtime.FileDeleter;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -111,7 +112,6 @@ public class File implements Serializable, Comparable
*/
public static final char pathSeparatorChar = pathSeparator.charAt(0);
-
static final String tmpdir = System.getProperty("java.io.tmpdir");
static int maxPathLen;
static boolean caseSensitive;
@@ -119,7 +119,12 @@ public class File implements Serializable, Comparable
static
{
- init_native();
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary ("javaio");
+ }
+
+ init_native ();
}
// Native function called at class initialization. This should should
@@ -345,7 +350,7 @@ public class File implements Serializable, Comparable
* name. If the directory path name ends in the separator string, another
* separator string will still be appended.
*
- * @param dirname The path to the directory the file resides in
+ * @param dirPath The path to the directory the file resides in
* @param name The name of the file
*/
public File (String dirPath, String name)
@@ -711,7 +716,6 @@ public class File implements Serializable, Comparable
* This native function actually produces the list of file in this
* directory
*/
-
private final native Object[] performList (FilenameFilter filter,
FileFilter fileFilter,
Class result_type);
@@ -984,21 +988,21 @@ public class File implements Serializable, Comparable
// Grab the system temp directory if necessary
if (directory == null)
{
- String dirname = tmpdir;
- if (dirname == null)
- throw
- new IOException ("Cannot determine system temporary directory");
+ String dirname = tmpdir;
+ if (dirname == null)
+ throw new IOException ("Cannot determine system temporary directory");
- directory = new File (dirname);
- if (!directory.exists ())
- throw new IOException ("System temporary directory "
- + directory.getName() + " does not exist.");
- if (!directory.isDirectory())
- throw new IOException ("System temporary directory "
- + directory.getName()
- + " is not really a directory.");
+ directory = new File (dirname);
+ if (!directory.exists ())
+ throw new IOException ("System temporary directory "
+ + directory.getName () + " does not exist.");
+ if (!directory.isDirectory ())
+ throw new IOException ("System temporary directory "
+ + directory.getName ()
+ + " is not really a directory.");
}
+ // Now process the prefix and suffix.
if (prefix.length () < 3)
throw new IllegalArgumentException ("Prefix too short: " + prefix);
@@ -1162,7 +1166,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
- public int compareTo(File other)
+ public int compareTo (File other)
{
if (caseSensitive)
return path.compareTo (other.path);
@@ -1191,10 +1195,9 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
- public int compareTo(Object o)
+ public int compareTo (Object obj)
{
- File other = (File) o;
- return compareTo (other);
+ return compareTo ((File) obj);
}
/*
@@ -1250,6 +1253,9 @@ public class File implements Serializable, Comparable
*/
public boolean setLastModified (long time)
{
+ if (time < 0)
+ throw new IllegalArgumentException("Negative modification time: " + time);
+
checkWrite ();
return performSetLastModified(time);
}
@@ -1276,6 +1282,8 @@ public class File implements Serializable, Comparable
* Add this File to the set of files to be deleted upon normal
* termination.
*
+ * @exception SecurityException If deleting of the file is not allowed
+ *
* @since 1.2
*/
// FIXME: This should use the ShutdownHook API once we implement that.
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java
index f4488dcca93..12543506643 100644
--- a/libjava/java/io/FileOutputStream.java
+++ b/libjava/java/io/FileOutputStream.java
@@ -85,7 +85,8 @@ public class FileOutputStream extends OutputStream
if (s != null)
s.checkWrite(path);
fd = new FileDescriptor (path, (append
- ? FileDescriptor.APPEND
+ ? FileDescriptor.WRITE
+ | FileDescriptor.APPEND
: FileDescriptor.WRITE));
}
diff --git a/libjava/java/io/LineNumberReader.java b/libjava/java/io/LineNumberReader.java
index 9d80745d2fa..12bafe39675 100644
--- a/libjava/java/io/LineNumberReader.java
+++ b/libjava/java/io/LineNumberReader.java
@@ -374,37 +374,22 @@ public class LineNumberReader extends BufferedReader
*
* @exception IOException If an error occurs
*/
- public long skip(long count) throws IOException
+ public long skip (long count) throws IOException
{
if (count <= 0)
return 0;
- long to_do = count;
- do
+
+ int skipped;
+
+ for (skipped = 0; skipped < count; skipped++)
{
- int ch = read();
- if (ch < 0)
- break;
- to_do--;
- if (ch == '\n' || ch == '\r')
- lineNumber++;
- else
- {
- long fence = pos + to_do;
- if (limit < fence)
- fence = limit;
- int end = pos;
- for (; end < fence; end++)
- {
- char endch = buffer[end];
- if (endch == '\n' || endch == '\r')
- break;
- }
- to_do -= end - pos;
- pos = end;
- }
+ int ch = read();
+
+ if (ch < 0)
+ break;
}
- while (to_do > 0);
- return count - to_do;
+
+ return skipped;
}
}
diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java
index e3e2412967f..ef79727c1e1 100644
--- a/libjava/java/io/ObjectInputStream.java
+++ b/libjava/java/io/ObjectInputStream.java
@@ -219,44 +219,7 @@ public class ObjectInputStream extends InputStream
case TC_CLASSDESC:
{
- dumpElement ("CLASSDESC NAME=");
- String name = this.realInputStream.readUTF ();
- dumpElement (name + "; UID=");
- long uid = this.realInputStream.readLong ();
- dumpElement (Long.toHexString(uid) + "; FLAGS=");
- byte flags = this.realInputStream.readByte ();
- dumpElement (Integer.toHexString(flags) + "; FIELD COUNT=");
- short field_count = this.realInputStream.readShort ();
- dumpElementln (Short.toString(field_count));
- ObjectStreamField[] fields = new ObjectStreamField[field_count];
- ObjectStreamClass osc = new ObjectStreamClass (name, uid,
- flags, fields);
- assignNewHandle (osc);
-
- for (int i=0; i < field_count; i++)
- {
- dumpElement (" TYPE CODE=");
- char type_code = (char)this.realInputStream.readByte ();
- dumpElement (type_code + "; FIELD NAME=");
- String field_name = this.realInputStream.readUTF ();
- dumpElementln (field_name);
- String class_name;
-
- if (type_code == 'L' || type_code == '[')
- class_name = (String)readObject ();
- else
- class_name = String.valueOf (type_code);
-
- // There're many cases you can't get java.lang.Class from
- // typename if your context class loader can't load it,
- // then use typename to construct the field
- fields[i] =
- new ObjectStreamField (field_name, class_name);
- }
-
- boolean oldmode = setBlockDataMode (true);
- osc.setClass (resolveClass (osc));
- setBlockDataMode (oldmode);
+ ObjectStreamClass osc = readClassDescriptor ();
if (!is_consumed)
{
@@ -451,6 +414,51 @@ public class ObjectInputStream extends InputStream
return ret_val;
}
+ protected ObjectStreamClass readClassDescriptor ()
+ throws ClassNotFoundException, IOException
+ {
+ dumpElement ("CLASSDESC NAME=");
+ String name = this.realInputStream.readUTF ();
+ dumpElement (name + "; UID=");
+ long uid = this.realInputStream.readLong ();
+ dumpElement (Long.toHexString(uid) + "; FLAGS=");
+ byte flags = this.realInputStream.readByte ();
+ dumpElement (Integer.toHexString(flags) + "; FIELD COUNT=");
+ short field_count = this.realInputStream.readShort ();
+ dumpElementln (Short.toString(field_count));
+ ObjectStreamField[] fields = new ObjectStreamField[field_count];
+ ObjectStreamClass osc = new ObjectStreamClass (name, uid,
+ flags, fields);
+ assignNewHandle (osc);
+
+ for (int i=0; i < field_count; i++)
+ {
+ dumpElement (" TYPE CODE=");
+ char type_code = (char)this.realInputStream.readByte ();
+ dumpElement (type_code + "; FIELD NAME=");
+ String field_name = this.realInputStream.readUTF ();
+ dumpElementln (field_name);
+ String class_name;
+
+ if (type_code == 'L' || type_code == '[')
+ class_name = (String)readObject ();
+ else
+ class_name = String.valueOf (type_code);
+
+ // There're many cases you can't get java.lang.Class from
+ // typename if your context class loader can't load it,
+ // then use typename to construct the field
+ fields[i] =
+ new ObjectStreamField (field_name, class_name);
+ }
+
+ boolean oldmode = setBlockDataMode (true);
+ osc.setClass (resolveClass (osc));
+ setBlockDataMode (oldmode);
+
+ return osc;
+ }
+
/**
* Reads the current objects non-transient, non-static fields from
* the current class from the underlying output stream.
diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java
index cb461231b33..da01b57ba8d 100644
--- a/libjava/java/io/ObjectOutputStream.java
+++ b/libjava/java/io/ObjectOutputStream.java
@@ -224,46 +224,7 @@ public class ObjectOutputStream extends OutputStream
}
if (obj instanceof ObjectStreamClass)
- {
- ObjectStreamClass osc = (ObjectStreamClass)obj;
- realOutput.writeByte (TC_CLASSDESC);
- realOutput.writeUTF (osc.getName ());
- realOutput.writeLong (osc.getSerialVersionUID ());
- assignNewHandle (obj);
-
- int flags = osc.getFlags ();
-
- if (protocolVersion == PROTOCOL_VERSION_2
- && osc.isExternalizable ())
- flags |= SC_BLOCK_DATA;
-
- realOutput.writeByte (flags);
-
- ObjectStreamField[] fields = osc.fields;
- realOutput.writeShort (fields.length);
-
- ObjectStreamField field;
- for (int i=0; i < fields.length; i++)
- {
- field = fields[i];
- realOutput.writeByte (field.getTypeCode ());
- realOutput.writeUTF (field.getName ());
-
- if (! field.isPrimitive ())
- writeObject (field.getTypeString ());
- }
-
- boolean oldmode = setBlockDataMode (true);
- annotateClass (osc.forClass ());
- setBlockDataMode (oldmode);
- realOutput.writeByte (TC_ENDBLOCKDATA);
-
- if (osc.isSerializable ())
- writeObject (osc.getSuper ());
- else
- writeObject (null);
- break;
- }
+ writeClassDescriptor ((ObjectStreamClass) obj);
if ((replacementEnabled || obj instanceof Serializable)
&& ! replaceDone)
@@ -406,6 +367,46 @@ public class ObjectOutputStream extends OutputStream
}
}
+ protected void writeClassDescriptor (ObjectStreamClass osc) throws IOException
+ {
+ realOutput.writeByte (TC_CLASSDESC);
+ realOutput.writeUTF (osc.getName ());
+ realOutput.writeLong (osc.getSerialVersionUID ());
+ assignNewHandle (osc);
+
+ int flags = osc.getFlags ();
+
+ if (protocolVersion == PROTOCOL_VERSION_2
+ && osc.isExternalizable ())
+ flags |= SC_BLOCK_DATA;
+
+ realOutput.writeByte (flags);
+
+ ObjectStreamField[] fields = osc.fields;
+ realOutput.writeShort (fields.length);
+
+ ObjectStreamField field;
+ for (int i=0; i < fields.length; i++)
+ {
+ field = fields[i];
+ realOutput.writeByte (field.getTypeCode ());
+ realOutput.writeUTF (field.getName ());
+
+ if (! field.isPrimitive ())
+ writeObject (field.getTypeString ());
+ }
+
+ boolean oldmode = setBlockDataMode (true);
+ annotateClass (osc.forClass ());
+ setBlockDataMode (oldmode);
+ realOutput.writeByte (TC_ENDBLOCKDATA);
+
+ if (osc.isSerializable ())
+ writeObject (osc.getSuper ());
+ else
+ writeObject (null);
+ }
+
/**
Writes the current objects non-transient, non-static fields from
the current class to the underlying output stream.
diff --git a/libjava/java/io/ObjectStreamField.java b/libjava/java/io/ObjectStreamField.java
index 56f0d1aa872..9edb1dc4cc4 100644
--- a/libjava/java/io/ObjectStreamField.java
+++ b/libjava/java/io/ObjectStreamField.java
@@ -41,13 +41,25 @@ package java.io;
import gnu.java.lang.reflect.TypeSignature;
// XXX doc
-public class ObjectStreamField implements java.lang.Comparable
+public class ObjectStreamField implements Comparable
{
+ private String name;
+ private Class type;
+ private String typename;
+ private int offset = -1; // XXX make sure this is correct
+ private boolean unshared;
+
public ObjectStreamField (String name, Class type)
{
+ this (name, type, false);
+ }
+
+ public ObjectStreamField (String name, Class type, boolean unshared)
+ {
this.name = name;
this.type = type;
this.typename = TypeSignature.getEncodingOfClass(type);
+ this.unshared = unshared;
}
/**
@@ -99,6 +111,11 @@ public class ObjectStreamField implements java.lang.Comparable
offset = off;
}
+ public boolean isUnshared ()
+ {
+ return unshared;
+ }
+
public boolean isPrimitive ()
{
return type.isPrimitive ();
@@ -123,10 +140,5 @@ public class ObjectStreamField implements java.lang.Comparable
{
return "ObjectStreamField< " + type + " " + name + " >";
}
-
- private String name;
- private Class type;
- private String typename;
- private int offset = -1; // XXX make sure this is correct
}
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java
index e4ecbdbab8f..8a47fdfc651 100644
--- a/libjava/java/io/OutputStreamWriter.java
+++ b/libjava/java/io/OutputStreamWriter.java
@@ -215,7 +215,7 @@ public class OutputStreamWriter extends Writer
private void writeChars(char[] buf, int offset, int count)
throws IOException
{
- while (count > 0)
+ while (count > 0 || converter.havePendingBytes())
{
// We must flush if out.count == out.buf.length.
// It is probably a good idea to flush if out.buf is almost full.
@@ -228,6 +228,13 @@ public class OutputStreamWriter extends Writer
}
converter.setOutput(out.buf, out.count);
int converted = converter.write(buf, offset, count);
+ // Flush if we cannot make progress.
+ if (converted == 0 && out.count == converter.count)
+ {
+ out.flush();
+ if (out.count != 0)
+ throw new IOException("unable to flush output byte buffer");
+ }
offset += converted;
count -= converted;
out.count = converter.count;
diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java
index 418eea178cd..94800150870 100644
--- a/libjava/java/io/PrintStream.java
+++ b/libjava/java/io/PrintStream.java
@@ -1,5 +1,5 @@
/* PrintStream.java -- OutputStream for printing output
- Copyright (C) 1998,2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.io;
-import gnu.gcj.convert.UnicodeToBytes;
-
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Believed complete and correct to 1.3
@@ -53,34 +51,13 @@ import gnu.gcj.convert.UnicodeToBytes;
* created so that any writes are automatically flushed to the underlying
* output sink when the current line is terminated.
* <p>
- * <b>Note that this class is deprecated</b>. It exists for backward
- * compatibility only. New code should be written to use
- * <code>PrintWriter</code> instead.
- * <p>
* This class converts char's into byte's using the system default encoding.
*
- * @deprecated
- *
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Tom Tromey <tromey@cygnus.com>
*/
public class PrintStream extends FilterOutputStream
{
- /* Notice the implementation is quite similar to OutputStreamWriter.
- * This leads to some minor duplication, because neither inherits
- * from the other, and we want to maximize performance. */
-
- // Line separator string.
- private static final char[] line_separator
- = System.getProperty("line.separator").toCharArray();
-
- UnicodeToBytes converter;
-
- // Work buffer of characters for converter.
- char[] work = new char[100];
- // Work buffer of bytes where we temporarily keep converter output.
- byte[] work_bytes = new byte[100];
-
/**
* This boolean indicates whether or not an error has ever occurred
* on this stream.
@@ -94,17 +71,24 @@ public class PrintStream extends FilterOutputStream
private boolean auto_flush;
/**
+ * The PrintWriter instance this object writes to
+ */
+ private PrintWriter pw;
+
+ /**
+ * Lets us know if the stream is closed
+ */
+ private boolean closed;
+
+ /**
* This method intializes a new <code>PrintStream</code> object to write
- * to the specified output sink. Note that this class is deprecated in
- * favor of <code>PrintWriter</code>.
+ * to the specified output sink.
*
* @param out The <code>OutputStream</code> to write to.
- *
- * @deprecated
*/
public PrintStream (OutputStream out)
{
- this(out, false);
+ this (out, false);
}
/**
@@ -113,19 +97,38 @@ public class PrintStream extends FilterOutputStream
* functionality to be specified where the stream will be flushed after
* every line is terminated or newline character is written.
* <p>
- * Note that this class is deprecated in favor of <code>PrintWriter</code>.
*
* @param out The <code>OutputStream</code> to write to.
* @param auto_flush <code>true</code> to flush the stream after every
* line, <code>false</code> otherwise
- *
- * @deprecated
*/
public PrintStream (OutputStream out, boolean auto_flush)
{
- super(out);
+ super (out);
- converter = UnicodeToBytes.getDefaultEncoder();
+ pw = new PrintWriter (out, auto_flush);
+ this.auto_flush = auto_flush;
+ }
+
+ /**
+ * This method intializes a new <code>PrintStream</code> object to write
+ * to the specified output sink. This constructor also allows "auto-flush"
+ * functionality to be specified where the stream will be flushed after
+ * every line is terminated or newline character is written.
+ * <p>
+ *
+ * @param out The <code>OutputStream</code> to write to.
+ * @param auto_flush <code>true</code> to flush the stream after every
+ * line, <code>false</code> otherwise
+ * @param encoding The name of the character encoding to use for this
+ * object.
+ */
+ public PrintStream (OutputStream out, boolean auto_flush, String encoding)
+ throws UnsupportedEncodingException
+ {
+ super (out);
+
+ pw = new PrintWriter (new OutputStreamWriter (out, encoding), auto_flush);
this.auto_flush = auto_flush;
}
@@ -140,8 +143,10 @@ public class PrintStream extends FilterOutputStream
*/
public boolean checkError ()
{
- flush();
- return error_occurred;
+ if (!closed)
+ flush ();
+
+ return error_occurred | pw.checkError ();
}
/**
@@ -158,19 +163,8 @@ public class PrintStream extends FilterOutputStream
*/
public void close ()
{
- try
- {
- flush();
- out.close();
- }
- catch (InterruptedIOException iioe)
- {
- Thread.currentThread().interrupt();
- }
- catch (IOException e)
- {
- setError ();
- }
+ pw.close ();
+ closed = true;
}
/**
@@ -179,85 +173,7 @@ public class PrintStream extends FilterOutputStream
*/
public void flush ()
{
- try
- {
- out.flush();
- }
- catch (InterruptedIOException iioe)
- {
- Thread.currentThread().interrupt();
- }
- catch (IOException e)
- {
- setError ();
- }
- }
-
- private synchronized void print (String str, boolean println)
- {
- try
- {
- writeChars(str, 0, str.length());
- if (println)
- writeChars(line_separator, 0, line_separator.length);
- if (auto_flush)
- flush();
- }
- catch (InterruptedIOException iioe)
- {
- Thread.currentThread().interrupt();
- }
- catch (IOException e)
- {
- setError ();
- }
- }
-
- private synchronized void print (char[] chars, int pos, int len,
- boolean println)
- {
- try
- {
- writeChars(chars, pos, len);
- if (println)
- writeChars(line_separator, 0, line_separator.length);
- if (auto_flush)
- flush();
- }
- catch (InterruptedIOException iioe)
- {
- Thread.currentThread().interrupt();
- }
- catch (IOException e)
- {
- setError ();
- }
- }
-
- private void writeChars(char[] buf, int offset, int count)
- throws IOException
- {
- while (count > 0)
- {
- converter.setOutput(work_bytes, 0);
- int converted = converter.write(buf, offset, count);
- offset += converted;
- count -= converted;
- out.write(work_bytes, 0, converter.count);
- }
- }
-
- private void writeChars(String str, int offset, int count)
- throws IOException
- {
- while (count > 0)
- {
- converter.setOutput(work_bytes, 0);
- int converted = converter.write(str, offset, count, work);
- offset += converted;
- count -= converted;
- out.write(work_bytes, 0, converter.count);
- }
+ pw.flush();
}
/**
@@ -269,7 +185,7 @@ public class PrintStream extends FilterOutputStream
*/
public void print (boolean bool)
{
- print(String.valueOf(bool), false);
+ print (String.valueOf (bool));
}
/**
@@ -280,7 +196,7 @@ public class PrintStream extends FilterOutputStream
*/
public void print (int inum)
{
- print(String.valueOf(inum), false);
+ print (String.valueOf (inum));
}
/**
@@ -291,7 +207,7 @@ public class PrintStream extends FilterOutputStream
*/
public void print (long lnum)
{
- print(String.valueOf(lnum), false);
+ print (String.valueOf (lnum));
}
/**
@@ -302,7 +218,7 @@ public class PrintStream extends FilterOutputStream
*/
public void print (float fnum)
{
- print(String.valueOf(fnum), false);
+ print (String.valueOf (fnum));
}
/**
@@ -313,7 +229,7 @@ public class PrintStream extends FilterOutputStream
*/
public void print (double dnum)
{
- print(String.valueOf(dnum), false);
+ print (String.valueOf (dnum));
}
/**
@@ -325,7 +241,9 @@ public class PrintStream extends FilterOutputStream
*/
public void print (Object obj)
{
- print(obj == null ? "null" : obj.toString(), false);
+ // Don't call pw directly. Convert to String so we scan for newline
+ // characters on auto-flush;
+ print (String.valueOf (obj));
}
/**
@@ -336,7 +254,12 @@ public class PrintStream extends FilterOutputStream
*/
public void print (String str)
{
- print(str == null ? "null" : str, false);
+ pw.print (str);
+
+ if (auto_flush)
+ if ((str.indexOf ('\r') != -1)
+ || (str.indexOf ('\n') != -1))
+ flush ();
}
/**
@@ -345,10 +268,9 @@ public class PrintStream extends FilterOutputStream
*
* @param ch The <code>char</code> value to be printed
*/
- public synchronized void print (char ch)
+ public void print (char ch)
{
- work[0] = ch;
- print(work, 0, 1, false);
+ print (String.valueOf (ch));
}
/**
@@ -359,7 +281,7 @@ public class PrintStream extends FilterOutputStream
*/
public void print (char[] charArray)
{
- print(charArray, 0, charArray.length, false);
+ pw.print (charArray);
}
/**
@@ -369,7 +291,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println ()
{
- print(line_separator, 0, line_separator.length, false);
+ pw.println();
}
/**
@@ -383,7 +305,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (boolean bool)
{
- print(String.valueOf(bool), true);
+ println (String.valueOf (bool));
}
/**
@@ -396,7 +318,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (int inum)
{
- print(String.valueOf(inum), true);
+ println (String.valueOf (inum));
}
/**
@@ -409,7 +331,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (long lnum)
{
- print(String.valueOf(lnum), true);
+ println (String.valueOf (lnum));
}
/**
@@ -422,7 +344,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (float fnum)
{
- print(String.valueOf(fnum), true);
+ println (String.valueOf (fnum));
}
/**
@@ -435,7 +357,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (double dnum)
{
- print(String.valueOf(dnum), true);
+ println (String.valueOf (dnum));
}
/**
@@ -449,7 +371,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (Object obj)
{
- print(obj == null ? "null" : obj.toString(), true);
+ println (String.valueOf (obj));
}
/**
@@ -462,7 +384,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (String str)
{
- print (str == null ? "null" : str, true);
+ pw.println (str);
}
/**
@@ -473,10 +395,9 @@ public class PrintStream extends FilterOutputStream
*
* @param ch The <code>char</code> value to be printed
*/
- public synchronized void println (char ch)
+ public void println (char ch)
{
- work[0] = ch;
- print(work, 0, 1, true);
+ println (String.valueOf (ch));
}
/**
@@ -489,7 +410,7 @@ public class PrintStream extends FilterOutputStream
*/
public void println (char[] charArray)
{
- print(charArray, 0, charArray.length, true);
+ pw.println (charArray);
}
/**
@@ -501,20 +422,9 @@ public class PrintStream extends FilterOutputStream
*/
public void write (int oneByte)
{
- try
- {
- out.write(oneByte);
- if (auto_flush && oneByte == '\n')
- flush();
- }
- catch (InterruptedIOException iioe)
- {
- Thread.currentThread().interrupt();
- }
- catch (IOException e)
- {
- setError ();
- }
+ byte[] data = new byte [1];
+ data [0] = (byte) (oneByte & 0xff);
+ write (data, 0, 1);
}
/**
@@ -527,20 +437,26 @@ public class PrintStream extends FilterOutputStream
*/
public void write (byte[] buffer, int offset, int len)
{
+ // We actually have to implement this method too. Flush first so that
+ // things get written in the right order.
+ flush();
+
try
{
- out.write (buffer, offset, len);
+ out.write (buffer, offset, len);
- if (auto_flush)
- flush();
- }
- catch (InterruptedIOException iioe)
- {
- Thread.currentThread().interrupt();
+ if (auto_flush)
+ for (int i = offset; i < len; i++)
+ if ((buffer [i] == '\r')
+ || (buffer [i] == '\n'))
+ {
+ flush ();
+ break;
+ }
}
catch (IOException e)
{
- setError ();
+ setError ();
}
}
diff --git a/libjava/java/io/PushbackInputStream.java b/libjava/java/io/PushbackInputStream.java
index ffc582f9ecf..778babd2c0b 100644
--- a/libjava/java/io/PushbackInputStream.java
+++ b/libjava/java/io/PushbackInputStream.java
@@ -74,8 +74,8 @@ public class PushbackInputStream extends FilterInputStream
/**
* This method initializes a <code>PushbackInputStream</code> to
- * read from the * specified subordinate <code>InputStream</code>
- * with a default pushback buffer * size of 1.
+ * read from the specified subordinate <code>InputStream</code>
+ * with a default pushback buffer size of 1.
*
* @param in The subordinate stream to read from
*/
@@ -302,7 +302,7 @@ public class PushbackInputStream extends FilterInputStream
* <code>skip</code> method on the underlying <code>InputStream</code> to
* skip additional bytes if necessary.
*
- * @param num_bytes The requested number of bytes to skip
+ * @param numBytes The requested number of bytes to skip
*
* @return The actual number of bytes skipped.
*
diff --git a/libjava/java/io/RandomAccessFile.java b/libjava/java/io/RandomAccessFile.java
index 0ff2ff65ce9..08fedb0e095 100644
--- a/libjava/java/io/RandomAccessFile.java
+++ b/libjava/java/io/RandomAccessFile.java
@@ -488,8 +488,6 @@ public class RandomAccessFile implements DataOutput, DataInput
* @exception IOException If an error occurs
*
* @see DataOutput
- *
- * @deprecated
*/
public final String readLine () throws IOException
{
@@ -962,7 +960,7 @@ public class RandomAccessFile implements DataOutput, DataInput
* A file channel must be created by first creating an instance of
* Input/Output/RandomAccessFile and invoking the getChannel() method on it.
*/
- public synchronized FileChannel getChannel ()
+ public final synchronized FileChannel getChannel ()
{
if (ch == null)
ch = new FileChannelImpl (fd, true, this);
diff --git a/libjava/java/io/natFileDescriptorPosix.cc b/libjava/java/io/natFileDescriptorPosix.cc
index b8892af6059..2ad2d9dce77 100644
--- a/libjava/java/io/natFileDescriptorPosix.cc
+++ b/libjava/java/io/natFileDescriptorPosix.cc
@@ -105,13 +105,11 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
}
}
-/* FIXME: comment this out until its better tested/implemented
if ((jflags & SYNC))
flags |= O_SYNC;
if ((jflags & DSYNC))
flags |= O_DSYNC;
-*/
int fd = ::open (buf, flags, mode);
if (fd == -1 && errno == EMFILE)
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index 65c50bb11ef..5ae70cdba95 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -258,7 +258,6 @@ public abstract class ClassLoader
* @param link if the class should be linked.
* @return the class loaded.
* @exception java.lang.ClassNotFoundException
- * @deprecated
*/
protected Class loadClass(String name, boolean link)
throws java.lang.ClassNotFoundException
diff --git a/libjava/java/lang/System.java b/libjava/java/lang/System.java
index 2e7c031b16c..1d27dfca331 100644
--- a/libjava/java/lang/System.java
+++ b/libjava/java/lang/System.java
@@ -38,7 +38,13 @@ exception statement from your version. */
package java.lang;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintStream;
import java.util.Properties;
import java.util.PropertyPermission;
import gnu.classpath.Configuration;
@@ -184,6 +190,7 @@ public final class System
SecurityManager sm = Runtime.securityManager; // Be thread-safe.
if (sm != null)
sm.checkPermission(new RuntimePermission("setIO"));
+
setOut0(out);
}
diff --git a/libjava/java/lang/natString.cc b/libjava/java/lang/natString.cc
index 8c9789e80b5..98309cfe62e 100644
--- a/libjava/java/lang/natString.cc
+++ b/libjava/java/lang/natString.cc
@@ -602,12 +602,12 @@ java::lang::String::getBytes (jstring enc)
jint offset = 0;
gnu::gcj::convert::UnicodeToBytes *converter
= gnu::gcj::convert::UnicodeToBytes::getEncoder(enc);
- while (todo > 0)
+ while (todo > 0 || converter->havePendingBytes())
{
converter->setOutput(buffer, bufpos);
int converted = converter->write(this, offset, todo, NULL);
bufpos = converter->count;
- if (converted == 0)
+ if (converted == 0 && bufpos == converter->count)
{
buflen *= 2;
jbyteArray newbuffer = JvNewByteArray(buflen);
@@ -615,10 +615,10 @@ java::lang::String::getBytes (jstring enc)
buffer = newbuffer;
}
else
- {
- offset += converted;
- todo -= converted;
- }
+ bufpos = converter->count;
+
+ offset += converted;
+ todo -= converted;
}
converter->done ();
if (bufpos == buflen)
diff --git a/libjava/java/lang/natVMSecurityManager.cc b/libjava/java/lang/natVMSecurityManager.cc
index 7b88e8a4a8c..8fd2875aedc 100644
--- a/libjava/java/lang/natVMSecurityManager.cc
+++ b/libjava/java/lang/natVMSecurityManager.cc
@@ -28,9 +28,9 @@ java::lang::VMSecurityManager::getClassContext ()
int maxlen = t->length();
int len = 0;
- while (len < maxlen)
+ for (int i=0; i<maxlen; i++)
{
- jclass klass = t->classAt(len);
+ jclass klass = t->classAt(i);
if (klass != NULL && klass != &java::lang::VMSecurityManager::class$
&& klass != &java::lang::SecurityManager::class$)
++len;
@@ -41,9 +41,9 @@ java::lang::VMSecurityManager::getClassContext ()
NULL);
len = 0;
- while (len < maxlen)
+ for (int i=0; i<maxlen; i++)
{
- jclass klass = t->classAt(len);
+ jclass klass = t->classAt(i);
if (klass != NULL && klass != &java::lang::VMSecurityManager::class$
&& klass != &java::lang::SecurityManager::class$)
elements(result)[len++] = klass;
diff --git a/libjava/java/lang/w_exp.c b/libjava/java/lang/w_exp.c
index ae792a84642..0086134b2c0 100644
--- a/libjava/java/lang/w_exp.c
+++ b/libjava/java/lang/w_exp.c
@@ -1,136 +1,4 @@
+#ifndef _IEEE_LIBM
-/* @(#)w_exp.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-/*
-FUNCTION
- <<exp>>, <<expf>>---exponential
-INDEX
- exp
-INDEX
- expf
-
-ANSI_SYNOPSIS
- #include <math.h>
- double exp(double <[x]>);
- float expf(float <[x]>);
-
-TRAD_SYNOPSIS
- #include <math.h>
- double exp(<[x]>);
- double <[x]>;
-
- float expf(<[x]>);
- float <[x]>;
-
-DESCRIPTION
- <<exp>> and <<expf>> calculate the exponential of <[x]>, that is,
- @ifinfo
- e raised to the power <[x]> (where e
- @end ifinfo
- @tex
- $e^x$ (where $e$
- @end tex
- is the base of the natural system of logarithms, approximately 2.71828).
-
- You can use the (non-ANSI) function <<matherr>> to specify
- error handling for these functions.
-
-RETURNS
- On success, <<exp>> and <<expf>> return the calculated value.
- If the result underflows, the returned value is <<0>>. If the
- result overflows, the returned value is <<HUGE_VAL>>. In
- either case, <<errno>> is set to <<ERANGE>>.
-
-PORTABILITY
- <<exp>> is ANSI C. <<expf>> is an extension.
-
-*/
-
-/*
- * wrapper exp(x)
- */
-
-#include "fdlibm.h"
-#include <errno.h>
-
-#ifndef _DOUBLE_IS_32BITS
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
-u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
-
-#ifdef __STDC__
- double exp(double x) /* wrapper exp */
-#else
- double exp(x) /* wrapper exp */
- double x;
#endif
-{
-#ifdef _IEEE_LIBM
- return __ieee754_exp(x);
-#else
- double z;
- struct exception exc;
- z = __ieee754_exp(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(finite(x)) {
- if(x>o_threshold) {
- /* exp(finite) overflow */
-#ifndef HUGE_VAL
-#define HUGE_VAL inf
- double inf = 0.0;
-
- SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */
-#endif
- exc.type = OVERFLOW;
- exc.name = "exp";
- exc.err = 0;
- exc.arg1 = exc.arg2 = x;
- if (_LIB_VERSION == _SVID_)
- exc.retval = HUGE;
- else
- exc.retval = HUGE_VAL;
- if (_LIB_VERSION == _POSIX_)
- errno = ERANGE;
- else if (!matherr(&exc)) {
- errno = ERANGE;
- }
- if (exc.err != 0)
- errno = exc.err;
- return exc.retval;
- } else if(x<u_threshold) {
- /* exp(finite) underflow */
- exc.type = UNDERFLOW;
- exc.name = "exp";
- exc.err = 0;
- exc.arg1 = exc.arg2 = x;
- exc.retval = 0.0;
- if (_LIB_VERSION == _POSIX_)
- errno = ERANGE;
- else if (!matherr(&exc)) {
- errno = ERANGE;
- }
- if (exc.err != 0)
- errno = exc.err;
- return exc.retval;
- }
- }
- return z;
-#endif
-}
-
-#endif /* defined(_DOUBLE_IS_32BITS) */
diff --git a/libjava/java/net/Authenticator.java b/libjava/java/net/Authenticator.java
index e1e322b3bb1..7592b525a50 100644
--- a/libjava/java/net/Authenticator.java
+++ b/libjava/java/net/Authenticator.java
@@ -1,5 +1,5 @@
/* Authenticator.java -- Abstract class for obtaining authentication info
- Copyright (C) 1998,2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,12 +43,13 @@ package java.net;
* some network operations (such as hitting a password protected
* web site).
* <p>
- * To make use of this feature, a programmer must create a subclass of
- * Authenticator that knows how to obtain the necessary info. An example
+ * To make use of this feature, a programmer must create a subclass
+ * that knows how to obtain the necessary info. An example
* would be a class that popped up a dialog box to prompt the user.
- * After creating an instance of that subclass, the static setDefault
- * method of this class is called to set up that instance as the object
- * to use on subsequent calls to obtain authorization.
+ * After creating an instance of that subclass, the static
+ * <code>setDefault</code> method of this class is called to set up
+ * that instance as the object to use on subsequent calls to obtain
+ * authorization.
*
* @since 1.2
*
@@ -57,280 +58,252 @@ package java.net;
*/
public abstract class Authenticator
{
-
-/*************************************************************************/
-
-/*
- * Class Variables
- */
-
-/**
- * This is the default Authenticator object to use for password requests
- */
-private static Authenticator default_authenticator;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * The hostname of the site requesting authentication
- */
-private String host;
-
-/**
- * InternetAddress of the site requesting authentication
- */
-private InetAddress addr;
-
-/**
- * The port number of the site requesting authentication
- */
-private int port;
-
-/**
- * The protocol name of the site requesting authentication
- */
-private String protocol;
-
-/**
- * The prompt to display to the user when requesting authentication info
- */
-private String prompt;
-
-/**
- * The authentication scheme in use
- */
-private String scheme;
-
-/*************************************************************************/
-
-/*
- * Class Methods
- */
-
-/**
- * This method sets the default <code>Authenticator</code> object (an
- * instance of a
- * subclass of <code>Authenticator</code>) to use when prompting the user for
- * information. Note that this method checks to see if the caller is
- * allowed to set this value (the "setDefaultAuthenticator" permission)
- * and throws a <code>SecurityException</code> if it is not.
- *
- * @param def_auth The new default <code>Authenticator</code> object to use
- *
- * @exception SecurityException If the caller does not have permission
- * to perform this operation
- */
-public static void
-setDefault(Authenticator def_auth)
-{
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new NetPermission("setDefaultAuthenticator"));
-
- default_authenticator = def_auth;
-}
-
-/*************************************************************************/
-
-/**
- * This method is called whenever a username and password for a given
- * network operation is required. First, a security check is made to see
- * if the caller has the "requestPasswordAuthentication"
- * permission. If not, the method thows an exception. If there is no
- * default <code>Authenticator</code> object, the method then returns
- * <code>null</code>. Otherwise, the default authenticators's instance
- * variables are initialized and it's <code>getPasswordAuthentication</code>
- * method is called to get the actual authentication information to return.
- *
- * @param addr The address requesting authentication
- * @param port The port requesting authentication
- * @param protocol The protocol requesting authentication
- * @param prompt The prompt to display to the user when requesting
- * authentication info
- * @param scheme The authentication scheme in use
- *
- * @return A <code>PasswordAuthentication</code> object with the user's
- * authentication info.
- *
- * @exception SecurityException If the caller does not have permission to
- * perform this operation
- */
-public static PasswordAuthentication
-requestPasswordAuthentication(InetAddress addr, int port, String protocol,
- String prompt, String scheme)
- throws SecurityException
-{
- return(requestPasswordAuthentication (null, addr, port, protocol,
- prompt, scheme));
-}
-
-/**
- * This method is called whenever a username and password for a given
- * network operation is required. First, a security check is made to see
- * if the caller has the "requestPasswordAuthentication"
- * permission. If not, the method thows an exception. If there is no
- * default <code>Authenticator</code> object, the method then returns
- * <code>null</code>. Otherwise, the default authenticators's instance
- * variables are initialized and it's <code>getPasswordAuthentication</code>
- * method is called to get the actual authentication information to return.
- * This method is the preferred one as it can be used with hostname
- * when addr is unknown.
- *
- * @param host The hostname requesting authentication
- * @param addr The address requesting authentication
- * @param port The port requesting authentication
- * @param protocol The protocol requesting authentication
- * @param prompt The prompt to display to the user when requesting
- * authentication info
- * @param scheme The authentication scheme in use
- *
- * @return A <code>PasswordAuthentication</code> object with the user's
- * authentication info.
- *
- * @exception SecurityException If the caller does not have permission to
- * perform this operation
- *
- * @since 1.4
- */
-public static PasswordAuthentication
-requestPasswordAuthentication(String host, InetAddress addr, int port,
- String protocol, String prompt, String scheme)
- throws SecurityException
-{
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new NetPermission("requestPasswordAuthentication"));
-
- if (default_authenticator == null)
+ /*
+ * Class Variables
+ */
+
+ /**
+ * This is the default Authenticator object to use for password requests
+ */
+ private static Authenticator defaultAuthenticator;
+
+ /*
+ * Instance Variables
+ */
+
+ /**
+ * The hostname of the site requesting authentication
+ */
+ private String host;
+
+ /**
+ * InternetAddress of the site requesting authentication
+ */
+ private InetAddress addr;
+
+ /**
+ * The port number of the site requesting authentication
+ */
+ private int port;
+
+ /**
+ * The protocol name of the site requesting authentication
+ */
+ private String protocol;
+
+ /**
+ * The prompt to display to the user when requesting authentication info
+ */
+ private String prompt;
+
+ /**
+ * The authentication scheme in use
+ */
+ private String scheme;
+
+ /*
+ * Class Methods
+ */
+
+ /**
+ * This method sets the default <code>Authenticator</code> object (an
+ * instance of a subclass of <code>Authenticator</code>) to use when
+ * prompting the user for
+ * information. Note that this method checks to see if the caller is
+ * allowed to set this value (the "setDefaultAuthenticator" permission)
+ * and throws a <code>SecurityException</code> if it is not.
+ *
+ * @param defAuth The new default <code>Authenticator</code> object to use
+ *
+ * @exception SecurityException If the caller does not have permission
+ * to perform this operation
+ */
+ public static void setDefault(Authenticator defAuth)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new NetPermission("setDefaultAuthenticator"));
+
+ defaultAuthenticator = defAuth;
+ }
+
+ /**
+ * This method is called whenever a username and password for a given
+ * network operation is required. First, a security check is made to see
+ * if the caller has the "requestPasswordAuthentication"
+ * permission. If not, the method thows an exception. If there is no
+ * default <code>Authenticator</code> object, the method then returns
+ * <code>null</code>. Otherwise, the default authenticators's instance
+ * variables are initialized and it's <code>getPasswordAuthentication</code>
+ * method is called to get the actual authentication information to return.
+ *
+ * @param addr The address requesting authentication
+ * @param port The port requesting authentication
+ * @param protocol The protocol requesting authentication
+ * @param prompt The prompt to display to the user when requesting
+ * authentication info
+ * @param scheme The authentication scheme in use
+ *
+ * @return A <code>PasswordAuthentication</code> object with the user's
+ * authentication info.
+ *
+ * @exception SecurityException If the caller does not have permission to
+ * perform this operation
+ */
+ public static PasswordAuthentication
+ requestPasswordAuthentication(InetAddress addr, int port, String protocol,
+ String prompt, String scheme)
+ throws SecurityException
+ {
+ return(requestPasswordAuthentication (null, addr, port, protocol,
+ prompt, scheme));
+ }
+
+ /**
+ * This method is called whenever a username and password for a given
+ * network operation is required. First, a security check is made to see
+ * if the caller has the "requestPasswordAuthentication"
+ * permission. If not, the method thows an exception. If there is no
+ * default <code>Authenticator</code> object, the method then returns
+ * <code>null</code>. Otherwise, the default authenticators's instance
+ * variables are initialized and it's <code>getPasswordAuthentication</code>
+ * method is called to get the actual authentication information to return.
+ * This method is the preferred one as it can be used with hostname
+ * when addr is unknown.
+ *
+ * @param host The hostname requesting authentication
+ * @param addr The address requesting authentication
+ * @param port The port requesting authentication
+ * @param protocol The protocol requesting authentication
+ * @param prompt The prompt to display to the user when requesting
+ * authentication info
+ * @param scheme The authentication scheme in use
+ *
+ * @return A <code>PasswordAuthentication</code> object with the user's
+ * authentication info.
+ *
+ * @exception SecurityException If the caller does not have permission to
+ * perform this operation
+ *
+ * @since 1.4
+ */
+ public static PasswordAuthentication
+ requestPasswordAuthentication(String host, InetAddress addr, int port,
+ String protocol, String prompt, String scheme)
+ throws SecurityException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new NetPermission("requestPasswordAuthentication"));
+
+ if (defaultAuthenticator == null)
+ return(null);
+
+ defaultAuthenticator.host = host;
+ defaultAuthenticator.addr = addr;
+ defaultAuthenticator.port = port;
+ defaultAuthenticator.protocol = protocol;
+ defaultAuthenticator.prompt = prompt;
+ defaultAuthenticator.scheme = scheme;
+
+ return(defaultAuthenticator.getPasswordAuthentication());
+ }
+
+ /*
+ * Constructors
+ */
+
+ /**
+ * Default, no-argument constructor for subclasses to call.
+ */
+ public Authenticator()
+ {
+ }
+
+ /*
+ * Instance Methods
+ */
+
+ /**
+ * This method returns the address of the site that is requesting
+ * authentication.
+ *
+ * @return The requesting site's address
+ */
+ protected final InetAddress getRequestingSite()
+ {
+ return(addr);
+ }
+
+ /**
+ * Returns the hostname of the host or proxy requesting authorization,
+ * or <code>null</code> if not available.
+ *
+ * @return The name of the host requesting authentication, or
+ * </code>null</code> if it is not available.
+ *
+ * @since 1.4
+ */
+ protected final String getRequestingHost()
+ {
+ return(host);
+ }
+
+ /**
+ * This method returns the port of the site that is requesting
+ * authentication.
+ *
+ * @return The requesting port
+ */
+ protected final int getRequestingPort()
+ {
+ return(port);
+ }
+
+ /**
+ * This method returns the requesting protocol of the operation that is
+ * requesting authentication
+ *
+ * @return The requesting protocol
+ */
+ protected final String getRequestingProtocol()
+ {
+ return(protocol);
+ }
+
+ /**
+ * Returns the prompt that should be used when requesting authentication
+ * information from the user
+ *
+ * @return The user prompt
+ */
+ protected final String getRequestingPrompt()
+ {
+ return(prompt);
+ }
+
+ /**
+ * This method returns the authentication scheme in use
+ *
+ * @return The authentication scheme
+ */
+ protected final String getRequestingScheme()
+ {
+ return(scheme);
+ }
+
+ /**
+ * This method is called whenever a request for authentication is made. It
+ * can call the other getXXX methods to determine the information relevant
+ * to this request. Subclasses should override this method, which returns
+ * <code>null</code> by default.
+ *
+ * @return The <code>PasswordAuthentication</code> information
+ */
+ protected PasswordAuthentication getPasswordAuthentication()
+ {
return(null);
-
- default_authenticator.host = host;
- default_authenticator.addr = addr;
- default_authenticator.port = port;
- default_authenticator.protocol = protocol;
- default_authenticator.prompt = prompt;
- default_authenticator.scheme = scheme;
-
- return(default_authenticator.getPasswordAuthentication());
-}
-
-/**
- * Returns the hostname of the host or proxy requesting authorization,
- * or null if not available.
- *
- * @since 1.4
- */
-protected final String getRequestingHost()
-{
- return(host);
-}
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Default, no-argument constructor for subclasses to call.
- */
-public
-Authenticator()
-{
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * This method returns the address of the site that is requesting
- * authentication.
- *
- * @return The requesting site
- */
-protected final InetAddress
-getRequestingSite()
-{
- return(addr);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the port of the site that is requesting
- * authentication.
- *
- * @return The requesting port
- */
-protected final int
-getRequestingPort()
-{
- return(port);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the requesting protocol of the operation that is
- * requesting authentication
- *
- * @return The requesting protocol
- */
-protected final String
-getRequestingProtocol()
-{
- return(protocol);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the prompt that should be used when requesting authentication
- * information from the user
- *
- * @return The user prompt
- */
-protected final String
-getRequestingPrompt()
-{
- return(prompt);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the authentication scheme in use
- *
- * @return The authentication scheme
- */
-protected final String
-getRequestingScheme()
-{
- return(scheme);
-}
-
-/*************************************************************************/
-
-/**
- * This method is called whenever a request for authentication is made. It
- * can call the other getXXX methods to determine the information relevant
- * to this request. Subclasses should override this method, which returns
- * <code>null</code> by default.
- *
- * @return The PasswordAuthentication information
- */
-protected PasswordAuthentication
-getPasswordAuthentication()
-{
- return(null);
-}
+ }
} // class Authenticator
diff --git a/libjava/java/net/ContentHandler.java b/libjava/java/net/ContentHandler.java
index ce8d7ee8bdd..ed746984775 100644
--- a/libjava/java/net/ContentHandler.java
+++ b/libjava/java/net/ContentHandler.java
@@ -1,5 +1,5 @@
/* ContentHandler.java -- Abstract class for handling content from URL's
- Copyright (C) 1998, 1999 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,65 +59,69 @@ import java.io.IOException;
*/
public abstract class ContentHandler
{
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Default, no-argument constructor.
- */
-public ContentHandler() { }
-
-/*************************************************************************/
-
-/**
- * This method reads from the <code>InputStream</code> of the passed in URL
- * connection and uses the data downloaded to create an <code>Object</code>
- * represening the content. For example, if the URL is pointing to a GIF
- * file, this method might return an <code>Image</code> object. This method
- * must be implemented by subclasses.
- *
- * @param urlc A <code>URLConnection</code> object to read data from.
- *
- * @return An object representing the data read
- *
- * @exception IOException If an error occurs
- */
-public abstract Object getContent(URLConnection urlc) throws IOException;
-
-/*************************************************************************/
-
-/**
- * This method reads from the <code>InputStream</code> of the passed in URL
- * connection and uses the data downloaded to create an <code>Object</code>
- * represening the content. For example, if the URL is pointing to a GIF
- * file, this method might return an <code>Image</code> object. This method
- * must be implemented by subclasses. If the object doesnt match any type in
- * classes it returns null.
- *
- * @param urlc A <code>URLConnection</code> object to read data from.
- *
- * @return An object representing the data read
- *
- * @exception IOException If an error occurs
- *
- * @since 1.3
- */
-public Object getContent(URLConnection urlc, Class[] classes)
- throws IOException
-{
- Object obj = getContent (urlc);
-
- for (int i = 0; i < classes.length; i++)
- {
- if (classes [i].isInstance (obj))
- return obj;
- }
-
- return null;
-}
+ /*
+ * Constructors
+ */
+
+ /**
+ * Default, no-argument constructor.
+ */
+ public ContentHandler()
+ {
+ }
+
+ /*
+ * Instance Methods
+ */
+
+ /**
+ * This method reads from the <code>InputStream</code> of the passed in URL
+ * connection and uses the data downloaded to create an <code>Object</code>
+ * represening the content. For example, if the URL is pointing to a GIF
+ * file, this method might return an <code>Image</code> object. This method
+ * must be implemented by subclasses.
+ *
+ * @param urlc A <code>URLConnection</code> object to read data from.
+ *
+ * @return An object representing the data read
+ *
+ * @exception IOException If an error occurs
+ */
+ public abstract Object getContent(URLConnection urlc)
+ throws IOException;
+
+ /**
+ * This method reads from the <code>InputStream</code> of the passed in URL
+ * connection and uses the data downloaded to create an <code>Object</code>
+ * represening the content. For example, if the URL is pointing to a GIF
+ * file, this method might return an <code>Image</code> object. This method
+ * must be implemented by subclasses. This method uses the list of
+ * supplied classes as candidate types. If the data read doesn't match
+ * any of the supplied type, <code>null</code> is returned.
+ *
+ * @param urlc A <code>URLConnection</code> object to read data from.
+ * @param classes An array of types of objects that are candidate types
+ * for the data to be read.
+ *
+ * @return An object representing the data read, or <code>null</code>
+ * if the data does not match any of the candidate types.
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.3
+ */
+ public Object getContent(URLConnection urlc, Class[] classes)
+ throws IOException
+ {
+ Object obj = getContent (urlc);
+
+ for (int i = 0; i < classes.length; i++)
+ {
+ if (classes [i].isInstance (obj))
+ return obj;
+ }
+
+ return null;
+ }
} // class ContentHandler
diff --git a/libjava/java/net/ContentHandlerFactory.java b/libjava/java/net/ContentHandlerFactory.java
index d954f9ad440..04fa3f11945 100644
--- a/libjava/java/net/ContentHandlerFactory.java
+++ b/libjava/java/net/ContentHandlerFactory.java
@@ -1,5 +1,5 @@
/* ContentHandlerFactory.java -- Interface for creating content handlers
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,25 +45,24 @@ package java.net;
*/
/**
- * This interface maps MIME types to ContentHandler objects. It consists
- * of one method that, when passed a MIME type, returns a handler for that
- * type.
+ * This interface maps MIME types to <code>ContentHandler</code> objects.
+ * It consists of one method that, when passed a MIME type, returns a
+ * handler for that type.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
*/
public interface ContentHandlerFactory
{
-/**
- * This method is passed a MIME type as a string and is responsible for
- * returning the appropriate ContentType object.
- *
- * @param mime_type The MIME type to map to a ContentHandler
- *
- * @return The ContentHandler for the passed in MIME type
- */
-ContentHandler
-createContentHandler(String mime_type);
+ /**
+ * This method is passed a MIME type as a string and is responsible for
+ * returning the appropriate <code>ContentHandler</code> object.
+ *
+ * @param mimeType The MIME type to map to a <code>ContentHandler</code>
+ *
+ * @return The <code>ContentHandler</code> for the passed in MIME type
+ */
+ public ContentHandler createContentHandler(String mimeType);
} // interface ContentHandlerFactory
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
index 45c15fdb6e0..57f3da70862 100644
--- a/libjava/java/net/DatagramSocket.java
+++ b/libjava/java/net/DatagramSocket.java
@@ -1,5 +1,5 @@
/* DatagramSocket.java -- A class to model UDP sockets
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -94,9 +94,11 @@ public class DatagramSocket
private boolean closed = false;
/**
- * Creates a DatagramSocket from a specified DatagramSocketImpl instance
+ * Creates a <code>DatagramSocket</code> from a specified
+ * <code>DatagramSocketImpl</code> instance
*
- * @param impl The DatagramSocketImpl the socket will be created from
+ * @param impl The <code>DatagramSocketImpl</code> the socket will be
+ * created from
*
* @since 1.4
*/
@@ -113,7 +115,7 @@ public class DatagramSocket
*
* @exception SocketException If an error occurs.
* @exception SecurityException If a security manager exists and
- * its checkListen method doesn't allow the operation.
+ * its <code>checkListen</code> method doesn't allow the operation.
*/
public DatagramSocket() throws SocketException
{
@@ -127,7 +129,7 @@ public class DatagramSocket
* @param port The local port number to bind to.
*
* @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation.
+ * <code>checkListen</code> method doesn't allow the operation.
* @exception SocketException If an error occurs.
*/
public DatagramSocket(int port) throws SocketException
@@ -172,14 +174,28 @@ public class DatagramSocket
}
impl.create();
- // For multicasting, set the socket to be reused (Stevens pp. 195-6).
- if (this instanceof MulticastSocket)
- impl.setOption(SocketOptions.SO_REUSEADDR, new Boolean(true));
-
- impl.bind(port, laddr == null ? InetAddress.ANY_IF : laddr);
+ if (laddr == null)
+ laddr = InetAddress.ANY_IF;
- remoteAddress = null;
- remotePort = -1;
+ try
+ {
+ impl.bind (port, laddr);
+ }
+ catch (SocketException exception)
+ {
+ impl.close ();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close ();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close ();
+ throw error;
+ }
}
/**
@@ -190,7 +206,7 @@ public class DatagramSocket
* @param laddr The local address to bind to.
*
* @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation.
+ * <code>checkListen</code> method doesn't allow the operation.
* @exception SocketException If an error occurs.
*
* @since 1.4
@@ -291,9 +307,6 @@ public class DatagramSocket
*/
public int getLocalPort()
{
- if (!isBound ())
- return -1;
-
return impl.getLocalPort();
}
diff --git a/libjava/java/net/DatagramSocketImpl.java b/libjava/java/net/DatagramSocketImpl.java
index 5a0aa3e4acd..891c8d183b5 100644
--- a/libjava/java/net/DatagramSocketImpl.java
+++ b/libjava/java/net/DatagramSocketImpl.java
@@ -1,5 +1,6 @@
/* DatagramSocketImpl.java -- Abstract class for UDP socket implementations
- Copyright (C) 1998, 1999 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,8 +103,8 @@ public abstract class DatagramSocketImpl implements SocketOptions
* Takes a peek at the next packet received in order to retrieve the
* address of the sender
*
- * @param i The InetAddress to fill in with the information about the
- * sender if the next packet
+ * @param i The <code>InetAddress</code> to fill in with the information
+ * about the sender if the next packet
*
* @return The port number of the sender of the packet
*
@@ -118,7 +119,7 @@ public abstract class DatagramSocketImpl implements SocketOptions
* Takes a peek at the next packet received. This packet is not consumed.
* With the next peekData/receive operation this packet will be read again.
*
- * @param p The DatagramPacket to fill in with the data sent.
+ * @param p The <code>DatagramPacket</code> to fill in with the data sent.
*
* @return The port number of the sender of the packet.
*
@@ -147,7 +148,7 @@ public abstract class DatagramSocketImpl implements SocketOptions
/**
* Receives a packet of data from the network Will block until a packet
* arrives. The packet info in populated into the passed in
- * DatagramPacket object.
+ * <code>DatagramPacket</code> object.
*
* @param p A place to store the incoming packet.
*
@@ -161,7 +162,7 @@ public abstract class DatagramSocketImpl implements SocketOptions
/**
* Connects the socket to a host specified by address and port.
*
- * @param address The InetAddress of the host to connect to
+ * @param address The <code>InetAddress</code> of the host to connect to
* @param port The port number of the host to connect to
*
* @exception SocketException If an error occurs
@@ -283,36 +284,4 @@ public abstract class DatagramSocketImpl implements SocketOptions
{
return localPort;
}
-
- /**
- * Sets the specified option on a socket to the passed in object. For
- * options that take an integer argument, the passed in object is an
- * <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>option_id</code>
- * parameter is one of the defined constants in the superinterface.
- *
- * @param option_id The identifier of the option
- * @param val The value to set the option to
- *
- * @exception SocketException If an error occurs
- * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
- */
- public abstract void setOption(int option_id, Object val)
- throws SocketException;
-
- /**
- * Returns the current setting of the specified option. The
- * <code>Object</code> returned will be an <code>Integer</code> for options
- * that have integer values. For options that are set to on or off, a
- * <code>Boolean</code> will be returned. The <code>option_id</code>
- * is one of the defined constants in the superinterface.
- *
- * @param option_id The option identifier
- *
- * @return The current value of the option
- *
- * @exception SocketException If an error occurs
- * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
- */
- public abstract Object getOption(int option_id) throws SocketException;
}
diff --git a/libjava/java/net/DatagramSocketImplFactory.java b/libjava/java/net/DatagramSocketImplFactory.java
index 60fe838458b..ab39dd45786 100644
--- a/libjava/java/net/DatagramSocketImplFactory.java
+++ b/libjava/java/net/DatagramSocketImplFactory.java
@@ -1,5 +1,5 @@
/* DatagramSocketImplFactory.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,8 @@ package java.net;
*/
/**
- * This interface defines one method which returns a DatagramSocketImpl object.
+ * This interface defines one method which returns a
+ * <code>DatagramSocketImpl</code> object.
* This should not be needed by ordinary applications.
*
* @author Michael Koch <konqueror@gmx.de>
@@ -55,5 +56,5 @@ public interface DatagramSocketImplFactory
*
* @return A DatagramSocketImpl object
*/
- DatagramSocketImpl createDatagramSocketImpl();
+ public DatagramSocketImpl createDatagramSocketImpl();
} // interface DatagramSocketImplFactory
diff --git a/libjava/java/net/FileNameMap.java b/libjava/java/net/FileNameMap.java
index 538dbe8e19a..b4f9e19160c 100644
--- a/libjava/java/net/FileNameMap.java
+++ b/libjava/java/net/FileNameMap.java
@@ -1,5 +1,5 @@
/* FileNameMap.java -- Maps filenames to MIME types
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,16 +54,15 @@ package java.net;
*/
public interface FileNameMap
{
-/**
- * This method is passed a filename and is responsible for determining
- * the appropriate MIME type for that file.
- *
- * @param filename The name of the file to generate a MIME type for.
- *
- * @return The MIME type for the filename passed in.
- */
-String
-getContentTypeFor(String filename);
+ /**
+ * This method is passed a filename and is responsible for determining
+ * the appropriate MIME type for that file.
+ *
+ * @param filename The name of the file to generate a MIME type for.
+ *
+ * @return The MIME type for the filename passed in.
+ */
+ public String getContentTypeFor(String filename);
} // interface FileNameMap
diff --git a/libjava/java/net/HttpURLConnection.java b/libjava/java/net/HttpURLConnection.java
index 4cdeaf19712..2f12fe57d46 100644
--- a/libjava/java/net/HttpURLConnection.java
+++ b/libjava/java/net/HttpURLConnection.java
@@ -1,7 +1,6 @@
-// HttpURLConnection.java - Subclass of communications links using
-// Hypertext Transfer Protocol.
-
-/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation
+/* HttpURLConnection.java - Subclass of communications links using
+ Hypertext Transfer Protocol.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,9 +36,12 @@ 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 java.net;
-import java.io.*;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.PushbackInputStream;
import java.security.Permission;
/*
diff --git a/libjava/java/net/Inet4Address.java b/libjava/java/net/Inet4Address.java
index c635c671d0e..25d296f995a 100644
--- a/libjava/java/net/Inet4Address.java
+++ b/libjava/java/net/Inet4Address.java
@@ -1,5 +1,5 @@
/* Inet4Address.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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 java.net;
-import java.io.IOException;
import java.io.ObjectStreamException;
+import java.util.Arrays;
/**
* @author Michael Koch
@@ -71,7 +72,7 @@ public final class Inet4Address extends InetAddress
* @param addr The IP address
* @param host The Hostname
*/
- protected Inet4Address(byte[] addr, String host)
+ Inet4Address(byte[] addr, String host)
{
super (addr, host);
}
@@ -103,7 +104,7 @@ public final class Inet4Address extends InetAddress
{
byte[] anylocal = { 0, 0, 0, 0 };
- return addr == anylocal;
+ return Arrays.equals(addr, anylocal);
}
/**
diff --git a/libjava/java/net/Inet6Address.java b/libjava/java/net/Inet6Address.java
index 8d3c0c3af44..4f4563ddcc5 100644
--- a/libjava/java/net/Inet6Address.java
+++ b/libjava/java/net/Inet6Address.java
@@ -1,5 +1,5 @@
/* Inet6Address.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,9 +35,10 @@ 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 java.net;
-import java.io.IOException;
+import java.util.Arrays;
/**
* @author Michael Koch
@@ -65,7 +66,7 @@ public final class Inet6Address extends InetAddress
* @param addr The IP address
* @param host The hostname
*/
- protected Inet6Address (byte[] addr, String host)
+ Inet6Address (byte[] addr, String host)
{
super (addr, host);
this.ipaddress = addr;
@@ -91,7 +92,7 @@ public final class Inet6Address extends InetAddress
byte[] anylocal = { 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
- return ipaddress == anylocal;
+ return Arrays.equals(ipaddress, anylocal);
}
/**
@@ -104,7 +105,7 @@ public final class Inet6Address extends InetAddress
byte[] loopback = { 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1 };
- return ipaddress == loopback;
+ return Arrays.equals(ipaddress, loopback);
}
/**
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java
index 34d4ad1eed9..8ef63668a55 100644
--- a/libjava/java/net/InetAddress.java
+++ b/libjava/java/net/InetAddress.java
@@ -68,19 +68,21 @@ import java.io.ObjectStreamException;
*/
public class InetAddress implements Serializable
{
+ private static final long serialVersionUID = 3286316764910316507L;
+
// The Serialized Form specifies that an int 'address' is saved/restored.
// This class uses a byte array internally so we'll just do the conversion
// at serialization time and leave the rest of the algorithm as is.
private int address;
transient byte[] addr;
String hostName;
+
// The field 'family' seems to be the AF_ value.
// FIXME: Much of the code in the other java.net classes does not make
// use of this family field. A better implementation would be to make
// use of getaddrinfo() and have other methods just check the family
// field rather than examining the length of the address each time.
int family;
- private static final long serialVersionUID = 3286316764910316507L;
/**
* Needed for serialization
@@ -90,14 +92,16 @@ public class InetAddress implements Serializable
// FIXME: implement this
}
- private void readObject(ObjectInputStream ois)
+ private void readObject (ObjectInputStream ois)
throws IOException, ClassNotFoundException
{
- ois.defaultReadObject();
- addr = new byte[4];
- addr[3] = (byte) address;
+ ois.defaultReadObject ();
+ addr = new byte [4];
+ addr [3] = (byte) address;
+
for (int i = 2; i >= 0; --i)
- addr[i] = (byte) (address >>= 8);
+ addr [i] = (byte) (address >>= 8);
+
// Ignore family from serialized data. Since the saved address is 32 bits
// the deserialized object will have an IPv4 address i.e. AF_INET family.
// FIXME: An alternative is to call the aton method on the deserialized
@@ -106,15 +110,17 @@ public class InetAddress implements Serializable
family = getFamily (addr);
}
- private void writeObject(ObjectOutputStream oos) throws IOException
+ private void writeObject (ObjectOutputStream oos) throws IOException
{
// Build a 32 bit address from the last 4 bytes of a 4 byte IPv4 address
// or a 16 byte IPv6 address.
int len = addr.length;
int i = len - 4;
+
for (; i < len; i++)
- address = address << 8 | (((int) addr[i]) & 0xFF);
- oos.defaultWriteObject();
+ address = address << 8 | (((int) addr [i]) & 0xFF);
+
+ oos.defaultWriteObject ();
}
private static native int getFamily (byte[] address);
@@ -123,6 +129,7 @@ public class InetAddress implements Serializable
{
addr = address;
hostName = hostname;
+
if (address != null)
family = getFamily (address);
}
@@ -135,10 +142,13 @@ public class InetAddress implements Serializable
public boolean isMulticastAddress ()
{
int len = addr.length;
+
if (len == 4)
- return (addr[0] & 0xF0) == 0xE0;
+ return (addr [0] & 0xF0) == 0xE0;
+
if (len == 16)
- return addr[0] == (byte) 0xFF;
+ return addr [0] == (byte) 0xFF;
+
return false;
}
@@ -164,7 +174,7 @@ public class InetAddress implements Serializable
// This is the IPv4 implementation.
// Any class derived from InetAddress should override this.
- return addr[0] == 0x7F;
+ return addr [0] == 0x7F;
}
/**
@@ -192,18 +202,20 @@ public class InetAddress implements Serializable
// Any class derived from InetAddress should override this.
// 10.0.0.0/8
- if (addr[0] == 0x0A)
+ if (addr [0] == 0x0A)
return true;
// XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
// it says 172.16.0.0 - 172.255.255.255 are site local addresses
// 172.16.0.0/12
- if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01)
+ if (addr [0] == 0xAC
+ && (addr [1] & 0xF0) == 0x01)
return true;
// 192.168.0.0/16
- if (addr[0] == 0xC0 && addr[1] == 0xA8)
+ if (addr [0] == 0xC0
+ && addr [1] == 0xA8)
return true;
// XXX: Do we need to check more addresses here ?
@@ -251,13 +263,13 @@ public class InetAddress implements Serializable
if (!isMulticastAddress ())
return false;
- return (addr[0] == 0xE0
- && addr[1] == 0x00
- && addr[2] == 0x00);
+ return (addr [0] == 0xE0
+ && addr [1] == 0x00
+ && addr [2] == 0x00);
}
/**
- * Utility reoutine to check if InetAddress is a site local multicast address
+ * Utility routine to check if InetAddress is a site local multicast address
*
* @since 1.4
*/
@@ -328,24 +340,26 @@ public class InetAddress implements Serializable
{
// An experiment shows that JDK1.2 returns a different byte array each
// time. This makes sense, in terms of security.
- return (byte[]) addr.clone();
+ return (byte[]) addr.clone ();
}
/* Helper function due to a CNI limitation. */
private static InetAddress[] allocArray (int count)
{
- return new InetAddress[count];
+ return new InetAddress [count];
}
/* Helper function due to a CNI limitation. */
private static SecurityException checkConnect (String hostname)
{
- SecurityManager s = System.getSecurityManager();
+ SecurityManager s = System.getSecurityManager ();
+
if (s == null)
return null;
+
try
{
- s.checkConnect(hostname, -1);
+ s.checkConnect (hostname, -1);
return null;
}
catch (SecurityException ex)
@@ -361,7 +375,7 @@ public class InetAddress implements Serializable
*/
public String getHostAddress ()
{
- StringBuffer sbuf = new StringBuffer(40);
+ StringBuffer sbuf = new StringBuffer (40);
int len = addr.length;
int i = 0;
if (len == 16)
@@ -369,37 +383,37 @@ public class InetAddress implements Serializable
for (; ; i += 2)
{
if (i >= 16)
- return sbuf.toString();
- int x = ((addr[i] & 0xFF) << 8) | (addr[i+1] & 0xFF);
- boolean empty = sbuf.length() == 0;
+ return sbuf.toString ();
+ int x = ((addr [i] & 0xFF) << 8) | (addr [i + 1] & 0xFF);
+ boolean empty = sbuf.length () == 0;
if (empty)
{
if (i == 10 && x == 0xFFFF)
{ // IPv4-mapped IPv6 address.
- sbuf.append(":FFFF:");
+ sbuf.append (":FFFF:");
break; // Continue as IPv4 address;
}
else if (i == 12)
{ // IPv4-compatible IPv6 address.
- sbuf.append(':');
+ sbuf.append (':');
break; // Continue as IPv4 address.
}
else if (i > 0)
- sbuf.append("::");
+ sbuf.append ("::");
}
else
- sbuf.append(':');
+ sbuf.append (':');
if (x != 0 || i >= 14)
- sbuf.append(Integer.toHexString(x).toUpperCase());
+ sbuf.append (Integer.toHexString (x).toUpperCase ());
}
}
for ( ; ; )
{
- sbuf.append(addr[i] & 0xFF);
+ sbuf.append (addr[i] & 0xFF);
i++;
if (i == len)
break;
- sbuf.append('.');
+ sbuf.append ('.');
}
return sbuf.toString();
@@ -408,15 +422,17 @@ public class InetAddress implements Serializable
/**
* Returns a hashcode of the InetAddress
*/
- public int hashCode()
+ public int hashCode ()
{
// There hashing algorithm is not specified, but a simple experiment
// shows that it is equal to the address, as a 32-bit big-endian integer.
int hash = 0;
int len = addr.length;
int i = len > 4 ? len - 4 : 0;
+
for ( ; i < len; i++)
hash = (hash << 8) | (addr[i] & 0xFF);
+
return hash;
}
@@ -425,7 +441,8 @@ public class InetAddress implements Serializable
*/
public boolean equals (Object obj)
{
- if (obj == null || ! (obj instanceof InetAddress))
+ if (obj == null
+ || ! (obj instanceof InetAddress))
return false;
// "The Java Class Libraries" 2nd edition says "If a machine has
@@ -436,25 +453,30 @@ public class InetAddress implements Serializable
// shows that the latter is correct.
byte[] addr1 = addr;
byte[] addr2 = ((InetAddress) obj).addr;
+
if (addr1.length != addr2.length)
return false;
+
for (int i = addr1.length; --i >= 0; )
if (addr1[i] != addr2[i])
return false;
+
return true;
}
/**
* Returns then <code>InetAddress</code> as string
*/
- public String toString()
+ public String toString ()
{
String result;
- String address = getHostAddress();
+ String address = getHostAddress ();
+
if (hostName != null)
result = hostName + "/" + address;
else
result = address;
+
return result;
}
@@ -470,16 +492,10 @@ public class InetAddress implements Serializable
*
* @since 1.4
*/
- public static InetAddress getByAddress(byte[] addr)
+ public static InetAddress getByAddress (byte[] addr)
throws UnknownHostException
{
- if (addr.length != 4 && addr.length != 16)
- throw new UnknownHostException ("IP address has illegal length");
-
- if (addr.length == 4)
- return new Inet4Address (addr, null);
-
- return new Inet6Address (addr, null);
+ return getByAddress (null, addr);
}
/**
@@ -505,8 +521,10 @@ public class InetAddress implements Serializable
throw new UnknownHostException ("IP address has illegal length");
}
- /** If host is a valid numeric IP address, return the numeric address.
- * Otherwise, return null. */
+ /**
+ * If host is a valid numeric IP address, return the numeric address.
+ * Otherwise, return null.
+ */
private static native byte[] aton (String host);
private static native InetAddress[] lookup (String hostname,
@@ -523,13 +541,13 @@ public class InetAddress implements Serializable
public static InetAddress getByName (String hostname)
throws UnknownHostException
{
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkConnect (hostname, -1);
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkConnect (hostname, -1);
// Default to current host if necessary
if (hostname == null)
- return getLocalHost();
+ return getLocalHost ();
// Assume that the host string is an IP address
byte[] address = aton (hostname);
@@ -539,13 +557,13 @@ public class InetAddress implements Serializable
return new Inet4Address (address, null);
else if (address.length == 16)
{
- if ((address[10] == 0xFF) && (address[11] == 0xFF))
+ if ((address [10] == 0xFF) && (address [11] == 0xFF))
{
- byte[] ip4addr = new byte[4];
- ip4addr[0] = address[12];
- ip4addr[1] = address[13];
- ip4addr[2] = address[14];
- ip4addr[3] = address[15];
+ byte[] ip4addr = new byte [4];
+ ip4addr [0] = address [12];
+ ip4addr [1] = address [13];
+ ip4addr [2] = address [14];
+ ip4addr [3] = address [15];
return new Inet4Address (ip4addr, null);
}
return new Inet6Address (address, null);
@@ -556,7 +574,7 @@ public class InetAddress implements Serializable
// Try to resolve the host by DNS
InetAddress[] addresses = getAllByName (hostname);
- return addresses[0];
+ return addresses [0];
}
/**
@@ -571,16 +589,16 @@ public class InetAddress implements Serializable
public static InetAddress[] getAllByName (String hostname)
throws UnknownHostException
{
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkConnect(hostname, -1);
+ SecurityManager s = System.getSecurityManager ();
+ if (s != null)
+ s.checkConnect (hostname, -1);
// Check if hostname is an IP address
byte[] address = aton (hostname);
if (address != null)
{
- InetAddress[] result = new InetAddress[1];
- result[0] = new InetAddress(address, null);
+ InetAddress[] result = new InetAddress [1];
+ result [0] = new InetAddress (address, null);
return result;
}
@@ -588,10 +606,10 @@ public class InetAddress implements Serializable
return lookup (hostname, null, true);
}
- static final byte[] zeros = {0,0,0,0};
+ static final byte[] zeros = { 0, 0, 0, 0 };
/* dummy InetAddress, used to bind socket to any (all) network interfaces */
- static final InetAddress ANY_IF = new InetAddress(zeros, null);
+ static final InetAddress ANY_IF = new InetAddress (zeros, null);
private static final byte[] localhostAddress = { 127, 0, 0, 1 };
@@ -605,25 +623,29 @@ public class InetAddress implements Serializable
* @exception UnknownHostException If no IP address for the host could
* be found
*/
- public static InetAddress getLocalHost() throws UnknownHostException
+ public static InetAddress getLocalHost () throws UnknownHostException
{
- SecurityManager s = System.getSecurityManager();
+ SecurityManager s = System.getSecurityManager ();
+
// Experimentation shows that JDK1.2 does cache the result.
// However, if there is a security manager, and the cached result
// is other than "localhost", we need to check again.
if (localhost == null
|| (s != null && localhost.addr != localhostAddress))
- getLocalHost(s);
+ getLocalHost (s);
+
return localhost;
}
- private static synchronized void getLocalHost(SecurityManager s)
+ private static synchronized void getLocalHost (SecurityManager s)
throws UnknownHostException
{
// Check the localhost cache again, now that we've synchronized.
if (s == null && localhost != null)
return;
- String hostname = getLocalHostname();
+
+ String hostname = getLocalHostname ();
+
if (s != null)
{
// "The Java Class Libraries" suggests that if the security
@@ -636,24 +658,26 @@ public class InetAddress implements Serializable
{
// This is wrong, if the name returned from getLocalHostname()
// is not a fully qualified name. FIXME.
- s.checkConnect(hostname, -1);
+ s.checkConnect (hostname, -1);
}
catch (SecurityException ex)
{
hostname = null;
}
}
+
if (hostname != null)
{
try
{
- localhost = new InetAddress(null, null);
- lookup(hostname, localhost, false);
+ localhost = new InetAddress (null, null);
+ lookup (hostname, localhost, false);
}
catch (Exception ex)
{
}
}
+
if (localhost == null)
localhost = new InetAddress (localhostAddress, "localhost");
}
diff --git a/libjava/java/net/InetSocketAddress.java b/libjava/java/net/InetSocketAddress.java
index 3c54b51a0f0..c720fbcfe61 100644
--- a/libjava/java/net/InetSocketAddress.java
+++ b/libjava/java/net/InetSocketAddress.java
@@ -69,6 +69,9 @@ public class InetSocketAddress extends SocketAddress
{
if (port < 0 || port > 65535)
throw new IllegalArgumentException();
+
+ if (addr == null)
+ addr = InetAddress.ANY_IF;
this.addr = addr;
this.port = port;
@@ -85,25 +88,9 @@ public class InetSocketAddress extends SocketAddress
public InetSocketAddress(int port)
throws IllegalArgumentException
{
- if (port < 0 || port > 65535)
- throw new IllegalArgumentException();
-
- this.port = port;
-
- try
- {
- byte[] any = { 0, 0, 0, 0 };
- this.addr = InetAddress.getByAddress (any);
- this.hostname = "0.0.0.0";
- }
- catch (UnknownHostException e)
- {
- this.addr = null;
- this.hostname = "";
- }
+ this ((InetAddress) null, port);
}
-
/**
* Constructs an InetSocketAddress instance.
*
@@ -115,7 +102,8 @@ public class InetSocketAddress extends SocketAddress
public InetSocketAddress(String hostname, int port)
throws IllegalArgumentException
{
- if (port < 0 || port > 65535)
+ if (port < 0 || port > 65535
+ || hostname == null)
throw new IllegalArgumentException();
this.port = port;
diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java
index a6dca948c8b..1b7b422e071 100644
--- a/libjava/java/net/MulticastSocket.java
+++ b/libjava/java/net/MulticastSocket.java
@@ -81,6 +81,7 @@ public class MulticastSocket extends DatagramSocket
public MulticastSocket() throws IOException
{
super(0, null);
+ setReuseAddress (true);
}
/**
@@ -95,6 +96,7 @@ public class MulticastSocket extends DatagramSocket
public MulticastSocket(int port) throws IOException
{
super(port, null);
+ setReuseAddress (true);
}
/**
@@ -111,6 +113,7 @@ public class MulticastSocket extends DatagramSocket
public MulticastSocket(SocketAddress address) throws IOException
{
super(address);
+ setReuseAddress (true);
}
/**
diff --git a/libjava/java/net/NetPermission.java b/libjava/java/net/NetPermission.java
index 593b63504a8..6b796be7f04 100644
--- a/libjava/java/net/NetPermission.java
+++ b/libjava/java/net/NetPermission.java
@@ -41,9 +41,21 @@ import java.security.BasicPermission;
/**
* This class is used to model miscellaneous network permissions. It is
- * a subclass of BasicPermission. This means that it models a "boolean"
- * permission. One that you either have or do not have. Thus there is
- * no permitted action list associated with this object.
+ * a subclass of <code>BasicPermission</code>. This means that it models a
+ * "boolean" permission. One that you either have or do not have. Thus
+ * there is no permitted action list associated with this object.
+ *
+ * The following permission names are defined for this class:
+ *
+ * <ul>
+ * <li>setDefaultAuthenticator - Grants the ability to install a facility
+ * to collect username and password information when requested by a
+ * web site or proxy server.
+ * <li>requestPasswordAuthentication - Grants the ability to ask the
+ * authentication facility for the user's password.
+ * <li>specifyStreamHandler - Grants the permission to specify the
+ * stream handler class used when loading from a URL.
+ * </ul>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java
index 4e8f4276c57..c3eb7108002 100644
--- a/libjava/java/net/NetworkInterface.java
+++ b/libjava/java/net/NetworkInterface.java
@@ -41,6 +41,12 @@ import java.util.Enumeration;
import java.util.Vector;
/**
+ * This class models a network interface on the host computer. A network
+ * interface contains a name (typically associated with a specific
+ * hardware adapter) and a list of addresses that are bound to it.
+ * For example, an ethernet interface may be named "eth0" and have the
+ * address 192.168.1.101 assigned to it.
+ *
* @author Michael Koch <konqueror@gmx.de>
* @since 1.4
*/
@@ -61,7 +67,9 @@ public final class NetworkInterface
throws SocketException;
/**
- * Returns the name of the network interface
+ * Returns the name of the network interface
+ *
+ * @return The name of the interface.
*/
public String getName ()
{
@@ -73,8 +81,8 @@ public final class NetworkInterface
*
* If a @see SecurityManager is available all addresses are checked
* with @see SecurityManager::checkConnect() if they are available.
- * Only InetAddresses are returned where the security manager doesn't
- * thrown an exception.
+ * Only <code>InetAddresses</code> are returned where the security manager
+ * doesn't throw an exception.
*
* @return An enumeration of all addresses.
*/
@@ -106,6 +114,8 @@ public final class NetworkInterface
/**
* Returns the display name of the interface
+ *
+ * @return The display name of the interface
*/
public String getDisplayName ()
{
@@ -168,7 +178,7 @@ public final class NetworkInterface
}
/**
- * Return an Enumeration of all available network interfaces
+ * Return an <code>Enumeration</code> of all available network interfaces
*
* @exception SocketException If an error occurs
*/
diff --git a/libjava/java/net/PasswordAuthentication.java b/libjava/java/net/PasswordAuthentication.java
index 0c4faa54398..97554e3dde4 100644
--- a/libjava/java/net/PasswordAuthentication.java
+++ b/libjava/java/net/PasswordAuthentication.java
@@ -1,5 +1,5 @@
/* PasswordAuthentication.java -- Container class for username/password pairs
- Copyright (C) 1998,2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,72 +45,64 @@ package java.net;
*/
public final class PasswordAuthentication
{
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * The username
- */
-private String username;
-
-/**
- * The password
- */
-private char[] password;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Creates a new PasswordAuthentication object from the specified username
- * and password.
- *
- * @param username The username for this object
- * @param password The password for this object
- */
-public
-PasswordAuthentication(String username, char[] password)
-{
- this.username = username;
- this.password = password;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the username associated with this object
- *
- * @return The username
- */
-public String
-getUserName()
-{
- return(username);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the password associated with this object
- *
- * @return The password
- */
-public char[]
-getPassword()
-{
- return(password);
-}
+ /*
+ * Instance Variables
+ */
+
+ /**
+ * The username
+ */
+ private String username;
+
+ /**
+ * The password
+ */
+ private char[] password;
+
+ /*************************************************************************/
+
+ /*
+ * Constructors
+ */
+
+ /**
+ * Creates a new <code>PasswordAuthentication</code> object from the
+ * specified username and password.
+ *
+ * @param username The username for this object
+ * @param password The password for this object
+ */
+ public PasswordAuthentication(String username, char[] password)
+ {
+ this.username = username;
+ this.password = password;
+ }
+
+ /*************************************************************************/
+
+ /*
+ * Instance Methods
+ */
+
+ /**
+ * Returns the username associated with this object
+ *
+ * @return The username
+ */
+ public String getUserName()
+ {
+ return(username);
+ }
+
+ /**
+ * Returns the password associated with this object
+ *
+ * @return The password
+ */
+ public char[] getPassword()
+ {
+ return(password);
+ }
} // class PasswordAuthentication
diff --git a/libjava/java/net/PlainDatagramSocketImpl.java b/libjava/java/net/PlainDatagramSocketImpl.java
index 69e17888995..83fdb633d99 100644
--- a/libjava/java/net/PlainDatagramSocketImpl.java
+++ b/libjava/java/net/PlainDatagramSocketImpl.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.net;
import java.io.IOException;
+import gnu.classpath.Configuration;
/**
* Written using on-line Java Platform 1.2 API Specification, as well
@@ -47,11 +48,24 @@ import java.io.IOException;
*/
/**
+ * This is the default socket implementation for datagram sockets.
+ * It makes native calls to C routines that implement BSD style
+ * SOCK_DGRAM sockets in the AF_INET family.
+ *
+ * @author Aaron M. Renn <arenn@urbanophile.com>
* @author Warren Levy <warrenl@cygnus.com>
- * @date May 3, 1999.
*/
class PlainDatagramSocketImpl extends DatagramSocketImpl
{
+ // Static initializer to load native library
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javanet");
+ }
+ }
+
// These fields are mirrored for use in native code to avoid cpp conflicts
// when the #defines in system header files are the same as the public fields.
static final int _Jv_TCP_NODELAY_ = SocketOptions.TCP_NODELAY,
@@ -69,6 +83,9 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
_Jv_SO_RCVBUF_ = SocketOptions.SO_RCVBUF,
_Jv_SO_KEEPALIVE_ = SocketOptions.SO_KEEPALIVE;
+ /**
+ * This is the actual underlying file descriptor
+ */
int fnum = -1;
// FIXME: Is this necessary? Could it help w/ DatagramSocket.getLocalAddress?
@@ -80,50 +97,152 @@ class PlainDatagramSocketImpl extends DatagramSocketImpl
// 'timeout' is set/read by setOption/getOption.
int timeout = 0;
- // FIXME: Probably should have bind (and create?) calls from DatagramSocket
- // constuctor. If so, then same change should be made to the corresponding
- // Socket (non-datagram) classes. This allows the implementation more
- // complete control over how the socket is set up and used (e.g. connect,
- // setting options, etc.).
+ /**
+ * Default do nothing constructor
+ */
public PlainDatagramSocketImpl()
{
}
+ /**
+ * Binds this socket to a particular port and interface
+ *
+ * @param port The port to bind to
+ * @param addr The address to bind to
+ *
+ * @exception SocketException If an error occurs
+ */
protected native void bind(int lport, InetAddress laddr)
throws SocketException;
+
protected native void connect (InetAddress i, int port)
throws SocketException;
+
protected native void disconnect ();
+
+ /**
+ * Creates a new datagram socket
+ *
+ * @exception SocketException If an error occurs
+ */
protected native void create() throws SocketException;
+
protected native int peek(InetAddress i) throws IOException;
+
protected native int peekData (DatagramPacket dp) throws IOException;
+
+ /**
+ * Sets the Time to Live value for the socket
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ */
protected native void setTimeToLive(int ttl) throws IOException;
+
+ /**
+ * Gets the Time to Live value for the socket
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ */
protected native int getTimeToLive() throws IOException;
+
+ /**
+ * Sends a packet of data to a remote host
+ *
+ * @param packet The packet to send
+ *
+ * @exception IOException If an error occurs
+ */
protected native void send(DatagramPacket p) throws IOException;
+
+ /**
+ * Receives a UDP packet from the network
+ *
+ * @param packet The packet to fill in with the data received
+ *
+ * @exception IOException IOException If an error occurs
+ */
protected native void receive(DatagramPacket p) throws IOException;
+
+ /**
+ * Sets the value of an option on the socket
+ *
+ * @param option_id The identifier of the option to set
+ * @param val The value of the option to set
+ *
+ * @exception SocketException If an error occurs
+ */
public native void setOption(int optID, Object value) throws SocketException;
+
+ /**
+ * Retrieves the value of an option on the socket
+ *
+ * @param option_id The identifier of the option to retrieve
+ *
+ * @return The value of the option
+ *
+ * @exception SocketException If an error occurs
+ */
public native Object getOption(int optID) throws SocketException;
+
private native void mcastGrp(InetAddress inetaddr, NetworkInterface netIf,
boolean join) throws IOException;
+
+ /**
+ * Closes the socket
+ */
protected native void close();
- // Deprecated in JDK 1.2.
+ /**
+ * Gets the Time to Live value for the socket
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated 1.2
+ */
protected byte getTTL() throws IOException
{
return (byte) getTimeToLive();
}
- // Deprecated in JDK 1.2.
+ /**
+ * Sets the Time to Live value for the socket
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated 1.2
+ */
protected void setTTL(byte ttl) throws IOException
{
setTimeToLive(((int) ttl) & 0xFF);
}
+ /**
+ * Joins a multicast group
+ *
+ * @param addr The group to join
+ *
+ * @exception IOException If an error occurs
+ */
protected void join(InetAddress inetaddr) throws IOException
{
mcastGrp(inetaddr, null, true);
}
+ /**
+ * Leaves a multicast group
+ *
+ * @param addr The group to leave
+ *
+ * @exception IOException If an error occurs
+ */
protected void leave(InetAddress inetaddr) throws IOException
{
mcastGrp(inetaddr, null, false);
diff --git a/libjava/java/net/PlainSocketImpl.java b/libjava/java/net/PlainSocketImpl.java
index ed63b57bc43..ad0ce46c7ea 100644
--- a/libjava/java/net/PlainSocketImpl.java
+++ b/libjava/java/net/PlainSocketImpl.java
@@ -41,18 +41,35 @@ package java.net;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
+import gnu.classpath.Configuration;
/**
- * The standard GCJ socket implementation.
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
+ */
+
+/**
+ * Unless the application installs its own SocketImplFactory, this is the
+ * default socket implemetation that will be used. It simply uses a
+ * combination of Java and native routines to implement standard BSD
+ * style sockets of family AF_INET and types SOCK_STREAM and SOCK_DGRAM
*
* @author Per Bothner <bothner@cygnus.com>
* @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
+ * @author Aaron M. Renn <arenn@urbanophile.com>
*/
class PlainSocketImpl extends SocketImpl
{
+ // Static initializer to load native library.
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javanet");
+ }
+ }
+
// These fields are mirrored for use in native code to avoid cpp conflicts
// when the #defines in system header files are the same as the public fields.
static final int _Jv_TCP_NODELAY_ = SocketOptions.TCP_NODELAY,
@@ -85,21 +102,101 @@ class PlainSocketImpl extends SocketImpl
// localAddress cache
InetAddress localAddress;
+ /**
+ * A cached copy of the in stream for reading from the socket.
+ */
+ private InputStream in;
+
+ /**
+ * A cached copy of the out stream for writing to the socket.
+ */
+ private OutputStream out;
+
+ /**
+ * Default do nothing constructor
+ */
+ public PlainSocketImpl()
+ {
+ }
+
+ protected void finalize() throws Throwable
+ {
+ synchronized (this)
+ {
+ if (fnum != -1)
+ try
+ {
+ close();
+ }
+ catch (IOException ex)
+ {
+ // ignore
+ }
+ }
+ super.finalize();
+ }
+
+ /**
+ * Sets the specified option on a socket to the passed in object. For
+ * options that take an integer argument, the passed in object is an
+ * Integer. The option_id parameter is one of the defined constants in
+ * this interface.
+ *
+ * @param option_id The identifier of the option
+ * @param val The value to set the option to
+ *
+ * @exception SocketException If an error occurs
+ */
public native void setOption(int optID, Object value) throws SocketException;
+ /**
+ * Returns the current setting of the specified option. The Object returned
+ * will be an Integer for options that have integer values. The option_id
+ * is one of the defined constants in this interface.
+ *
+ * @param option_id The option identifier
+ *
+ * @return The current value of the option
+ *
+ * @exception SocketException If an error occurs
+ */
public native Object getOption(int optID) throws SocketException;
public native void shutdownInput () throws IOException;
public native void shutdownOutput () throws IOException;
+ /**
+ * Creates a new socket that is not bound to any local address/port and
+ * is not connected to any remote address/port. This will be created as
+ * a stream socket if the stream parameter is true, or a datagram socket
+ * if the stream parameter is false.
+ *
+ * @param stream true for a stream socket, false for a datagram socket
+ */
protected native void create (boolean stream) throws IOException;
+ /**
+ * Connects to the remote hostname and port specified as arguments.
+ *
+ * @param hostname The remote hostname to connect to
+ * @param port The remote port to connect to
+ *
+ * @exception IOException If an error occurs
+ */
protected void connect (String host, int port) throws IOException
{
connect (new InetSocketAddress (InetAddress.getByName(host), port), 0);
}
+ /**
+ * Connects to the remote address and port specified as arguments.
+ *
+ * @param addr The remote address to connect to
+ * @param port The remote port to connect to
+ *
+ * @exception IOException If an error occurs
+ */
protected void connect (InetAddress host, int port) throws IOException
{
connect (new InetSocketAddress (host, port), 0);
@@ -108,80 +205,121 @@ class PlainSocketImpl extends SocketImpl
protected native void connect (SocketAddress addr, int timeout)
throws IOException;
+ /**
+ * Binds to the specified port on the specified addr. Note that this addr
+ * must represent a local IP address. **** How bind to INADDR_ANY? ****
+ *
+ * @param addr The address to bind to
+ * @param port The port number to bind to
+ *
+ * @exception IOException If an error occurs
+ */
protected native void bind (InetAddress host, int port) throws IOException;
+ /**
+ * Starts listening for connections on a socket. The queuelen parameter
+ * is how many pending connections will queue up waiting to be serviced
+ * before being accept'ed. If the queue of pending requests exceeds this
+ * number, additional connections will be refused.
+ *
+ * @param queuelen The length of the pending connection queue
+ *
+ * @exception IOException If an error occurs
+ */
protected native void listen (int backlog) throws IOException;
private native void accept (PlainSocketImpl s) throws IOException;
+ /**
+ * Accepts a new connection on this socket and returns in in the
+ * passed in SocketImpl.
+ *
+ * @param impl The SocketImpl object to accept this connection.
+ */
protected void accept (SocketImpl s) throws IOException
{
accept((PlainSocketImpl) s);
}
+ /**
+ * Returns the number of bytes that the caller can read from this socket
+ * without blocking.
+ *
+ * @return The number of readable bytes before blocking
+ *
+ * @exception IOException If an error occurs
+ */
protected native int available() throws IOException;
+ /**
+ * Closes the socket. This will cause any InputStream or OutputStream
+ * objects for this Socket to be closed as well.
+ * <p>
+ * Note that if the SO_LINGER option is set on this socket, then the
+ * operation could block.
+ *
+ * @exception IOException If an error occurs
+ */
protected native void close () throws IOException;
protected native void sendUrgentData(int data)
throws IOException;
- // Stream handling.
-
- /** A cached copy of the in stream for reading from the socket. */
- private InputStream in;
-
- /** A cached copy of the out stream for writing to the socket. */
- private OutputStream out;
-
-
- // The native read methods.
+ native int read() throws IOException;
- private native int read() throws IOException;
-
- private native int read(byte[] buffer, int offset, int count)
+ /**
+ * Internal method used by SocketInputStream for reading data from
+ * the connection. Reads up to len bytes of data into the buffer
+ * buf starting at offset bytes into the buffer.
+ *
+ * @return The actual number of bytes read or -1 if end of stream.
+ *
+ * @exception IOException If an error occurs
+ */
+ native int read(byte[] buffer, int offset, int count)
throws IOException;
+ native void write(int c) throws IOException;
- // The native write methods.
-
- private native void write(int c) throws IOException;
-
- private native void write(byte[] buffer, int offset, int count)
+ /**
+ * Internal method used by SocketOuputStream for writing data to
+ * the connection. Writes up to len bytes of data from the buffer
+ * buf starting at offset bytes into the buffer.
+ *
+ * @exception IOException If an error occurs
+ */
+ native void write(byte[] buffer, int offset, int count)
throws IOException;
- protected void finalize() throws Throwable
- {
- synchronized (this)
- {
- if (fnum != -1)
- try
- {
- close();
- }
- catch (IOException ex)
- {
- // ignore
- }
- }
- super.finalize();
- }
-
- /** @return the input stream attached to the socket.
+ /**
+ * Returns an InputStream object for reading from this socket. This will
+ * be an instance of SocketInputStream.
+ *
+ * @return An input stream attached to the socket.
+ *
+ * @exception IOException If an error occurs
*/
- protected InputStream getInputStream() throws IOException
+ protected synchronized InputStream getInputStream() throws IOException
{
if (in == null)
in = new SocketInputStream();
+
return in;
}
- /** @return the output stream attached to the socket.
+ /**
+ * Returns an OutputStream object for writing to this socket. This will
+ * be an instance of SocketOutputStream.
+ *
+ * @return An output stream attached to the socket.
+ *
+ * @exception IOException If an error occurs
*/
- protected OutputStream getOutputStream() throws IOException
+ protected synchronized OutputStream getOutputStream() throws IOException
{
if (out == null)
out = new SocketOutputStream();
+
return out;
}
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index 2d04eac452f..699319e70b2 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -157,57 +157,19 @@ public class ServerSocket
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkListen(port);
-
- if (bindAddr == null)
- bindAddr = InetAddress.ANY_IF;
-
// create socket
impl.create(true);
- // bind to address/port
- try
- {
- impl.bind(bindAddr, port);
- }
- catch (IOException exception)
- {
- impl.close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- impl.close();
- throw exception;
- }
- catch (Error error)
- {
- impl.close();
- throw error;
- }
+ // bind/listen socket
+ bind (new InetSocketAddress (bindAddr, port), backlog);
+ }
- // listen on socket
- try
- {
- impl.listen(backlog);
- }
- catch (IOException exception)
- {
- impl.close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- impl.close();
- throw exception;
- }
- catch (Error error)
- {
- impl.close();
- throw error;
- }
+ /*
+ * This method may only be used by java.nio.channels.ServerSocketChannel.open.
+ */
+ void setChannel (ServerSocketChannel ch)
+ {
+ this.ch = ch;
}
/**
@@ -258,9 +220,48 @@ public class ServerSocket
if (s != null)
s.checkListen (tmp.getPort ());
+ // bind to address/port
+ try
+ {
impl.bind (tmp.getAddress (), tmp.getPort ());
+ }
+ catch (IOException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close();
+ throw error;
+ }
+
+ // listen on socket
+ try
+ {
impl.listen(backlog);
}
+ catch (IOException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close();
+ throw error;
+ }
+ }
/**
* This method returns the local address to which this socket is bound
diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java
index cd3b5ecb857..ef88de5c151 100644
--- a/libjava/java/net/Socket.java
+++ b/libjava/java/net/Socket.java
@@ -37,7 +37,9 @@ exception statement from your version. */
package java.net;
-import java.io.*;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
import java.nio.channels.SocketChannel;
import java.nio.channels.IllegalBlockingModeException;
@@ -87,8 +89,6 @@ public class Socket
private boolean closed = false;
- // Constructors
-
/**
* Initializes a new instance of <code>Socket</code> object without
* connecting to a remote host. This useful for subclasses of socket that
@@ -281,9 +281,10 @@ public class Socket
boolean stream) throws IOException
{
this();
- this.inputShutdown = false;
- this.outputShutdown = false;
+ if (raddr == null)
+ throw new NullPointerException ();
+
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
@@ -291,59 +292,26 @@ public class Socket
if (sm != null)
sm.checkConnect(raddr.getHostName(), rport);
- // create socket
- impl.create(stream);
+ // bind socket
+ SocketAddress bindaddr =
+ laddr == null ? null : new InetSocketAddress (laddr, lport);
+ bind (bindaddr);
+
+ // connect socket
+ connect (new InetSocketAddress (raddr, rport));
// FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port,
// i.e. '0' and if localAddr is unspecified, use getLocalAddress() as
// that default. JDK 1.2 doc infers not to do a bind.
-
- // bind/connect to address/port
- if (laddr != null)
- {
- try
- {
- impl.bind(laddr, lport);
- }
- catch (IOException exception)
- {
- impl.close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- impl.close();
- throw exception;
- }
- catch (Error error)
- {
- impl.close();
- throw error;
- }
- }
+ }
- if (raddr != null)
- {
- try
- {
- impl.connect(raddr, rport);
- }
- catch (IOException exception)
- {
- impl.close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- impl.close();
- throw exception;
- }
- catch (Error error)
- {
- impl.close();
- throw error;
- }
- }
+ /*
+ * This method may only be used by java.nio.channels.ServerSocketChannel.accept and
+ * java.nio.channels.SocketChannel.open.
+ */
+ void setChannel (SocketChannel ch)
+ {
+ this.ch = ch;
}
/**
@@ -362,12 +330,40 @@ public class Socket
{
if (closed)
throw new SocketException ("Socket is closed");
+
+ // XXX: JDK 1.4.1 API documentation says that if bindpoint is null the
+ // socket will be bound to an ephemeral port and a valid local address.
+ if (bindpoint == null)
+ bindpoint = new InetSocketAddress (InetAddress.ANY_IF, 0);
if ( !(bindpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ();
InetSocketAddress tmp = (InetSocketAddress) bindpoint;
- impl.bind (tmp.getAddress(), tmp.getPort());
+
+ // create socket
+ impl.create (true);
+
+ // bind to address/port
+ try
+ {
+ impl.bind (tmp.getAddress(), tmp.getPort());
+ }
+ catch (IOException exception)
+ {
+ impl.close ();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close ();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close ();
+ throw error;
+ }
}
/**
@@ -385,16 +381,7 @@ public class Socket
public void connect (SocketAddress endpoint)
throws IOException
{
- if (closed)
- throw new SocketException ("Socket is closed");
-
- if (! (endpoint instanceof InetSocketAddress))
- throw new IllegalArgumentException ("Address type not supported");
-
- if (ch != null && !ch.isBlocking ())
- throw new IllegalBlockingModeException ();
-
- impl.connect (endpoint, 0);
+ connect (endpoint, 0);
}
/**
@@ -423,8 +410,29 @@ public class Socket
if (ch != null && !ch.isBlocking ())
throw new IllegalBlockingModeException ();
-
- impl.connect (endpoint, timeout);
+
+ if (!isBound ())
+ bind (null);
+
+ try
+ {
+ impl.connect (endpoint, timeout);
+ }
+ catch (IOException exception)
+ {
+ impl.close ();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close ();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close ();
+ throw error;
+ }
}
/**
diff --git a/libjava/java/net/SocketImpl.java b/libjava/java/net/SocketImpl.java
index 12dcb0b9a5c..14101513e09 100644
--- a/libjava/java/net/SocketImpl.java
+++ b/libjava/java/net/SocketImpl.java
@@ -1,5 +1,6 @@
/* SocketImpl.java -- Abstract socket implementation class
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,9 +36,13 @@ 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 java.net;
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
/* Written using on-line Java Platform 1.2 API Specification.
* Believed complete and correct.
@@ -277,44 +282,15 @@ public abstract class SocketImpl implements SocketOptions
}
/**
- * Sets the specified option on a socket to the passed in object. For
- * options that take an integer argument, the passed in object is an
- * <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>option_id</code>
- * parameter is one of the defined constants in the superinterface.
- *
- * @param option_id The identifier of the option
- * @param val The value to set the option to
- *
- * @exception SocketException If an error occurs
- * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
- */
- public abstract void setOption(int option_id, Object val)
- throws SocketException;
-
- /**
- * Returns the current setting of the specified option. The
- * <code>Object</code> returned will be an <code>Integer</code> for options
- * that have integer values. For options that are set to on or off, a
- * <code>Boolean</code> will be returned. The <code>option_id</code>
- * is one of the defined constants in the superinterface.
- *
- * @param option_id The option identifier
- *
- * @return The current value of the option
- *
- * @exception SocketException If an error occurs
- * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
- */
- public abstract Object getOption(int option_id) throws SocketException;
-
- /**
* Shut down the input side of this socket. Subsequent reads will
* return end-of-file.
*
* @exception IOException if an error occurs
*/
- protected abstract void shutdownInput () throws IOException;
+ protected void shutdownInput () throws IOException
+ {
+ throw new IOException ("Not implemented in this socket class");
+ }
/**
* Shut down the output side of this socket. Subsequent writes will
@@ -322,5 +298,8 @@ public abstract class SocketImpl implements SocketOptions
*
* @exception IOException if an error occurs
*/
- protected abstract void shutdownOutput () throws IOException;
+ protected void shutdownOutput () throws IOException
+ {
+ throw new IOException ("Not implemented in this socket class");
+ }
}
diff --git a/libjava/java/net/SocketImplFactory.java b/libjava/java/net/SocketImplFactory.java
index f9b3f418670..fc5de7a0851 100644
--- a/libjava/java/net/SocketImplFactory.java
+++ b/libjava/java/net/SocketImplFactory.java
@@ -1,5 +1,5 @@
/* SocketImplFactory.java -- Interface to create a SocketImpl object
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,21 +43,20 @@ package java.net;
*/
/**
- * This interface defines one method which returns a SocketImpl object.
- * This should not be needed by ordinary applications.
+ * This interface defines one method which returns a <code>SocketImpl</code>
+ * object. This should not be needed by ordinary applications.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner <bothner@cygnus.com>
*/
public interface SocketImplFactory
{
-/**
- * This method returns an instance of the SocketImpl object
- *
- * @return A SocketImpl object
- */
-SocketImpl
-createSocketImpl();
+ /**
+ * This method returns an instance of the <code>SocketImpl</code> object
+ *
+ * @return A <code>SocketImpl</code> object
+ */
+ public SocketImpl createSocketImpl();
} // interface SocketImplFactory
diff --git a/libjava/java/net/SocketOptions.java b/libjava/java/net/SocketOptions.java
index f62afef9aab..b0404e8409c 100644
--- a/libjava/java/net/SocketOptions.java
+++ b/libjava/java/net/SocketOptions.java
@@ -1,5 +1,6 @@
/* SocketOptions.java -- Implements options for sockets (duh!)
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -138,30 +139,30 @@ public interface SocketOptions
* Sets the specified option on a socket to the passed in object. For
* options that take an integer argument, the passed in object is an
* <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>option_id</code>
+ * value passed will be a <code>Boolean</code>. The <code>optionId</code>
* parameter is one of the defined constants in this interface.
*
- * @param option_id The identifier of the option
+ * @param optionId The identifier of the option
* @param val The value to set the option to
*
* @exception SocketException If an error occurs
*/
- void setOption(int option_id, Object val) throws SocketException;
+ void setOption(int optionId, Object val) throws SocketException;
/**
* Returns the current setting of the specified option. The
* <code>Object</code> returned will be an <code>Integer</code> for options
* that have integer values. For options that are set to on or off, a
- * <code>Boolean</code> will be returned. The <code>option_id</code>
- * is one of the defined constants in this interface.
+ * <code>Boolean</code> will be returned. The <code>optionId</code>
+ * parameter is one of the defined constants in this interface.
*
- * @param option_id The option identifier
+ * @param optionId The option identifier
*
* @return The current value of the option
*
* @exception SocketException If an error occurs
*/
- Object getOption(int option_id) throws SocketException;
+ Object getOption(int optionId) throws SocketException;
} // interface SocketOptions
diff --git a/libjava/java/net/SocketPermission.java b/libjava/java/net/SocketPermission.java
index 6fa65f8793a..dea04e2432a 100644
--- a/libjava/java/net/SocketPermission.java
+++ b/libjava/java/net/SocketPermission.java
@@ -96,6 +96,9 @@ import java.security.PermissionCollection;
* Can accept connections from 197.197.20.1
* </pre><p>
*
+ * This class also supports IPv6 addresses. These should be specified
+ * in either RFC 2732 format or in full uncompressed form.
+ *
* @since 1.2
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -159,7 +162,7 @@ public final class SocketPermission extends Permission
/**
* Returns a hash code value for this object. Overrides the
- * Permission.hashCode()
+ * <code>Permission.hashCode()</code>.
*
* @return A hash code
*/
@@ -233,7 +236,7 @@ public final class SocketPermission extends Permission
* Returns true if the permission object passed it is implied by the
* this permission. This will be true if
* <p><ul>
- * <li>The argument is of type SocketPermission
+ * <li>The argument is of type <code>SocketPermission</code>
* <li>The actions list of the argument are in this object's actions
* <li>The port range of the argument is within this objects port range
* <li>The hostname is equal to or a subset of this objects hostname
@@ -247,7 +250,7 @@ public final class SocketPermission extends Permission
* wildcards
* </ul>
*
- * @param perm The Permission to check against
+ * @param perm The <code>Permission</code> to check against
*
* @return <code>true</code> if the <code>Permission</code> is implied by
* this object, <code>false</code> otherwise.
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index fd7428ed37f..12c86914e30 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -1,5 +1,5 @@
/* URL.java -- Uniform Resource Locator Class
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -147,7 +147,7 @@ public final class URL implements Serializable
/**
* The protocol handler in use for this URL
*/
- transient private URLStreamHandler handler;
+ transient URLStreamHandler ph;
/**
* This a table where we cache protocol handlers to avoid the overhead
@@ -223,24 +223,25 @@ public final class URL implements Serializable
* @since 1.2
*/
public URL(String protocol, String host, int port, String file,
- URLStreamHandler handler) throws MalformedURLException
+ URLStreamHandler ph)
+ throws MalformedURLException
{
if (protocol == null)
throw new MalformedURLException("null protocol");
this.protocol = protocol.toLowerCase();
- if (handler != null)
+ if (ph != null)
{
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkPermission (new NetPermission ("specifyStreamHandler"));
- this.handler = handler;
+ this.ph = ph;
}
else
- this.handler = getURLStreamHandler(protocol);
+ this.ph = getURLStreamHandler(protocol);
- if (this.handler == null)
+ if (this.ph == null)
throw new MalformedURLException (
"Protocol handler not found: " + protocol);
@@ -328,7 +329,7 @@ public final class URL implements Serializable
*
* @since 1.2
*/
- public URL(URL context, String spec, URLStreamHandler handler)
+ public URL(URL context, String spec, URLStreamHandler ph)
throws MalformedURLException
{
/* A protocol is defined by the doc as the substring before a ':'
@@ -381,18 +382,18 @@ public final class URL implements Serializable
throw new
MalformedURLException("Absolute URL required with null context");
- if (handler != null)
+ if (ph != null)
{
SecurityManager s = System.getSecurityManager ();
if (s != null)
s.checkPermission (new NetPermission ("specifyStreamHandler"));
- this.handler = handler;
+ this.ph = ph;
}
else
- this.handler = getURLStreamHandler(protocol);
+ this.ph = getURLStreamHandler(protocol);
- if (this.handler == null)
+ if (this.ph == null)
throw new MalformedURLException("Protocol handler not found: "
+ protocol);
@@ -400,8 +401,8 @@ public final class URL implements Serializable
// is to be excluded by passing the 'limit' as the indexOf the '#'
// if one exists, otherwise pass the end of the string.
int hashAt = spec.indexOf('#', colon + 1);
- this.handler.parseURL(this, spec, colon + 1,
- hashAt < 0 ? spec.length() : hashAt);
+ this.ph.parseURL(this, spec, colon + 1,
+ hashAt < 0 ? spec.length() : hashAt);
if (hashAt >= 0)
ref = spec.substring(hashAt + 1);
@@ -418,14 +419,12 @@ public final class URL implements Serializable
*
* @return true if the URL is equal, false otherwise
*/
- public boolean equals(Object obj)
+ public boolean equals (Object obj)
{
if (obj == null || ! (obj instanceof URL))
return false;
- URL uObj = (URL) obj;
-
- return handler.equals (this, uObj);
+ return ph.equals (this, (URL) obj);
}
/**
@@ -514,7 +513,7 @@ public final class URL implements Serializable
*/
public int getDefaultPort()
{
- return handler.getDefaultPort();
+ return ph.getDefaultPort();
}
/**
@@ -568,7 +567,7 @@ public final class URL implements Serializable
if (hashCode != 0)
return hashCode; // Use cached value if available.
else
- return handler.hashCode (this);
+ return ph.hashCode (this);
}
/**
@@ -581,7 +580,7 @@ public final class URL implements Serializable
*/
public URLConnection openConnection() throws IOException
{
- return handler.openConnection(this);
+ return ph.openConnection(this);
}
/**
@@ -607,7 +606,7 @@ public final class URL implements Serializable
*/
public boolean sameFile(URL other)
{
- return handler.sameFile(this, other);
+ return ph.sameFile(this, other);
}
/**
@@ -629,7 +628,7 @@ public final class URL implements Serializable
// invalid protocol. It will cause the handler to be set to null
// thus overriding a valid handler. Callers of this method should
// be aware of this.
- this.handler = getURLStreamHandler(protocol);
+ this.ph = getURLStreamHandler(protocol);
this.protocol = protocol.toLowerCase();
this.authority = null;
this.port = port;
@@ -654,7 +653,7 @@ public final class URL implements Serializable
// invalid protocol. It will cause the handler to be set to null
// thus overriding a valid handler. Callers of this method should
// be aware of this.
- this.handler = getURLStreamHandler(protocol);
+ this.ph = getURLStreamHandler(protocol);
this.protocol = protocol.toLowerCase();
if (userInfo == null)
this.host = host;
@@ -703,7 +702,7 @@ public final class URL implements Serializable
public String toExternalForm()
{
// Identical to toString().
- return handler.toExternalForm(this);
+ return ph.toExternalForm(this);
}
/**
@@ -716,24 +715,24 @@ public final class URL implements Serializable
public String toString()
{
// Identical to toExternalForm().
- return handler.toExternalForm(this);
+ return ph.toExternalForm(this);
}
private static synchronized URLStreamHandler
getURLStreamHandler (String protocol)
{
- URLStreamHandler handler;
+ URLStreamHandler ph;
// See if a handler has been cached for this protocol.
- if ((handler = (URLStreamHandler) handlers.get(protocol)) != null)
- return handler;
+ if ((ph = (URLStreamHandler) handlers.get(protocol)) != null)
+ return ph;
// If a non-default factory has been set, use it to find the protocol.
if (factory != null)
- handler = factory.createURLStreamHandler(protocol);
+ ph = factory.createURLStreamHandler(protocol);
else if (protocol.equals ("core"))
{
- handler = new gnu.gcj.protocol.core.Handler ();
+ ph = new gnu.gcj.protocol.core.Handler ();
}
else if (protocol.equals ("file"))
{
@@ -747,12 +746,12 @@ public final class URL implements Serializable
// fix this problem. If other protocols are required in a
// statically linked application they will need to be handled in
// the same way as "file".
- handler = new gnu.gcj.protocol.file.Handler ();
+ ph = new gnu.gcj.protocol.file.Handler ();
}
// Non-default factory may have returned null or a factory wasn't set.
// Use the default search algorithm to find a handler for this protocol.
- if (handler == null)
+ if (ph == null)
{
// Get the list of packages to check and append our default handler
// to it, along with the JDK specified default as a last resort.
@@ -769,34 +768,33 @@ public final class URL implements Serializable
".Handler";
try
{
- handler =
- (URLStreamHandler) Class.forName(facName).newInstance();
+ ph = (URLStreamHandler) Class.forName(facName).newInstance();
}
catch (Exception e)
{
// Can't instantiate; handler still null, go on to next element.
}
- } while ((handler == null ||
- ! (handler instanceof URLStreamHandler)) &&
+ } while ((ph == null ||
+ ! (ph instanceof URLStreamHandler)) &&
pkgPrefix.hasMoreTokens());
}
// Update the hashtable with the new protocol handler.
- if (handler != null)
- if (handler instanceof URLStreamHandler)
- handlers.put(protocol, handler);
+ if (ph != null)
+ if (ph instanceof URLStreamHandler)
+ handlers.put(protocol, ph);
else
- handler = null;
+ ph = null;
- return handler;
+ return ph;
}
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException
{
ois.defaultReadObject();
- this.handler = getURLStreamHandler(protocol);
- if (this.handler == null)
+ this.ph = getURLStreamHandler(protocol);
+ if (this.ph == null)
throw new IOException("Handler for protocol " + protocol + " not found");
}
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index d7fc77f8ab4..10b67352f04 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -35,14 +35,13 @@ 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 java.net;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FilterInputStream;
import java.io.FilePermission;
import java.io.InputStream;
import java.io.IOException;
@@ -60,7 +59,6 @@ import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-import java.util.zip.ZipException;
/**
* A secure class loader that can load classes and resources from
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java
index 75adf522398..3b8a85be139 100644
--- a/libjava/java/net/URLConnection.java
+++ b/libjava/java/net/URLConnection.java
@@ -322,25 +322,28 @@ public abstract class URLConnection
* is not present or cannot be parsed as an integer, the default value
* will be returned.
*
- * @param name The name of the header field
- * @param val The default value
+ * @param name The header field key to lookup
+ * @param defaultValue The defaule value if the header field is not found
+ * or can't be parsed.
*
* @return The value of the header field or the default value if the field
* is missing or malformed
*/
- public int getHeaderFieldInt(String name, int val)
+ public int getHeaderFieldInt(String name, int defaultValue)
{
- String str = getHeaderField(name);
+ String value = getHeaderField (name);
+
+ if (value == null)
+ return defaultValue;
+
try
{
- if (str != null)
- val = Integer.parseInt(str);
+ return Integer.parseInt (value);
}
- catch (NumberFormatException e)
- {
- ; // Do nothing; val is the default.
+ catch (NumberFormatException e)
+ {
+ return defaultValue;
}
- return val;
}
/**
@@ -349,27 +352,32 @@ public abstract class URLConnection
* value if the field is not present or cannot be converted to a date.
*
* @param name The name of the header field
- * @param val The dafault date
+ * @param defaultValue The default date if the header field is not found
+ * or can't be converted.
*
* @return Returns the date value of the header filed or the default value
* if the field is missing or malformed
*/
- public long getHeaderFieldDate(String name, long val)
+ public long getHeaderFieldDate (String name, long defaultValue)
{
if (! dateformats_initialized)
- initializeDateFormats();
- String str = getHeaderField(name);
+ initializeDateFormats ();
+
+ long result = defaultValue;
+ String str = getHeaderField (name);
+
if (str != null)
{
- Date date;
- if ((date = dateFormat1.parse(str, new ParsePosition(0))) != null)
- val = date.getTime();
- else if ((date = dateFormat2.parse(str, new ParsePosition(0))) != null)
- val = date.getTime();
- else if ((date = dateFormat3.parse(str, new ParsePosition(0))) != null)
- val = date.getTime();
+ Date date;
+ if ((date = dateFormat1.parse (str, new ParsePosition (0))) != null)
+ result = date.getTime ();
+ else if ((date = dateFormat2.parse (str, new ParsePosition (0))) != null)
+ result = date.getTime ();
+ else if ((date = dateFormat3.parse (str, new ParsePosition (0))) != null)
+ result = date.getTime ();
}
- return val;
+
+ return result;
}
/**
@@ -383,7 +391,7 @@ public abstract class URLConnection
* @return The header field key or null if index is past the end
* of the headers.
*/
- public String getHeaderFieldKey(int index)
+ public String getHeaderFieldKey (int index)
{
// Subclasses for specific protocols override this.
return null;
@@ -505,7 +513,8 @@ public abstract class URLConnection
* to be done for this connection. This default to true unless the
* doOutput flag is set to false, in which case this defaults to false.
*
- * @param doinput The new value of the doInput field
+ * @param input <code>true</code> if input is to be done,
+ * <code>false</code> otherwise
*
* @exception IllegalStateException If already connected
*/
@@ -667,7 +676,10 @@ public abstract class URLConnection
}
/**
- * Returns the default value of the useCaches field
+ * Returns the default value used to determine whether or not caching
+ * of documents will be done when possible.
+ *
+ * @return true if caches will be used, false otherwise
*/
public boolean getDefaultUseCaches()
{
@@ -697,6 +709,8 @@ public abstract class URLConnection
*
* @see URLConnection#getRequestProperty(String key)
* @see URLConnection#addRequestProperty(String key, String value)
+ *
+ * @since 1.4
*/
public void setRequestProperty(String key, String value)
{
diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java
index 37183b9633e..93a8ab27814 100644
--- a/libjava/java/net/URLStreamHandler.java
+++ b/libjava/java/net/URLStreamHandler.java
@@ -265,7 +265,15 @@ public abstract class URLStreamHandler
return true;
// This comparison is very conservative. It assumes that any
// field can be null.
- if (url1 == null || url2 == null || url1.getPort() != url2.getPort())
+ if (url1 == null || url2 == null)
+ return false;
+ int p1 = url1.getPort ();
+ if (p1 == -1)
+ p1 = url1.ph.getDefaultPort ();
+ int p2 = url2.getPort ();
+ if (p2 == -1)
+ p2 = url2.ph.getDefaultPort ();
+ if (p1 != p2)
return false;
String s1, s2;
s1 = url1.getProtocol();
@@ -372,12 +380,20 @@ public abstract class URLStreamHandler
* @exception UnknownHostException If an unknown host is found
*/
protected boolean hostsEqual (URL url1, URL url2)
- throws UnknownHostException
{
- InetAddress addr1 = InetAddress.getByName (url1.getHost ());
- InetAddress addr2 = InetAddress.getByName (url2.getHost ());
+ InetAddress addr1 = getHostAddress (url1);
+ InetAddress addr2 = getHostAddress (url2);
+
+ if (addr1 != null || addr2 != null)
+ return addr1.equals (addr2);
+
+ String host1 = url1.getHost();
+ String host2 = url2.getHost();
+
+ if (host1 != null && host2 != null)
+ return host1.equalsIgnoreCase (host2);
- return addr1.equals (addr2);
+ return host1 == null && host2 == null;
}
/**
diff --git a/libjava/java/net/URLStreamHandlerFactory.java b/libjava/java/net/URLStreamHandlerFactory.java
index 1e67d1d37b7..a9ecbad8f06 100644
--- a/libjava/java/net/URLStreamHandlerFactory.java
+++ b/libjava/java/net/URLStreamHandlerFactory.java
@@ -1,5 +1,5 @@
/* URLStreamHandlerFactory.java -- Maps protocols to URLStreamHandlers
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,23 +46,22 @@ package java.net;
/**
* This interface contains one method which maps the protocol portion of
* a URL (eg, "http" in "http://www.urbanophile.com/arenn/") to a
- * URLStreamHandler object.
+ * <code>URLStreamHandler</code> object.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
*/
public interface URLStreamHandlerFactory
{
-/**
- * This method maps the protocol portion of a URL to a URLStreamHandler
- * object.
- *
- * @param protocol The protocol name to map ("http", "ftp", etc).
- *
- * @return The URLStreamHandler for the specified protocol
- */
-URLStreamHandler
-createURLStreamHandler(String protocol);
+ /**
+ * This method maps the protocol portion of a URL to a
+ * <code>URLStreamHandler</code> object.
+ *
+ * @param protocol The protocol name to map ("http", "ftp", etc).
+ *
+ * @return The <code>URLStreamHandler</code> for the specified protocol
+ */
+ public URLStreamHandler createURLStreamHandler(String protocol);
} // interface URLStreamHandlerFactory
diff --git a/libjava/java/nio/Buffer.java b/libjava/java/nio/Buffer.java
index 693765f3e46..9221d755be9 100644
--- a/libjava/java/nio/Buffer.java
+++ b/libjava/java/nio/Buffer.java
@@ -35,14 +35,15 @@ 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 java.nio;
public abstract class Buffer
{
- private int cap = 0;
- private int limit = 0;
- private int pos = 0;
- private int mark = -1;
+ int cap = 0;
+ int limit = 0;
+ int pos = 0;
+ int mark = -1;
// Creates a new Buffer.
//
diff --git a/libjava/java/nio/ByteBufferImpl.java b/libjava/java/nio/ByteBufferImpl.java
index 4642288e79a..37db881fa4c 100644
--- a/libjava/java/nio/ByteBufferImpl.java
+++ b/libjava/java/nio/ByteBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class ByteBufferImpl extends ByteBuffer
+final class ByteBufferImpl extends ByteBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/CharBufferImpl.java b/libjava/java/nio/CharBufferImpl.java
index 708ab403f54..d22b4d1b2bb 100644
--- a/libjava/java/nio/CharBufferImpl.java
+++ b/libjava/java/nio/CharBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class CharBufferImpl extends CharBuffer
+final class CharBufferImpl extends CharBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java
index b037385c4af..352016372f7 100644
--- a/libjava/java/nio/DirectByteBufferImpl.java
+++ b/libjava/java/nio/DirectByteBufferImpl.java
@@ -40,11 +40,16 @@ package java.nio;
import gnu.gcj.RawData;
-public class DirectByteBufferImpl extends ByteBuffer
+class DirectByteBufferImpl extends ByteBuffer
{
- private RawData address;
+ RawData address;
private int offset;
private boolean readOnly;
+
+ public DirectByteBufferImpl (RawData address, long len)
+ {
+ this (address, 0, (int) len, (int) len, 0, -1, false);
+ }
public DirectByteBufferImpl (RawData address, int offset, int capacity,
int limit, int position, int mark,
diff --git a/libjava/java/nio/DoubleBufferImpl.java b/libjava/java/nio/DoubleBufferImpl.java
index dbc63bbad29..8dacec9be34 100644
--- a/libjava/java/nio/DoubleBufferImpl.java
+++ b/libjava/java/nio/DoubleBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class DoubleBufferImpl extends DoubleBuffer
+final class DoubleBufferImpl extends DoubleBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/FloatBufferImpl.java b/libjava/java/nio/FloatBufferImpl.java
index 93dd1d0b35a..db0f52bb412 100644
--- a/libjava/java/nio/FloatBufferImpl.java
+++ b/libjava/java/nio/FloatBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class FloatBufferImpl extends FloatBuffer
+final class FloatBufferImpl extends FloatBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/IntBufferImpl.java b/libjava/java/nio/IntBufferImpl.java
index ebf33ecbc51..ec444c014c3 100644
--- a/libjava/java/nio/IntBufferImpl.java
+++ b/libjava/java/nio/IntBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class IntBufferImpl extends IntBuffer
+final class IntBufferImpl extends IntBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/LongBufferImpl.java b/libjava/java/nio/LongBufferImpl.java
index 08d4ac5486f..b4fb3de5f8a 100644
--- a/libjava/java/nio/LongBufferImpl.java
+++ b/libjava/java/nio/LongBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class LongBufferImpl extends LongBuffer
+final class LongBufferImpl extends LongBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/MappedByteBuffer.java b/libjava/java/nio/MappedByteBuffer.java
index 305327b74c5..87500e76656 100644
--- a/libjava/java/nio/MappedByteBuffer.java
+++ b/libjava/java/nio/MappedByteBuffer.java
@@ -35,6 +35,7 @@ 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 java.nio;
/**
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index f28f1137535..422794872b7 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.nio;
+import gnu.java.nio.FileChannelImpl;
import java.io.IOException;
-import java.nio.channels.FileChannelImpl;
import gnu.gcj.RawData;
public class MappedByteBufferImpl extends MappedByteBuffer
diff --git a/libjava/java/nio/ShortBufferImpl.java b/libjava/java/nio/ShortBufferImpl.java
index fcfbee64f96..5f6c60137a1 100644
--- a/libjava/java/nio/ShortBufferImpl.java
+++ b/libjava/java/nio/ShortBufferImpl.java
@@ -41,7 +41,7 @@ package java.nio;
/**
* This is a Heap memory implementation
*/
-public final class ShortBufferImpl extends ShortBuffer
+final class ShortBufferImpl extends ShortBuffer
{
private boolean readOnly;
diff --git a/libjava/java/nio/channels/Channels.java b/libjava/java/nio/channels/Channels.java
index d911b41d00b..98fc2b6f8a5 100644
--- a/libjava/java/nio/channels/Channels.java
+++ b/libjava/java/nio/channels/Channels.java
@@ -41,7 +41,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
-import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
diff --git a/libjava/java/nio/channels/FileChannel.java b/libjava/java/nio/channels/FileChannel.java
index 708a50c9a39..9def4631652 100644
--- a/libjava/java/nio/channels/FileChannel.java
+++ b/libjava/java/nio/channels/FileChannel.java
@@ -112,7 +112,7 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
*
* @exception IOException If an I/O error occurs.
*/
- public long write (ByteBuffer[] srcs) throws IOException
+ public final long write (ByteBuffer[] srcs) throws IOException
{
long result = 0;
diff --git a/libjava/java/nio/channels/ServerSocketChannel.java b/libjava/java/nio/channels/ServerSocketChannel.java
index e41af212623..a116731c602 100644
--- a/libjava/java/nio/channels/ServerSocketChannel.java
+++ b/libjava/java/nio/channels/ServerSocketChannel.java
@@ -35,12 +35,11 @@ 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 java.nio.channels;
import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.SelectorProvider;
-import java.nio.ByteOrder;
-import java.nio.ByteBuffer;
import java.io.IOException;
import java.net.ServerSocket;
@@ -54,7 +53,7 @@ public abstract class ServerSocketChannel
/**
* Initializes this channel.
*/
- public ServerSocketChannel (SelectorProvider provider)
+ protected ServerSocketChannel (SelectorProvider provider)
{
super (provider);
}
diff --git a/libjava/java/nio/channels/spi/AbstractSelector.java b/libjava/java/nio/channels/spi/AbstractSelector.java
index fc0aeca32d9..160cdc00365 100644
--- a/libjava/java/nio/channels/spi/AbstractSelector.java
+++ b/libjava/java/nio/channels/spi/AbstractSelector.java
@@ -35,12 +35,12 @@ 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 java.nio.channels.spi;
import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
-import java.util.List;
import java.util.Set;
public abstract class AbstractSelector extends Selector
diff --git a/libjava/java/nio/natDirectByteBufferImpl.cc b/libjava/java/nio/natDirectByteBufferImpl.cc
index 82863900256..2ceea170551 100644
--- a/libjava/java/nio/natDirectByteBufferImpl.cc
+++ b/libjava/java/nio/natDirectByteBufferImpl.cc
@@ -13,33 +13,33 @@ details. */
#include <gcj/cni.h>
#include <jvm.h>
+#include <stdlib.h>
+
#include <gnu/gcj/RawData.h>
#include <java/nio/DirectByteBufferImpl.h>
gnu::gcj::RawData*
-java::nio::DirectByteBufferImpl::allocateImpl (jint /*capacity*/)
+java::nio::DirectByteBufferImpl::allocateImpl (jint capacity)
{
- // FIXME: implement this
- return 0;
+ return reinterpret_cast<gnu::gcj::RawData*> (::malloc (capacity));
}
void
-java::nio::DirectByteBufferImpl::freeImpl (gnu::gcj::RawData* /*address*/)
+java::nio::DirectByteBufferImpl::freeImpl (gnu::gcj::RawData* address)
{
- // FIXME: implement this
+ ::free (reinterpret_cast<void*> (address));
}
jbyte
-java::nio::DirectByteBufferImpl::getImpl (jint /*index*/)
+java::nio::DirectByteBufferImpl::getImpl (jint index)
{
- // FIXME: implement this
- // Dont forget: add offset to index
- return 0;
+ jbyte* pointer = reinterpret_cast<jbyte*> (address) + offset + index;
+ return *pointer;
}
void
-java::nio::DirectByteBufferImpl::putImpl (jint /*index*/, jbyte /*value*/)
+java::nio::DirectByteBufferImpl::putImpl (jint index, jbyte value)
{
- // FIXME: implement this
- // Dont forget: add offset to index
+ jbyte* pointer = reinterpret_cast<jbyte*> (address) + offset + index;
+ *pointer = value;
}
diff --git a/libjava/java/rmi/server/SkeletonNotFoundException.java b/libjava/java/rmi/server/SkeletonNotFoundException.java
index 41819d938f5..93ad1ecf1db 100644
--- a/libjava/java/rmi/server/SkeletonNotFoundException.java
+++ b/libjava/java/rmi/server/SkeletonNotFoundException.java
@@ -35,6 +35,7 @@ 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 java.rmi.server;
import java.rmi.RemoteException;
@@ -59,7 +60,6 @@ public class SkeletonNotFoundException extends RemoteException
* Create an exception with the specified message.
*
* @param s the message
- * @deprecated no longer needed
*/
public SkeletonNotFoundException(String s)
{
@@ -71,7 +71,6 @@ public class SkeletonNotFoundException extends RemoteException
*
* @param s the message
* @param e the cause
- * @deprecated no longer needed
*/
public SkeletonNotFoundException(String s, Exception e)
{
diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java
index 4e2f06ae64b..8e010e7e5e8 100644
--- a/libjava/java/rmi/server/UnicastRemoteObject.java
+++ b/libjava/java/rmi/server/UnicastRemoteObject.java
@@ -35,6 +35,7 @@ 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 java.rmi.server;
import java.rmi.RemoteException;
@@ -89,7 +90,7 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException {
return exportObject(obj, port, null);
}
- protected static Remote exportObject(Remote obj, int port, RMIServerSocketFactory ssf)
+ static Remote exportObject(Remote obj, int port, RMIServerSocketFactory ssf)
throws RemoteException
{
UnicastServerRef sref = null;
@@ -103,7 +104,7 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException {
}
/**
- * FIX ME
+ * FIXME
*/
public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
diff --git a/libjava/java/security/BasicPermission.java b/libjava/java/security/BasicPermission.java
index 25630fb798b..0945f2d7faf 100644
--- a/libjava/java/security/BasicPermission.java
+++ b/libjava/java/security/BasicPermission.java
@@ -1,5 +1,5 @@
/* BasicPermission.java -- implements a simple named permission
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,9 +71,8 @@ import java.util.Enumeration;
* @since 1.1
* @status updated to 1.4
*/
-public abstract class BasicPermission extends java.security.Permission
+public abstract class BasicPermission extends Permission
implements Serializable
- // FIXME extends with fully qualified classname is workaround for gcj 3.0.4.
{
/**
* Compatible with JDK 1.1+.
diff --git a/libjava/java/security/Certificate.java b/libjava/java/security/Certificate.java
index f37d919a733..5b0f9ae8d21 100644
--- a/libjava/java/security/Certificate.java
+++ b/libjava/java/security/Certificate.java
@@ -35,6 +35,7 @@ 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 java.security;
import java.io.InputStream;
@@ -62,7 +63,6 @@ public interface Certificate
* this certificate.
*
* @return the <code>Principal</code> guaranteeing the certificate
- * @deprecated this entire interface is deprecated
*/
Principal getGuarantor();
@@ -71,7 +71,6 @@ public interface Certificate
* this certificate.
*
* @return the <code>Principal</code> guaranteed by this certificate
- * @deprecated this entire interface is deprecated
*/
Principal getPrincipal();
@@ -80,7 +79,6 @@ public interface Certificate
* is being guaranteed.
*
* @return the <code>PublicKey</code> of the Principal being guaranteed
- * @deprecated this entire interface is deprecated
*/
PublicKey getPublicKey();
@@ -93,7 +91,6 @@ public interface Certificate
* @throws IOException if an error occurs writing to the stream
* @see #decode(InputStream)
* @see #getFormat()
- * @deprecated this entire interface is deprecated
*/
void encode(OutputStream out) throws KeyException, IOException;
@@ -105,7 +102,6 @@ public interface Certificate
* @throws IOException if an error occurs reading from the stream
* @see #encode(OutputStream)
* @see #getFormat()
- * @deprecated this entire interface is deprecated
*/
void decode(InputStream in) throws KeyException, IOException;
@@ -115,7 +111,6 @@ public interface Certificate
* <code>decode</code> methods.
*
* @return the encoding format being used
- * @deprecated this entire interface is deprecated
*/
String getFormat();
@@ -125,7 +120,6 @@ public interface Certificate
*
* @param detail true to provided more detailed information
* @return the string representation
- * @deprecated this entire interface is deprecated
*/
String toString(boolean detail);
} // interface Certificate
diff --git a/libjava/java/security/Security.java b/libjava/java/security/Security.java
index 0f1827ea02c..56335bf85c3 100644
--- a/libjava/java/security/Security.java
+++ b/libjava/java/security/Security.java
@@ -64,12 +64,29 @@ public final class Security extends Object
private static final String ALG_ALIAS = "Alg.Alias.";
private static Vector providers = new Vector();
- private static Properties secprops;
+ private static Properties secprops = new Properties();
static
{
String base = System.getProperty("gnu.classpath.home.url");
- loadProviders(base, System.getProperty("gnu.classpath.vm.shortname"));
- loadProviders(base, "classpath");
+ String vendor = System.getProperty("gnu.classpath.vm.shortname");
+
+ // Try VM specific security file
+ boolean loaded = loadProviders(base, vendor);
+
+ // Append classpath standard provider if possible
+ if (!loadProviders(base, "classpath") && !loaded && providers.size() == 0)
+ {
+ // No providers found and both security files failed to load properly.
+ System.err.println
+ ("WARNING: could not properly read security provider files:");
+ System.err.println
+ (" " + base + "/security/" + vendor + ".security");
+ System.err.println
+ (" " + base + "/security/" + "classpath" + ".security");
+ System.err.println
+ (" Falling back to standard GNU security provider");
+ providers.addElement(new gnu.java.security.provider.Gnu());
+ }
}
// This class can't be instantiated.
@@ -77,16 +94,21 @@ public final class Security extends Object
{
}
- private static void loadProviders(String baseUrl, String vendor)
+ /**
+ * Tries to load the vender specific security providers from the given
+ * base URL. Returns true if the resource could be read and completely
+ * parsed successfully, false otherwise.
+ */
+ private static boolean loadProviders(String baseUrl, String vendor)
{
if (baseUrl == null || vendor == null)
- return;
+ return false;
+ boolean result = true;
String secfilestr = baseUrl + "/security/" + vendor + ".security";
try
{
InputStream fin = new URL(secfilestr).openStream();
- secprops = new Properties();
secprops.load(fin);
int i = 1;
@@ -112,19 +134,20 @@ public final class Security extends Object
}
if (exception != null)
- System.err.println (
- "Error loading security provider " + name + ": " + exception);
+ {
+ System.err.println ("WARNING: Error loading security provider "
+ + name + ": " + exception);
+ result = false;
+ }
i++;
}
}
- catch (FileNotFoundException ignored)
- {
- // Actually we probably shouldn't ignore these, once the security
- // properties file is actually installed somewhere.
- }
catch (IOException ignored)
{
+ result = false;
}
+
+ return false;
}
/**
diff --git a/libjava/java/security/cert/PolicyQualifierInfo.java b/libjava/java/security/cert/PolicyQualifierInfo.java
index a46b6ba89be..8dede47fcb8 100644
--- a/libjava/java/security/cert/PolicyQualifierInfo.java
+++ b/libjava/java/security/cert/PolicyQualifierInfo.java
@@ -65,7 +65,7 @@ import gnu.java.security.der.DERWriter;
*
* @since JDK 1.4
*/
-public class PolicyQualifierInfo
+public final class PolicyQualifierInfo
{
// Fields.
diff --git a/libjava/java/text/CollationElementIterator.java b/libjava/java/text/CollationElementIterator.java
index ba60f205f3c..94c65005e8f 100644
--- a/libjava/java/text/CollationElementIterator.java
+++ b/libjava/java/text/CollationElementIterator.java
@@ -1,6 +1,6 @@
/* CollationElementIterator.java -- Walks through collation elements
+ Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation
-/* Copyright (C) 1999, 2001 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
@@ -60,7 +60,7 @@ public final class CollationElementIterator
* This is a constant value that is returned to indicate that the end of
* the string was encountered.
*/
- public static final int NULLORDER = 0xffffffff;
+ public static final int NULLORDER = -1;
/**
* This is the RuleBasedCollator this object was created from.
@@ -92,6 +92,7 @@ public final class CollationElementIterator
{
if (index == text.length())
return NULLORDER;
+
return collator.ceiNext(this);
}
diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java
index c298ef23342..df2b270e4f3 100644
--- a/libjava/java/text/DateFormat.java
+++ b/libjava/java/text/DateFormat.java
@@ -101,7 +101,7 @@ public abstract class DateFormat extends Format implements Cloneable
* <ul>
* <li>Is not <code>null</code>.
* <li>Is an instance of <code>DateFormat</code>.
- * <li>Has the same calendar and numberFormat field values as this object.
+ * <li>Has the same numberFormat field value as this object.
* </ul>
*
* @param obj The object to test for equality against.
@@ -111,10 +111,12 @@ public abstract class DateFormat extends Format implements Cloneable
*/
public boolean equals (Object obj)
{
- if (! (obj instanceof DateFormat))
+ if (!(obj instanceof DateFormat))
return false;
+
DateFormat d = (DateFormat) obj;
- return calendar.equals(d.calendar) && numberFormat.equals(d.numberFormat);
+
+ return numberFormat.equals(d.numberFormat);
}
/**
@@ -467,10 +469,10 @@ public abstract class DateFormat extends Format implements Cloneable
*/
public int hashCode ()
{
- int hash = calendar.hashCode();
if (numberFormat != null)
- hash ^= numberFormat.hashCode();
- return hash;
+ return numberFormat.hashCode();
+ else
+ return 0;
}
/**
diff --git a/libjava/java/text/DecimalFormat.java b/libjava/java/text/DecimalFormat.java
index 2dfdd2751a6..7f946173fee 100644
--- a/libjava/java/text/DecimalFormat.java
+++ b/libjava/java/text/DecimalFormat.java
@@ -1,5 +1,5 @@
/* DecimalFormat.java -- Formats and parses numbers
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -693,8 +693,8 @@ public class DecimalFormat extends NumberFormat
int index = pos.getIndex();
StringBuffer buf = new StringBuffer ();
- // We have to check both prefixes, because one might be empty.
- // We want to pick the longest prefix that matches.
+ // We have to check both prefixes, because one might be empty. We
+ // want to pick the longest prefix that matches.
boolean got_pos = str.startsWith(positivePrefix, index);
String np = (negativePrefix != null
? negativePrefix
@@ -729,11 +729,14 @@ public class DecimalFormat extends NumberFormat
// FIXME: handle Inf and NaN.
- // FIXME: do we have to respect minimum/maxmimum digit stuff?
- // What about leading zeros? What about multiplier?
+ // FIXME: do we have to respect minimum digits?
+ // What about leading zeros? What about multiplier?
int start_index = index;
int max = str.length();
+ int last = index + maximumIntegerDigits;
+ if (last > 0 && max > last)
+ max = last;
char zero = symbols.getZeroDigit();
int last_group = -1;
boolean int_part = true;
diff --git a/libjava/java/text/Format.java b/libjava/java/text/Format.java
index 804ef43ff29..ab61f28ae30 100644
--- a/libjava/java/text/Format.java
+++ b/libjava/java/text/Format.java
@@ -59,7 +59,7 @@ import java.io.Serializable;
*/
public abstract class Format implements Serializable, Cloneable
{
- static final long serialVersionUID = -299282585814624189L;
+ static final long serialVersionUID = 4479235611355683992L;
/**
* This method initializes a new instance of <code>Format</code>.
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java
index c1c79d9cdc2..67523e1628d 100644
--- a/libjava/java/text/SimpleDateFormat.java
+++ b/libjava/java/text/SimpleDateFormat.java
@@ -1,6 +1,6 @@
/* SimpleDateFormat.java -- A class for parsing/formating simple
date constructs
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -182,6 +182,7 @@ public class SimpleDateFormat extends DateFormat
compileFormat(pattern);
numberFormat = NumberFormat.getInstance(locale);
numberFormat.setGroupingUsed (false);
+ numberFormat.setParseIntegerOnly (true);
}
/**
@@ -208,6 +209,7 @@ public class SimpleDateFormat extends DateFormat
this.pattern = pattern;
numberFormat = NumberFormat.getInstance(locale);
numberFormat.setGroupingUsed (false);
+ numberFormat.setParseIntegerOnly (true);
}
/**
@@ -225,6 +227,7 @@ public class SimpleDateFormat extends DateFormat
this.pattern = pattern;
numberFormat = NumberFormat.getInstance();
numberFormat.setGroupingUsed (false);
+ numberFormat.setParseIntegerOnly (true);
}
// What is the difference between localized and unlocalized? The
@@ -381,10 +384,10 @@ public class SimpleDateFormat extends DateFormat
SimpleDateFormat sdf = (SimpleDateFormat)o;
- if (!toPattern().equals(sdf.toPattern()))
+ if (defaultCentury != sdf.defaultCentury)
return false;
- if (!get2DigitYearStart().equals(sdf.get2DigitYearStart()))
+ if (!toPattern().equals(sdf.toPattern()))
return false;
if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols()))
@@ -393,6 +396,17 @@ public class SimpleDateFormat extends DateFormat
return true;
}
+ /**
+ * This method returns a hash value for this object.
+ *
+ * @return A hash value for this object.
+ */
+ public int hashCode()
+ {
+ return super.hashCode() ^ toPattern().hashCode() ^ defaultCentury ^
+ getDateFormatSymbols().hashCode();
+ }
+
/**
* Formats the date input according to the format string in use,
@@ -567,6 +581,14 @@ public class SimpleDateFormat extends DateFormat
while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch)
;
int fmt_count = fmt_index - first;
+
+ // We might need to limit the number of digits to parse in
+ // some cases. We look to the next pattern character to
+ // decide.
+ boolean limit_digits = false;
+ if (fmt_index < fmt_max
+ && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0)
+ limit_digits = true;
--fmt_index;
// We can handle most fields automatically: most either are
@@ -699,6 +721,8 @@ public class SimpleDateFormat extends DateFormat
if (is_numeric)
{
numberFormat.setMinimumIntegerDigits(fmt_count);
+ if (limit_digits)
+ numberFormat.setMaximumIntegerDigits(fmt_count);
if (maybe2DigitYear)
index = pos.getIndex();
Number n = numberFormat.parse(dateStr, pos);
diff --git a/libjava/java/util/Locale.java b/libjava/java/util/Locale.java
index 22e19384c59..431824f0c35 100644
--- a/libjava/java/util/Locale.java
+++ b/libjava/java/util/Locale.java
@@ -231,9 +231,9 @@ public final class Locale implements Serializable, Cloneable
// default locale.
if (defaultLocale != null)
{
- language = convertLanguage(language);
- country = country.toUpperCase();
- variant = variant.toUpperCase();
+ language = convertLanguage(language).intern();
+ country = country.toUpperCase().intern();
+ variant = variant.toUpperCase().intern();
}
this.language = language;
this.country = country;
@@ -436,7 +436,7 @@ public final class Locale implements Serializable, Cloneable
*/
public String getISO3Language()
{
- if ("".equals(language))
+ if (language == "")
return "";
int index
= ("aa,ab,af,am,ar,as,ay,az,ba,be,bg,bh,bi,bn,bo,br,ca,co,cs,cy,da,"
@@ -472,7 +472,7 @@ public final class Locale implements Serializable, Cloneable
*/
public String getISO3Country()
{
- if ("".equals(country))
+ if (country == "")
return "";
int index
= ("AD,AE,AF,AG,AI,AL,AM,AN,AO,AQ,AR,AS,AT,AU,AW,AZ,BA,BB,BD,BE,BF,"
@@ -520,7 +520,7 @@ public final class Locale implements Serializable, Cloneable
* @return the language name of this locale localized to the default locale,
* with the ISO code as backup
*/
- public String getDisplayLanguage()
+ public final String getDisplayLanguage()
{
return getDisplayLanguage(defaultLocale);
}
@@ -558,7 +558,7 @@ public final class Locale implements Serializable, Cloneable
* @return the country name of this locale localized to the given locale,
* with the ISO code as backup
*/
- public String getDisplayCountry()
+ public final String getDisplayCountry()
{
return getDisplayCountry(defaultLocale);
}
@@ -596,7 +596,7 @@ public final class Locale implements Serializable, Cloneable
* @return the variant code of this locale localized to the given locale,
* with the ISO code as backup
*/
- public String getDisplayVariant()
+ public final String getDisplayVariant()
{
return getDisplayVariant(defaultLocale);
}
@@ -635,7 +635,7 @@ public final class Locale implements Serializable, Cloneable
*
* @return String version of this locale, suitable for display to the user
*/
- public String getDisplayName()
+ public final String getDisplayName()
{
return getDisplayName(defaultLocale);
}
@@ -723,12 +723,19 @@ public final class Locale implements Serializable, Cloneable
*/
public boolean equals(Object obj)
{
+ if (this == obj)
+ return true;
if (! (obj instanceof Locale))
return false;
Locale l = (Locale) obj;
- return (language.equals(l.language)
- && country.equals(l.country)
- && variant.equals(l.variant));
+
+ // ??? We might also want to add:
+ // hashCode() == l.hashCode()
+ // But this is a synchronized method. Is the overhead worth it?
+ // Measure this to make a decision.
+ return (language == l.language
+ && country == l.country
+ && variant == l.variant);
}
/**
diff --git a/libjava/java/util/PropertyResourceBundle.java b/libjava/java/util/PropertyResourceBundle.java
index a3173cf9eb7..7ebe2b1e6df 100644
--- a/libjava/java/util/PropertyResourceBundle.java
+++ b/libjava/java/util/PropertyResourceBundle.java
@@ -40,7 +40,6 @@ package java.util;
import java.io.IOException;
import java.io.InputStream;
-import gnu.java.util.DoubleEnumeration;
/**
* This class is a concrete <code>ResourceBundle</code> that gets it
diff --git a/libjava/java/util/SimpleTimeZone.java b/libjava/java/util/SimpleTimeZone.java
index c2e2560fc78..e777fbd456a 100644
--- a/libjava/java/util/SimpleTimeZone.java
+++ b/libjava/java/util/SimpleTimeZone.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.util;
-import java.text.DateFormatSymbols;
-
/**
* This class represents a simple time zone offset and handles
* daylight savings. It can only handle one daylight savings rule, so
@@ -88,6 +86,7 @@ public class SimpleTimeZone extends TimeZone
private static final int DOW_IN_MONTH_MODE = 2;
private static final int DOW_GE_DOM_MODE = 3;
private static final int DOW_LE_DOM_MODE = 4;
+
/**
* The mode of the start rule. This takes one of the following values:
* <dl>
@@ -488,7 +487,8 @@ public class SimpleTimeZone extends TimeZone
/**
* Returns the time zone offset to GMT in milliseconds, ignoring
* day light savings.
- * @return the time zone offset. */
+ * @return the time zone offset.
+ */
public int getRawOffset()
{
return rawOffset;
@@ -508,7 +508,8 @@ public class SimpleTimeZone extends TimeZone
* milliseconds with respect to standard time. Typically this
* is one hour, but for some time zones this may be half an our.
* @return the daylight savings offset in milliseconds.
- * @since JDK1.1.4?
+ *
+ * @since JDK1.2
*/
public int getDSTSavings()
{
diff --git a/libjava/java/util/logging/Handler.java b/libjava/java/util/logging/Handler.java
index c0fb1cd653a..324532187d3 100644
--- a/libjava/java/util/logging/Handler.java
+++ b/libjava/java/util/logging/Handler.java
@@ -379,7 +379,7 @@ h.setFormatter(h.getFormatter());</pre>
*/
public boolean isLoggable(LogRecord record)
{
- if (record.getLevel().intValue() <= level.intValue())
+ if (record.getLevel().intValue() < level.intValue())
return false;
if (filter != null)
diff --git a/libjava/java/util/prefs/AbstractPreferences.java b/libjava/java/util/prefs/AbstractPreferences.java
index d192c1f6717..a6a3e9a82f2 100644
--- a/libjava/java/util/prefs/AbstractPreferences.java
+++ b/libjava/java/util/prefs/AbstractPreferences.java
@@ -35,17 +35,15 @@ 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 java.util.prefs;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
-
import java.util.Iterator;
import java.util.HashMap;
import java.util.TreeSet;
-
import gnu.java.util.prefs.NodeWriter;
/**
diff --git a/libjava/java/util/prefs/Preferences.java b/libjava/java/util/prefs/Preferences.java
index 8705b77191c..af2535966be 100644
--- a/libjava/java/util/prefs/Preferences.java
+++ b/libjava/java/util/prefs/Preferences.java
@@ -238,10 +238,10 @@ public abstract class Preferences {
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
- public static Preferences systemNodeForPackage(Object o)
+ public static Preferences systemNodeForPackage(Class c)
throws SecurityException
{
- return nodeForPackage(o, systemRoot());
+ return nodeForPackage(c, systemRoot());
}
/**
@@ -257,10 +257,10 @@ public abstract class Preferences {
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
- public static Preferences userNodeForPackage(Object o)
+ public static Preferences userNodeForPackage(Class c)
throws SecurityException
{
- return nodeForPackage(o, userRoot());
+ return nodeForPackage(c, userRoot());
}
/**
@@ -269,9 +269,9 @@ public abstract class Preferences {
* root it returns the correct Preference node for the package node name
* of the given object.
*/
- private static Preferences nodeForPackage(Object o, Preferences root) {
+ private static Preferences nodeForPackage(Class c, Preferences root) {
// Get the package path
- String className = o.getClass().getName();
+ String className = c.getName();
String packagePath;
int index = className.lastIndexOf('.');
if(index == -1) {
diff --git a/libjava/java/util/prefs/PreferencesFactory.java b/libjava/java/util/prefs/PreferencesFactory.java
index f43497894f1..9b2b4129356 100644
--- a/libjava/java/util/prefs/PreferencesFactory.java
+++ b/libjava/java/util/prefs/PreferencesFactory.java
@@ -35,9 +35,8 @@ 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 java.util.prefs;
-import java.util.EventListener;
+package java.util.prefs;
/**
* Preferences system and user root factory interface. Defines how to get
diff --git a/libjava/java/util/zip/Deflater.java b/libjava/java/util/zip/Deflater.java
index ce3dc0ba52f..52c569a412a 100644
--- a/libjava/java/util/zip/Deflater.java
+++ b/libjava/java/util/zip/Deflater.java
@@ -48,7 +48,6 @@ import gnu.gcj.RawData;
* and JCL book.
* Believed complete and correct.
*/
-
public class Deflater
{
/**
@@ -73,6 +72,10 @@ public class Deflater
* The default strategy.
*/
public static final int DEFAULT_STRATEGY = 0;
+ /**
+ * This strategy will only allow longer string repetitions. It is
+ * useful for random data with a small character set.
+ */
public static final int FILTERED = 1;
/**
diff --git a/libjava/java/util/zip/DeflaterOutputStream.java b/libjava/java/util/zip/DeflaterOutputStream.java
index 755d8e71420..ff66b080f9e 100644
--- a/libjava/java/util/zip/DeflaterOutputStream.java
+++ b/libjava/java/util/zip/DeflaterOutputStream.java
@@ -56,6 +56,7 @@ import java.io.IOException;
* finishing the stream.
*
* @author Tom Tromey, Jochen Hoenicke
+ * @date Jan 11, 2001
*/
public class DeflaterOutputStream extends FilterOutputStream
{
@@ -65,6 +66,11 @@ public class DeflaterOutputStream extends FilterOutputStream
out.close();
}
+ /**
+ * Deflates everything in the def's input buffers. This will call
+ * <code>def.deflate()</code> until all bytes from the input buffers
+ * are processed.
+ */
protected void deflate () throws IOException
{
do
@@ -76,23 +82,49 @@ public class DeflaterOutputStream extends FilterOutputStream
while (! def.needsInput());
}
+ /**
+ * Creates a new DeflaterOutputStream with a default Deflater and
+ * default buffer size.
+ * @param out the output stream where deflated output should be written.
+ */
public DeflaterOutputStream (OutputStream out)
{
this (out, new Deflater (), 512);
}
+ /**
+ * Creates a new DeflaterOutputStream with the given Deflater and
+ * default buffer size.
+ * @param out the output stream where deflated output should be written.
+ * @param defl the underlying deflater.
+ */
public DeflaterOutputStream (OutputStream out, Deflater defl)
{
this (out, defl, 512);
}
+ /**
+ * Creates a new DeflaterOutputStream with the given Deflater and
+ * buffer size.
+ * @param out the output stream where deflated output should be written.
+ * @param defl the underlying deflater.
+ * @param bufsize the buffer size.
+ * @exception IllegalArgumentException if bufsize isn't positive.
+ */
public DeflaterOutputStream(OutputStream out, Deflater defl, int bufsize)
{
super (out);
+ if (bufsize <= 0)
+ throw new IllegalArgumentException("bufsize <= 0");
buf = new byte[bufsize];
def = defl;
}
+ /**
+ * Finishes the stream by calling finish() on the deflater. This
+ * was the only way to ensure that all bytes are flushed in Sun's
+ * JDK.
+ */
public void finish () throws IOException
{
if (inbufLength > 0)
diff --git a/libjava/java/util/zip/Inflater.java b/libjava/java/util/zip/Inflater.java
index c1d7741e82f..28e89ea4449 100644
--- a/libjava/java/util/zip/Inflater.java
+++ b/libjava/java/util/zip/Inflater.java
@@ -1,5 +1,5 @@
/* Inflater.java - Decompress a data stream
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,87 +39,231 @@ package java.util.zip;
import gnu.gcj.RawData;
-/**
- * @author Tom Tromey
- * @date May 17, 1999
- */
-
/* Written using on-line Java Platform 1.2 API Specification
* and JCL book.
* Believed complete and correct.
*/
+/**
+ * Inflater is used to decompress data that has been compressed according
+ * to the "deflate" standard described in rfc1950.
+ *
+ * The usage is as following. First you have to set some input with
+ * <code>setInput()</code>, then inflate() it. If inflate doesn't
+ * inflate any bytes there may be three reasons:
+ * <ul>
+ * <li>needsInput() returns true because the input buffer is empty.
+ * You have to provide more input with <code>setInput()</code>.
+ * NOTE: needsInput() also returns true when, the stream is finished.
+ * </li>
+ * <li>needsDictionary() returns true, you have to provide a preset
+ * dictionary with <code>setDictionary()</code>.</li>
+ * <li>finished() returns true, the inflater has finished.</li>
+ * </ul>
+ * Once the first output byte is produced, a dictionary will not be
+ * needed at a later stage.
+ *
+ * @author John Leuner, Jochen Hoenicke
+ * @author Tom Tromey
+ * @date May 17, 1999
+ * @since JDK 1.1
+ */
public class Inflater
{
- public native void end ();
+ // The zlib stream.
+ private RawData zstream;
+
+ // True if finished.
+ private boolean is_finished;
+
+ // True if dictionary needed.
+ private boolean dict_needed;
+
+ /**
+ * Creates a new inflater.
+ */
+ public Inflater ()
+ {
+ this (false);
+ }
+
+ /**
+ * Creates a new inflater.
+ * @param nowrap true if no header and checksum field appears in the
+ * stream. This is used for GZIPed input. For compatibility with
+ * Sun JDK you should provide one byte of input more than needed in
+ * this case.
+ */
+ public Inflater (boolean noHeader)
+ {
+ init (noHeader);
+ }
+ /**
+ * Finalizes this object.
+ */
protected void finalize ()
{
end ();
}
+ /**
+ * Frees all objects allocated by the inflater. There's no reason
+ * to call this, since you can just rely on garbage collection (even
+ * for the Sun implementation). Exists only for compatibility
+ * with Sun's JDK, where the compressor allocates native memory.
+ * If you call any method (even reset) afterwards the behaviour is
+ * <i>undefined</i>.
+ * @deprecated Just clear all references to inflater instead.
+ */
+ public native void end ();
+
+ /**
+ * Returns true, if the inflater has finished. This means, that no
+ * input is needed and no output can be produced.
+ */
public synchronized boolean finished ()
{
return is_finished;
}
+ /**
+ * Gets the adler checksum. This is either the checksum of all
+ * uncompressed bytes returned by inflate(), or if needsDictionary()
+ * returns true (and thus no output was yet produced) this is the
+ * adler checksum of the expected dictionary.
+ * @returns the adler checksum.
+ */
public native int getAdler ();
+
+ /**
+ * Gets the number of unprocessed input. Useful, if the end of the
+ * stream is reached and you want to further process the bytes after
+ * the deflate stream.
+ * @return the number of bytes of the input which were not processed.
+ */
public native int getRemaining ();
+
+ /**
+ * Gets the total number of processed compressed input bytes.
+ * @return the total number of bytes of processed input bytes.
+ */
public native int getTotalIn ();
+
+ /**
+ * Gets the total number of output bytes returned by inflate().
+ * @return the total number of output bytes.
+ */
public native int getTotalOut ();
+ /**
+ * Inflates the compressed stream to the output buffer. If this
+ * returns 0, you should check, whether needsDictionary(),
+ * needsInput() or finished() returns true, to determine why no
+ * further output is produced.
+ * @param buffer the output buffer.
+ * @return the number of bytes written to the buffer, 0 if no further
+ * output can be produced.
+ * @exception DataFormatException if deflated stream is invalid.
+ * @exception IllegalArgumentException if buf has length 0.
+ */
public int inflate (byte[] buf) throws DataFormatException
{
return inflate (buf, 0, buf.length);
}
+ /**
+ * Inflates the compressed stream to the output buffer. If this
+ * returns 0, you should check, whether needsDictionary(),
+ * needsInput() or finished() returns true, to determine why no
+ * further output is produced.
+ * @param buffer the output buffer.
+ * @param off the offset into buffer where the output should start.
+ * @param len the maximum length of the output.
+ * @return the number of bytes written to the buffer, 0 if no further
+ * output can be produced.
+ * @exception DataFormatException if deflated stream is invalid.
+ * @exception IndexOutOfBoundsException if the off and/or len are wrong.
+ */
public native int inflate (byte[] buf, int off, int len)
throws DataFormatException;
private native void init (boolean noHeader);
- public Inflater ()
- {
- this (false);
- }
-
- public Inflater (boolean noHeader)
- {
- init (noHeader);
- }
-
+ /**
+ * Returns true, if a preset dictionary is needed to inflate the input.
+ */
public synchronized boolean needsDictionary ()
{
return dict_needed;
}
+ /**
+ * Returns true, if the input buffer is empty.
+ * You should then call setInput(). <br>
+ *
+ * <em>NOTE</em>: This method also returns true when the stream is finished.
+ */
public synchronized boolean needsInput ()
{
return getRemaining () == 0;
}
+ /**
+ * Resets the inflater so that a new stream can be decompressed. All
+ * pending input and output will be discarded.
+ */
public native void reset ();
+ /**
+ * Sets the preset dictionary. This should only be called, if
+ * needsDictionary() returns true and it should set the same
+ * dictionary, that was used for deflating. The getAdler()
+ * function returns the checksum of the dictionary needed.
+ * @param buffer the dictionary.
+ * @exception IllegalStateException if no dictionary is needed.
+ * @exception IllegalArgumentException if the dictionary checksum is
+ * wrong.
+ */
public void setDictionary (byte[] buf)
{
setDictionary (buf, 0, buf.length);
}
+ /**
+ * Sets the preset dictionary. This should only be called, if
+ * needsDictionary() returns true and it should set the same
+ * dictionary, that was used for deflating. The getAdler()
+ * function returns the checksum of the dictionary needed.
+ * @param buffer the dictionary.
+ * @param off the offset into buffer where the dictionary starts.
+ * @param len the length of the dictionary.
+ * @exception IllegalStateException if no dictionary is needed.
+ * @exception IllegalArgumentException if the dictionary checksum is
+ * wrong.
+ * @exception IndexOutOfBoundsException if the off and/or len are wrong.
+ */
public native void setDictionary (byte[] buf, int off, int len);
+ /**
+ * Sets the input. This should only be called, if needsInput()
+ * returns true.
+ * @param buffer the input.
+ * @exception IllegalStateException if no input is needed.
+ */
public void setInput (byte[] buf)
{
setInput (buf, 0, buf.length);
}
+ /**
+ * Sets the input. This should only be called, if needsInput()
+ * returns true.
+ * @param buffer the input.
+ * @param off the offset into buffer where the input starts.
+ * @param len the length of the input.
+ * @exception IllegalStateException if no input is needed.
+ * @exception IndexOutOfBoundsException if the off and/or len are wrong.
+ */
public native void setInput (byte[] buf, int off, int len);
-
- // The zlib stream.
- private RawData zstream;
-
- // True if finished.
- private boolean is_finished;
-
- // True if dictionary needed.
- private boolean dict_needed;
}
diff --git a/libjava/java/util/zip/InflaterInputStream.java b/libjava/java/util/zip/InflaterInputStream.java
index b04534977f1..8ee88e5f11c 100644
--- a/libjava/java/util/zip/InflaterInputStream.java
+++ b/libjava/java/util/zip/InflaterInputStream.java
@@ -73,6 +73,10 @@ public class InflaterInputStream extends FilterInputStream
public InflaterInputStream (InputStream in, Inflater infl, int bufsize)
{
super (in);
+
+ if (in == null)
+ throw new NullPointerException();
+
this.inf = infl;
this.buf = new byte[bufsize];
}
diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java
index 5284d793f6c..e2262812b9f 100644
--- a/libjava/java/util/zip/ZipEntry.java
+++ b/libjava/java/util/zip/ZipEntry.java
@@ -35,9 +35,10 @@ 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 java.util.zip;
+
import java.util.Calendar;
-import java.util.TimeZone;
import java.util.Date;
/**
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
index 8f7ef6f8d6f..06238cea176 100644
--- a/libjava/java/util/zip/ZipFile.java
+++ b/libjava/java/util/zip/ZipFile.java
@@ -38,9 +38,7 @@ exception statement from your version. */
package java.util.zip;
import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
import java.io.DataInput;
-import java.io.DataInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
diff --git a/libjava/java/util/zip/ZipInputStream.java b/libjava/java/util/zip/ZipInputStream.java
index 2fba9f556dc..40ba8055b51 100644
--- a/libjava/java/util/zip/ZipInputStream.java
+++ b/libjava/java/util/zip/ZipInputStream.java
@@ -35,11 +35,12 @@ 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 java.util.zip;
+
import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;
-import java.util.Enumeration;
/**
* This is a FilterInputStream that reads the files in an zip archive
diff --git a/libjava/java/util/zip/ZipOutputStream.java b/libjava/java/util/zip/ZipOutputStream.java
index 44c4a9cc9b1..7d36e45214d 100644
--- a/libjava/java/util/zip/ZipOutputStream.java
+++ b/libjava/java/util/zip/ZipOutputStream.java
@@ -35,12 +35,13 @@ 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 java.util.zip;
-import java.io.OutputStream;
+
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.Vector;
+import java.io.OutputStream;
import java.util.Enumeration;
+import java.util.Vector;
/**
* This is a FilterOutputStream that writes the files into a zip
diff --git a/libjava/javax/naming/CompositeName.java b/libjava/javax/naming/CompositeName.java
index 71cdaaf7ba9..e3559a911cf 100644
--- a/libjava/javax/naming/CompositeName.java
+++ b/libjava/javax/naming/CompositeName.java
@@ -52,6 +52,8 @@ import java.util.Vector;
*/
public class CompositeName implements Name, Cloneable, Serializable
{
+ private static final long serialVersionUID = 1667768148915813118L;
+
public CompositeName ()
{
elts = new Vector ();
diff --git a/libjava/javax/naming/CompoundName.java b/libjava/javax/naming/CompoundName.java
index 686a3a3d348..20b6cc51cb3 100644
--- a/libjava/javax/naming/CompoundName.java
+++ b/libjava/javax/naming/CompoundName.java
@@ -58,6 +58,8 @@ import java.util.Vector;
*/
public class CompoundName implements Name, Cloneable, Serializable
{
+ private static final long serialVersionUID = 3513100557083972036L;
+
private CompoundName (Properties syntax)
{
elts = new Vector ();
diff --git a/libjava/javax/naming/InitialContext.java b/libjava/javax/naming/InitialContext.java
index 705e24ad1eb..62837ab9ee5 100644
--- a/libjava/javax/naming/InitialContext.java
+++ b/libjava/javax/naming/InitialContext.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.naming;
+import java.applet.Applet;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -46,8 +47,6 @@ import java.net.URL;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
-import java.applet.Applet;
-import java.util.Hashtable;
import javax.naming.spi.NamingManager;
public class InitialContext implements Context
@@ -57,22 +56,27 @@ public class InitialContext implements Context
protected Hashtable myProps;
public InitialContext (Hashtable environment)
+ throws NamingException
{
init (environment);
}
protected InitialContext (boolean lazy)
+ throws NamingException
{
if (! lazy)
init (null);
}
public InitialContext ()
+ throws NamingException
{
init (null);
}
-
+
+ /** @since 1.3 */
protected void init (Hashtable environment)
+ throws NamingException
{
// FIXME: Is this enough?
final String[] properties = {
diff --git a/libjava/javax/naming/LinkRef.java b/libjava/javax/naming/LinkRef.java
index a8a22adca8f..51b0f1bf771 100644
--- a/libjava/javax/naming/LinkRef.java
+++ b/libjava/javax/naming/LinkRef.java
@@ -46,6 +46,8 @@ import java.io.Serializable;
*/
public class LinkRef extends Reference
{
+ private static final long serialVersionUID = -5386290613498931298L;
+
public LinkRef (Name name)
{
this (name.toString ());
@@ -58,6 +60,7 @@ public class LinkRef extends Reference
}
public String getLinkName ()
+ throws NamingException
{
StringRefAddr sra = (StringRefAddr) get (0);
return (String) sra.getContent ();
diff --git a/libjava/javax/naming/NamingException.java b/libjava/javax/naming/NamingException.java
index 6c0f0172dc1..0cb2d5547cd 100644
--- a/libjava/javax/naming/NamingException.java
+++ b/libjava/javax/naming/NamingException.java
@@ -55,6 +55,7 @@ import java.io.PrintWriter;
*/
public class NamingException extends Exception
{
+ private static final long serialVersionUID = -1299181962103167177L;
/**
* The root cause of this exception. Might be null. Set by calling
diff --git a/libjava/javax/naming/NamingSecurityException.java b/libjava/javax/naming/NamingSecurityException.java
index 71d538a0b0e..5972f56b052 100644
--- a/libjava/javax/naming/NamingSecurityException.java
+++ b/libjava/javax/naming/NamingSecurityException.java
@@ -40,8 +40,10 @@ package javax.naming;
import java.lang.Exception;
-public class NamingSecurityException extends NamingException
+public abstract class NamingSecurityException extends NamingException
{
+ private static final long serialVersionUID = 5855287647294685775L;
+
public NamingSecurityException ()
{
super ();
diff --git a/libjava/javax/naming/ReferralException.java b/libjava/javax/naming/ReferralException.java
index 5becc6b3162..1be6c6649e4 100644
--- a/libjava/javax/naming/ReferralException.java
+++ b/libjava/javax/naming/ReferralException.java
@@ -48,6 +48,8 @@ import java.util.Hashtable;
public abstract class ReferralException extends NamingException
{
+ private static final long serialVersionUID = -2881363844695698876L;
+
protected ReferralException ()
{
super ();
diff --git a/libjava/javax/naming/StringRefAddr.java b/libjava/javax/naming/StringRefAddr.java
index 3859ec300dc..fbb57cbfe67 100644
--- a/libjava/javax/naming/StringRefAddr.java
+++ b/libjava/javax/naming/StringRefAddr.java
@@ -48,6 +48,7 @@ package javax.naming;
*/
public class StringRefAddr extends RefAddr
{
+ private static final long serialVersionUID = -8913762495138505527L;
/**
* The possibly null content of this RefAddr.
diff --git a/libjava/javax/naming/directory/Attribute.java b/libjava/javax/naming/directory/Attribute.java
index d04a12c36f4..8579d84a01c 100644
--- a/libjava/javax/naming/directory/Attribute.java
+++ b/libjava/javax/naming/directory/Attribute.java
@@ -45,11 +45,9 @@ import java.io.Serializable;
* @author Warren Levy <warrenl@redhat.com>
* @date June 14, 2001
*/
-
public interface Attribute extends Cloneable, Serializable
{
- // FIXME: Need to set value from JNDI 1.1.1 fro interoperability.
- // public static final long serialVersionUID = ;
+ public static final long serialVersionUID = 8707690322213556804L;
public NamingEnumeration getAll() throws NamingException;
public Object get() throws NamingException;
diff --git a/libjava/javax/naming/directory/BasicAttribute.java b/libjava/javax/naming/directory/BasicAttribute.java
index 6bf77f1712e..8065ae970e1 100644
--- a/libjava/javax/naming/directory/BasicAttribute.java
+++ b/libjava/javax/naming/directory/BasicAttribute.java
@@ -38,8 +38,11 @@ exception statement from your version. */
package javax.naming.directory;
-import javax.naming.*;
-import java.util.*;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.OperationNotSupportedException;
/**
* @author Tom Tromey <tromey@redhat.com>
@@ -47,6 +50,8 @@ import java.util.*;
*/
public class BasicAttribute implements Attribute
{
+ private static final long serialVersionUID = 6743528196119291326L;
+
/** The ID of this attribute. */
protected String attrID;
/** True if this attribute's values are ordered. */
@@ -159,6 +164,7 @@ public class BasicAttribute implements Attribute
}
public Object get ()
+ throws NamingException
{
if (values.size () == 0)
throw new NoSuchElementException ("no values");
@@ -166,11 +172,13 @@ public class BasicAttribute implements Attribute
}
public Object get (int index)
+ throws NamingException
{
return values.get (index);
}
public NamingEnumeration getAll ()
+ throws NamingException
{
return new BasicAttributeEnumeration ();
}
diff --git a/libjava/javax/naming/directory/BasicAttributes.java b/libjava/javax/naming/directory/BasicAttributes.java
index 331a3c2a3e7..e9b4d073377 100644
--- a/libjava/javax/naming/directory/BasicAttributes.java
+++ b/libjava/javax/naming/directory/BasicAttributes.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package javax.naming.directory;
-import javax.naming.*;
-import java.util.*;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
/**
* @author Tom Tromey <tromey@redhat.com>
@@ -47,6 +49,8 @@ import java.util.*;
*/
public class BasicAttributes implements Attributes
{
+ private static final long serialVersionUID = 4980164073184639448L;
+
public BasicAttributes ()
{
this (false);
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java b/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
index 93d9144232e..4d5161c3093 100644
--- a/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
+++ b/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
@@ -37,15 +37,17 @@ exception statement from your version. */
package javax.naming.ldap;
+
import java.util.EventObject;
/**
* @author Warren Levy <warrenl@redhat.com>
* @date June 5, 2001
*/
-
public class UnsolicitedNotificationEvent extends EventObject
{
+ private static final long serialVersionUID = -2382603380799883705L;
+
// Serialized fields.
private UnsolicitedNotification notice;
diff --git a/libjava/javax/naming/spi/NamingManager.java b/libjava/javax/naming/spi/NamingManager.java
index bb3d87253d7..6d02f9d2cba 100644
--- a/libjava/javax/naming/spi/NamingManager.java
+++ b/libjava/javax/naming/spi/NamingManager.java
@@ -1,5 +1,5 @@
/* NamingManager.java --
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,7 +117,7 @@ public class NamingManager
prefixes = "com.sun.jndi.url";
}
- scheme += "URLContextFactory";
+ scheme = scheme + "." + scheme + "URLContextFactory";
StringTokenizer tokens = new StringTokenizer (prefixes, ":");
while (tokens.hasMoreTokens ())
diff --git a/libjava/javax/security/auth/x500/X500Principal.java b/libjava/javax/security/auth/x500/X500Principal.java
index fc72e7b268e..036cab7f91a 100644
--- a/libjava/javax/security/auth/x500/X500Principal.java
+++ b/libjava/javax/security/auth/x500/X500Principal.java
@@ -55,6 +55,7 @@ import gnu.java.security.x509.X500DistinguishedName;
public final class X500Principal implements Principal, Serializable
{
+ private static final long serialVersionUID = -500463348111345721L;
// Constants and fields.
// ------------------------------------------------------------------------
diff --git a/libjava/javax/swing/AbstractAction.java b/libjava/javax/swing/AbstractAction.java
index cf9308d0685..7ba652b926a 100644
--- a/libjava/javax/swing/AbstractAction.java
+++ b/libjava/javax/swing/AbstractAction.java
@@ -35,9 +35,9 @@ 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;
-// Imports
import java.awt.event.*;
import java.beans.*;
import java.io.*;
@@ -207,12 +207,4 @@ public abstract class AbstractAction
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(listener);
} // removePropertyChangeListener()
-
- /**
- * actionPerformed
- * @param event TODO
- */
- public abstract void actionPerformed(ActionEvent event);
-
-
-} // AbstractAction
+}
diff --git a/libjava/javax/swing/AbstractButton.java b/libjava/javax/swing/AbstractButton.java
index b675d808a42..951650dbdbd 100644
--- a/libjava/javax/swing/AbstractButton.java
+++ b/libjava/javax/swing/AbstractButton.java
@@ -35,18 +35,33 @@ 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;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
-import javax.swing.text.*;
-import javax.accessibility.*;
+package javax.swing;
-import java.util.*;
-import java.beans.*;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.ItemSelectable;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeListener;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleIcon;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleRelationSet;
+import javax.accessibility.AccessibleText;
+import javax.accessibility.AccessibleValue;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.plaf.ButtonUI;
+import javax.swing.text.AttributeSet;
/**
* Provides basic button functionality
@@ -54,7 +69,7 @@ import java.beans.*;
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
public abstract class AbstractButton extends JComponent
- implements ItemSelectable, SwingConstants
+ implements ItemSelectable, SwingConstants
{
Icon default_icon, pressed_button, disabled_button,
selected_button, disabled_selected_button, current_icon;
diff --git a/libjava/javax/swing/AbstractCellEditor.java b/libjava/javax/swing/AbstractCellEditor.java
index e25e97b18b3..026ab30f804 100644
--- a/libjava/javax/swing/AbstractCellEditor.java
+++ b/libjava/javax/swing/AbstractCellEditor.java
@@ -35,12 +35,14 @@ 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;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.Serializable;
+import java.util.EventObject;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.EventListenerList;
/**
* AbstractCellEditor
diff --git a/libjava/javax/swing/AbstractListModel.java b/libjava/javax/swing/AbstractListModel.java
index 4e227b4dda7..da85a4def95 100644
--- a/libjava/javax/swing/AbstractListModel.java
+++ b/libjava/javax/swing/AbstractListModel.java
@@ -189,17 +189,4 @@ public abstract class AbstractListModel
{
return (ListDataListener[]) getListeners (ListDataListener.class);
}
-
- /**
- * getElementAt
- * @param index TODO
- * @returns Object
- */
- public abstract Object getElementAt (int index);
-
- /**
- * getSize
- * @returns int
- */
- public abstract int getSize ();
}
diff --git a/libjava/javax/swing/BorderFactory.java b/libjava/javax/swing/BorderFactory.java
index 808144fdd7a..1cc6cbf420d 100644
--- a/libjava/javax/swing/BorderFactory.java
+++ b/libjava/javax/swing/BorderFactory.java
@@ -38,332 +38,406 @@ exception statement from your version. */
package javax.swing;
-import java.awt.*;
-import java.awt.font.*;
-import javax.swing.border.*;
-
+import java.awt.Color;
+import java.awt.Font;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.border.TitledBorder;
public class BorderFactory
{
+ /**
+ * Creates a line border withe the specified color.
+ *
+ * @param color A color to use for the line.
+ *
+ * @return The Border object
+ */
public static Border createLineBorder(Color color)
- { /*
- Creates a line border withe the specified color.
-
- Parameters:
- color - a Color to use for the lineReturns:
- the Border object
-createLineBorder
- */
- return null;
- }
-
-public static Border createLineBorder(Color color,
- int thickness)
- { /*
-
- Creates a line border withe the specified color and width. The width applies to all 4 sides of the border. To specify widths individually for the top, bottom, left, and right, use createMatteBorder(int,int,int,int,Color).
-
- Parameters:
- color - a Color to use for the linethickness - an int specifying the width in pixelsReturns:
- the Border object
-createRaisedBevelBorder
- */
+ {
return null;
}
+ /**
+ * Creates a line border withe the specified color and width. The width
+ * applies to all 4 sides of the border. To specify widths individually for
+ * the top, bottom, left, and right, use
+ * createMatteBorder(int,int,int,int,Color).
+ *
+ * @param color A color to use for the line.
+ * @param thickness An int specifying the width in pixels.
+ *
+ * @return The Border object
+ */
+ public static Border createLineBorder (Color color, int thickness)
+ {
+ return new LineBorder (color, thickness);
+ }
-public static Border createRaisedBevelBorder()
- { /*
-
- Created a border with a raised beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a raised border, highlights are on top and shadows are underneath.)
-
- Returns:
- the Border object
-createLoweredBevelBorder
-
- */
- return null;
- }
-
-public static Border createLoweredBevelBorder()
- { /*
-
- Created a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.)
-
- Returns:
- the Border object
-createBevelBorder
-
- */
- return null;
- }
-
-public static Border createBevelBorder(int type)
-
- { /*
- Create a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.).
-
- Parameters:
- type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDReturns:
- the Border object
-createBevelBorder
-
- */
- return null;
- }
-
-public static Border createBevelBorder(int type,
- Color highlight,
- Color shadow)
- { /*
-
- Create a beveled border of the specified type, using the specified highlighting and shadowing. The outer edge of the highlighted area uses a brighter shade of the highlight color. The inner edge of the shadow area uses a brighter shade of the shadaw color.
-
- Parameters:
- type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDhighlight - a Color object for highlightsshadow - a Color object for shadowsReturns:
- the Border object
-createBevelBorder
-
- */
- return null;
- }
-
-public static Border createBevelBorder(int type,
- Color highlightOuter,
- Color highlightInner,
- Color shadowOuter,
- Color shadowInner)
- { /*
-
- Create a beveled border of the specified type, using the specified colors for the inner and outer highlight and shadow areas.
-
- Parameters:
- type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDhighlightOuter - a Color object for the outer edge of the highlight areahighlightInner - a Color object for the inner edge of the highlight areashadowOuter - a Color object for the outer edge of the shadow areashadowInner - a Color object for the inner edge of the shadow areaReturns:
- the Border object
-createEtchedBorder
- */
- return null;
- }
-
-
-public static Border createEtchedBorder()
- { /*
-
- Create a border with an "etched" look using the component's current background color for highlighting and shading.
-
- Returns:
- the Border object
-createEtchedBorder
-
- */
- return null;
- }
-
-public static Border createEtchedBorder(Color highlight,
- Color shadow)
- { /*
-
- Create a border with an "etched" look using the specified highlighting and shading colors.
-
- Parameters:
- highlight - a Color object for the border highlightsshadow - a Color object for the border shadowsReturns:
- the Border object
-createTitledBorder
-
- */
- return null;
- }
-
- public static TitledBorder createTitledBorder(String title)
- { /*
- Create a new title border specifying the text of the title, using the default border (etched), using the default text position (sitting on the top line) and default justification (left) and using the default font and text color determined by the current look and feel.
-
- Parameters:
- title - a String containing the text of the titleReturns:
- the TitledBorder object
-createTitledBorder
-
- */
- return null;
- }
-
- public static TitledBorder createTitledBorder(Border border)
- { /*
-
- Create a new title border with an empty title specifying the border object, using the default text position (sitting on the top line) and default justification (left) and using the default font, text color, and border determined by the current look and feel. (The Motif and Windows look and feels use an etched border; The Java look and feel use a gray border.)
-
- Parameters:
- border - the Border object to add the title toReturns:
- the TitledBorder object
-createTitledBorder
-
- */
- return null;
- }
-
-public static TitledBorder createTitledBorder(Border border,
- String title)
- { /*
-
- Add a title to an existing border, specifying the text of the title, using the default positioning (sitting on the top line) and default justification (left) and using the default font and text color determined by the current look and feel.
-
- Parameters:
- border - the Border object to add the title totitle - a String containing the text of the titleReturns:
- the TitledBorder object
-createTitledBorder
-
- */
- return null;
- }
-
-public static TitledBorder createTitledBorder(Border border,
- String title,
- int titleJustification,
- int titlePosition)
- { /*
-
- Add a title to an existing border, specifying the text of the title along with its positioning, using the default font and text color determined by the current look and feel.
-
- Parameters:
- border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).Returns:
- the TitledBorder object
-createTitledBorder
-
- */
- return null;
- }
-
-public static TitledBorder createTitledBorder(Border border,
- String title,
- int titleJustification,
- int titlePosition,
- Font titleFont)
- { /*
-
- Add a title to an existing border, specifying the text of the title along with its positioning and font, using the default text color determined by the current look and feel.
-
- Parameters:
- border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).titleFont - a Font object specifying the title fontReturns:
- the TitledBorder object
-createTitledBorder
-
- */
- return null;
- }
-
-public static TitledBorder createTitledBorder(Border border,
- String title,
- int titleJustification,
- int titlePosition,
- Font titleFont,
- Color titleColor)
- { /*
-
- Add a title to an existing border, specifying the text of the title along with its positioning, font, and color.
-
- Parameters:
- border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).titleFont - a Font object specifying the title fonttitleColor - a Color object specifying the title colorReturns:
- the TitledBorder object
-createEmptyBorder
-
- */
- return null;
- }
-
-public static Border createEmptyBorder()
- { /*
-
- Creates an empty border that takes up no space. (The width of the top, bottom, left, and right sides are all zero.)
-
- Returns:
- the Border object
-createEmptyBorder
-
- */
- return null;
- }
-
-public static Border createEmptyBorder(int top,
- int left,
- int bottom,
- int right)
- { /*
-
- Creates an empty border that takes up no space but which does no drawing, specifying the width of the top, left, bottom, and right sides.
+ /**
+ * Created a border with a raised beveled edge, using brighter shades of
+ * the component's current background color for highlighting, and darker
+ * shading for shadows. (In a raised border, highlights are on top and
+ * shadows are underneath.)
+ *
+ * @return The Border object
+ */
+ public static Border createRaisedBevelBorder ()
+ {
+ return new BevelBorder (BevelBorder.RAISED);
+ }
- Parameters:
- top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelsReturns:
- the Border object
-createCompoundBorder
+ /**
+ * Created a border with a lowered beveled edge, using brighter shades of
+ * the component's current background color for highlighting, and darker
+ * shading for shadows. (In a lowered border, shadows are on top and
+ * highlights are underneath.)
+ *
+ * @return The Border object
+ */
+ public static Border createLoweredBevelBorder ()
+ {
+ return new BevelBorder (BevelBorder.LOWERED);
+ }
- */
- return null;
- }
+ /**
+ * Create a beveled border of the specified type, using brighter shades of
+ * the component's current background color for highlighting, and darker
+ * shading for shadows. (In a lowered border, shadows are on top and
+ * highlights are underneath.).
+ *
+ * @param type An int specifying either BevelBorder.LOWERED or
+ * BevelBorder.RAISED
+ *
+ * @Return The Border object
+ */
+ public static Border createBevelBorder (int type)
+ {
+ return new BevelBorder (type);
+ }
-public static CompoundBorder createCompoundBorder()
- { /*
+ /**
+ * Create a beveled border of the specified type, using the specified
+ * highlighting and shadowing. The outer edge of the highlighted area uses
+ * a brighter shade of the highlight color. The inner edge of the shadow
+ * area uses a brighter shade of the shadaw color.
+ *
+ * @param type An int specifying either BevelBorder.LOWERED or
+ * BevelBorder.RAISED
+ * @param highlight A Color object for highlights
+ * @param shadow A Color object for shadows
+ *
+ * @return The Border object
+ */
+ public static Border createBevelBorder (int type, Color highlight,
+ Color shadow)
+ {
+ return new BevelBorder (type, highlight, shadow);
+ }
- Create a compound border with a null inside edge and a null outside edge.
+ /**
+ * Create a beveled border of the specified type, using the specified colors
+ * for the inner and outer highlight and shadow areas.
+ *
+ * @param type An int specifying either BevelBorder.LOWERED or
+ * BevelBorder.RAISED
+ * @param highlightOuter A Color object for the outer edge of the
+ * highlight area
+ * @param highlightInner A Color object for the inner edge of the
+ * highlight area
+ * @param shadowOuter A Color object for the outer edge of the shadow area
+ * @param shadowInner A Color object for the inner edge of the shadow area
+ *
+ * @return The Border object
+ */
+ public static Border createBevelBorder (int type, Color highlightOuter,
+ Color highlightInner,
+ Color shadowOuter, Color shadowInner)
+ {
+ return new BevelBorder (type, highlightOuter, highlightInner, shadowOuter,
+ shadowInner);
+ }
- Returns:
- the CompoundBorder object
-createCompoundBorder
- */
- return null;
- }
+ /**
+ * Create a border with an "etched" look using the component's current
+ * background color for highlighting and shading.
+ *
+ * @return The Border object
+ */
+ public static Border createEtchedBorder ()
+ {
+ return new EtchedBorder ();
+ }
+ /**
+ * Create a border with an "etched" look using the component's current
+ * background color for highlighting and shading.
+ *
+ * @return The Border object
+ */
+ public static Border createEtchedBorder (int etchType)
+ {
+ return new EtchedBorder (etchType);
+ }
-public static CompoundBorder createCompoundBorder(Border outsideBorder,
- Border insideBorder)
- { /*
+ /**
+ * Create a border with an "etched" look using the specified highlighting and
+ * shading colors.
+ *
+ * @param highlight A Color object for the border highlights
+ * @param shadow A Color object for the border shadows
+ *
+ * @return The Border object
+ */
+ public static Border createEtchedBorder (Color highlight, Color shadow)
+ {
+ return new EtchedBorder (highlight, shadow);
+ }
- Create a compound border specifying the border objects to use for the outside and inside edges.
+ /**
+ * Create a border with an "etched" look using the specified highlighting and
+ * shading colors.
+ *
+ * @param highlight A Color object for the border highlights
+ * @param shadow A Color object for the border shadows
+ *
+ * @return The Border object
+ */
+ public static Border createEtchedBorder (int etchType, Color highlight,
+ Color shadow)
+ {
+ return new EtchedBorder (etchType, highlight, shadow);
+ }
- Parameters:
- outsideBorder - a Border object for the outer edge of the compound borderinsideBorder - a Border object for the inner edge of the compound borderReturns:
- the CompoundBorder object
-createMatteBorder
- */
- return null;
- }
+ /**
+ * Create a new title border specifying the text of the title, using the
+ * default border (etched), using the default text position (sitting on the
+ * top line) and default justification (left) and using the default font and
+ * text color determined by the current look and feel.
+ *
+ * @param title A String containing the text of the title
+ *
+ * @return The TitledBorder object
+ */
+ public static TitledBorder createTitledBorder (String title)
+ {
+ return new TitledBorder (title);
+ }
+ /**
+ * Create a new title border with an empty title specifying the border
+ * object, using the default text position (sitting on the top line) and
+ * default justification (left) and using the default font, text color,
+ * and border determined by the current look and feel. (The Motif and Windows
+ * look and feels use an etched border; The Java look and feel use a
+ * gray border.)
+ *
+ * @param border The Border object to add the title to
+ *
+ * @return The TitledBorder object
+ */
+ public static TitledBorder createTitledBorder (Border border)
+ {
+ return new TitledBorder (border);
+ }
-public static MatteBorder createMatteBorder(int top,
- int left,
- int bottom,
- int right,
- Color color)
- { /*
+ /**
+ * Add a title to an existing border, specifying the text of the title, using
+ * the default positioning (sitting on the top line) and default
+ * justification (left) and using the default font and text color determined
+ * by the current look and feel.
+ *
+ * @param order The Border object to add the title to
+ * @param title A String containing the text of the title
+ *
+ * @return The TitledBorder object
+ */
+ public static TitledBorder createTitledBorder (Border border, String title)
+ {
+ return new TitledBorder (border, title);
+ }
- Create a matte-look border using a solid color. (The difference between this border and a line border is that you can specify the individual border dimensions.)
+ /**
+ * Add a title to an existing border, specifying the text of the title along
+ * with its positioning, using the default font and text color determined by
+ * the current look and feel.
+ *
+ * @param border The Border object to add the title to
+ * @param title A String containing the text of the title
+ * @param titleJustification An int specifying the left/right position of
+ * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
+ * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
+ * @param titlePosition An int specifying the vertical position of the text
+ * in relation to the border -- one of: TitledBorder.ABOVE_TOP,
+ * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
+ * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
+ * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
+ *
+ * @return The TitledBorder object
+ */
+ public static TitledBorder createTitledBorder (Border border, String title,
+ int titleJustification,
+ int titlePosition)
+ {
+ return new TitledBorder (border, title, titleJustification, titlePosition);
+ }
- Parameters:
- top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelscolor - a Color to use for the borderReturns:
- the MatteBorder object
-createMatteBorder
+ /**
+ * Add a title to an existing border, specifying the text of the title along
+ * with its positioning and font, using the default text color determined by
+ * the current look and feel.
+ *
+ * @param border - the Border object to add the title to
+ * @param title - a String containing the text of the title
+ * @param titleJustification - an int specifying the left/right position of
+ * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
+ * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
+ * @param titlePosition - an int specifying the vertical position of the
+ * text in relation to the border -- one of: TitledBorder.ABOVE_TOP,
+ * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
+ * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
+ * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
+ * @param titleFont - a Font object specifying the title font
+ *
+ * @return The TitledBorder object
+ */
+ public static TitledBorder createTitledBorder (Border border, String title,
+ int titleJustification,
+ int titlePosition,
+ Font titleFont)
+ {
+ return new TitledBorder (border, title, titleJustification, titlePosition,
+ titleFont);
+ }
- */
- return null;
- }
+ /**
+ * Add a title to an existing border, specifying the text of the title along
+ * with its positioning, font, and color.
+ *
+ * @param border - the Border object to add the title to
+ * @param title - a String containing the text of the title
+ * @param titleJustification - an int specifying the left/right position of
+ * the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
+ * TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
+ * @param titlePosition - an int specifying the vertical position of the text
+ * in relation to the border -- one of: TitledBorder.ABOVE_TOP,
+ * TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
+ * TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
+ * line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
+ * @param titleFont - a Font object specifying the title font
+ * @param titleColor - a Color object specifying the title color
+ *
+ * @return The TitledBorder object
+ */
+ public static TitledBorder createTitledBorder (Border border,
+ String title,
+ int titleJustification,
+ int titlePosition,
+ Font titleFont,
+ Color titleColor)
+ {
+ return new TitledBorder (border, title, titleJustification, titlePosition,
+ titleFont, titleColor);
+ }
-public static MatteBorder createMatteBorder(int top,
- int left,
- int bottom,
- int right,
- Icon tileIcon)
- { /*
+ /**
+ * Creates an empty border that takes up no space. (The width of the top,
+ * bottom, left, and right sides are all zero.)
+ *
+ * @return The Border object
+ */
+ public static Border createEmptyBorder ()
+ {
+ return new EmptyBorder (0, 0, 0, 0);
+ }
- Create a matte-look border that consists of multiple tiles of a specified icon. Multiple copies of the icon are placed side-by-side to fill up the border area.
+ /**
+ * Creates an empty border that takes up no space but which does no drawing,
+ * specifying the width of the top, left, bottom, and right sides.
+ *
+ * @param top An int specifying the width of the top in pixels
+ * @param left An int specifying the width of the left side in pixels
+ * @param bottom An int specifying the width of the right side in pixels
+ * @param right An int specifying the width of the bottom in pixels
+ *
+ * @return The Border object
+ */
+ public static Border createEmptyBorder (int top, int left, int bottom,
+ int right)
+ {
+ return new EmptyBorder (top, left, bottom, right);
+ }
- Note:
- If the icon doesn't load, the border area is painted gray.
+ /**
+ * Create a compound border with a null inside edge and a null outside edge.
+ *
+ * @return The CompoundBorder object
+ */
+ public static CompoundBorder createCompoundBorder ()
+ {
+ return new CompoundBorder ();
+ }
- Parameters:
- top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelstileIcon - the Icon object used for the border tilesReturns:
- the MatteBorder object
+ /**
+ * Create a compound border specifying the border objects to use for the
+ * outside and inside edges.
+ *
+ * @param outsideBorder A Border object for the outer edge of the
+ * compound border
+ * @param insideBorder A Border object for the inner edge of the
+ * compound border
+ *
+ * @return The CompoundBorder object
+ */
+ public static CompoundBorder createCompoundBorder (Border outsideBorder,
+ Border insideBorder)
+ {
+ return new CompoundBorder (outsideBorder, insideBorder);
+ }
- */
- return null;
- }
+ /**
+ * Create a matte-look border using a solid color. (The difference between
+ * this border and a line border is that you can specify the individual
+ * border dimensions.)
+ *
+ * @param top An int specifying the width of the top in pixels
+ * @param left An int specifying the width of the left side in pixels
+ * @param bottom An int specifying the width of the right side in pixels
+ * @param right An int specifying the width of the bottom in pixels
+ * @param color A Color to use for the border
+ *
+ * @return The MatteBorder object
+ */
+ public static MatteBorder createMatteBorder (int top, int left, int bottom,
+ int right, Color color)
+ {
+ return new MatteBorder (top, left, bottom, right, color);
+ }
+ /**
+ * Create a matte-look border that consists of multiple tiles of a specified
+ * icon. Multiple copies of the icon are placed side-by-side to fill up the
+ * border area.
+ *
+ * Note:
+ * If the icon doesn't load, the border area is painted gray.
+ *
+ * @param top An int specifying the width of the top in pixels
+ * @param left An int specifying the width of the left side in pixels
+ * @param bottom An int specifying the width of the right side in pixels
+ * @param right An int specifying the width of the bottom in pixels
+ * @param tileIcon The Icon object used for the border tiles
+ *
+ * @return The MatteBorder object
+ */
+ public static MatteBorder createMatteBorder (int top, int left, int bottom,
+ int right, Icon tileIcon)
+ {
+ return new MatteBorder (top, left, bottom, right, tileIcon);
+ }
}
diff --git a/libjava/javax/swing/Box.java b/libjava/javax/swing/Box.java
index a425db50b65..eee96b1cdc8 100644
--- a/libjava/javax/swing/Box.java
+++ b/libjava/javax/swing/Box.java
@@ -35,14 +35,17 @@ 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;
+import javax.accessibility.Accessible;
+
/**
* Needs some work I guess....
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class Box extends JComponent
+public class Box extends JComponent implements Accessible
{
Box(int a)
{
diff --git a/libjava/javax/swing/BoxLayout.java b/libjava/javax/swing/BoxLayout.java
index 00d9cb438a2..23009fe68b0 100644
--- a/libjava/javax/swing/BoxLayout.java
+++ b/libjava/javax/swing/BoxLayout.java
@@ -35,9 +35,15 @@ 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;
-import java.awt.*;
+import java.awt.Container;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.LayoutManager2;
+import java.io.Serializable;
/**
* A layout for swing components.
@@ -46,7 +52,7 @@ import java.awt.*;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class BoxLayout implements LayoutManager2
+public class BoxLayout implements LayoutManager2, Serializable
{
GridLayout gridbag;
diff --git a/libjava/javax/swing/ButtonGroup.java b/libjava/javax/swing/ButtonGroup.java
index 502d0840933..c872ab76a40 100644
--- a/libjava/javax/swing/ButtonGroup.java
+++ b/libjava/javax/swing/ButtonGroup.java
@@ -35,12 +35,12 @@ 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;
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+package javax.swing;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
public class ButtonGroup implements Serializable
{
diff --git a/libjava/javax/swing/DefaultButtonModel.java b/libjava/javax/swing/DefaultButtonModel.java
index 9d6f4089da7..52b78b33782 100644
--- a/libjava/javax/swing/DefaultButtonModel.java
+++ b/libjava/javax/swing/DefaultButtonModel.java
@@ -35,15 +35,22 @@ 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;
-import java.util.*;
-import java.awt.event.*;
-import java.awt.*;
-import javax.swing.event.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.Serializable;
+import java.util.EventListener;
+import java.util.Vector;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
public class DefaultButtonModel
- implements ButtonModel, java.io.Serializable
+ implements ButtonModel, Serializable
{
static final long serialVersionUID = -5342609566534980231L;
diff --git a/libjava/javax/swing/DefaultListModel.java b/libjava/javax/swing/DefaultListModel.java
index 3a841635903..43846a5cdbe 100644
--- a/libjava/javax/swing/DefaultListModel.java
+++ b/libjava/javax/swing/DefaultListModel.java
@@ -35,17 +35,21 @@ 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;
-// Imports
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Vector;
/**
* DefaultListModel
* @author Andrew Selkirk
* @version 1.0
*/
-public class DefaultListModel extends AbstractListModel {
+public class DefaultListModel extends AbstractListModel
+{
//-------------------------------------------------------------
// Variables --------------------------------------------------
diff --git a/libjava/javax/swing/DefaultListSelectionModel.java b/libjava/javax/swing/DefaultListSelectionModel.java
index 64ae505fd12..2da790d247c 100644
--- a/libjava/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/javax/swing/DefaultListSelectionModel.java
@@ -35,12 +35,16 @@ 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;
-import javax.swing.event.*;
-import java.util.*;
+import java.io.Serializable;
+import java.util.EventListener;
+import java.util.Vector;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ListSelectionListener;
-public class DefaultListSelectionModel implements ListSelectionModel
+public class DefaultListSelectionModel implements Cloneable, ListSelectionModel, Serializable
{
int mode = SINGLE_SELECTION;
diff --git a/libjava/javax/swing/FocusManager.java b/libjava/javax/swing/FocusManager.java
index c770bd0246e..6cbfa10f9d6 100644
--- a/libjava/javax/swing/FocusManager.java
+++ b/libjava/javax/swing/FocusManager.java
@@ -35,18 +35,20 @@ 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;
-// Imports
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Component;
+import java.awt.DefaultKeyboardFocusManager;
+import java.awt.event.KeyEvent;
/**
* FocusManager
* @author Andrew Selkirk
* @version 1.0
*/
-public abstract class FocusManager {
+public abstract class FocusManager extends DefaultKeyboardFocusManager
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/ImageIcon.java b/libjava/javax/swing/ImageIcon.java
index ded11a13424..872558d08dd 100644
--- a/libjava/javax/swing/ImageIcon.java
+++ b/libjava/javax/swing/ImageIcon.java
@@ -35,12 +35,18 @@ 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;
-
-import java.awt.*;
-import java.awt.image.*;
+package javax.swing;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Toolkit;
+import java.io.Serializable;
+import java.net.URL;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
public class ImageIcon implements Icon
{
diff --git a/libjava/javax/swing/InputMap.java b/libjava/javax/swing/InputMap.java
index 861fe57ea84..d748fb53e02 100644
--- a/libjava/javax/swing/InputMap.java
+++ b/libjava/javax/swing/InputMap.java
@@ -35,11 +35,19 @@ 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;
-// Imports
-import java.util.*;
-import java.io.*;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
/**
* InputMap
diff --git a/libjava/javax/swing/JApplet.java b/libjava/javax/swing/JApplet.java
index 094123a2c7b..ed450ced7a5 100644
--- a/libjava/javax/swing/JApplet.java
+++ b/libjava/javax/swing/JApplet.java
@@ -35,18 +35,19 @@ 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;
-
-import java.applet.*;
-import java.awt.*;
-import java.awt.event.*;
+package javax.swing;
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.LayoutManager;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
public class JApplet extends Applet
{
diff --git a/libjava/javax/swing/JButton.java b/libjava/javax/swing/JButton.java
index 9bfe32edaa9..9c43e6d0bb9 100644
--- a/libjava/javax/swing/JButton.java
+++ b/libjava/javax/swing/JButton.java
@@ -49,6 +49,8 @@ import javax.accessibility.*;
*/
public class JButton extends AbstractButton implements Accessible
{
+ private static final long serialVersionUID = -1907255238954382202L;
+
boolean def, is_def;
diff --git a/libjava/javax/swing/JCheckBox.java b/libjava/javax/swing/JCheckBox.java
index 4e6810ca22e..4d2cee7e02b 100644
--- a/libjava/javax/swing/JCheckBox.java
+++ b/libjava/javax/swing/JCheckBox.java
@@ -35,12 +35,10 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.plaf.*;
-import javax.accessibility.*;
+import javax.accessibility.AccessibleContext;
/**
* An instance of JCheckbox can be added to a panel, frame etc
diff --git a/libjava/javax/swing/JCheckBoxMenuItem.java b/libjava/javax/swing/JCheckBoxMenuItem.java
index ac3b6600cbf..0b767785fa4 100644
--- a/libjava/javax/swing/JCheckBoxMenuItem.java
+++ b/libjava/javax/swing/JCheckBoxMenuItem.java
@@ -46,7 +46,8 @@ import javax.accessibility.*;
* @author Andrew Selkirk
* @version 1.0
*/
-public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, Accessible {
+public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, Accessible
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JColorChooser.java b/libjava/javax/swing/JColorChooser.java
index c9c22f18c57..8881dc3555d 100644
--- a/libjava/javax/swing/JColorChooser.java
+++ b/libjava/javax/swing/JColorChooser.java
@@ -35,15 +35,20 @@ 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;
-// Imports
-import java.awt.*;
-import java.awt.event.*;
-import java.io.*;
-import javax.accessibility.*;
-import javax.swing.colorchooser.*;
-import javax.swing.plaf.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.colorchooser.AbstractColorChooserPanel;
+import javax.swing.colorchooser.ColorSelectionModel;
+import javax.swing.plaf.ColorChooserUI;
/**
* JColorChooser
diff --git a/libjava/javax/swing/JComboBox.java b/libjava/javax/swing/JComboBox.java
index 4837e972087..c854520d07d 100644
--- a/libjava/javax/swing/JComboBox.java
+++ b/libjava/javax/swing/JComboBox.java
@@ -35,9 +35,9 @@ 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;
-// Imports
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
@@ -52,8 +52,11 @@ import javax.swing.plaf.*;
* @author Andrew Selkirk
* @version 1.0
*/
-public class JComboBox extends JComponent implements ItemSelectable,
- ListDataListener, ActionListener, Accessible {
+public class JComboBox extends JComponent
+ implements ItemSelectable, ListDataListener, ActionListener, Accessible
+{
+ private static final long serialVersionUID = 5654585963292734470L;
+
//-------------------------------------------------------------
// Classes ----------------------------------------------------
@@ -766,6 +769,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
/**
* isFocusTraversable
* @returns boolean
+ * @deprecated
*/
public boolean isFocusTraversable() {
return false; // TODO
diff --git a/libjava/javax/swing/JComponent.java b/libjava/javax/swing/JComponent.java
index 119e3859193..a0409a4fbfe 100644
--- a/libjava/javax/swing/JComponent.java
+++ b/libjava/javax/swing/JComponent.java
@@ -35,21 +35,43 @@ 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;
-
-import java.awt.*;
-import java.awt.peer.*;
-import java.awt.event.*;
-import java.io.*;
-
-import javax.swing.event.*;
-import javax.swing.border.*;
-import javax.swing.plaf.*;
-import java.util.*;
-import java.beans.*;
+package javax.swing;
-import javax.accessibility.*;
+import java.awt.AWTEvent;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.ActionListener;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.peer.LightweightPeer;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+import java.io.Serializable;
+import java.util.Vector;
+import java.util.Hashtable;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleExtendedComponent;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleStateSet;
+import javax.swing.event.AncestorListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.border.Border;
+import javax.swing.plaf.ComponentUI;
/**
* Every component in swing inherits from this class (JLabel, JButton, etc).
@@ -93,16 +115,6 @@ public abstract class JComponent extends Container implements Serializable
* AccessibleFocusHandler
*/
protected class AccessibleFocusHandler implements FocusListener {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AccessibleFocusHandler
* @param component TODO
@@ -111,11 +123,6 @@ public abstract class JComponent extends Container implements Serializable
// TODO
} // AccessibleFocusHandler()
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
* focusGained
* @param event TODO
@@ -131,24 +138,12 @@ public abstract class JComponent extends Container implements Serializable
public void focusLost(FocusEvent valevent) {
// TODO
} // focusLost()
-
-
} // AccessibleFocusHandler
/**
* AccessibleContainerHandler
*/
protected class AccessibleContainerHandler implements ContainerListener {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AccessibleContainerHandler
* @param component TODO
@@ -157,11 +152,6 @@ public abstract class JComponent extends Container implements Serializable
// TODO
} // AccessibleContainerHandler()
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
* componentAdded
* @param event TODO
@@ -177,15 +167,8 @@ public abstract class JComponent extends Container implements Serializable
public void componentRemoved(ContainerEvent valevent) {
// TODO
} // componentRemoved()
-
-
} // AccessibleContainerHandler
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
/**
* accessibleContainerHandler
*/
@@ -196,11 +179,6 @@ public abstract class JComponent extends Container implements Serializable
*/
protected FocusListener accessibleFocusHandler;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AccessibleJComponent
* @param component TODO
@@ -210,11 +188,6 @@ public abstract class JComponent extends Container implements Serializable
// TODO
} // AccessibleJComponent()
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
* addPropertyChangeListener
* @param listener TODO
@@ -304,7 +277,6 @@ public abstract class JComponent extends Container implements Serializable
//updateUI(); // get a proper ui
}
-
// protected EventListenerList listenerList
public boolean contains(int x, int y)
{
@@ -312,14 +284,12 @@ public abstract class JComponent extends Container implements Serializable
return super.contains(x,y);
}
-
public void addNotify()
{
//Notification to this component that it now has a parent component.
super.addNotify();
}
-
Hashtable get_prop_hash()
{
if (prop_hash == null)
@@ -351,7 +321,6 @@ public abstract class JComponent extends Container implements Serializable
public void putClientProperty(Object key, Object value)
{ get_prop_hash().put(key, value); }
-
public void removeAncestorListener(AncestorListener listener)
{ get_ancestor_list().removeElement(listener); }
@@ -382,7 +351,6 @@ public abstract class JComponent extends Container implements Serializable
//super.computeVisibleRect(rect);
}
-
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
{
//Reports a bound property change.
@@ -423,7 +391,6 @@ public abstract class JComponent extends Container implements Serializable
// Reports a bound property change.
}
-
protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
{
// Support for reporting constrained property changes.
@@ -635,16 +602,6 @@ public abstract class JComponent extends Container implements Serializable
}
}
-
-
- /*********************************************************************
- *
- *
- * tooltips:
- *
- *
- **************************************/
-
public JToolTip createToolTip()
{
if (tooltip == null)
@@ -664,15 +621,6 @@ public abstract class JComponent extends Container implements Serializable
public String getToolTipText(MouseEvent event)
{ return tool_tip_text; }
- /*********************************************************************
- *
- *
- * things to do with visibility:
- *
- *
- **************************************/
-
-
public Container getTopLevelAncestor()
{
// Returns the top-level ancestor of this component (either the containing Window or Applet), or null if this component has not been added to any container.
@@ -930,7 +878,6 @@ public abstract class JComponent extends Container implements Serializable
// If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport
}
-
public void setDebugGraphicsOptions(int debugOptions)
{
// Enables or disables diagnostic information about every graphics operation performed within the component or one of its children.
@@ -954,6 +901,7 @@ public abstract class JComponent extends Container implements Serializable
revalidate();
repaint();
}
+
public void setBackground(Color bg)
{
super.setBackground(bg);
@@ -1020,16 +968,6 @@ public abstract class JComponent extends Container implements Serializable
paint(g);
}
-
-
- /******************************************
- *
- *
- * UI management
- *
- *
- *********/
-
public String getUIClassID()
{
/// Return the UIDefaults key used to look up the name of the swing.
diff --git a/libjava/javax/swing/JDesktopPane.java b/libjava/javax/swing/JDesktopPane.java
index af979f3084a..4ad265c9bd9 100644
--- a/libjava/javax/swing/JDesktopPane.java
+++ b/libjava/javax/swing/JDesktopPane.java
@@ -47,7 +47,8 @@ import javax.swing.plaf.*;
* @author Andrew Selkirk
* @version 1.0
*/
-public class JDesktopPane extends JLayeredPane implements Accessible {
+public class JDesktopPane extends JLayeredPane implements Accessible
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JDialog.java b/libjava/javax/swing/JDialog.java
index 61b9d40a49b..11f27b239e0 100644
--- a/libjava/javax/swing/JDialog.java
+++ b/libjava/javax/swing/JDialog.java
@@ -35,16 +35,21 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
+package javax.swing;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.LayoutManager;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
/**
* Unlike JComponent derivatives, JDialog inherits from
diff --git a/libjava/javax/swing/JEditorPane.java b/libjava/javax/swing/JEditorPane.java
index a2db3ee9007..bce9dc70640 100644
--- a/libjava/javax/swing/JEditorPane.java
+++ b/libjava/javax/swing/JEditorPane.java
@@ -35,15 +35,19 @@ 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;
-import java.io.*;
-import java.net.*;
-import javax.swing.text.*;
-import javax.swing.event.*;
-import java.awt.event.*;
-import java.awt.*;
-import javax.accessibility.*;
+import java.awt.Dimension;
+import java.awt.event.KeyEvent;
+import java.io.InputStream;
+import java.net.URL;
+import javax.accessibility.AccessibleContext;
+import javax.swing.text.EditorKit;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.PlainEditorKit;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
public class JEditorPane extends JTextComponent
{
diff --git a/libjava/javax/swing/JFileChooser.java b/libjava/javax/swing/JFileChooser.java
index cfa435c6d41..988e75b7743 100644
--- a/libjava/javax/swing/JFileChooser.java
+++ b/libjava/javax/swing/JFileChooser.java
@@ -35,17 +35,22 @@ 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;
-// Imports
-import java.awt.*;
-import java.awt.event.*;
-import java.io.*;
-import java.util.*;
-import javax.accessibility.*;
-import javax.swing.filechooser.*;
+import java.awt.Component;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.Vector;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.filechooser.FileFilter;
-import javax.swing.plaf.*;
+import javax.swing.filechooser.FileSystemView;
+import javax.swing.filechooser.FileView;
+import javax.swing.plaf.FileChooserUI;
/**
* JFileChooser
diff --git a/libjava/javax/swing/JFormattedTextField.java b/libjava/javax/swing/JFormattedTextField.java
index c7838e80a36..f26af99e60e 100644
--- a/libjava/javax/swing/JFormattedTextField.java
+++ b/libjava/javax/swing/JFormattedTextField.java
@@ -41,6 +41,7 @@ package javax.swing;
import java.awt.event.FocusEvent;
import java.io.Serializable;
import java.text.Format;
+import java.text.ParseException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;
import javax.swing.text.NavigationFilter;
diff --git a/libjava/javax/swing/JFrame.java b/libjava/javax/swing/JFrame.java
index 947bfab0e6c..9f4436ffb07 100644
--- a/libjava/javax/swing/JFrame.java
+++ b/libjava/javax/swing/JFrame.java
@@ -35,15 +35,20 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
+package javax.swing;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.LayoutManager;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
/**
* Unlike JComponent derivatives, JFrame inherits from
diff --git a/libjava/javax/swing/JInternalFrame.java b/libjava/javax/swing/JInternalFrame.java
index 55162393412..034050b6456 100644
--- a/libjava/javax/swing/JInternalFrame.java
+++ b/libjava/javax/swing/JInternalFrame.java
@@ -35,11 +35,27 @@ 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;
-/**
- * STUBBED
- */
+
+import java.awt.Component;
+import java.awt.Container;
+import javax.accessibility.Accessible;
+
public class JInternalFrame extends JComponent
/*implements Accessible, WindowConstants, RootPaneContainer*/
{
+ private static final long serialVersionUID = -5425177187760785402L;
+
+ public static final String CONTENT_PANE_PROPERTY = "contentPane";
+ public static final String MENU_BAR_PROPERTY = "JMenuBar";
+ public static final String TITLE_PROPERTY = "title";
+ public static final String LAYERED_PANE_PROPERTY = "layeredPane";
+ public static final String ROOT_PANE_PROPERTY = "rootPane";
+ public static final String GLASS_PANE_PROPERTY = "glassPane";
+ public static final String FRAME_ICON_PROPERTY = "frameIcon";
+ public static final String IS_SELECTED_PROPERTY = "selected";
+ public static final String IS_CLOSED_PROPERTY = "closed";
+ public static final String IS_MAXIMUM_PROPERTY = "maximum";
+ public static final String IS_ICON_PROPERTY = "icon";
} // class JInternalFrame
diff --git a/libjava/javax/swing/JLabel.java b/libjava/javax/swing/JLabel.java
index a4d6fa16faf..c49615c4638 100644
--- a/libjava/javax/swing/JLabel.java
+++ b/libjava/javax/swing/JLabel.java
@@ -35,19 +35,16 @@ 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;
-
-import java.awt.*;
-import javax.swing.plaf.*;
+package javax.swing;
+import java.awt.Component;
+import java.awt.Image;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
+import javax.swing.plaf.LabelUI;
-public class JLabel extends JComponent implements SwingConstants
+public class JLabel extends JComponent implements Accessible, SwingConstants
{
String text;
Icon icon;
diff --git a/libjava/javax/swing/JLayeredPane.java b/libjava/javax/swing/JLayeredPane.java
index ca49378dbb3..69217804ac1 100644
--- a/libjava/javax/swing/JLayeredPane.java
+++ b/libjava/javax/swing/JLayeredPane.java
@@ -35,11 +35,13 @@ 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;
-import java.awt.*;
+import java.awt.Component;
+import javax.accessibility.Accessible;
-public class JLayeredPane extends JComponent
+public class JLayeredPane extends JComponent implements Accessible
{
JLayeredPane()
{
diff --git a/libjava/javax/swing/JList.java b/libjava/javax/swing/JList.java
index b12e3c3d73f..22d35a5a2c0 100644
--- a/libjava/javax/swing/JList.java
+++ b/libjava/javax/swing/JList.java
@@ -1,5 +1,5 @@
/* JList.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,21 +35,21 @@ 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;
-
-import javax.swing.event.*;
-
-import java.awt.*;
-import javax.swing.plaf.*;
-import java.util.*;
+package javax.swing;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.util.Vector;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.plaf.ListUI;
-public class JList extends JComponent implements Scrollable
+public class JList extends JComponent implements Accessible, Scrollable
{
Color select_back, select_fore;
ListCellRenderer render;
@@ -143,14 +143,13 @@ public class JList extends JComponent implements Scrollable
public void setListData(final Vector listData)
{
- // XXX - FIXME Don't also name this AL, workaround for gcj 3.1.
- class ALData extends AbstractListModel
+ class AL extends AbstractListModel
{
public int getSize() { return listData.size(); }
public Object getElementAt(int i) { return listData.elementAt(i); }
};
- setModel (new ALData());
+ setModel (new AL());
}
diff --git a/libjava/javax/swing/JMenuBar.java b/libjava/javax/swing/JMenuBar.java
index dcceb9e3122..24440db598a 100644
--- a/libjava/javax/swing/JMenuBar.java
+++ b/libjava/javax/swing/JMenuBar.java
@@ -35,8 +35,14 @@ 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;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import javax.accessibility.Accessible;
+
public class JMenuBar extends JComponent
{
JMenuBar()
diff --git a/libjava/javax/swing/JMenuItem.java b/libjava/javax/swing/JMenuItem.java
index 7d3bfef9a7a..db09f22972f 100644
--- a/libjava/javax/swing/JMenuItem.java
+++ b/libjava/javax/swing/JMenuItem.java
@@ -35,16 +35,26 @@ 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;
-// Imports
-import java.awt.*;
-import java.awt.event.*;
-import java.beans.*;
-import java.io.*;
-import javax.accessibility.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
+import java.awt.Component;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+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.plaf.MenuItemUI;
/**
* JMenuItem
diff --git a/libjava/javax/swing/JOptionPane.java b/libjava/javax/swing/JOptionPane.java
index 71904021a9e..5dc10c7dc03 100644
--- a/libjava/javax/swing/JOptionPane.java
+++ b/libjava/javax/swing/JOptionPane.java
@@ -35,14 +35,16 @@ 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;
-import java.awt.*;
-import javax.swing.plaf.*;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
+import javax.swing.plaf.OptionPaneUI;
public class JOptionPane extends JComponent
{
diff --git a/libjava/javax/swing/JPanel.java b/libjava/javax/swing/JPanel.java
index b50271628b4..56cc1f09e26 100644
--- a/libjava/javax/swing/JPanel.java
+++ b/libjava/javax/swing/JPanel.java
@@ -35,22 +35,21 @@ 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;
-import java.awt.*;
-import javax.swing.plaf.*;
+package javax.swing;
+import java.awt.FlowLayout;
+import java.awt.LayoutManager;
+import javax.swing.plaf.PanelUI;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
/**
* An instance of JPanel can be added to a panel, frame etc
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JPanel extends JComponent
+public class JPanel extends JComponent implements Accessible
{
public JPanel()
{
diff --git a/libjava/javax/swing/JPasswordField.java b/libjava/javax/swing/JPasswordField.java
index 3e28a8fc106..40fb921f280 100644
--- a/libjava/javax/swing/JPasswordField.java
+++ b/libjava/javax/swing/JPasswordField.java
@@ -218,6 +218,7 @@ public class JPasswordField extends JTextField {
/**
* getText
* @returns String
+ * @deprecated
*/
public String getText() {
return null; // TODO
@@ -229,6 +230,7 @@ public class JPasswordField extends JTextField {
* @param length TODO
* @exception BadLocationException TODO
* @returns String
+ * @deprecated
*/
public String getText(int offset, int length) throws BadLocationException {
return null; // TODO
diff --git a/libjava/javax/swing/JPopupMenu.java b/libjava/javax/swing/JPopupMenu.java
index a787332f176..d5c6023205e 100644
--- a/libjava/javax/swing/JPopupMenu.java
+++ b/libjava/javax/swing/JPopupMenu.java
@@ -51,7 +51,8 @@ import javax.swing.plaf.*;
* @author Andrew Selkirk
* @version 1.0
*/
-public class JPopupMenu extends JComponent implements Accessible, MenuElement {
+public class JPopupMenu extends JComponent implements Accessible, MenuElement
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JProgressBar.java b/libjava/javax/swing/JProgressBar.java
index 6558bf83abc..2c4d834a6dd 100644
--- a/libjava/javax/swing/JProgressBar.java
+++ b/libjava/javax/swing/JProgressBar.java
@@ -49,7 +49,8 @@ import javax.swing.plaf.*;
* @author Andrew Selkirk
* @version 1.0
*/
-public class JProgressBar extends JComponent implements SwingConstants, Accessible {
+public class JProgressBar extends JComponent implements SwingConstants, Accessible
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JRadioButton.java b/libjava/javax/swing/JRadioButton.java
index 7671b1d3f7b..14bfcebb1fd 100644
--- a/libjava/javax/swing/JRadioButton.java
+++ b/libjava/javax/swing/JRadioButton.java
@@ -35,12 +35,10 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.plaf.*;
-import javax.accessibility.*;
+import javax.accessibility.AccessibleContext;
public class JRadioButton extends JToggleButton
{
diff --git a/libjava/javax/swing/JRadioButtonMenuItem.java b/libjava/javax/swing/JRadioButtonMenuItem.java
index 208b678ee5c..d619bfdd051 100644
--- a/libjava/javax/swing/JRadioButtonMenuItem.java
+++ b/libjava/javax/swing/JRadioButtonMenuItem.java
@@ -46,7 +46,8 @@ import javax.accessibility.*;
* @author Andrew Selkirk
* @version 1.0
*/
-public class JRadioButtonMenuItem extends JMenuItem implements Accessible {
+public class JRadioButtonMenuItem extends JMenuItem implements Accessible
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JRootPane.java b/libjava/javax/swing/JRootPane.java
index e7216d706a2..f0121b8ce92 100644
--- a/libjava/javax/swing/JRootPane.java
+++ b/libjava/javax/swing/JRootPane.java
@@ -35,15 +35,18 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
+package javax.swing;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager;
+import java.awt.LayoutManager2;
+import java.io.Serializable;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
/**
* This class is where JComponents are added to.
diff --git a/libjava/javax/swing/JScrollBar.java b/libjava/javax/swing/JScrollBar.java
index 482ed8f62bf..1cf6667d483 100644
--- a/libjava/javax/swing/JScrollBar.java
+++ b/libjava/javax/swing/JScrollBar.java
@@ -35,8 +35,12 @@ 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;
+import java.awt.Adjustable;
+import java.awt.event.AdjustmentListener;
+import javax.accessibility.Accessible;
public class JScrollBar extends JComponent
{
diff --git a/libjava/javax/swing/JScrollPane.java b/libjava/javax/swing/JScrollPane.java
index 70cbd2d6ef7..33cdba127dc 100644
--- a/libjava/javax/swing/JScrollPane.java
+++ b/libjava/javax/swing/JScrollPane.java
@@ -35,13 +35,14 @@ 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;
-import java.awt.*;
-import javax.swing.plaf.*;
+package javax.swing;
+import java.awt.Component;
+import javax.accessibility.Accessible;
+import javax.swing.plaf.ScrollPaneUI;
-public class JScrollPane extends JComponent
+public class JScrollPane extends JComponent implements Accessible, ScrollPaneConstants
{
protected JViewport columnHeader;
protected JViewport rowHeader;
diff --git a/libjava/javax/swing/JSeparator.java b/libjava/javax/swing/JSeparator.java
index a49a77faa52..a0a010aa304 100644
--- a/libjava/javax/swing/JSeparator.java
+++ b/libjava/javax/swing/JSeparator.java
@@ -48,7 +48,8 @@ import javax.swing.plaf.*;
* @version 1.0
*/
public class JSeparator extends JComponent
- implements SwingConstants, Accessible {
+ implements SwingConstants, Accessible
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JSlider.java b/libjava/javax/swing/JSlider.java
index 58475b67f16..c9fc022fa6a 100644
--- a/libjava/javax/swing/JSlider.java
+++ b/libjava/javax/swing/JSlider.java
@@ -35,14 +35,22 @@ 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;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.accessibility.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleValue;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.plaf.SliderUI;
/**
* JSlider
diff --git a/libjava/javax/swing/JTabbedPane.java b/libjava/javax/swing/JTabbedPane.java
index 915ec93258f..9264a76e9c5 100644
--- a/libjava/javax/swing/JTabbedPane.java
+++ b/libjava/javax/swing/JTabbedPane.java
@@ -35,19 +35,18 @@ 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;
-
-import java.util.*;
-import javax.swing.plaf.*;
-import java.awt.*;
+package javax.swing;
+import java.awt.Component;
+import java.util.Vector;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.plaf.TabbedPaneUI;
-public class JTabbedPane extends JComponent
+public class JTabbedPane extends JComponent implements Accessible, SwingConstants
{
class Tab
{
diff --git a/libjava/javax/swing/JTable.java b/libjava/javax/swing/JTable.java
index a6ed0cc79b4..55c6043ff8f 100644
--- a/libjava/javax/swing/JTable.java
+++ b/libjava/javax/swing/JTable.java
@@ -35,10 +35,14 @@ 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;
+import java.awt.Color;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
+import java.util.Hashtable;
import java.util.Vector;
import javax.accessibility.Accessible;
import javax.swing.event.ChangeEvent;
@@ -49,9 +53,10 @@ import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
+import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;
+import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumnModel;
-import javax.swing.table.DefaultTableModel;
public class JTable extends JComponent
implements TableModelListener, Scrollable, TableColumnModelListener,
diff --git a/libjava/javax/swing/JTextField.java b/libjava/javax/swing/JTextField.java
index 806aa27dfb3..edc3ea7735b 100644
--- a/libjava/javax/swing/JTextField.java
+++ b/libjava/javax/swing/JTextField.java
@@ -35,12 +35,14 @@ 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;
-import java.awt.event.*;
-import java.util.*;
+package javax.swing;
-import javax.accessibility.*;
+import java.awt.event.ActionListener;
+import java.util.Vector;
+import javax.accessibility.AccessibleStateSet;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
public class JTextField extends JEditorPane
{
diff --git a/libjava/javax/swing/JToggleButton.java b/libjava/javax/swing/JToggleButton.java
index d0e90cb59c8..63972c1cad5 100644
--- a/libjava/javax/swing/JToggleButton.java
+++ b/libjava/javax/swing/JToggleButton.java
@@ -35,14 +35,14 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.plaf.*;
-import javax.accessibility.*;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.swing.plaf.ButtonUI;
-public class JToggleButton extends AbstractButton
+public class JToggleButton extends AbstractButton implements Accessible
{
public JToggleButton()
{
diff --git a/libjava/javax/swing/JToolBar.java b/libjava/javax/swing/JToolBar.java
index f5b18d900ac..a92157efbf2 100644
--- a/libjava/javax/swing/JToolBar.java
+++ b/libjava/javax/swing/JToolBar.java
@@ -50,7 +50,8 @@ import javax.swing.plaf.*;
* @version 1.0
*/
public class JToolBar extends JComponent
- implements SwingConstants, Accessible {
+ implements SwingConstants, Accessible
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/JToolTip.java b/libjava/javax/swing/JToolTip.java
index d245df99fe4..54e09cf0c60 100644
--- a/libjava/javax/swing/JToolTip.java
+++ b/libjava/javax/swing/JToolTip.java
@@ -35,12 +35,13 @@ 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;
-import java.awt.*;
+package javax.swing;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
-public class JToolTip extends JComponent
+public class JToolTip extends JComponent implements Accessible
{
String text;
diff --git a/libjava/javax/swing/JTree.java b/libjava/javax/swing/JTree.java
index f474c2f69ac..432612db808 100644
--- a/libjava/javax/swing/JTree.java
+++ b/libjava/javax/swing/JTree.java
@@ -35,11 +35,28 @@ 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;
-import java.awt.*;
-import javax.swing.plaf.*;
-import javax.accessibility.*;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.io.Serializable;
+import java.util.Hashtable;
+import java.util.Vector;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.plaf.TreeUI;
+import javax.swing.tree.DefaultTreeSelectionModel;
+import javax.swing.tree.TreeCellEditor;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
public class JTree extends JComponent implements Scrollable, Accessible
{
diff --git a/libjava/javax/swing/JViewport.java b/libjava/javax/swing/JViewport.java
index c4a8df6e15c..43ed91e6883 100644
--- a/libjava/javax/swing/JViewport.java
+++ b/libjava/javax/swing/JViewport.java
@@ -35,11 +35,17 @@ 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;
-import javax.swing.plaf.*;
-import java.awt.*;
+package javax.swing;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
+import javax.accessibility.Accessible;
+import javax.swing.plaf.ViewportUI;
public class JViewport extends JComponent
{
diff --git a/libjava/javax/swing/JWindow.java b/libjava/javax/swing/JWindow.java
index c74e33870c0..5edf5b25412 100644
--- a/libjava/javax/swing/JWindow.java
+++ b/libjava/javax/swing/JWindow.java
@@ -1,5 +1,5 @@
/* JWindow.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,22 @@ 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;
-import java.awt.*;
-import java.awt.event.*;
-import javax.accessibility.*;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.LayoutManager;
+import java.awt.Window;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
/**
* Unlike JComponent derivatives, JWindow inherits from
@@ -67,6 +78,11 @@ public class JWindow extends Window implements Accessible
*
*************/
+ public JWindow()
+ {
+ this(null);
+ }
+
// huuu ?
public JWindow(Frame f)
{
diff --git a/libjava/javax/swing/KeyStroke.java b/libjava/javax/swing/KeyStroke.java
index 7fe06995a9f..c3053aa289e 100644
--- a/libjava/javax/swing/KeyStroke.java
+++ b/libjava/javax/swing/KeyStroke.java
@@ -37,9 +37,9 @@ exception statement from your version. */
package javax.swing;
-// Imports
-import java.awt.event.*;
-import java.io.*;
+import java.awt.AWTKeyStroke;
+import java.awt.event.KeyEvent;
+import java.io.Serializable;
/**
* KeyStroke
diff --git a/libjava/javax/swing/ListSelectionModel.java b/libjava/javax/swing/ListSelectionModel.java
index e4b985b93e0..f4568479387 100644
--- a/libjava/javax/swing/ListSelectionModel.java
+++ b/libjava/javax/swing/ListSelectionModel.java
@@ -35,10 +35,10 @@ 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;
+package javax.swing;
-import javax.swing.event.*;
+import javax.swing.event.ListSelectionListener;
public interface ListSelectionModel
{
diff --git a/libjava/javax/swing/LookAndFeel.java b/libjava/javax/swing/LookAndFeel.java
index cd9d201dce6..b841a178075 100644
--- a/libjava/javax/swing/LookAndFeel.java
+++ b/libjava/javax/swing/LookAndFeel.java
@@ -35,9 +35,11 @@ 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;
-import javax.swing.text.*;
+import java.awt.Component;
+import javax.swing.text.JTextComponent;
public abstract class LookAndFeel
{
diff --git a/libjava/javax/swing/MenuSelectionManager.java b/libjava/javax/swing/MenuSelectionManager.java
index 4d635c0e81c..9088968538a 100644
--- a/libjava/javax/swing/MenuSelectionManager.java
+++ b/libjava/javax/swing/MenuSelectionManager.java
@@ -35,10 +35,42 @@ 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;
-/**
- * STUBBED
- */
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
public class MenuSelectionManager
{
+ protected ChangeEvent changeEvent;
+
+ protected EventListenerList listenerList = new EventListenerList ();
+
+ protected void fireStateChanged ()
+ {
+ ChangeListener[] listeners = getChangeListeners ();
+
+ for (int i = 0; i < listeners.length; i++)
+ {
+ listeners [i].stateChanged (new ChangeEvent (this));
+ }
+ }
+
+ public void addChangeListener (ChangeListener listener)
+ {
+ listenerList.add (ChangeListener.class, listener);
+ }
+
+ public void removeChangeListener (ChangeListener listener)
+ {
+ listenerList.remove (ChangeListener.class, listener);
+ }
+
+ /** @since 1.4 */
+ public ChangeListener[] getChangeListeners ()
+ {
+ return (ChangeListener[]) listenerList.getListeners (ChangeListener.class);
+ }
} // class MenuSelectionManager
diff --git a/libjava/javax/swing/RepaintManager.java b/libjava/javax/swing/RepaintManager.java
index cce32b5a018..55d62ae5f80 100644
--- a/libjava/javax/swing/RepaintManager.java
+++ b/libjava/javax/swing/RepaintManager.java
@@ -35,11 +35,15 @@ 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;
-// Imports
-import java.awt.*;
-import java.util.*;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* RepaintManager
diff --git a/libjava/javax/swing/ScrollPaneLayout.java b/libjava/javax/swing/ScrollPaneLayout.java
index bd65471d05f..d6cc479de0b 100644
--- a/libjava/javax/swing/ScrollPaneLayout.java
+++ b/libjava/javax/swing/ScrollPaneLayout.java
@@ -35,12 +35,15 @@ 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;
-// Imports
-import java.awt.*;
-import java.io.*;
-import javax.swing.plaf.*;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.io.Serializable;
/**
* ScrollPaneLayout
diff --git a/libjava/javax/swing/SizeRequirements.java b/libjava/javax/swing/SizeRequirements.java
index da6d1129d0f..eb641fbd1c7 100644
--- a/libjava/javax/swing/SizeRequirements.java
+++ b/libjava/javax/swing/SizeRequirements.java
@@ -35,10 +35,10 @@ 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;
-// Imports
-import java.io.*;
+import java.io.Serializable;
/**
* SizeRequirements
diff --git a/libjava/javax/swing/SwingConstants.java b/libjava/javax/swing/SwingConstants.java
index dbdd71043f1..fb7c23b4970 100644
--- a/libjava/javax/swing/SwingConstants.java
+++ b/libjava/javax/swing/SwingConstants.java
@@ -35,11 +35,10 @@ 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;
-
+package javax.swing;
-public interface SwingConstants
+public interface SwingConstants
{
public static final int CENTER = 0;
public static final int TOP = 1;
diff --git a/libjava/javax/swing/SwingUtilities.java b/libjava/javax/swing/SwingUtilities.java
index 974ee4f8d0e..a123ad83438 100644
--- a/libjava/javax/swing/SwingUtilities.java
+++ b/libjava/javax/swing/SwingUtilities.java
@@ -35,20 +35,34 @@ 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;
-
-import java.awt.*;
+package javax.swing;
-public class SwingUtilities
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.lang.reflect.InvocationTargetException;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleStateSet;
+
+public class SwingUtilities implements SwingConstants
+{
+ public static FontMetrics getFontMetrics (Font font)
{
-
- public static FontMetrics getFontMetrics ( Font font ) {
return Toolkit.getDefaultToolkit().getFontMetrics(font);
}
-
- static JRootPane getRootPane(Component a)
+ public static JRootPane getRootPane (Component a)
{
if (a instanceof JRootPane)
return (JRootPane) a;
@@ -63,11 +77,11 @@ public class SwingUtilities
return null;
}
- static void updateComponentTreeUI(JFrame comp)
+ public static void updateComponentTreeUI(JFrame comp)
{
}
- static public String layoutCompoundLabel(JComponent c,
+ public static String layoutCompoundLabel(JComponent c,
FontMetrics fm,
String text,
Icon i,
diff --git a/libjava/javax/swing/Timer.java b/libjava/javax/swing/Timer.java
index 1d52405218f..89df756eee2 100644
--- a/libjava/javax/swing/Timer.java
+++ b/libjava/javax/swing/Timer.java
@@ -35,20 +35,25 @@ 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;
-import java.awt.event.*;
-import java.util.*;
+package javax.swing;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.Serializable;
+import java.util.EventListener;
+import java.util.Vector;
+import javax.swing.event.EventListenerList;
-public class Timer
+public class Timer implements Serializable
{
+ protected EventListenerList listenerList = new EventListenerList();
+
int ticks;
static boolean verbose;
boolean running;
boolean repeat_ticks = true;
long interval, init_delay;
- Vector actions = new Vector();
class Waker extends Thread
{
@@ -82,23 +87,44 @@ public class Timer
public void addActionListener(ActionListener listener)
{
- actions.addElement(listener);
+ listenerList.add (ActionListener.class, listener);
}
+
public void removeActionListener(ActionListener listener)
{
- actions.removeElement(listener);
+ listenerList.remove (ActionListener.class, listener);
+ }
+
+ /**
+ * @since 1.3
+ */
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public ActionListener[] getActionListeners ()
+ {
+ return (ActionListener[]) listenerList.getListeners (ActionListener.class);
}
- void fireActionPerformed()
+ protected void fireActionPerformed (ActionEvent event)
{
- for (int i=0;i<actions.size();i++)
+ ActionListener[] listeners = getActionListeners();
+
+ for (int i = 0; i < listeners.length; i++)
{
- ActionListener a = (ActionListener) actions.elementAt(i);
- a.actionPerformed(new ActionEvent(this, ticks, "Timer"));
+ listeners [i].actionPerformed (event);
}
}
-
+ void fireActionPerformed ()
+ {
+ fireActionPerformed (new ActionEvent (this, ticks, "Timer"));
+ }
public static void setLogTimers(boolean flag)
{
diff --git a/libjava/javax/swing/ToggleButtonModel.java b/libjava/javax/swing/ToggleButtonModel.java
index 0128258bd76..b268925d1b9 100644
--- a/libjava/javax/swing/ToggleButtonModel.java
+++ b/libjava/javax/swing/ToggleButtonModel.java
@@ -35,14 +35,10 @@ 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;
-import java.util.*;
-import java.awt.event.*;
-import javax.swing.event.*;
+package javax.swing;
-public
-class ToggleButtonModel extends DefaultButtonModel
+public class ToggleButtonModel extends DefaultButtonModel
{
ToggleButtonModel(JComponent c)
{
diff --git a/libjava/javax/swing/UIDefaults.java b/libjava/javax/swing/UIDefaults.java
index de36203c9dc..71f0955fcfc 100644
--- a/libjava/javax/swing/UIDefaults.java
+++ b/libjava/javax/swing/UIDefaults.java
@@ -77,7 +77,7 @@ public class UIDefaults extends Hashtable
Object createValue(UIDefaults table);
} // interface LazyValue
- public static class ProxyLazyValue
+ public static class ProxyLazyValue implements LazyValue
{
public ProxyLazyValue(String s)
{
@@ -101,6 +101,8 @@ public class UIDefaults extends Hashtable
}
} // class ProxyLazyValue
+ private static final long serialVersionUID = 7341222528856548117L;
+
public UIDefaults()
{
}
diff --git a/libjava/javax/swing/UIManager.java b/libjava/javax/swing/UIManager.java
index 8feaccf30e3..556e8fffdf7 100644
--- a/libjava/javax/swing/UIManager.java
+++ b/libjava/javax/swing/UIManager.java
@@ -35,19 +35,18 @@ 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;
-
-import java.io.*;
-import java.awt.*;
-
-import javax.swing.border.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-import javax.swing.plaf.metal.*;
-
-import java.beans.*;
+package javax.swing;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Insets;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import javax.swing.border.Border;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
public class UIManager implements Serializable
{
@@ -175,11 +174,21 @@ public class UIManager implements Serializable
System.out.println("UIManager.getDim");
return new Dimension(200,100);
}
- static Font getFont(Object key)
- // Returns a drawing font from the defaults table.
- {
- return (Font) getLookAndFeel().getDefaults().get(key);
- }
+
+
+ /**
+ * Retrieves a font from the defaults table of the current
+ * LookAndFeel.
+ *
+ * @param key an Object that specifies the font. Typically,
+ * this is a String such as
+ * <code>&quot;TitledBorder.font&quot;</code>.
+ */
+ public static Font getFont(Object key)
+ {
+ return (Font) getLookAndFeel().getDefaults().get(key);
+ }
+
static Icon getIcon(Object key)
// Returns an Icon from the defaults table.
{
@@ -208,11 +217,17 @@ public class UIManager implements Serializable
return look_and_feel;
}
- static UIDefaults getLookAndFeelDefaults()
- // Returns the default values for this look and feel.
- {
- return getLookAndFeel().getDefaults();
- }
+
+ /**
+ * Returns the <code>UIDefaults</code> table of the currently active
+ * look and feel.
+ */
+ public static UIDefaults getLookAndFeelDefaults()
+ {
+ return getLookAndFeel().getDefaults();
+ }
+
+
static String getString(Object key)
// Returns a string from the defaults table.
{
diff --git a/libjava/javax/swing/border/AbstractBorder.java b/libjava/javax/swing/border/AbstractBorder.java
index d0285b33a5c..9c1f06be7d1 100644
--- a/libjava/javax/swing/border/AbstractBorder.java
+++ b/libjava/javax/swing/border/AbstractBorder.java
@@ -1,5 +1,5 @@
/* AbstractBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,90 +35,158 @@ 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.border;
-import java.io.*;
-import java.awt.*;
+package javax.swing.border;
-public abstract class AbstractBorder implements Border, Serializable
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.io.Serializable;
+
+
+/**
+ * An invisible zero-width border, serving as a base class for
+ * implementing more interesting borders.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ * @author Ronald Veldema (rveldema@cs.vu.nl)
+ */
+public abstract class AbstractBorder
+ implements Border, Serializable
{
static final long serialVersionUID = -545885975315191844L;
- AbstractBorder()
- {
- }
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
- {
- System.out.println("HMMMMM, abstract-border.paintBorder");
- }
-
-
- public Insets getBorderInsets(Component c, Insets insets)
- {
- if (insets == null)
- insets = new Insets(0,0,0,0);
-
- insets.left = insets.top = insets.right = insets.bottom = 5;
-
- return insets;
- }
-
- public Insets getBorderInsets(Component c)
- {
- return getBorderInsets(c, new Insets(0,0,0,0));
- }
-
-
- public boolean isBorderOpaque()
- { return false; }
- public Rectangle getInteriorRectangle(Component c,
- int x,
- int y,
- int width,
- int height)
+ /**
+ * Constructs a new AbstractBorder.
+ */
+ public AbstractBorder ()
+ {
+ }
+
+
+ /**
+ * Performs nothing, because the default implementation provided by
+ * this class is an invisible, zero-width border. Subclasses will
+ * likely want to override this method, but they are not required
+ * for doing so.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder (Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ /* A previous version of Classpath had emitted a warning when
+ * this method was called. The warning was removed because it is
+ * perfectly legal for a subclass to not override the paintBorder
+ * method. An example would be EmptyBorder.
+ */
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge, which is zero
+ * for the default implementation provided by AbstractButton.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets (Component c)
+ {
+ return new Insets (0, 0, 0, 0);
+ }
+
+
+ /**
+ * Determines the insets of this border. The implementation provided
+ * by AbstractButton sets the <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields of the passed
+ * <code>insets</code> parameter to zero.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets (Component c, Insets insets)
+ {
+ insets.left = insets.right = insets.top = insets.bottom = 0;
+ return insets;
+ }
+
+
+ /**
+ * Determines whether or not this border is opaque. An opaque border
+ * fills every pixel in its area when painting. Partially
+ * translucent borders must return <code>false</code>, or ugly
+ * artifacts can appear on screen. The default implementation
+ * provided by AbstractBorder always returns <code>false</code>.
+ *
+ * @return <code>false</code>.
+ */
+ public boolean isBorderOpaque ()
+ {
+ return false;
+ }
+
+
+ /**
+ * Returns a rectangle that covers the specified area minus this
+ * border. Components that wish to determine an area into which
+ * they can safely draw without intersecting with a border might
+ * want to use this helper method.
+ *
+ * @param c the component in the center of this border.
+ * @param x the horizontal position of the border.
+ * @param y the vertical position of the border.
+ * @param width the width of the available area for the border.
+ * @param height the height of the available area for the border.
+ */
+ public Rectangle getInteriorRectangle (Component c,
+ int x, int y, int width, int height)
+ {
+ return getInteriorRectangle (c, this, x, y, width, height);
+ }
+
+
+ /**
+ * Returns a rectangle that covers the specified area minus a
+ * border. Components that wish to determine an area into which
+ * they can safely draw without intersecting with a border might
+ * want to use this helper method.
+ *
+ * @param c the component in the center of this border.
+ * @param x the horizontal position of the border.
+ * @param y the vertical position of the border.
+ * @param width the width of the available area for the border.
+ * @param height the height of the available area for the border.
+ */
+ public static Rectangle getInteriorRectangle (Component c, Border b,
+ int x, int y, int width, int height)
+ {
+ Insets borderInsets;
+
+ if (b != null)
{
- return getInteriorRectangle(c,
- this,
- x,
- y,
- width,
- height);
+ borderInsets = b.getBorderInsets (c);
+ x += borderInsets.left;
+ y += borderInsets.top;
+ width -= borderInsets.left + borderInsets.right;
+ height -= borderInsets.top + borderInsets.bottom;
}
-
- public static Rectangle getInteriorRectangle(Component c,
- Border b,
- int x,
- int y,
- int width,
- int height)
- {
- if(b != null)
- {
- Insets insets = b.getBorderInsets(c);
-
- int w = insets.right - insets.left;
- int h = insets.top - insets.bottom;
-
- return new Rectangle(x + insets.left,
- y + insets.top,
- width - w,
- height - h);
- }
- else
- {
- return new Rectangle(x,
- y,
- width,
- height);
- }
- }
+ return new Rectangle (x, y, width, height);
+ }
}
-
diff --git a/libjava/javax/swing/border/BevelBorder.java b/libjava/javax/swing/border/BevelBorder.java
index ef2c279fa71..87bf04a0c61 100644
--- a/libjava/javax/swing/border/BevelBorder.java
+++ b/libjava/javax/swing/border/BevelBorder.java
@@ -1,5 +1,5 @@
/* BevelBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,39 +37,532 @@ exception statement from your version. */
package javax.swing.border;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
-public class BevelBorder extends EmptyBorder
+
+/**
+ * A rectangular, two pixel thick border that causes the enclosed area
+ * to appear as if it was raising out of or lowered into the screen. Some
+ * LookAndFeels use this kind of border for rectangular buttons.
+ *
+ * <p>A BevelBorder has a highlight and a shadow color. In the raised
+ * variant, the highlight color is used for the top and left edges,
+ * and the shadow color is used for the bottom and right edge. For an
+ * image, see the documentation of the individual constructors.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class BevelBorder
+ extends AbstractBorder
{
- Color c;
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -1034942243356299676L;
- public BevelBorder()
- {
- }
-
- public BevelBorder(int top,
- int left,
- int bottom,
- int right,
- Color color)
+ /**
+ * Indicates that the BevelBorder looks like if the enclosed area was
+ * raising out of the screen.
+ */
+ public static final int RAISED = 0;
+
+
+ /**
+ * Indicates that the BevelBorder looks like if the enclosed area was
+ * pressed into the screen.
+ */
+ public static final int LOWERED = 1;
+
+
+ /**
+ * The type of this BevelBorder, which is either {@link #RAISED}
+ * or {@link #LOWERED}.
+ */
+ protected int bevelType;
+
+
+ /**
+ * The outer highlight color, or <code>null</code> to indicate that
+ * the color shall be derived from the background of the component
+ * whose border is being painted.
+ */
+ protected Color highlightOuter;
+
+
+ /**
+ * The inner highlight color, or <code>null</code> to indicate that
+ * the color shall be derived from the background of the component
+ * whose border is being painted.
+ */
+ protected Color highlightInner;
+
+
+ /**
+ * The outer shadow color, or <code>null</code> to indicate that the
+ * color shall be derived from the background of the component whose
+ * border is being painted.
+ */
+ protected Color shadowOuter;
+
+
+ /**
+ * The inner shadow color, or <code>null</code> to indicate that the
+ * color shall be derived from the background of the component whose
+ * border is being painted.
+ */
+ protected Color shadowInner;
+
+
+ /**
+ * Constructs a BevelBorder whose colors will be derived from the
+ * background of the enclosed component. The background color is
+ * retrieved each time the border is painted, so a BevelBorder
+ * constructed by this method will automatically reflect a change
+ * to the component&#x2019;s background color.
+ *
+ * <p><img src="BevelBorder-1.png" width="500" height="150"
+ * alt="[An illustration showing raised and lowered BevelBorders]" />
+ *
+ * @param bevelType the desired appearance of the border. The value
+ * must be either {@link #RAISED} or {@link #LOWERED}.
+ *
+ * @throws IllegalArgumentException if <code>bevelType</code> has
+ * an unsupported value.
+ */
+ public BevelBorder(int bevelType)
+ {
+ if ((bevelType != RAISED) && (bevelType != LOWERED))
+ throw new IllegalArgumentException();
+
+ this.bevelType = bevelType;
+ }
+
+
+ /**
+ * Constructs a BevelBorder given its appearance type and two colors
+ * for its highlight and shadow.
+ *
+ * <p><img src="BevelBorder-2.png" width="500" height="150"
+ * alt="[An illustration showing BevelBorders that were constructed
+ * with this method]" />
+ *
+ * @param bevelType the desired appearance of the border. The value
+ * must be either {@link #RAISED} or {@link #LOWERED}.
+ *
+ * @param highlight the color that will be used for the inner
+ * side of the highlighted edges (top and left if
+ * if <code>bevelType</code> is {@link #RAISED}; bottom
+ * and right otherwise). The color for the outer side
+ * is a brightened version of this color.
+ *
+ * @param shadow the color that will be used for the outer
+ * side of the shadowed edges (bottom and right
+ * if <code>bevelType</code> is {@link #RAISED}; top
+ * and left otherwise). The color for the inner side
+ * is a brightened version of this color.
+ *
+ * @throws IllegalArgumentException if <code>bevelType</code> has
+ * an unsupported value.
+ *
+ * @throws NullPointerException if <code>highlight</code> or
+ * <code>shadow</code> is <code>null</code>.
+ *
+ * @see java.awt.Color.brighter()
+ */
+ public BevelBorder(int bevelType, Color highlight, Color shadow)
+ {
+ this(bevelType,
+ /* highlightOuter */ highlight.brighter(),
+ /* highlightInner */ highlight,
+ /* shadowOuter */ shadow,
+ /* shadowInner */ shadow.brighter());
+ }
+
+
+ /**
+ * Constructs a BevelBorder given its appearance type and all
+ * colors.
+ *
+ * <p><img src="BevelBorder-3.png" width="500" height="150"
+ * alt="[An illustration showing BevelBorders that were constructed
+ * with this method]" />
+ *
+ * @param bevelType the desired appearance of the border. The value
+ * must be either {@link #RAISED} or {@link #LOWERED}.
+ *
+ * @param highlightOuter the color that will be used for the outer
+ * side of the highlighted edges (top and left if
+ * <code>bevelType</code> is {@link #RAISED}; bottom and
+ * right otherwise).
+ *
+ * @param highlightInner the color that will be used for the inner
+ * side of the highlighted edges.
+ *
+ * @param shadowOuter the color that will be used for the outer
+ * side of the shadowed edges (bottom and right
+ * if <code>bevelType</code> is {@link #RAISED}; top
+ * and left otherwise).
+ *
+ * @param shadowInner the color that will be used for the inner
+ * side of the shadowed edges.
+ *
+ * @throws IllegalArgumentException if <code>bevelType</code> has
+ * an unsupported value.
+ *
+ * @throws NullPointerException if one of the passed colors
+ * is <code>null</code>.
+ */
+ public BevelBorder(int bevelType,
+ Color highlightOuter, Color highlightInner,
+ Color shadowOuter, Color shadowInner)
+ {
+ this(bevelType); // checks the validity of bevelType
+
+ if ((highlightOuter == null) || (highlightInner == null)
+ || (shadowOuter == null) || (shadowInner == null))
+ throw new NullPointerException();
+
+ this.highlightOuter = highlightOuter;
+ this.highlightInner = highlightInner;
+ this.shadowOuter = shadowOuter;
+ this.shadowInner = shadowInner;
+ }
+
+
+ /**
+ * Paints the border for a given component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ switch (bevelType)
{
- super(top, left, bottom, right);
- this.c = color;
+ case RAISED:
+ paintRaisedBevel(c, g, x, y, width, height);
+ break;
+
+ case LOWERED:
+ paintLoweredBevel(c, g, x, y, width, height);
+ break;
}
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
- public boolean isBorderOpaque()
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ insets.left = insets.right = insets.top = insets.bottom = 2;
+ return insets;
+ }
+
+
+ /**
+ * Determines the color that will be used for the outer side of
+ * highlighted edges when painting the border. If a highlight color
+ * has been specified upon constructing the border, that color is
+ * returned. Otherwise, the inner highlight color is brightened.
+ *
+ * @param c the component enclosed by this border.
+ *
+ * @see #getHighlightInnerColor(java.awt.Component)
+ * @see java.awt.Color#brighter()
+ */
+ public Color getHighlightOuterColor(Component c)
+ {
+ if (highlightOuter != null)
+ return highlightOuter;
+ else
+ return getHighlightInnerColor(c).brighter();
+ }
+
+
+ /**
+ * Determines the color that will be used for the inner side of
+ * highlighted edges when painting the border. If a highlight color
+ * has been specified upon constructing the border, that color is
+ * returned. Otherwise, the background color of the enclosed
+ * component is brightened.
+ *
+ * @param c the component enclosed by this border.
+ *
+ * @see java.awt.Component#getBackground()
+ * @see java.awt.Color#brighter()
+ */
+ public Color getHighlightInnerColor(Component c)
+ {
+ if (highlightInner != null)
+ return highlightInner;
+ else
+ return c.getBackground().brighter();
+ }
+
+
+ /**
+ * Determines the color that will be used for the inner side of
+ * shadowed edges when painting the border. If a shadow color has
+ * been specified upon constructing the border, that color is
+ * returned. Otherwise, the background color of the enclosed
+ * component is darkened.
+ *
+ * @param c the component enclosed by this border.
+ *
+ * @see java.awt.Component#getBackground()
+ * @see java.awt.Color#darker()
+ */
+ public Color getShadowInnerColor(Component c)
+ {
+ if (shadowInner != null)
+ return shadowInner;
+ else
+ return c.getBackground().darker();
+ }
+
+
+ /**
+ * Determines the color that will be used for the outer side of
+ * shadowed edges when painting the border. If a shadow color
+ * has been specified upon constructing the border, that color is
+ * returned. Otherwise, the inner shadow color is darkened.
+ *
+ * @param c the component enclosed by this border.
+ *
+ * @see #getShadowInnerColor(java.awt.Component)
+ * @see java.awt.Color#darker()
+ */
+ public Color getShadowOuterColor(Component c)
+ {
+ if (shadowOuter != null)
+ return shadowOuter;
+ else
+ return getShadowInnerColor(c).darker();
+ }
+
+
+ /**
+ * Returns the color that will be used for the outer side of
+ * highlighted edges when painting the border, or <code>null</code>
+ * if that color will be derived from the background of the enclosed
+ * Component.
+ */
+ public Color getHighlightOuterColor()
+ {
+ return highlightOuter;
+ }
+
+
+ /**
+ * Returns the color that will be used for the inner side of
+ * highlighted edges when painting the border, or <code>null</code>
+ * if that color will be derived from the background of the enclosed
+ * Component.
+ */
+ public Color getHighlightInnerColor()
+ {
+ return highlightInner;
+ }
+
+
+ /**
+ * Returns the color that will be used for the inner side of
+ * shadowed edges when painting the border, or <code>null</code> if
+ * that color will be derived from the background of the enclosed
+ * Component.
+ */
+ public Color getShadowInnerColor()
+ {
+ return shadowInner;
+ }
+
+
+ /**
+ * Returns the color that will be used for the outer side of
+ * shadowed edges when painting the border, or <code>null</code> if
+ * that color will be derived from the background of the enclosed
+ * Component.
+ */
+ public Color getShadowOuterColor()
+ {
+ return shadowOuter;
+ }
+
+
+ /**
+ * Returns the appearance of this border, which is either {@link
+ * #RAISED} or {@link #LOWERED}.
+ */
+ public int getBevelType()
+ {
+ return bevelType;
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * <p>If the border colors are derived from the background color of
+ * the enclosed component, the result is <code>true</code> because
+ * the derivation method always returns opaque colors. Otherwise,
+ * the result depends on the opacity of the individual colors.
+ *
+ * @return <code>true</code> if the border is fully opaque, or
+ * <code>false</code> if some pixels of the background
+ * can shine through the border.
+ */
+ public boolean isBorderOpaque()
+ {
+ /* If the colors are to be drived from the enclosed Component's
+ * background color, the border is guaranteed to be fully opaque
+ * because Color.brighten() and Color.darken() always return an
+ * opaque color.
+ */
+ return
+ ((highlightOuter == null) || (highlightOuter.getAlpha() == 255))
+ && ((highlightInner == null) || (highlightInner.getAlpha() == 255))
+ && ((shadowInner == null) || (shadowInner.getAlpha() == 255))
+ && ((shadowOuter == null) ||(shadowOuter.getAlpha() == 255));
+ }
+
+
+ /**
+ * Paints a raised bevel border around a component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ protected void paintRaisedBevel(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ paintBevel(g, x, y, width, height,
+ getHighlightOuterColor(c), getHighlightInnerColor(c),
+ getShadowInnerColor(c), getShadowOuterColor(c));
+ }
+
+
+ /**
+ * Paints a lowered bevel border around a component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ protected void paintLoweredBevel(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ paintBevel(g, x, y, width, height,
+ getShadowInnerColor(c), getShadowOuterColor(c),
+ getHighlightInnerColor(c), getHighlightOuterColor(c));
+ }
+
+
+ /**
+ * Paints a two-pixel bevel in four colors.
+ *
+ * <pre>
+ * @@@@@@@@@@@@
+ * @..........# @ = color a
+ * @. X# . = color b
+ * @. X# X = color c
+ * @.XXXXXXXXX# # = color d
+ * ############</pre>
+ *
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ * @param a the color for the outer side of the top and left edges.
+ * @param b the color for the inner side of the top and left edges.
+ * @param c the color for the inner side of the bottom and right edges.
+ * @param d the color for the outer side of the bottom and right edges.
+ */
+ private static void paintBevel(Graphics g,
+ int x, int y, int width, int height,
+ Color a, Color b, Color c, Color d)
+ {
+ Color oldColor;
+
+ oldColor = g.getColor();
+ g.translate(x, y);
+ width = width - 1;
+ height = height - 1;
+
+ try
{
- return false;
+ /* To understand this code, it might be helpful to look at the
+ * images that are included with the JavaDoc. They are located
+ * in the "doc-files" subdirectory.
+ */
+ g.setColor(a);
+ g.drawLine(0, 0, width, 0); // a, horizontal
+ g.drawLine(0, 1, 0, height); // a, vertical
+
+ g.setColor(b);
+ g.drawLine(1, 1, width - 1, 1); // b, horizontal
+ g.drawLine(1, 2, 1, height - 1); // b, vertical
+
+ g.setColor(c);
+ g.drawLine(2, height - 1, width - 1, height - 1); // c, horizontal
+ g.drawLine(width - 1, 2, width - 1, height - 2); // c, vertical
+
+ g.setColor(d);
+ g.drawLine(1, height, width, height); // d, horizontal
+ g.drawLine(width, 1, width, height - 1); // d, vertical
}
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
+ finally
{
+ g.translate(-x, -y);
+ g.setColor(oldColor);
}
+ }
}
diff --git a/libjava/javax/swing/border/Border.java b/libjava/javax/swing/border/Border.java
index 356693563c0..1f2fb827e96 100644
--- a/libjava/javax/swing/border/Border.java
+++ b/libjava/javax/swing/border/Border.java
@@ -1,5 +1,5 @@
/* Border.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,18 +35,71 @@ 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.border;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
+/**
+ * An interface for decorative or spacing borders around a Component.
+ *
+ * <p>To reduce memory consumption, several Components may share a
+ * single Border instance. {@link javax.swing.BorderFactory} is a
+ * factory class for producing commonly used shared borders.
+ *
+ * @see javax.swing.BorderFactory
+ * @see EmptyBorder
+ * @see CompoundBorder
+ * @see BevelBorder
+ * @see EtchedBorder
+ * @see LineBorder
+ * @see MatteBorder
+ * @see SoftBevelBorder
+ * @see TitledBorder
+ * @see AbstractBorder
+ *
+ * @author Ronald Veldema (rveldema@cs.vu.nl)
+ * @author Michael Koch (konqueror@gmx.de)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public interface Border
{
- public Insets getBorderInsets(Component c);
- public boolean isBorderOpaque();
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height);
+ /**
+ * Paints the border for a given component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height);
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ */
+ public Insets getBorderInsets(Component c);
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * @return <code>true</code> if the border is fully opaque, or
+ * <code>false</code> if some pixels of the background
+ * can shine through the border.
+ */
+ public boolean isBorderOpaque();
}
diff --git a/libjava/javax/swing/border/CompoundBorder.java b/libjava/javax/swing/border/CompoundBorder.java
index a1e731e17cf..d75f4c0dca6 100644
--- a/libjava/javax/swing/border/CompoundBorder.java
+++ b/libjava/javax/swing/border/CompoundBorder.java
@@ -1,5 +1,5 @@
/* CompoundBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,36 +35,223 @@ 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.border;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
-public class CompoundBorder extends AbstractBorder
+/**
+ * A Border that is composed of an interior and an exterior border,
+ * where the interior border is tightly nested into the exterior.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class CompoundBorder
+ extends AbstractBorder
{
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 9054540377030555103L;
+
+
+ /**
+ * The inside border, which is painted between the bordered
+ * Component and the outside border. It is valid for
+ * <code>insideBorder</code> to be <code>null</code>.
+ */
+ protected Border insideBorder;
+
+
+ /**
+ * The outside border, which is painted outside both the
+ * bordered Component and the inside border. It is valid for
+ * <code>outsideBorder</code> to be <code>null</code>.
+ */
+ protected Border outsideBorder;
+
+
+ /**
+ * Constructs a CompoundBorder whose inside and outside borders
+ * are both <code>null</code>. While this does not really make
+ * any sense (there exists a class EmptyBorder as well, and not
+ * every Component needs to have a border at all), the API
+ * specification requires the existence of this constructor.
+ *
+ * @see EmptyBorder
+ */
+ public CompoundBorder ()
+ {
+ this (null, null);
+ }
+
+
+ /**
+ * Constructs a CompoundBorder with the specified inside and
+ * outside borders.
+ *
+ * @param outsideBorder the outside border, which is painted to the
+ * outside of both <code>insideBorder</code> and the enclosed
+ * component. It is acceptable to pass <code>null</code>, in
+ * which case no outside border is painted.
+ *
+ * @param insideBorder the inside border, which is painted to
+ * between <code>outsideBorder</code> and the enclosed
+ * component. It is acceptable to pass <code>null</code>, in
+ * which case no inside border is painted.
+ */
+ public CompoundBorder (Border outsideBorder, Border insideBorder)
+ {
+ this.outsideBorder = outsideBorder;
+ this.insideBorder = insideBorder;
+ }
+
+
+ /**
+ * Determines whether or not this border is opaque. An opaque
+ * border fills every pixel in its area when painting. Partially
+ * translucent borders must return <code>false</code>, or ugly
+ * artifacts can appear on screen.
+ *
+ * @return <code>true</code> if both the inside and outside borders
+ * are opaque, or <code>false</code> otherwise.
+ */
+ public boolean isBorderOpaque ()
+ {
+ /* While it would be safe to assume true for the opacity of
+ * a null border, this behavior would not be according to
+ * the API specification. Also, it is pathological to have
+ * null borders anyway.
+ */
+ if ((insideBorder == null) || (outsideBorder == null))
+ return false;
+
+ return insideBorder.isBorderOpaque()
+ && outsideBorder.isBorderOpaque();
+ }
- public Insets getBorderInsets(Component c,
- Insets s)
+
+ /**
+ * Paints the compound border by first painting the outside border,
+ * then painting the inside border tightly nested into the outside.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ /* If there is an outside border, paint it and reduce the
+ * bounding box by its insets.
+ */
+ if (outsideBorder != null)
{
- if (s == null)
- s = new Insets(0,0,0,0);
-
- s.left = s.right = s.top = s.bottom = 5;
-
- return s;
+ Insets outsideInsets;
+
+ outsideBorder.paintBorder(c, g, x, y, width, height);
+ outsideInsets = outsideBorder.getBorderInsets(c);
+
+ x += outsideInsets.left;
+ y += outsideInsets.top;
+
+ /* Reduce width and height by the respective extent of the
+ * outside border.
+ */
+ width -= outsideInsets.left + outsideInsets.right;
+ height -= outsideInsets.top + outsideInsets.bottom;
}
-
- public boolean isBorderOpaque()
+
+ if (insideBorder != null)
+ insideBorder.paintBorder(c, g, x, y, width, height);
+ }
+
+
+ /**
+ * Changes the specified insets to the insets of this border,
+ * which is the sum of the insets of the inside and the outside
+ * border.
+ *
+ * @param c the component in the center of this border.
+ * @param insets an Insets object for holding the added insets.
+ *
+ * @return the <code>insets</code> object.
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ Insets borderInsets;
+
+ if (insets == null)
+ insets = new Insets (0,0,0,0);
+ else
+ insets.left = insets.right = insets.top = insets.bottom = 0;
+
+ /* If there is an outside border, add it to insets. */
+ if (outsideBorder != null)
{
- return false;
+ borderInsets = outsideBorder.getBorderInsets(c);
+ insets.left += borderInsets.left;
+ insets.right += borderInsets.right;
+ insets.top += borderInsets.top;
+ insets.bottom += borderInsets.bottom;
}
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
+
+ /* If there is an inside border, add it to insets. */
+ if (insideBorder != null)
{
+ borderInsets = insideBorder.getBorderInsets(c);
+ insets.left += borderInsets.left;
+ insets.right += borderInsets.right;
+ insets.top += borderInsets.top;
+ insets.bottom += borderInsets.bottom;
}
+
+ return insets;
+ }
+
+
+ /**
+ * Determines the insets of this border, which is the sum of the
+ * insets of the inside and the outside border.
+ *
+ * @param c the component in the center of this border.
+ */
+ public Insets getBorderInsets (Component c)
+ {
+ /* It is not clear why CompoundBorder does not simply inherit
+ * the implementation from AbstractBorder. However, we want
+ * to be compatible with the API specification, which overrides
+ * the getBorderInsets(Component) method.
+ */
+ return getBorderInsets (c, null);
+ }
+
+
+ /**
+ * Returns the outside border, which is painted outside both the
+ * bordered Component and the inside border. It is valid for the
+ * result to be <code>null</code>.
+ */
+ public Border getOutsideBorder ()
+ {
+ return outsideBorder;
+ }
+
+
+ /**
+ * Returns the inside border, which is painted between the bordered
+ * Component and the outside border. It is valid for the result to
+ * be <code>null</code>.
+ */
+ public Border getInsideBorder ()
+ {
+ return insideBorder;
+ }
}
diff --git a/libjava/javax/swing/border/EmptyBorder.java b/libjava/javax/swing/border/EmptyBorder.java
index c09a0affc40..6360063ffa4 100644
--- a/libjava/javax/swing/border/EmptyBorder.java
+++ b/libjava/javax/swing/border/EmptyBorder.java
@@ -1,5 +1,5 @@
/* EmptyBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,56 +35,189 @@ 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.border;
-
-import java.awt.*;
+package javax.swing.border;
-public class EmptyBorder extends AbstractBorder
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
+
+/**
+ * A border for leaving a specifiable number of pixels empty around
+ * the enclosed component. An EmptyBorder requires some space on each
+ * edge, but does not perform any drawing.
+ *
+ * <p><img src="EmptyBorder-1.png" width="290" height="200"
+ * alt="[An illustration of EmptyBorder]" />
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class EmptyBorder
+ extends AbstractBorder
{
-
- protected int l,r,b,t;
-
- public EmptyBorder()
- {
- }
-
- public EmptyBorder(int left,
- int right,
- int top,
- int bottom)
- {
- this.l = left;
- this.r = r;
- this.t = t;
- this.b = b;
- }
-
-
- public Insets getBorderInsets(Component c,
- Insets s)
- {
- if (s == null)
- s = new Insets(0,0,0,0);
-
- s.left = l;
- s.right = r;
- s.top = t;
- s.bottom = b;
-
- return s;
- }
-
- public boolean isBorderOpaque()
- {
- return false;
- }
-
-
- public void paintBorder(Component c,
- Graphics g,
- int x, int y, int width, int height)
- {
- }
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -8116076291731988694L;
+
+
+ /**
+ * The number of pixels required at the left edge.
+ */
+ protected int left;
+
+
+ /**
+ * The number of pixels required at the right edge.
+ */
+ protected int right;
+
+
+ /**
+ * The number of pixels required at the top edge.
+ */
+ protected int top;
+
+
+ /**
+ * The number of pixels required at the bottom edge.
+ */
+ protected int bottom;
+
+
+ /**
+ * Constructs an empty border given the number of pixels required
+ * on each side.
+ *
+ * @param top the number of pixels that the border will need
+ * for its top edge.
+ *
+ * @param left the number of pixels that the border will need
+ * for its left edge.
+ *
+ * @param bottom the number of pixels that the border will need
+ * for its bottom edge.
+ *
+ * @param right the number of pixels that the border will need
+ * for its right edge.
+ */
+ public EmptyBorder(int top, int left, int bottom, int right)
+ {
+ this.top = top;
+ this.left = left;
+ this.bottom = bottom;
+ this.right = right;
+ }
+
+
+ /**
+ * Constructs an empty border given the number of pixels required
+ * on each side, passed in an Insets object.
+ *
+ * @param borderInsets the Insets for the new border.
+ */
+ public EmptyBorder(Insets borderInsets)
+ {
+ this(borderInsets.top, borderInsets.left,
+ borderInsets.bottom, borderInsets.right);
+ }
+
+
+ /**
+ * Performs nothing because an EmptyBorder does not paint any
+ * pixels. While the inherited implementation provided by
+ * {@link AbstractBorder#paintBorder} is a no-op as well,
+ * it is overwritten in order to match the API of the Sun
+ * reference implementation.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ if (insets == null)
+ insets = new Insets(0, 0, 0, 0);
+
+ insets.left = left;
+ insets.right = right;
+ insets.top = top;
+ insets.bottom = bottom;
+ return insets;
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets()
+ {
+ return getBorderInsets(null, null);
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting. Since an empty border does not paint any pixels
+ * whatsoever, the result is <code>false</code>.
+ *
+ * @return <code>false</code>.
+ */
+ public boolean isBorderOpaque()
+ {
+ /* The inherited implementation of AbstractBorder.isBorderOpaque()
+ * would also return false. It is not clear why this is overriden
+ * in the Sun implementation, at least not from just reading the
+ * JavaDoc.
+ */
+ return false;
+ }
}
-
diff --git a/libjava/javax/swing/border/EtchedBorder.java b/libjava/javax/swing/border/EtchedBorder.java
index 97e5099d1a4..bb16ae925b1 100644
--- a/libjava/javax/swing/border/EtchedBorder.java
+++ b/libjava/javax/swing/border/EtchedBorder.java
@@ -1,5 +1,5 @@
/* EtchedBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,41 +35,377 @@ 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.border;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
-public class EtchedBorder extends EmptyBorder
+/**
+ * A border that looks like an engraving etched into the background
+ * surface, or (in its raised variant) coming out of the surface
+ * plane. Using different constructors, it is possible to either
+ * explicitly specify the border colors, or to let the colors derive
+ * from the background color of the enclosed Component.
+ *
+ * <p><img src="EtchedBorder-1.png" width="500" height="200"
+ * alt="[An illustration of the two EtchedBorder variants]" />
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class EtchedBorder
+ extends AbstractBorder
{
- Color c;
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 4001244046866360638L;
+
+
+ /**
+ * Indicates that the border appears as coming out of the
+ * background.
+ */
+ public static final int RAISED = 0;
- public EtchedBorder()
- {
- }
-
- public EtchedBorder(int top,
- int left,
- int bottom,
- int right,
- Color color)
+ /**
+ * Indicates that the border appears as engraved into the
+ * background.
+ */
+ public static final int LOWERED = 1;
+
+
+ /**
+ * The type of this EtchedBorder, which is either {@link #RAISED}
+ * or {@link #LOWERED}.
+ */
+ protected int etchType;
+
+
+ /**
+ * The highlight color, or <code>null</code> to indicate that the
+ * color shall be derived from the background of the enclosed
+ * component.
+ */
+ protected Color highlight;
+
+
+ /**
+ * The shadow color, or <code>null</code> to indicate that the
+ * color shall be derived from the background of the enclosed
+ * component.
+ */
+ protected Color shadow;
+
+
+ /**
+ * Constructs a lowered EtchedBorder. The colors will be derived
+ * from the background color of the enclosed Component when the
+ * border gets painted.
+ */
+ public EtchedBorder()
+ {
+ this(LOWERED);
+ }
+
+
+ /**
+ * Constructs an EtchedBorder with the specified appearance. The
+ * colors will be derived from the background color of the enclosed
+ * Component when the border gets painted.
+ *
+ * <p><img src="EtchedBorder-1.png" width="500" height="200"
+ * alt="[An illustration of the two EtchedBorder variants]" />
+ *
+ * @param etchType the desired appearance of the border. The value
+ * must be either {@link #RAISED} or {@link #LOWERED}.
+ *
+ * @throws IllegalArgumentException if <code>etchType</code> has
+ * an unsupported value.
+ */
+ public EtchedBorder(int etchType)
+ {
+ if ((etchType != RAISED) && (etchType != LOWERED))
+ throw new IllegalArgumentException();
+
+ this.etchType = etchType;
+
+ /* The highlight and shadow fields already have a null value
+ * when the constructor gets called, so there is no need to
+ * assign a value here.
+ */
+ }
+
+
+ /**
+ * Constructs a lowered EtchedBorder, explicitly selecting the
+ * colors that will be used for highlight and shadow.
+ *
+ * @param highlight the color that will be used for painting
+ * the highlight part of the border.
+ *
+ * @param shadow the color that will be used for painting
+ * the shadow part of the border.
+ *
+ * @see #EtchedBorder(int, Color, Color)
+ */
+ public EtchedBorder(Color highlight, Color shadow)
+ {
+ this(LOWERED, highlight, shadow);
+ }
+
+
+ /**
+ * Constructs an EtchedBorder with the specified appearance,
+ * explicitly selecting the colors that will be used for
+ * highlight and shadow.
+ *
+ * <p><img src="EtchedBorder-2.png" width="500" height="200"
+ * alt="[An illustration that shows which pixels get painted
+ * in what color]" />
+ *
+ * @param etchType the desired appearance of the border. The value
+ * must be either {@link #RAISED} or {@link #LOWERED}.
+ *
+ * @param highlight the color that will be used for painting
+ * the highlight part of the border.
+ *
+ * @param shadow the color that will be used for painting
+ * the shadow part of the border.
+ *
+ * @throws IllegalArgumentException if <code>etchType</code> has
+ * an unsupported value.
+ */
+ public EtchedBorder(int etchType, Color highlight, Color shadow)
+ {
+ this(etchType); // Checks the validity of the value.
+ this.highlight = highlight;
+ this.shadow = shadow;
+ }
+
+
+ /**
+ * Paints the border for a given component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ switch (etchType)
{
- super(top, left, bottom, right);
- this.c = color;
+ case RAISED:
+ paintEtchedBorder(g, x, y, width, height,
+ getHighlightColor(c), getShadowColor(c));
+ break;
+
+ case LOWERED:
+ paintEtchedBorder(g, x, y, width, height,
+ getShadowColor(c), getHighlightColor(c));
+ break;
}
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ insets.left = insets.right = insets.top = insets.bottom = 2;
+ return insets;
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * <p>If the border colors are derived from the background color of
+ * the enclosed component, the result is <code>true</code> because
+ * the derivation method always returns opaque colors. Otherwise,
+ * the result depends on the opacity of the individual colors.
+ *
+ * @return <code>true</code> if the border is fully opaque, or
+ * <code>false</code> if some pixels of the background
+ * can shine through the border.
+ */
+ public boolean isBorderOpaque()
+ {
+ /* If the colors are to be drived from the enclosed Component's
+ * background color, the border is guaranteed to be fully opaque
+ * because Color.brighten() and Color.darken() always return an
+ * opaque color.
+ */
+ return
+ ((highlight == null) || (highlight.getAlpha() == 255))
+ && ((shadow == null) || (shadow.getAlpha() == 255));
+ }
+
+
+ /**
+ * Returns the appearance of this EtchedBorder, which is either
+ * {@link #RAISED} or {@link #LOWERED}.
+ */
+ public int getEtchType()
+ {
+ return etchType;
+ }
+
- public boolean isBorderOpaque()
+ /**
+ * Determines the color that will be used for highlighted parts when
+ * painting the border around a given component. If a highlight
+ * color has been specified upon constructing the border, that color
+ * is returned. Otherwise, the background color of the enclosed
+ * component is brightened.
+ *
+ * @param c the component enclosed by this border.
+ *
+ * @see java.awt.Component#getBackground()
+ * @see java.awt.Color#brighter()
+ */
+ public Color getHighlightColor(Component c)
+ {
+ if (highlight != null)
+ return highlight;
+ else
+ return c.getBackground().brighter();
+ }
+
+
+ /**
+ * Returns the color that will be used for highlighted parts when
+ * painting the border, or <code>null</code> if that color will be
+ * derived from the background of the enclosed Component.
+ */
+ public Color getHighlightColor()
+ {
+ return highlight;
+ }
+
+
+ /**
+ * Determines the color that will be used for shadowed parts when
+ * painting the border around a given component. If a shadow color
+ * has been specified upon constructing the border, that color is
+ * returned. Otherwise, the background color of the enclosed
+ * component is darkened.
+ *
+ * @param c the component enclosed by this border.
+ *
+ * @see java.awt.Component#getBackground()
+ * @see java.awt.Color#darker()
+ */
+ public Color getShadowColor(Component c)
+ {
+ if (shadow != null)
+ return shadow;
+ else
+ return c.getBackground().darker();
+ }
+
+
+ /**
+ * Returns the color that will be used for shadowed parts when
+ * painting the border, or <code>null</code> if that color will be
+ * derived from the background of the enclosed Component.
+ */
+ public Color getShadowColor()
+ {
+ return shadow;
+ }
+
+
+ /**
+ * Paints a two-pixel etching in two colors.
+ *
+ * <pre>
+ * @@@@@@@@@@@.
+ * @.........@. @ = color a
+ * @. @. . = color b
+ * @. @.
+ * @@@@@@@@@@@.
+ * ............</pre>
+ *
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ * @param a one of the two colors.
+ * @param b the second of the two colors.
+ */
+ private static void paintEtchedBorder(Graphics g,
+ int x, int y, int width, int height,
+ Color a, Color b)
+ {
+ Color oldColor;
+
+ oldColor = g.getColor();
+ g.translate(x, y);
+ width = width - 1;
+ height = height - 1;
+
+ try
{
- return false;
+ /* To understand this code, it might be helpful to look at the
+ * images that are included with the JavaDoc. They are located
+ * in the "doc-files" subdirectory. EtchedBorder-2.png might
+ * be especially informative.
+ */
+ g.setColor(a);
+ g.drawRect(0, 0, width - 1, height - 1);
+
+ g.setColor(b);
+ g.drawLine(1, 1, width - 2, 1); // top edge
+ g.drawLine(1, 2, 1, height - 2); // left edge
+ g.drawLine(0, height, width, height); // bottom edge
+ g.drawLine(width, 0, width, height - 1); // right edge
}
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
+ finally
{
+ g.translate(-x, -y);
+ g.setColor(oldColor);
}
+ }
}
diff --git a/libjava/javax/swing/border/LineBorder.java b/libjava/javax/swing/border/LineBorder.java
index 7f3c6511668..3c85c29dfdb 100644
--- a/libjava/javax/swing/border/LineBorder.java
+++ b/libjava/javax/swing/border/LineBorder.java
@@ -1,5 +1,5 @@
/* LineBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,41 +35,309 @@ 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.border;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
-public class LineBorder extends EmptyBorder
+/**
+ * A border that consists of a line whose thickness and color can be
+ * specified. There also is a variant with rounded corners.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class LineBorder
+ extends AbstractBorder
{
- Color c;
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -787563427772288970L;
+
+
+ /**
+ * A shared instance of a black, one pixel thick, plain LineBorder.
+ * The singleton object is lazily created by {@link
+ * #createBlackLineBorder()} upon its first invocation.
+ */
+ private static LineBorder blackLineBorder;
+
+
+ /**
+ * A shared instance of a gray, one pixel thick, plain LineBorder.
+ * The singleton object is lazily created by {@link
+ * #createBlackGrayBorder()} upon its first invocation.
+ */
+ private static LineBorder grayLineBorder;
+
+
+ /**
+ * The width of the line in pixels.
+ */
+ protected int thickness;
+
+
+ /**
+ * The color of the line.
+ */
+ protected Color lineColor;
- public LineBorder()
- {
- }
+ /**
+ * Indicates whether the line is drawn with rounded corners
+ * (<code>true</code>) or not ((<code>false</code>).
+ */
+ protected boolean roundedCorners;
+
+
+ /**
+ * Constructs a LineBorder given its color. The border will be one
+ * pixel thick and have plain corners.
+ *
+ * @param color the color for drawing the border.
+ *
+ * @see #LineBorder(java.awt.Color, int, boolean)
+ */
+ public LineBorder(Color color)
+ {
+ this(color, /* thickness */ 1, /* roundedCorners */ false);
+ }
+
+
+ /**
+ * Constructs a LineBorder given its color and thickness. The
+ * border will have plain corners.
+ *
+ * @param color the color for drawing the border.
+ * @param thickness the width of the line in pixels.
+ *
+ * @see #LineBorder(java.awt.Color, int, boolean)
+ */
+ public LineBorder(Color color, int thickness)
+ {
+ this (color, thickness, /* roundedCorners */ false);
+ }
+
+
+ /**
+ * Constructs a LineBorder given its color, thickness, and whether
+ * it has rounded corners.
+ *
+ * <p><img src="LineBorder-1.png" width="500" height="200"
+ * alt="[An illustration of two LineBorders] />
+ *
+ * <p>Note that the enlarged view in the right-hand picture shows
+ * that the implementation draws one more pixel than specified,
+ * provided that <code>roundedCorders</code> is <code>true</code>
+ * and anti-aliasing is turned on while painting. While this might
+ * be considered a bug, the Sun reference implementation (at least
+ * JDK 1.3.1 on Apple MacOS X 10.1.5) can be observed to fill
+ * exactly the same pixels as shown above. The GNU Classpath
+ * LineBorder replicates the observed behavior of the Sun
+ * implementation.
+ *
+ * @param color the color for drawing the border.
+ * @param thickness the width of the line in pixels.
+ * @param roundedCorners <code>true</code> for rounded corners,
+ * <code>false</code> for plain corners.
+ *
+ * @since 1.3
+ */
+ // For the bug mentioned in the JavaDoc, please see also the comment
+ // in the paintBorder method below.
+ //
+ public LineBorder(Color color, int thickness, boolean roundedCorners)
+ {
+ if ((color == null) || (thickness < 0))
+ throw new IllegalArgumentException();
+
+ this.lineColor = color;
+ this.thickness = thickness;
+ this.roundedCorners = roundedCorners;
+ }
+
+
+ /**
+ * Returns a black, one pixel thick, plain LineBorder. The method
+ * may always return the same (singleton) LineBorder instance.
+ */
+ public static Border createBlackLineBorder()
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (blackLineBorder == null)
+ blackLineBorder = new LineBorder(Color.black);
- public LineBorder(int top,
- int left,
- int bottom,
- int right,
- Color color)
- {
- super(top, left, bottom, right);
- this.c = color;
- }
+ return blackLineBorder;
+ }
+
+
+ /**
+ * Returns a gray, one pixel thick, plain LineBorder. The method
+ * may always return the same (singleton) LineBorder instance.
+ */
+ public static Border createGrayLineBorder()
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (grayLineBorder == null)
+ grayLineBorder = new LineBorder(Color.gray);
+
+ return grayLineBorder;
+ }
+
+
+ /**
+ * Paints the line border around a given Component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ Color oldColor = g.getColor();
- public boolean isBorderOpaque()
+ try
{
- return false;
+ g.setColor(lineColor);
+
+ /* If width and height were not adjusted, the border would
+ * appear one pixel too large in both directions.
+ */
+ width -= 1;
+ height -= 1;
+
+ /* Blurred, too large appearance
+ * -----------------------------
+ * While Java 2D has introduced line strokes of arbitrary width,
+ * it seems desirable to keep this code independent of Java 2D.
+ * Therefore, multiple nested rectangles (or rounded rectangles)
+ * are drawn in order to simulate a line whose thickness is
+ * greater than one pixel.
+ *
+ * This hack causes a blurred appearance when anti-aliasing is
+ * on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
+ * on MacOS X 10.1.5) shows exactly the same appearance under
+ * this condition. It thus seems likely that Sun does the same
+ * hack for simulating thick lines. For this reason, the
+ * blurred appearance seems acceptable -- especially since GNU
+ * Classpath tries to be compatible with the Sun reference
+ * implementation.
+ */
+ for (int i = 0; i < thickness; i++)
+ {
+ if (roundedCorners)
+ g.drawRoundRect(x, y, width, height, thickness, thickness);
+ else
+ g.drawRect(x, y, width, height);
+
+ x += 1;
+ y += 1;
+ width -= 2;
+ height -= 2;
+ }
}
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
+ finally
{
+ g.setColor(oldColor);
}
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge, which is the
+ * thickness of the line.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(thickness, thickness, thickness, thickness);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge, which is the thickness
+ * of the line.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ insets.left = insets.right = insets.top = insets.bottom = thickness;
+ return insets;
+ }
+
+
+ /**
+ * Returns the color of the line.
+ */
+ public Color getLineColor()
+ {
+ return lineColor;
+ }
+
+
+ /**
+ * Returns the thickness of the line in pixels.
+ */
+ public int getThickness()
+ {
+ return thickness;
+ }
+
+
+ /**
+ * Returns whether this LineBorder os drawm with rounded
+ * or with plain corners.
+ *
+ * @return <code>true</code> if the corners are rounded,
+ * <code>false</code> if the corners are plain.
+ */
+ public boolean getRoundedCorners()
+ {
+ return roundedCorners;
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * @return <code>true</code> if the corners are plain and the line
+ * color is fully opaque; <code>false</code> if the corners
+ * are rounded or the line color is partially transparent.
+ */
+ public boolean isBorderOpaque()
+ {
+ return (!roundedCorners) && (lineColor.getAlpha() == 255);
+ }
}
diff --git a/libjava/javax/swing/border/MatteBorder.java b/libjava/javax/swing/border/MatteBorder.java
index 30e5f59e14e..1cc66f70a1f 100644
--- a/libjava/javax/swing/border/MatteBorder.java
+++ b/libjava/javax/swing/border/MatteBorder.java
@@ -1,5 +1,5 @@
/* MatteBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,41 +35,370 @@ 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.border;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import javax.swing.Icon;
+
-public class MatteBorder extends EmptyBorder
+/**
+ * A border that is filled with either a solid color or with repeated
+ * icon tiles.
+ *
+ * <p><img src="MatteBorder-1.png" width="500" height="150"
+ * alt="[Two MatteBorders]" />
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class MatteBorder
+ extends EmptyBorder
{
- Color c;
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 4422248989617298224L;
+
+
+ /**
+ * The color that is used for filling the border, or
+ * <code>null</code> if the border is filled with repetitions of a
+ * tile icon.
+ *
+ * @see #tileIcon
+ */
+ protected Color color;
+
+
+ /**
+ * The icon is used for filling the border with a tile, or
+ * <code>null</code> if the border is filled with a solid
+ * color.
+ *
+ * @see #color
+ */
+ protected Icon tileIcon;
+
+
+ /**
+ * Constructs a MatteBorder given the width on each side
+ * and a fill color.
+ *
+ * <p><img src="MatteBorder-2.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param top the width of the border at its top edge.
+ * @param left the width of the border at its left edge.
+ * @param bottom the width of the border at its bottom edge.
+ * @param right the width of the border at its right edge.
+ * @param matteColor the color for filling the border.
+ */
+ public MatteBorder(int top, int left, int bottom, int right,
+ Color matteColor)
+ {
+ super(top, left, bottom, right);
+
+ if (matteColor == null)
+ throw new IllegalArgumentException();
+
+ this.color = matteColor;
+ }
+
+
+ /**
+ * Constructs a MatteBorder given its insets and fill color.
+ *
+ * <p><img src="MatteBorder-3.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param borderInsets an Insets object whose <code>top</code>,
+ * <code>left</code>, <code>bottom</code> and <code>right</code>
+ * fields indicate the with of the border at the respective
+ * edge.
+ *
+ * @param matteColor the color for filling the border.
+ */
+ public MatteBorder(Insets borderInsets, Color matteColor)
+ {
+ this(borderInsets.top, borderInsets.left,
+ borderInsets.bottom, borderInsets.right,
+ matteColor);
+ }
+
+
+ /**
+ * Constructs a MatteBorder given the width on each side
+ * and an icon for tiling the border area.
+ *
+ * <p><img src="MatteBorder-4.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param top the width of the border at its top edge.
+ * @param left the width of the border at its left edge.
+ * @param bottom the width of the border at its bottom edge.
+ * @param right the width of the border at its right edge.
+ * @param tileIcon an icon for tiling the border area.
+ */
+ public MatteBorder(int top, int left, int bottom, int right,
+ Icon tileIcon)
+ {
+ super(top, left, bottom, right);
+
+ if (tileIcon == null)
+ throw new IllegalArgumentException();
- public MatteBorder()
+ this.tileIcon = tileIcon;
+ }
+
+
+ /**
+ * Constructs a MatteBorder given its insets and an icon
+ * for tiling the border area.
+ *
+ * <p><img src="MatteBorder-5.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param borderInsets an Insets object whose <code>top</code>,
+ * <code>left</code>, <code>bottom</code> and <code>right</code>
+ * fields indicate the with of the border at the respective
+ * edge.
+ *
+ * @param tileIcon an icon for tiling the border area.
+ */
+ public MatteBorder(Insets borderInsets, Icon tileIcon)
+ {
+ this(borderInsets.top, borderInsets.left,
+ borderInsets.bottom, borderInsets.right,
+ tileIcon);
+ }
+
+
+ /**
+ * Constructs a MatteBorder given an icon for tiling the
+ * border area. The icon width is used for the border insets
+ * at the left and right edge, the icon height for the top and
+ * bottom edge.
+ *
+ * <p><img src="MatteBorder-6.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param tileIcon an icon for tiling the border area.
+ */
+ public MatteBorder(Icon tileIcon)
+ {
+ this(-1, -1, -1, -1, tileIcon);
+ }
+
+
+ /**
+ * Paints the border for a given component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ Insets i = getBorderInsets();
+ paintEdge(c, g, x, y, width, i.top, 0, 0); // top edge
+ paintEdge(c, g, x, y + height - i.bottom, // bottom edge
+ width, i.bottom,
+ 0, height - i.bottom);
+ paintEdge(c, g, x, y + i.top, // left edge
+ i.left, height - i.top,
+ 0, i.top);
+ paintEdge(c, g, x + width - i.right, y + i.top, // right edge
+ i.right, height - i.bottom,
+ width - i.right, i.top);
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ /* There is no obvious reason for overriding this method, but we
+ * try to have exactly the same API as the Sun reference
+ * implementation.
+ */
+ return this.getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ if (insets == null)
+ insets = new Insets(0, 0, 0, 0);
+
+ if ((tileIcon != null)
+ && (top < 0) && (left < 0)
+ && (right < 0) && (bottom < 0))
{
+ insets.left = insets.right = tileIcon.getIconWidth();
+ insets.top = insets.bottom = tileIcon.getIconHeight();
+ return insets;
}
-
- public MatteBorder(int top,
- int left,
- int bottom,
- int right,
- Color color)
+ /* Copy top, left, bottom and right into the respective
+ * field of insets.
+ */
+ return super.getBorderInsets(c, insets);
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets()
+ {
+ /* The inherited implementation of EmptyBorder.isBorderOpaque()
+ * would do the same. It is not clear why this is overriden in the
+ * Sun implementation, at least not from just reading the JavaDoc.
+ */
+ return this.getBorderInsets(null, null);
+ }
+
+
+ /**
+ * Returns the color that is used for filling the border, or
+ * <code>null</code> if the border is filled with repetitions of a
+ * tile icon.
+ */
+ public Color getMatteColor()
+ {
+ return color;
+ }
+
+
+ /**
+ * Returns the icon is used for tiling the border, or
+ * <code>null</code> if the border is filled with a color instead of
+ * an icon.
+ */
+ public Icon getTileIcon()
+ {
+ return tileIcon;
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * @return <code>true</code> if the border is filled with an
+ * opaque color; <code>false</code> if it is filled with
+ * a semi-transparent color or with an icon.
+ */
+ public boolean isBorderOpaque()
+ {
+ return (color != null) && (color.getAlpha() == 255);
+ }
+
+
+ /**
+ * Paints a rectangular area of the border. This private helper
+ * method is called once for each of the border edges
+ * by {@link #paintBorder}.
+ *
+ * @param c the component whose border is being painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position of the rectangular area.
+ * @param y the vertical position of the rectangular area.
+ * @param width the width of the rectangular area.
+ * @param height the height of the rectangular area.
+ * @param dx the x displacement for repeating the tile.
+ * @param dy the y displacement for repeating the tile.
+ */
+ private void paintEdge(Component c, Graphics g,
+ int x, int y, int width, int height,
+ int dx, int dy)
+ {
+ Color oldColor;
+ int iconWidth, iconHeight;
+ Graphics clipped;
+
+ if ((width <= 0) || (height <= 0))
+ return;
+
+ /* Paint a colored rectangle if desired. */
+ if (color != null)
{
- super(top, left, bottom, right);
- this.c = color;
+ oldColor = g.getColor();
+ try
+ {
+ g.setColor(color);
+ g.fillRect(x, y, width, height);
+ }
+ finally
+ {
+ g.setColor(oldColor);
+ }
+ return;
}
- public boolean isBorderOpaque()
+ /* Determine the width and height of the icon. Some icons return
+ * -1 if it is an image whose dimensions have not yet been
+ * retrieved. There is not much we can do about this, but we
+ * should at least avoid entering the paint loop below
+ * with negative increments.
+ */
+ iconWidth = tileIcon.getIconWidth();
+ iconHeight = tileIcon.getIconHeight();
+ if ((iconWidth <= 0) || (iconHeight <= 0))
+ return;
+
+ dx = dx % iconWidth;
+ dy = dy % iconHeight;
+
+ clipped = g.create();
+ try
{
- return false;
+ clipped.setClip(x, y, width, height);
+ for (int ty = y - dy; ty < y + height; ty += iconHeight)
+ for (int tx = x - dx; tx < x + width; tx += iconWidth)
+ tileIcon.paintIcon(c, clipped, tx, ty);
}
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
+ finally
{
+ clipped.dispose();
}
+ }
}
diff --git a/libjava/javax/swing/border/TitledBorder.java b/libjava/javax/swing/border/TitledBorder.java
index 5937aa4c0ad..3b6a791630c 100644
--- a/libjava/javax/swing/border/TitledBorder.java
+++ b/libjava/javax/swing/border/TitledBorder.java
@@ -1,5 +1,5 @@
/* TitledBorder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,34 +35,1121 @@ 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.border;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import javax.swing.UIManager;
+
-public class TitledBorder extends AbstractBorder
+/**
+ * A border that paints a title on top of another border.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class TitledBorder
+ extends AbstractBorder
{
-
- public Insets getBorderInsets(Component c,
- Insets s)
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text at the default vertical position, which
+ * is in the middle of the top line of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int DEFAULT_POSITION = 0;
+
+
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text above the top line of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int ABOVE_TOP = 1;
+
+
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text at the middle of the top line
+ * of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int TOP = 2;
+
+
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text below the top line of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int BELOW_TOP = 3;
+
+
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text above the bottom line of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int ABOVE_BOTTOM = 4;
+
+
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text at the center of the bottom line
+ * of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int BOTTOM = 5;
+
+
+ /**
+ * A value for the <code>titlePosition</code> property that vertically
+ * positions the title text below the bottom line of the border.
+ *
+ * @see #getTitlePosition()
+ * @see #setTitlePosition(int)
+ */
+ public static final int BELOW_BOTTOM = 6;
+
+
+ /**
+ * A value for the <code>titleJustification</code> property that
+ * horizontally aligns the title text with either the left or the
+ * right edge of the border, depending on the orientation of the
+ * component nested into the border. If the component orientation
+ * is left-to-right, the title text is aligned with the left edge;
+ * otherwise, it is aligned with the right edge. This is the same
+ * behavior as with {@link #LEADING}.
+ *
+ * @see #getTitleJustification()
+ * @see #setTitleJustification(int)
+ * @see java.awt.ComponentOrientation#isLeftToRight()
+ */
+ public static final int DEFAULT_JUSTIFICATION = 0;
+
+
+ /**
+ * A value for the <code>titleJustification</code> property that
+ * horizontally aligns the title text with the left-hand edge of
+ * the border.
+ *
+ * @see #getTitleJustification()
+ * @see #setTitleJustification(int)
+ */
+ public static final int LEFT = 1;
+
+
+ /**
+ * A value for the <code>titleJustification</code> property that
+ * horizontally aligns the title text with the center of the border.
+ *
+ * @see #getTitleJustification()
+ * @see #setTitleJustification(int)
+ */
+ public static final int CENTER = 2;
+
+
+ /**
+ * A value for the <code>titleJustification</code> property that
+ * horizontally aligns the title text with the right-hand edge of
+ * the border.
+ *
+ * @see #getTitleJustification()
+ * @see #setTitleJustification(int)
+ */
+ public static final int RIGHT = 3;
+
+
+ /**
+ * A value for the <code>titleJustification</code> property that
+ * horizontally aligns the title text with either the left or the
+ * right edge of the border, depending on the orientation of the
+ * component nested into the border. If the component orientation
+ * is left-to-right, the title text is aligned with the left edge;
+ * otherwise, it is aligned with the right edge. This is the same
+ * behavior as with {@link #DEFAULT_JUSTIFICATION}.
+ *
+ * @see #getTitleJustification()
+ * @see #setTitleJustification(int)
+ * @see java.awt.ComponentOrientation#isLeftToRight()
+ */
+ public static final int LEADING = 4;
+
+
+ /**
+ * A value for the <code>titleJustification</code> property that
+ * horizontally aligns the title text with either the right or the
+ * left edge of the border, depending on the orientation of the
+ * component nested into the border. If the component orientation
+ * is left-to-right, the title text is aligned with the right edge;
+ * otherwise, it is aligned with the left edge.
+ *
+ * @see #getTitleJustification()
+ * @see #setTitleJustification(int)
+ * @see java.awt.ComponentOrientation#isLeftToRight()
+ */
+ public static final int TRAILING = 5;
+
+
+ /**
+ * The number of pixels between the inside of {@link #border}
+ * and the bordered component.
+ */
+ protected static final int EDGE_SPACING = 2;
+
+
+ /**
+ * The number of pixels between the outside of this TitledBorder
+ * and the beginning (if left-aligned) or end (if right-aligned)
+ * of the title text.
+ */
+ protected static final int TEXT_INSET_H = 5;
+
+
+ /**
+ * The number of pixels between the title text and {@link #border}.
+ * This value is only relevant if the title text does not intersect
+ * {@link #border}. No intersection occurs if {@link #titlePosition}
+ * is one of {@link #ABOVE_TOP}, {@link #BELOW_TOP}, {@link #ABOVE_BOTTOM},
+ * or {@link #BELOW_BOTTOM}.
+ */
+ protected static final int TEXT_SPACING = 2;
+
+
+ /**
+ * Determined using the <code>serialver</code> tool of Apple/Sun JDK 1.3.1
+ * on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 8012999415147721601L;
+
+
+ /**
+ * The title, or <code>null</code> to display no title.
+ */
+ protected String title;
+
+
+ /**
+ * The border underneath the title. If this value is
+ * <code>null</code>, the border will be retrieved from the {@link
+ * javax.swing.UIManager}&#x2019;s defaults table using the key
+ * <code>&quot;TitledBorder.border&quot;</code>.
+ */
+ protected Border border;
+
+
+ /**
+ * The vertical position of the title text relative to the border,
+ * which is one of {@link #ABOVE_TOP}, {@link #TOP}, {@link
+ * #BELOW_TOP}, {@link #ABOVE_BOTTOM}, {@link #BOTTOM}, {@link
+ * #BELOW_BOTTOM}, or {@link #DEFAULT_POSITION}.
+ */
+ protected int titlePosition;
+
+
+ /**
+ * The horizontal alignment of the title text in relation to the
+ * border, which is one of {@link #LEFT}, {@link #CENTER}, {@link
+ * #RIGHT}, {@link #LEADING}, {@link #TRAILING}, or {@link
+ * #DEFAULT_JUSTIFICATION}.
+ */
+ protected int titleJustification;
+
+
+ /**
+ * The font for displaying the title text. If this value is
+ * <code>null</code>, the font will be retrieved from the {@link
+ * javax.swing.UIManager}&#x2019;s defaults table using the key
+ * <code>&quot;TitledBorder.font&quot;</code>.
+ */
+ protected Font titleFont;
+
+
+ /**
+ * The color for displaying the title text. If this value is
+ * <code>null</code>, the color will be retrieved from the {@link
+ * javax.swing.UIManager}&#x2019;s defaults table using the key
+ * <code>&quot;TitledBorder.titleColor&quot;</code>.
+ */
+ protected Color titleColor;
+
+
+ /**
+ * Constructs a TitledBorder given the text of its title.
+ *
+ * @param title the title text, or <code>null</code> to use no title text.
+ */
+ public TitledBorder(String title)
+ {
+ this(/* border */ null,
+ title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ /* titleFont */ null, /* titleColor */ null);
+ }
+
+
+ /**
+ * Constructs an initially untitled TitledBorder given another border.
+ *
+ * @param border the border underneath the title, or <code>null</code>
+ * to use a default from the current look and feel.
+ */
+ public TitledBorder(Border border)
+ {
+ this(border, /* title */ "", DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ /* titleFont */ null, /* titleColor */ null);
+ }
+
+
+ /**
+ * Constructs a TitledBorder given its border and title text.
+ *
+ * @param border the border underneath the title, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code> to use no title
+ * text.
+ */
+ public TitledBorder(Border border, String title)
+ {
+ this(border, title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ /* titleFont */ null, /* titleColor */ null);
+ }
+
+
+ /**
+ * Constructs a TitledBorder given its border, title text, horizontal
+ * alignment, and vertical position.
+ *
+ * @param border the border underneath the title, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code> to use no title
+ * text.
+ *
+ * @param titleJustification the horizontal alignment of the title
+ * text in relation to the border. The value must be one of
+ * {@link #LEFT}, {@link #CENTER}, {@link #RIGHT}, {@link #LEADING},
+ * {@link #TRAILING}, or {@link #DEFAULT_JUSTIFICATION}.
+
+ * @param titlePosition the vertical position of the title text
+ * in relation to the border. The value must be one of
+ * {@link #ABOVE_TOP}, {@link #TOP}, {@link #BELOW_TOP},
+ * {@link #ABOVE_BOTTOM}, {@link #BOTTOM}, {@link #BELOW_BOTTOM},
+ * or {@link #DEFAULT_POSITION}.
+ *
+ * @throws IllegalArgumentException if <code>titleJustification</code>
+ * or <code>titlePosition</code> have an unsupported value.
+ */
+ public TitledBorder(Border border, String title, int titleJustification,
+ int titlePosition)
+ {
+ this(border, title, titleJustification, titlePosition,
+ /* titleFont */ null, /* titleColor */ null);
+ }
+
+
+ /**
+ * Constructs a TitledBorder given its border, title text, horizontal
+ * alignment, vertical position, and font.
+ *
+ * @param border the border underneath the title, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code> to use no title
+ * text.
+ *
+ * @param titleJustification the horizontal alignment of the title
+ * text in relation to the border. The value must be one of
+ * {@link #LEFT}, {@link #CENTER}, {@link #RIGHT}, {@link #LEADING},
+ * {@link #TRAILING}, or {@link #DEFAULT_JUSTIFICATION}.
+ *
+ * @param titlePosition the vertical position of the title text
+ * in relation to the border. The value must be one of
+ * {@link #ABOVE_TOP}, {@link #TOP}, {@link #BELOW_TOP},
+ * {@link #ABOVE_BOTTOM}, {@link #BOTTOM}, {@link #BELOW_BOTTOM},
+ * or {@link #DEFAULT_POSITION}.
+ *
+ * @param titleFont the font for the title text, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @throws IllegalArgumentException if <code>titleJustification</code>
+ * or <code>titlePosition</code> have an unsupported value.
+ */
+ public TitledBorder(Border border, String title, int titleJustification,
+ int titlePosition, Font titleFont)
+ {
+ this(border, title, titleJustification, titlePosition, titleFont,
+ /* titleColor */ null);
+ }
+
+
+ /**
+ * Constructs a TitledBorder given its border, title text, horizontal
+ * alignment, vertical position, font, and color.
+ *
+ * @param border the border underneath the title, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code> to use no title
+ * text.
+ *
+ * @param titleJustification the horizontal alignment of the title
+ * text in relation to the border. The value must be one of
+ * {@link #LEFT}, {@link #CENTER}, {@link #RIGHT}, {@link #LEADING},
+ * {@link #TRAILING}, or {@link #DEFAULT_JUSTIFICATION}.
+ *
+ * @param titlePosition the vertical position of the title text
+ * in relation to the border. The value must be one of
+ * {@link #ABOVE_TOP}, {@link #TOP}, {@link #BELOW_TOP},
+ * {@link #ABOVE_BOTTOM}, {@link #BOTTOM}, {@link #BELOW_BOTTOM},
+ * or {@link #DEFAULT_POSITION}.
+ *
+ * @param titleFont the font for the title text, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @param titleColor the color for the title text, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @throws IllegalArgumentException if <code>titleJustification</code>
+ * or <code>titlePosition</code> have an unsupported value.
+ */
+ public TitledBorder(Border border, String title, int titleJustification,
+ int titlePosition, Font titleFont, Color titleColor)
+ {
+ this.border = border;
+ this.title = title;
+
+ /* Invoking the setter methods ensures that the newly constructed
+ * TitledBorder has valid property values.
+ */
+ setTitleJustification(titleJustification);
+ setTitlePosition(titlePosition);
+
+ this.titleFont = titleFont;
+ this.titleColor = titleColor;
+ }
+
+
+ /**
+ * Paints the border and the title text.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ Measurements mes = getMeasurements(c);
+ Font oldFont = g.getFont();
+ Color oldColor = g.getColor();
+
+ /**
+ * A local helper class for painting the border without changing
+ * any pixels inside the rectangle of the title text.
+ */
+ class BorderPainter
+ {
+ private Component c;
+ private Border b;
+ private int x, y, width, height;
+
+ /**
+ * Constructs a BorderPainter.
+ *
+ * @param c the component whose border is being painted.
+ * @param b the border object.
+ * @param x the x coordinate of the rectangle delimiting the border.
+ * @param y the y coordinate of the rectangle delimiting the border.
+ * @param width the width of the rectangle delimiting the border.
+ * @param height the width of the rectangle delimiting the border.
+ */
+ public BorderPainter(Component c, Border b,
+ int x, int y, int width, int height)
+ {
+ this.c = c;
+ this.b = b;
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+
+ /**
+ * Paints the entire border.
+ */
+ public void paint(Graphics g)
+ {
+ if (b != null)
+ b.paintBorder(c, g, x, y, width - 1, height - 1);
+ }
+
+
+ /**
+ * Paints the border, clipping the drawing operation to a
+ * given rectangular area.
+ */
+ private void paint(Graphics g,
+ int clipX, int clipY, int clipWidth, int clipHeight)
+ {
+ Shape oldClip = g.getClip();
+ try
+ {
+ g.clipRect(clipX, clipY, clipWidth, clipHeight);
+ paint(g);
+ }
+ finally
+ {
+ g.setClip(oldClip);
+ }
+ }
+
+
+ /**
+ * Paints the border without affecting a given rectangular area.
+ * This is used for painting the border without drawing anything
+ * underneath the title text.
+ *
+ * <p>Since we do not want to introduce unnecessary dependencies
+ * on Java 2D, we perform the clipping without constructive geometry
+ * (provided by java.awt.geom.Area). Instead, the border&#x2019;s
+ * bounding rectangle is split into smaller parts, which are then
+ * clipped and painted individually.:
+ *
+ * <p><pre>
+ * +--------------------+ +--------------------+
+ * | | | 1 |
+ * | +--------+ | +---+--------+-------+
+ * | | hole | | |====> | 2 | hole | 3 |
+ * | +--------+ | |---+--------+-------+
+ * | | | 4 |
+ * +--------------------+ +--------------------+</pre>
+ *
+ */
+ public void paintExcept(Graphics g,
+ int holeX, int holeY, int holeWidth, int holeHeight)
+ {
+ int stripeHeight;
+
+ stripeHeight = holeY - y;
+ if (stripeHeight > 0)
+ paint(g, x, y, width, stripeHeight); // patch #1 in the image above
+
+ stripeHeight = holeHeight;
+ if (stripeHeight > 0)
+ {
+ paint(g, x, holeY, holeX - x, stripeHeight); // patches #2 and #3
+ paint(g, holeX + holeWidth, holeY, width - (holeX + holeWidth), stripeHeight);
+ }
+
+ stripeHeight = height - (holeY - y + holeHeight);
+ if (stripeHeight > 0)
+ paint(g, x, y + height - stripeHeight, width, stripeHeight); // #4
+ }
+ };
+
+ BorderPainter bp;
+ int textX, textY, borderWidth, borderHeight;
+
+ borderWidth = width - (mes.borderSpacing.left + mes.borderSpacing.right);
+ borderHeight = height - (mes.borderSpacing.top + mes.borderSpacing.bottom);
+ bp = new BorderPainter(c, getBorder(),
+ x + mes.borderSpacing.left, y + mes.borderSpacing.top,
+ borderWidth, borderHeight);
+
+ switch (getRealTitleJustification(c))
+ {
+ case LEFT:
+ textX = x + TEXT_INSET_H;
+ break;
+
+ case CENTER:
+ textX = x + (borderWidth - mes.textWidth) / 2;
+ break;
+
+ case RIGHT:
+ textX = x + borderWidth - (mes.textWidth + TEXT_INSET_H);
+ break;
+
+ default:
+ throw new IllegalStateException();
+ }
+
+ switch (titlePosition)
+ {
+ case ABOVE_TOP:
+ textY = y;
+ break;
+
+ case TOP:
+ case DEFAULT_POSITION:
+ default:
+ textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent;
+ break;
+
+ case BELOW_TOP:
+ textY = y + mes.borderSpacing.top + mes.borderInsets.top + TEXT_SPACING;
+ break;
+
+ case ABOVE_BOTTOM:
+ textY = y + height - mes.borderSpacing.bottom - mes.borderInsets.bottom
+ - TEXT_SPACING - (mes.textAscent + mes.textDescent);
+ break;
+
+ case BOTTOM:
+ case BELOW_BOTTOM:
+ textY = y + height - (mes.textAscent + mes.textDescent);
+ break;
+ }
+
+ if (mes.trimmedText == null)
+ bp.paint(g);
+ else
+ {
+ try
+ {
+ g.setFont(mes.font);
+ g.setColor(getTitleColor());
+ g.drawString(mes.trimmedText, textX, textY + mes.textAscent);
+ }
+ finally
+ {
+ g.setFont(oldFont);
+ g.setColor(oldColor);
+ }
+ bp.paintExcept(g, textX - 2, textY,
+ mes.textWidth + 2, mes.textAscent + mes.textDescent);
+ }
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, new Insets(0, 0, 0, 0));
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ return getMeasurements(c).getContentInsets(insets);
+ }
+
+
+ /**
+ * Returns <code>false</code>, indicating that there are pixels inside
+ * the area of this border where the background shines through.
+ *
+ * @return <code>false</code>.
+ */
+ public boolean isBorderOpaque()
+ {
+ /* Note that the AbstractBorder.isBorderOpaque would also return
+ * false, so there is actually no need to override the inherited
+ * implementation. However, GNU Classpath strives for exact
+ * compatibility with the Sun reference implementation, which
+ * overrides isBorderOpaque for unknown reasons.
+ */
+ return false;
+ }
+
+
+ /**
+ * Returns the text of the title.
+ *
+ * @return the title text, or <code>null</code> if no title is
+ * displayed.
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+
+ /**
+ * Retrieves the border underneath the title. If no border has been
+ * set, or if it has been set to<code>null</code>, the current
+ * {@link javax.swing.LookAndFeel} will be asked for a border
+ * using the key <code>&quot;TitledBorder.border&quot;</code>.
+ *
+ * @return a border, or <code>null</code> if the current LookAndFeel
+ * does not provide a border for the key
+ * <code>&quot;TitledBorder.border&quot;</code>.
+ *
+ * @see javax.swing.UIManager#getBorder(Object)
+ */
+ public Border getBorder()
+ {
+ if (border != null)
+ return border;
+
+ return UIManager.getBorder("TitledBorder.border");
+ }
+
+
+ /**
+ * Returns the vertical position of the title text in relation
+ * to the border.
+ *
+ * @return one of the values {@link #ABOVE_TOP}, {@link #TOP},
+ * {@link #BELOW_TOP}, {@link #ABOVE_BOTTOM}, {@link #BOTTOM},
+ * {@link #BELOW_BOTTOM}, or {@link #DEFAULT_POSITION}.
+ */
+ public int getTitlePosition()
+ {
+ return titlePosition;
+ }
+
+
+ /**
+ * Returns the horizontal alignment of the title text in relation to
+ * the border.
+ *
+ * @return one of the values {@link #LEFT}, {@link #CENTER}, {@link
+ * #RIGHT}, {@link #LEADING}, {@link #TRAILING}, or {@link
+ * #DEFAULT_JUSTIFICATION}.
+ */
+ public int getTitleJustification()
+ {
+ return titleJustification;
+ }
+
+
+ /**
+ * Retrieves the font for displaying the title text. If no font has
+ * been set, or if it has been set to<code>null</code>, the current
+ * {@link javax.swing.LookAndFeel} will be asked for a font
+ * using the key <code>&quot;TitledBorder.font&quot;</code>.
+ *
+ * @return a font, or <code>null</code> if the current LookAndFeel
+ * does not provide a font for the key
+ * <code>&quot;TitledBorder.font&quot;</code>.
+ *
+ * @see javax.swing.UIManager#getFont(Object)
+ */
+ public Font getTitleFont()
+ {
+ if (titleFont != null)
+ return titleFont;
+
+ return UIManager.getFont("TitledBorder.font");
+ }
+
+
+ /**
+ * Retrieves the color for displaying the title text. If no color has
+ * been set, or if it has been set to<code>null</code>, the current
+ * {@link javax.swing.LookAndFeel} will be asked for a color
+ * using the key <code>&quot;TitledBorder.titleColor&quot;</code>.
+ *
+ * @return a color, or <code>null</code> if the current LookAndFeel
+ * does not provide a color for the key
+ * <code>&quot;TitledBorder.titleColor&quot;</code>.
+ *
+ * @see javax.swing.UIManager#getColor(Object)
+ */
+ public Color getTitleColor()
+ {
+ if (titleColor != null)
+ return titleColor;
+
+ return UIManager.getColor("TitledBorder.titleColor");
+ }
+
+
+ /**
+ * Sets the text of the title.
+ *
+ * @param title the new title text, or <code>null</code> for displaying
+ * no text at all.
+ */
+ public void setTitle(String title)
+ {
+ // Swing borders are not JavaBeans, thus no need to fire an event.
+ this.title = title;
+ }
+
+
+ /**
+ * Sets the border underneath the title.
+ *
+ * @param border a border, or <code>null</code> to use the
+ * border that is supplied by the current LookAndFeel.
+ *
+ * @see #getBorder()
+ */
+ public void setBorder(Border border)
+ {
+ // Swing borders are not JavaBeans, thus no need to fire an event.
+ this.border = border;
+ }
+
+
+ /**
+ * Sets the vertical position of the title text in relation
+ * to the border.
+ *
+ * @param titlePosition one of the values {@link #ABOVE_TOP},
+ * {@link #TOP}, {@link #BELOW_TOP}, {@link #ABOVE_BOTTOM},
+ * {@link #BOTTOM}, {@link #BELOW_BOTTOM},
+ * or {@link #DEFAULT_POSITION}.
+ *
+ * @throws IllegalArgumentException if an unsupported value is passed
+ * for <code>titlePosition</code>.
+ */
+ public void setTitlePosition(int titlePosition)
+ {
+ if ((titlePosition < DEFAULT_POSITION) || (titlePosition > BELOW_BOTTOM))
+ throw new IllegalArgumentException();
+
+ // Swing borders are not JavaBeans, thus no need to fire an event.
+ this.titlePosition = titlePosition;
+ }
+
+
+ /**
+ * Sets the horizontal alignment of the title text in relation to the border.
+ *
+ * @param titleJustification the new alignment, which must be one of
+ * {@link #LEFT}, {@link #CENTER}, {@link #RIGHT}, {@link #LEADING},
+ * {@link #TRAILING}, or {@link #DEFAULT_JUSTIFICATION}.
+ *
+ * @throws IllegalArgumentException if an unsupported value is passed
+ * for <code>titleJustification</code>.
+ */
+ public void setTitleJustification(int titleJustification)
+ {
+ if ((titleJustification < DEFAULT_JUSTIFICATION)
+ || (titleJustification > TRAILING))
+ throw new IllegalArgumentException();
+
+ // Swing borders are not JavaBeans, thus no need to fire an event.
+ this.titleJustification = titleJustification;
+ }
+
+
+ /**
+ * Sets the font for displaying the title text.
+ *
+ * @param titleFont the font, or <code>null</code> to use the font
+ * provided by the current {@link javax.swing.LookAndFeel}.
+ *
+ * @see #getTitleFont()
+ */
+ public void setTitleFont(Font titleFont)
+ {
+ // Swing borders are not JavaBeans, thus no need to fire an event.
+ this.titleFont = titleFont;
+ }
+
+
+ /**
+ * Sets the color for displaying the title text.
+ *
+ * @param titleColor the color, or <code>null</code> to use the color
+ * provided by the current {@link javax.swing.LookAndFeel}.
+ *
+ * @see #getTitleColor()
+ */
+ public void setTitleColor(Color titleColor)
+ {
+ // Swing borders are not JavaBeans, thus no need to fire an event.
+ this.titleColor = titleColor;
+ }
+
+
+ /**
+ * Calculates the minimum size needed for displaying the border
+ * and its title.
+ *
+ * @param c the Component for which this TitledBorder consitutes
+ * a border.
+ */
+ public Dimension getMinimumSize(Component c)
+ {
+ return getMeasurements(c).getMinimumSize();
+ }
+
+
+ /**
+ * Returns the font that is used for displaying the title text for
+ * a given Component.
+ *
+ * @param c the Component for which this TitledBorder is the border.
+ *
+ * @return The font returned by {@link #getTitleFont()}, or a fallback
+ * if {@link #getTitleFont()} returned <code>null</code>.
+ */
+ protected Font getFont(Component c)
+ {
+ Font f;
+
+ f = getTitleFont();
+ if (f != null)
+ return f;
+
+ return new Font("Dialog", Font.PLAIN, 12);
+ }
+
+
+ /**
+ * Returns the horizontal alignment of the title text in relation to
+ * the border, mapping the component-dependent alignment constants
+ * {@link #LEADING}, {@link #TRAILING} and {@link #DEFAULT_JUSTIFICATION}
+ * to the correct value according to the embedded component&#x2019;s
+ * orientation.
+ *
+ * @param c the Component for which this TitledBorder is the border.
+ *
+ * @return one of the values {@link #LEFT}, {@link #CENTER}, or {@link
+ * #RIGHT}.
+ */
+ private int getRealTitleJustification(Component c)
+ {
+ switch (titleJustification)
{
- s.left = s.right = s.top = s.bottom = 5;
- return s;
+ case DEFAULT_JUSTIFICATION:
+ case LEADING:
+ if ((c == null) || c.getComponentOrientation().isLeftToRight())
+ return LEFT;
+ else
+ return RIGHT;
+
+ case TRAILING:
+ if ((c == null) || c.getComponentOrientation().isLeftToRight())
+ return RIGHT;
+ else
+ return LEFT;
+
+ default:
+ return titleJustification;
+ }
+ }
+
+
+ /**
+ * Performs various measurements for the current state of this TitledBorder
+ * and the given Component.
+ */
+ private Measurements getMeasurements(Component c)
+ {
+ Measurements m = new Measurements();
+ FontMetrics fmet;
+
+ m.font = getFont(c);
+ fmet = c.getFontMetrics(m.font);
+ m.border = getBorder();
+ if (m.border != null)
+ m.borderInsets = m.border.getBorderInsets(c);
+ else
+ m.borderInsets = new Insets(0, 0, 0, 0);
+
+ if (title != null)
+ {
+ m.trimmedText = title.trim();
+ if (m.trimmedText.length() == 0)
+ m.trimmedText = null;
}
+ m.textAscent = fmet.getAscent();
+ m.textDescent = fmet.getDescent();
+ if (m.trimmedText != null)
+ m.textWidth = fmet.stringWidth(m.trimmedText) + 3;
+
+ m.edgeSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING, EDGE_SPACING);
+ m.borderSpacing = new Insets(0, 0, 0, 0);
+
+ switch (titlePosition)
+ {
+ case ABOVE_TOP:
+ m.borderSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
+ break;
+
+ case BELOW_TOP:
+ m.edgeSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
+ break;
+
+ case ABOVE_BOTTOM:
+ m.edgeSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
+ break;
+
+ case BOTTOM:
+ m.edgeSpacing.bottom += Math.max(m.textAscent - m.borderInsets.bottom, 0);
+ m.borderSpacing.bottom += m.textDescent;
+ break;
+
+ case BELOW_BOTTOM:
+ m.borderSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
+ break;
+
+ default:
+ m.borderSpacing.top += m.textAscent;
+ }
+
+ return m;
+ }
+
+
+ /**
+ * A private helper class for holding the result of measuring the
+ * distances of a TitledBorder. While it would be possible to cache
+ * these objects, it does not seem to be worth the effort. Note that
+ * invalidating the cache would be tricky, especially since there is
+ * no notification mechanism that would inform the cache when
+ * border has changed, so it would return different insets.
+ */
+ private static class Measurements
+ {
+ /**
+ * The font used for displaying the title text. Note that it can
+ * well be that the TitledBorder&#x2019;s font is <code>null</code>,
+ * which means that the font is to be retrieved from the current
+ * LookAndFeel. In this case, this <code>font</code> field will
+ * contain the result of the retrieval. Therefore, it is safe
+ * to assume that his <code>font</code> field will never have
+ * a <code>null</code> value.
+ */
+ Font font;
+
+
+ /**
+ * The number of pixels between the base line and the top of the
+ * text box.
+ */
+ int textAscent;
+
+
+ /**
+ * The number of pixels between the base line and the bottom of
+ * the text box.
+ */
+ int textDescent;
+
+
+ /**
+ * The title text after removing leading and trailing white space
+ * characters. If the title consists only of white space, the
+ * value of <code>trimmedText</code> will be <code>null</code>.
+ */
+ String trimmedText;
+
+
+ /**
+ * The width of the trimmed title text in pixels.
+ */
+ int textWidth;
+
+
+ /**
+ * The border that constitues the &quot;interior&quot; border
+ * underneath the title text.
+ */
+ Border border;
+
+
+ /**
+ * The distance between the TitledBorder and the interior border.
+ */
+ Insets borderSpacing;
+
+ /**
+ * The width of the interior border, as returned by
+ * <code>border.getBorderInsets()</code>.
+ */
+ Insets borderInsets;
+
- public boolean isBorderOpaque()
+ /**
+ * The distance between the interior border and the nested
+ * Component for which this TitledBorder is a border.
+ */
+ Insets edgeSpacing;
+
+
+ /**
+ * Determines the insets of the nested component when it has a
+ * TitledBorder as its border. Used by {@link
+ * TitledBorder#getBorderInsets()}.
+ *
+ * @param i an Insets object for storing the results into, or
+ * <code>null</code> to cause the creation of a
+ * new instance.
+ *
+ * @return the <code>i</code> object, or a new Insets object
+ * if <code>null</code> was passed for <code>i</code>.
+ */
+ public Insets getContentInsets(Insets i)
{
- return false;
+ if (i == null)
+ i = new Insets(0, 0, 0, 0);
+ i.left = borderSpacing.left + borderInsets.left + edgeSpacing.left;
+ i.right = borderSpacing.right + borderInsets.right + edgeSpacing.right;
+ i.top = borderSpacing.top + borderInsets.top + edgeSpacing.top;
+ i.bottom = borderSpacing.bottom + borderInsets.bottom + edgeSpacing.bottom;
+ return i;
}
-
- public void paintBorder(Component c,
- Graphics g,
- int x,
- int y,
- int width,
- int height)
+
+
+ /**
+ * Calculates the minimum size needed for displaying the border
+ * and its title. Used by {@link TitledBorder#getMiminumSize()}.
+ */
+ public Dimension getMinimumSize()
{
+ int width;
+ Insets insets;
+
+ insets = getContentInsets(null);
+ width = Math.max(insets.left + insets.right, textWidth + 2 * TEXT_INSET_H);
+ return new Dimension(width, insets.top + insets.bottom);
}
+ }
}
-
diff --git a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
index 94503207af4..c39801dc10a 100644
--- a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
+++ b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
@@ -35,13 +35,14 @@ 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.colorchooser;
-// Imports
-import java.awt.*;
-import java.io.*;
-import javax.swing.*;
-import javax.swing.event.*;
+import java.awt.Color;
+import java.awt.Graphics;
+import javax.swing.Icon;
+import javax.swing.JColorChooser;
+import javax.swing.JPanel;
/**
* AbstractColorChooserPanel
diff --git a/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java b/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java
index 122612e5669..ffd8718eac0 100644
--- a/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java
+++ b/libjava/javax/swing/colorchooser/ColorChooserComponentFactory.java
@@ -35,10 +35,10 @@ 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.colorchooser;
-// Imports
-import javax.swing.*;
+import javax.swing.JComponent;
/**
* ColorChooserComponentFactory
diff --git a/libjava/javax/swing/colorchooser/ColorSelectionModel.java b/libjava/javax/swing/colorchooser/ColorSelectionModel.java
index 8139a18c720..d04266b07a9 100644
--- a/libjava/javax/swing/colorchooser/ColorSelectionModel.java
+++ b/libjava/javax/swing/colorchooser/ColorSelectionModel.java
@@ -35,11 +35,11 @@ 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.colorchooser;
-// Imports
-import java.awt.*;
-import javax.swing.event.*;
+import java.awt.Color;
+import javax.swing.event.ChangeListener;
/**
* ColorSelectionModel
diff --git a/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java b/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java
index 1df4e325e94..1aa51fd64c0 100644
--- a/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java
+++ b/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java
@@ -1,4 +1,4 @@
-/* BoundedRangeModel.java --
+/* DefaultColorSelectionModel.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,14 @@ 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.colorchooser;
-// Imports
-import java.awt.*;
-import java.io.*;
-import javax.swing.event.*;
+import java.awt.Color;
+import java.io.Serializable;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
/**
* DefaultColorSelectionModel
diff --git a/libjava/javax/swing/event/AncestorEvent.java b/libjava/javax/swing/event/AncestorEvent.java
index a1f5ae19fbd..c6173932bb9 100644
--- a/libjava/javax/swing/event/AncestorEvent.java
+++ b/libjava/javax/swing/event/AncestorEvent.java
@@ -35,106 +35,65 @@ 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.event;
-// Imports
-import javax.swing.*;
-import java.awt.*;
+import java.awt.AWTEvent;
+import java.awt.Container;
+import javax.swing.JComponent;
/**
- * Ancestor Event
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public class AncestorEvent extends AWTEvent {
-
- //-------------------------------------------------------------
- // Constants --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * ANCESTOR_ADDED constant
- */
- public static int ANCESTOR_ADDED = 0;
-
- /**
- * ANCESTOR_MOVED constant
- */
- public static int ANCESTOR_MOVED = 1;
-
- /**
- * ANCESTOR_REMOVED constant
- */
- public static int ANCESTOR_REMOVED = 2;
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Source component
- */
- private JComponent sourceComponent = null;
-
- /**
- * Ancestor
- */
- private Container ancestor = null;
-
- /**
- * Ancestor Parent
- */
- private Container ancestorParent = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor AncestorEvent
- * @param source Source component
- * @param id ID
- * @param ancestor ancestor
- * @param ancestorParent parent ancestor
- */
- public AncestorEvent(JComponent source, int id, Container ancestor,
- Container ancestorParent) {
- super(source, id);
- this.sourceComponent = source;
- this.ancestor = ancestor;
- this.ancestorParent = ancestorParent;
- } // AncestorEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Get ancestor
- * @return ancestor
- */
- public Container getAncestor() {
- return ancestor;
- } // getAncestor()
-
- /**
- * Get ancestor parent
- * @return ancestor parent
- */
- public Container getAncestorParent() {
- return ancestorParent;
- } // getAncestorParent()
-
- /**
- * Get component
- * @return component
- */
- public JComponent getComponent() {
- return sourceComponent;
- } // getComponent()
-
-
-} // AncestorEvent
+public class AncestorEvent extends AWTEvent
+{
+ private static final long serialVersionUID = -8079801679695605002L;
+
+ public static final int ANCESTOR_ADDED = 0;
+ public static final int ANCESTOR_MOVED = 1;
+ public static final int ANCESTOR_REMOVED = 2;
+
+ private JComponent sourceComponent;
+ private Container ancestor;
+ private Container ancestorParent;
+
+ /**
+ * @param source Source component
+ * @param id ID
+ * @param ancestor ancestor
+ * @param ancestorParent parent ancestor
+ */
+ public AncestorEvent(JComponent source, int id, Container ancestor,
+ Container ancestorParent)
+ {
+ super(source, id);
+ this.sourceComponent = source;
+ this.ancestor = ancestor;
+ this.ancestorParent = ancestorParent;
+ }
+
+ /**
+ * Returns the ancestor of this event.
+ */
+ public Container getAncestor()
+ {
+ return ancestor;
+ }
+
+ /**
+ * Returns the ancester parent of this event.
+ */
+ public Container getAncestorParent()
+ {
+ return ancestorParent;
+ }
+
+ /**
+ * Returns the source of this event.
+ */
+ public JComponent getComponent()
+ {
+ return sourceComponent;
+ }
+}
diff --git a/libjava/javax/swing/event/HyperlinkEvent.java b/libjava/javax/swing/event/HyperlinkEvent.java
index ae356bb92a9..c979fbf62da 100644
--- a/libjava/javax/swing/event/HyperlinkEvent.java
+++ b/libjava/javax/swing/event/HyperlinkEvent.java
@@ -35,161 +35,127 @@ 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.event;
-// Imports
-import java.net.*;
-import java.util.*;
+import java.net.URL;
+import java.util.EventObject;
+import javax.swing.text.Element;
/**
- * HyperlinkEvent
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public class HyperlinkEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Classes ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * EventType
- */
- public static final class EventType {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * ENTERED
- */
- public static final EventType ENTERED = new EventType("ENTERED"); // TODO
-
- /**
- * EXITED
- */
- public static final EventType EXITED = new EventType("EXITED"); // TODO
-
- /**
- * ACTIVATED
- */
- public static final EventType ACTIVATED = new EventType("ACTIVATED"); // TODO
-
- /**
- * type
- */
- private String type;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor EventType
- * @param type TODO
- */
- private EventType(String type) {
- this.type = type;
- } // EventType()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * toString
- * @returns String
- */
- public String toString() {
- return type; // TODO
- } // toString()
-
-
- } // EventType
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * type
- */
- private EventType type;
-
- /**
- * url
- */
- private URL url;
-
- /**
- * description
- */
- private String description;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor HyperlinkEvent
- * @param source TODO
- * @param type TODO
- * @param url TODO
- */
- public HyperlinkEvent(Object source, EventType type, URL url) {
- super(source);
- this.type = type;
- this.url = url;
- this.description = null;
- } // HyperlinkEvent()
-
- /**
- * Constructor HyperlinkEvent
- * @param source TODO
- * @param type TODO
- * @param url TODO
- * @param description TODO
- */
- public HyperlinkEvent(Object source, EventType type, URL url, String description) {
- super(source);
- this.type = type;
- this.url = url;
- this.description = null;
- } // HyperlinkEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getURL
- * @returns URL
- */
- public URL getURL() {
- return url;
- } // getURL()
-
- /**
- * getEventType
- * @returns EventType
- */
- public EventType getEventType() {
- return type;
- } // getEventType()
-
- /**
- * getDescription
- * @returns String
- */
- public String getDescription() {
- return description;
- } // getDescription()
-
-
-} // HyperlinkEvent
+public class HyperlinkEvent extends EventObject
+{
+ public static final class EventType
+ {
+ public static final EventType ENTERED = new EventType("ENTERED"); // TODO
+ public static final EventType EXITED = new EventType("EXITED"); // TODO
+ public static final EventType ACTIVATED = new EventType("ACTIVATED"); // TODO
+
+ private String type;
+
+ /**
+ * Creates a new Event type.
+ *
+ * @param type String representing the event type.
+ */
+ private EventType(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Returns a <code>String</code> of this object.
+ */
+ public String toString()
+ {
+ return type;
+ }
+ }
+
+ private static final long serialVersionUID = -2054640811732867012L;
+
+ private EventType type;
+ private URL url;
+ private String description;
+ private Element element;
+
+ /**
+ * Creates a new <code>HyperlinkEvent</code> with the given arguments.
+ *
+ * @param source The object this link is associated to.
+ * @param type The type of event.
+ * @param url The URL this link pointing too.
+ */
+ public HyperlinkEvent(Object source, EventType type, URL url)
+ {
+ this (source, type, url, null, null);
+ }
+
+ /**
+ * Creates a new <code>HyperlinkEvent</code> with the given arguments.
+ *
+ * @param source The object this link is associated to.
+ * @param type The type of event.
+ * @param url The URL this link pointing too.
+ * @param description The description for this link.
+ */
+ public HyperlinkEvent(Object source, EventType type, URL url,
+ String description)
+ {
+ this (source, type, url, description, null);
+ }
+
+ /**
+ * Creates a new <code>HyperlinkEvent</code> with the given arguments.
+ *
+ * @param source The object this link is associated to.
+ * @param type The type of event.
+ * @param url The URL this link pointing too.
+ * @param description The description for this link.
+ * @param element The element in the document representing the anchor.
+ */
+ public HyperlinkEvent(Object source, EventType type, URL url,
+ String description, Element element)
+ {
+ super(source);
+ this.type = type;
+ this.url = url;
+ this.description = description;
+ this.element = element;
+ }
+
+ /**
+ * Returns the element of the document repesenting this anchor.
+ */
+ public Element getSourceElement()
+ {
+ return element;
+ }
+
+ /**
+ * Returns the URL of this event.
+ */
+ public URL getURL()
+ {
+ return url;
+ }
+
+ /**
+ * Returns the type of this event.
+ */
+ public EventType getEventType()
+ {
+ return type;
+ }
+
+ /**
+ * Returns the description of this event.
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+}
diff --git a/libjava/javax/swing/event/InternalFrameAdapter.java b/libjava/javax/swing/event/InternalFrameAdapter.java
index d314cadc068..76f3d89da3d 100644
--- a/libjava/javax/swing/event/InternalFrameAdapter.java
+++ b/libjava/javax/swing/event/InternalFrameAdapter.java
@@ -35,14 +35,15 @@ 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.event;
/**
* InternalFrameAdapter
* @author Andrew Selkirk
*/
-public class InternalFrameAdapter extends Object
- implements InternalFrameListener {
+public abstract class InternalFrameAdapter implements InternalFrameListener
+{
//-------------------------------------------------------------
// Initialization ---------------------------------------------
diff --git a/libjava/javax/swing/event/InternalFrameEvent.java b/libjava/javax/swing/event/InternalFrameEvent.java
index f974cb52ff3..15d12f2efcf 100644
--- a/libjava/javax/swing/event/InternalFrameEvent.java
+++ b/libjava/javax/swing/event/InternalFrameEvent.java
@@ -35,80 +35,80 @@ 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.event;
-// Imports
import java.awt.AWTEvent;
import javax.swing.JInternalFrame;
/**
- * InternalFrameEvent
* @author Andrew Selkirk
*/
-public class InternalFrameEvent extends AWTEvent {
-
- //-------------------------------------------------------------
- // Constants --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Internal frame activated event
- */
- public static int INTERNAL_FRAME_ACTIVATED = 25554;
-
- /**
- * Internal frame closed event
- */
- public static int INTERNAL_FRAME_CLOSED = 25551;
-
- /**
- * Internal frame closing event
- */
- public static int INTERNAL_FRAME_CLOSING = 25550;
-
- /**
- * Internal frame deactivated event
- */
- public static int INTERNAL_FRAME_DEACTIVATED = 25555;
-
- /**
- * Internal frame deiconifed event
- */
- public static int INTERNAL_FRAME_DEICONIFIED = 25553;
-
- /**
- * Internal frame frame first event
- */
- public static int INTERNAL_FRAME_FIRST = 25549;
-
- /**
- * Internal frame iconified event
- */
- public static int INTERNAL_FRAME_ICONIFIED = 2552;
-
- /**
- * Internal frame last event
- */
- public static int INTERNAL_FRAME_LAST = 25555;
-
- /**
- * Internal frame opened event
- */
- public static int INTERNAL_FRAME_OPENED = 25550;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor InternalFrameEvent
- * @param source JInternalFrame
- * @param id Event ID
- */
- public InternalFrameEvent(JInternalFrame source, int id) {
- super(source, id);
- } // InternalFrameEvent()
-
-
-} // InternalFrameEvent
+public class InternalFrameEvent extends AWTEvent
+{
+ private static final long serialVersionUID = -5204823611874873183L;
+
+ /**
+ * Internal frame activated event
+ */
+ public static final int INTERNAL_FRAME_ACTIVATED = 25554;
+
+ /**
+ * Internal frame closed event
+ */
+ public static final int INTERNAL_FRAME_CLOSED = 25551;
+
+ /**
+ * Internal frame closing event
+ */
+ public static final int INTERNAL_FRAME_CLOSING = 25550;
+
+ /**
+ * Internal frame deactivated event
+ */
+ public static final int INTERNAL_FRAME_DEACTIVATED = 25555;
+
+ /**
+ * Internal frame deiconifed event
+ */
+ public static final int INTERNAL_FRAME_DEICONIFIED = 25553;
+
+ /**
+ * Internal frame frame first event
+ */
+ public static final int INTERNAL_FRAME_FIRST = 25549;
+
+ /**
+ * Internal frame iconified event
+ */
+ public static final int INTERNAL_FRAME_ICONIFIED = 2552;
+
+ /**
+ * Internal frame last event
+ */
+ public static final int INTERNAL_FRAME_LAST = 25555;
+
+ /**
+ * Internal frame opened event
+ */
+ public static final int INTERNAL_FRAME_OPENED = 25550;
+
+ /**
+ * Creates a <code>JInternalFrameEvent</code> object.
+ *
+ * @param source The source of this event.
+ * @param id Then event ID of this event.
+ */
+ public InternalFrameEvent(JInternalFrame source, int id)
+ {
+ super(source, id);
+ }
+
+ /**
+ * Returns the <code>JInternalFrame</code> object stored in this event.
+ */
+ public JInternalFrame getInternalFrame()
+ {
+ return (JInternalFrame) source;
+ }
+}
diff --git a/libjava/javax/swing/event/ListDataEvent.java b/libjava/javax/swing/event/ListDataEvent.java
index 5849f7dc898..c86e86abe92 100644
--- a/libjava/javax/swing/event/ListDataEvent.java
+++ b/libjava/javax/swing/event/ListDataEvent.java
@@ -35,105 +35,64 @@ 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.event;
-// Imports
import java.util.EventObject;
/**
- * ListDataEvent
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public class ListDataEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Constants --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Contents changed
- */
- public static int CONTENTS_CHANGED = 0;
-
- /**
- * Internal added
- */
- public static int INTERVAL_ADDED = 1;
-
- /**
- * Interval removed
- */
- public static int INTERVAL_REMOVED = 2;
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * type
- */
- private int type = 0;
-
- /**
- * index0
- */
- private int index0 = 0;
+public class ListDataEvent extends EventObject
+{
+ private static final long serialVersionUID = 2510353260071004774L;
+
+ public static final int CONTENTS_CHANGED = 0;
+ public static final int INTERVAL_ADDED = 1;
+ public static final int INTERVAL_REMOVED = 2;
+
+ private int type = 0;
+ private int index0 = 0;
+ private int index1 = 0;
- /**
- * index1
- */
- private int index1 = 0;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ListDataEvent
- * @param source Source
- * @param type Event type
- * @param index0 Bottom of range
- * @param index1 Top of range
- */
- public ListDataEvent(Object source, int type,
- int index0, int index1) {
- super(source);
- this.type = type;
- this.index0 = index0;
- this.index1 = index1;
- } // ListDataEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ /**
+ * Creates a <code>ListDataEvent</code> object.
+ *
+ * @param source The source of the event.
+ * @param type The type of the event
+ * @param index0 Bottom of range
+ * @param index1 Top of range
+ */
+ public ListDataEvent(Object source, int type, int index0, int index1)
+ {
+ super(source);
+ this.type = type;
+ this.index0 = index0;
+ this.index1 = index1;
+ }
- /**
- * getIndex0
- * @returns index0
- */
- public int getIndex0() {
- return index0;
- } // getIndex0()
-
- /**
- * getIndex1
- * @returns index1
- */
- public int getIndex1() {
- return index1;
- } // getIndex1()
-
- /**
- * Event type
- * @returns Event type
- */
- public int getType() {
- return type;
- } // getType()
-
-
-} // ListDataEvent
+ /**
+ * Returns the bottom index.
+ */
+ public int getIndex0()
+ {
+ return index0;
+ }
+
+ /**
+ * Returns the top index.
+ */
+ public int getIndex1()
+ {
+ return index1;
+ }
+
+ /**
+ * Returns the type of this event.
+ */
+ public int getType()
+ {
+ return type;
+ }
+}
diff --git a/libjava/javax/swing/event/MouseInputAdapter.java b/libjava/javax/swing/event/MouseInputAdapter.java
index 087f01c17d6..23caed0a8d9 100644
--- a/libjava/javax/swing/event/MouseInputAdapter.java
+++ b/libjava/javax/swing/event/MouseInputAdapter.java
@@ -35,9 +35,9 @@ 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.event;
-// Imports
import java.awt.event.MouseEvent;
/**
diff --git a/libjava/javax/swing/event/SwingPropertyChangeSupport.java b/libjava/javax/swing/event/SwingPropertyChangeSupport.java
index 2bb0d64aca6..9092158df32 100644
--- a/libjava/javax/swing/event/SwingPropertyChangeSupport.java
+++ b/libjava/javax/swing/event/SwingPropertyChangeSupport.java
@@ -49,6 +49,8 @@ import java.util.*;
public final class SwingPropertyChangeSupport
extends PropertyChangeSupport {
+ private static final long serialVersionUID = 7162625831330845068L;
+
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
diff --git a/libjava/javax/swing/event/TableModelEvent.java b/libjava/javax/swing/event/TableModelEvent.java
index 2316c28a75c..6bd96971950 100644
--- a/libjava/javax/swing/event/TableModelEvent.java
+++ b/libjava/javax/swing/event/TableModelEvent.java
@@ -35,170 +35,123 @@ 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.event;
-// Imports
import java.util.EventObject;
import javax.swing.table.TableModel;
/**
- * TableModelEvent
* @author Andrew Selkirk
*/
-public class TableModelEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Constants --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * ALL_COLUMNS
- */
- public static int ALL_COLUMNS = -1;
-
- /**
- * DELETE
- */
- public static int DELETE = -1;
-
- /**
- * HEADER_ROW
- */
- public static int HEADER_ROW = -1;
-
- /**
- * INSERT
- */
- public static int INSERT = 1;
-
- /**
- * UPDATE
- */
- public static int UPDATE = 0;
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * column
- */
- protected int column = 0;
-
- /**
- * firstRow
- */
- protected int firstRow = 0;
-
- /**
- * lastRow
- */
- protected int lastRow = 0;
-
- /**
- * type
- */
- protected int type = 0;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor TableModelEvent
- * @param source Source object
- */
- public TableModelEvent(TableModel source) {
- this(source, 0, source.getRowCount(), ALL_COLUMNS, UPDATE);
- } // TableModelEvent()
-
- /**
- * Constructor TableModelEvent
- * @param source Source table model
- * @param row Updated row
- */
- public TableModelEvent(TableModel source, int row) {
- this(source, row, row, ALL_COLUMNS, UPDATE);
- } // TableModelEvent()
-
- /**
- * Constructor TableModelEvent
- * @param source Source table model
- * @param firstRow First row of update
- * @param lastRow Last row of update
- */
- public TableModelEvent(TableModel source, int firstRow,
- int lastRow) {
- this(source, firstRow, lastRow, ALL_COLUMNS, UPDATE);
- } // TableModelEvent()
-
- /**
- * Constructor TableModelEvent
- * @param source Source table model
- * @param firstRow First row of update
- * @param lastRow Last row of update
- * @param column Affected column
- */
- public TableModelEvent(TableModel source, int firstRow,
- int lastRow, int column) {
- this(source, firstRow, lastRow, column, UPDATE);
- } // TableModelEvent()
-
- /**
- * Constructor TableModelEvent
- * @param source Source table model
- * @param firstRow First row of update
- * @param lastRow Last row of update
- * @param column Affected column
- * @param type Type of change
- */
- public TableModelEvent(TableModel source, int firstRow,
- int lastRow, int column, int type) {
- super(source);
- this.firstRow = firstRow;
- this.lastRow = lastRow;
- this.column = column;
- this.type = type;
- } // TableModelEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getColumn
- * @returns column
- */
- public int getColumn() {
- return column;
- } // getColumn()
-
- /**
- * getFirstRow
- * @returns row
- */
- public int getFirstRow() {
- return firstRow;
- } // getFirstRow()
-
- /**
- * getLastRow
- * @returns row
- */
- public int getLastRow() {
- return lastRow;
- } // getLastRow()
-
- /**
- * Get type
- * @returns Type of event
- */
- public int getType() {
- return type;
- } // getType()
-
-
-} // TableModelEvent
+public class TableModelEvent extends EventObject
+{
+ private static final long serialVersionUID = -7849342674552212824L;
+
+ public static final int ALL_COLUMNS = -1;
+ public static final int DELETE = -1;
+ public static final int HEADER_ROW = -1;
+ public static final int INSERT = 1;
+ public static final int UPDATE = 0;
+
+ protected int column = 0;
+ protected int firstRow = 0;
+ protected int lastRow = 0;
+ protected int type = 0;
+
+ /**
+ * Creates a <code>TableModelEvent</code> event.
+ *
+ * @param source The source object
+ */
+ public TableModelEvent(TableModel source)
+ {
+ this(source, 0, source.getRowCount(), ALL_COLUMNS, UPDATE);
+ }
+
+ /**
+ * Creates a <code>TableModelEvent</code> event.
+ *
+ * @param source The source object
+ * @param row The updated row
+ */
+ public TableModelEvent(TableModel source, int row)
+ {
+ this(source, row, row, ALL_COLUMNS, UPDATE);
+ }
+
+ /**
+ * Creates a <code>TableModelEvent</code> event.
+ *
+ * @param source The source object
+ * @param firstRow The first row of update
+ * @param lastRow The last row of update
+ */
+ public TableModelEvent(TableModel source, int firstRow, int lastRow)
+ {
+ this(source, firstRow, lastRow, ALL_COLUMNS, UPDATE);
+ }
+
+ /**
+ * Creates a <code>TableModelEvent</code> event.
+ *
+ * @param source The source object
+ * @param firstRow The first row of update
+ * @param lastRow The last row of update
+ * @param column The affected column
+ */
+ public TableModelEvent(TableModel source, int firstRow, int lastRow, int column)
+ {
+ this(source, firstRow, lastRow, column, UPDATE);
+ }
+
+ /**
+ * Creates a <code>TableModelEvent</code> event.
+ *
+ * @param source The source object
+ * @param firstRow The first row of update
+ * @param lastRow The last row of update
+ * @param column The affected column
+ * @param type The type of change
+ */
+ public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)
+ {
+ super(source);
+ this.firstRow = firstRow;
+ this.lastRow = lastRow;
+ this.column = column;
+ this.type = type;
+ }
+
+ /**
+ * Returns the affected column of this event.
+ */
+ public int getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * Returns the first affected row of this event.
+ */
+ public int getFirstRow()
+ {
+ return firstRow;
+ }
+
+ /**
+ * Returns the last affected row of this event.
+ */
+ public int getLastRow()
+ {
+ return lastRow;
+ }
+
+ /**
+ * Returns the type of change of this event.
+ */
+ public int getType()
+ {
+ return type;
+ }
+}
diff --git a/libjava/javax/swing/event/TreeWillExpandListener.java b/libjava/javax/swing/event/TreeWillExpandListener.java
index c70c6c6d4a5..c286fef8016 100644
--- a/libjava/javax/swing/event/TreeWillExpandListener.java
+++ b/libjava/javax/swing/event/TreeWillExpandListener.java
@@ -35,28 +35,30 @@ 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.event;
-// Imports
import java.util.EventListener;
+import javax.swing.tree.ExpandVetoException;
/**
- * TreeWillExpandListener interface
* @author Andrew Selkirk
*/
-public interface TreeWillExpandListener extends EventListener {
-
- /**
- * Tree will collapse
- * @param event Tree Expansion Event
- */
- public void treeWillCollapse(TreeExpansionEvent event);
-
- /**
- * Tree will expand
- * @param event Tree Expansion Event
- */
- public void treeWillExpand(TreeExpansionEvent event);
-
+public interface TreeWillExpandListener extends EventListener
+{
+ /**
+ * Invoked whenever a node in the tree is about to be collapsed.
+ *
+ * @param event The tree expansion Event
+ */
+ public void treeWillCollapse(TreeExpansionEvent event)
+ throws ExpandVetoException;
-} // TreeWillExpandListener
+ /**
+ * Invoked whenever a node in the tree is about to be expanded.
+ *
+ * @param event The tree expansion Event
+ */
+ public void treeWillExpand(TreeExpansionEvent event)
+ throws ExpandVetoException;
+}
diff --git a/libjava/javax/swing/event/UndoableEditEvent.java b/libjava/javax/swing/event/UndoableEditEvent.java
index 43ed56a4953..7fb7a9e3abb 100644
--- a/libjava/javax/swing/event/UndoableEditEvent.java
+++ b/libjava/javax/swing/event/UndoableEditEvent.java
@@ -48,6 +48,8 @@ import javax.swing.undo.*;
*/
public class UndoableEditEvent extends EventObject {
+ private static final long serialVersionUID = 4418044561759134484L;
+
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
diff --git a/libjava/javax/swing/filechooser/FileFilter.java b/libjava/javax/swing/filechooser/FileFilter.java
index 9f624b3c814..7e0be6d1b06 100644
--- a/libjava/javax/swing/filechooser/FileFilter.java
+++ b/libjava/javax/swing/filechooser/FileFilter.java
@@ -35,10 +35,10 @@ 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.filechooser;
-// Imports
-import java.io.*;
+import java.io.File;
/**
* FileFilter
diff --git a/libjava/javax/swing/filechooser/FileSystemView.java b/libjava/javax/swing/filechooser/FileSystemView.java
index 20abe09259c..759149756fc 100644
--- a/libjava/javax/swing/filechooser/FileSystemView.java
+++ b/libjava/javax/swing/filechooser/FileSystemView.java
@@ -35,10 +35,12 @@ 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.filechooser;
-// Imports
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import javax.swing.Icon;
/**
* FileSystemView
diff --git a/libjava/javax/swing/filechooser/FileView.java b/libjava/javax/swing/filechooser/FileView.java
index 77d28eb6bba..7ff8ab0b9bb 100644
--- a/libjava/javax/swing/filechooser/FileView.java
+++ b/libjava/javax/swing/filechooser/FileView.java
@@ -35,11 +35,11 @@ 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.filechooser;
-// Imports
-import java.io.*;
-import javax.swing.*;
+import java.io.File;
+import javax.swing.Icon;
/**
* FileView
diff --git a/libjava/javax/swing/plaf/ActionMapUIResource.java b/libjava/javax/swing/plaf/ActionMapUIResource.java
index cd9771b2dbb..640f3a75628 100644
--- a/libjava/javax/swing/plaf/ActionMapUIResource.java
+++ b/libjava/javax/swing/plaf/ActionMapUIResource.java
@@ -1,5 +1,5 @@
/* ActionMapUIResource.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,26 +37,28 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import javax.swing.*;
+import javax.swing.ActionMap;
+
/**
- * ActionMapUIResource
- * @author Andrew Selkirk
- * @version 1.0
+ * An <code>ActionMap</code> that implements the {@link UIResource}
+ * interface to indicate that it belongs to a pluggable
+ * LookAndFeel.
+ *
+ * @see javax.swing.ActionMap
+ *
+ * @author Andrew Selkirk
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ActionMapUIResource extends ActionMap implements UIResource {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ActionMapUIResource
- */
- public ActionMapUIResource() {
- // TODO
- } // ActionMapUIResource()
-
-
-} // ActionMapUIResource
+public class ActionMapUIResource
+ extends ActionMap
+ implements UIResource
+{
+ /**
+ * Constructs a new ActionMapUIResource.
+ */
+ public ActionMapUIResource()
+ {
+ /* The constructor does nothing. */
+ }
+}
diff --git a/libjava/javax/swing/plaf/BorderUIResource.java b/libjava/javax/swing/plaf/BorderUIResource.java
index 6e8a8291d74..aebb1a03fe3 100644
--- a/libjava/javax/swing/plaf/BorderUIResource.java
+++ b/libjava/javax/swing/plaf/BorderUIResource.java
@@ -1,5 +1,5 @@
/* BorderUIResource.java
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,6 +37,7 @@ exception statement from your version. */
package javax.swing.plaf;
+
import javax.swing.border.*;
import javax.swing.Icon;
import java.io.Serializable;
@@ -47,231 +48,858 @@ import java.awt.Font;
import java.awt.Color;
/**
+ * A wrapper for {@link javax.swing.border.Border} that also
+ * implements the {@link UIResource} marker interface. This is useful
+ * for implementing pluggable look-and-feels: When switching the
+ * current LookAndFeel, only those borders are replaced that are
+ * marked as {@link UIResource}. For this reason, a look-and-feel
+ * should always install borders that implement
+ * <code>UIResource</code>, such as the borders provided by this
+ * class.
+ *
* @serial
* @serialField delegate Border the <code>Border</code> wrapped
- * @author Brian Jones
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
public class BorderUIResource
- extends Object
- implements Border, UIResource, Serializable
+ extends Object
+ implements Border, UIResource, Serializable
{
+ /**
+ * Verified using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
static final long serialVersionUID = -3440553684010079691L;
- private Border delegate;
+ /**
+ * A shared instance of an {@link EtchedBorderUIResource}, or
+ * <code>null</code> if the {@link #getEtchedBorderUIResource()}
+ * method has not yet been called.
+ */
+ private static Border etchedBorderUIResource;
+
+
+ /**
+ * A shared instance of a {@link BevelBorderUIResource} whose
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#LOWERED}, or <code>null</code> if
+ * the {@link #getLoweredBevelBorderUIResource()} has not yet been
+ * called.
+ */
+ private static Border loweredBevelBorderUIResource;
+
+
+ /**
+ * A shared instance of a {@link BevelBorderUIResource} whose
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#RAISED}, or <code>null</code> if
+ * the {@link #getRaisedBevelBorderUIResource()} has not yet been
+ * called.
+ */
+ private static Border raisedBevelBorderUIResource;
+
+
+ /**
+ * A shared instance of a {@link LineBorderUIResource} for
+ * a one-pixel thick black line, or <code>null</code> if
+ * the {@link #getBlackLineBorderUIResource()} has not yet been
+ * called.
+ */
+ private static Border blackLineBorderUIResource;
+
+
+ /**
+ * Returns a shared instance of an etched border which also
+ * is marked as an {@link UIResource}.
+ *
+ * @see javax.swing.border.EtchedBorder
+ */
+ public static Border getEtchedBorderUIResource()
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (etchedBorderUIResource == null)
+ etchedBorderUIResource = new EtchedBorderUIResource();
+ return etchedBorderUIResource;
+ }
+
+
+ /**
+ * Returns a shared instance of {@link BevelBorderUIResource} whose
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#LOWERED}.
+ *
+ * @see javax.swing.border.BevelBorder
+ */
+ public static Border getLoweredBevelBorderUIResource()
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (loweredBevelBorderUIResource == null)
+ loweredBevelBorderUIResource = new BevelBorderUIResource(
+ BevelBorder.LOWERED);
+ return loweredBevelBorderUIResource;
+ }
+
+
+ /**
+ * Returns a shared instance of {@link BevelBorderUIResource} whose
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#RAISED}.
+ *
+ * @see javax.swing.border.BevelBorder
+ */
+ public static Border getRaisedBevelBorderUIResource()
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (raisedBevelBorderUIResource == null)
+ raisedBevelBorderUIResource = new BevelBorderUIResource(
+ BevelBorder.RAISED);
+ return raisedBevelBorderUIResource;
+ }
+
+
+ /**
+ * Returns a shared instance of {@link LineBorderUIResource} for
+ * a black, one-pixel width border.
+ *
+ * @see javax.swing.border.LineBorder
+ */
+ public static Border getBlackLineBorderUIResource()
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (blackLineBorderUIResource == null)
+ blackLineBorderUIResource = new LineBorderUIResource(Color.black);
+ return blackLineBorderUIResource;
+ }
+
+
+ /**
+ * The wrapped border.
+ */
+ private Border delegate;
+
+
+ /**
+ * Constructs a <code>BorderUIResource</code> for wrapping
+ * a <code>Border</code> object.
+ *
+ * @param delegate the border to be wrapped.
+ */
+ public BorderUIResource(Border delegate)
+ {
+ if (delegate == null)
+ throw new IllegalArgumentException();
+
+ this.delegate = delegate;
+ }
+
+
+ /**
+ * Paints the border around an enclosed component by calling
+ * the <code>paintBorder</code> method of the wrapped delegate.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ delegate.paintBorder(c, g, x, y, width, height);
+ }
+
+
+ /**
+ * Measures the width of this border by calling the
+ * <code>getBorderInsets</code> method of the wrapped
+ * delegate.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return delegate.getBorderInsets(c);
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting by calling the <code>isBorderOpaque</code>
+ * method of the wrapped delegate.
+ *
+ * @return <code>true</code> if the border is fully opaque, or
+ * <code>false</code> if some pixels of the background
+ * can shine through the border.
+ */
+ public boolean isBorderOpaque()
+ {
+ return delegate.isBorderOpaque();
+ }
+
+
+ /**
+ * A {@link javax.swing.border.BevelBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class BevelBorderUIResource
+ extends BevelBorder
+ implements UIResource, Serializable
+ {
/**
- * Creates a <code>UIResource</code> wrapper for a <code>Border</code>
- * object.
- *
- * @param delegate the border to be wrapped
+ * Constructs a BevelBorderUIResource whose colors will be derived
+ * from the background of the enclosed component. The background
+ * color is retrieved each time the border is painted, so a border
+ * constructed by this method will automatically reflect a change
+ * to the component&#x2019;s background color.
+ *
+ * <p><img src="../border/BevelBorder-1.png" width="500" height="150"
+ * alt="[An illustration showing raised and lowered BevelBorders]" />
+ *
+ * @param bevelType the desired appearance of the border. The value
+ * must be either {@link javax.swing.border.BevelBorder#RAISED}
+ * or {@link javax.swing.border.BevelBorder#LOWERED}.
+ *
+ * @throws IllegalArgumentException if <code>bevelType</code> has
+ * an unsupported value.
*/
- public BorderUIResource(Border delegate)
+ public BevelBorderUIResource(int bevelType)
+ {
+ super(bevelType);
+ }
+
+
+ /**
+ * Constructs a BevelBorderUIResource given its appearance type
+ * and two colors for its highlight and shadow.
+ *
+ * <p><img src="../border/BevelBorder-2.png" width="500" height="150"
+ * alt="[An illustration showing BevelBorders that were constructed
+ * with this method]" />
+ *
+ * @param bevelType the desired appearance of the border. The value
+ * must be either {@link javax.swing.border.BevelBorder#RAISED}
+ * or {@link javax.swing.border.BevelBorder#LOWERED}.
+ *
+ * @param highlight the color that will be used for the inner side
+ * of the highlighted edges (top and left if if
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#RAISED}; bottom and right
+ * otherwise). The color for the outer side is a brightened
+ * version of this color.
+ *
+ * @param shadow the color that will be used for the outer side of
+ * the shadowed edges (bottom and right if
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#RAISED}; top and left
+ * otherwise). The color for the inner side is a brightened
+ * version of this color.
+ *
+ * @throws IllegalArgumentException if <code>bevelType</code> has
+ * an unsupported value.
+ *
+ * @throws NullPointerException if <code>highlight</code> or
+ * <code>shadow</code> is <code>null</code>.
+ */
+ public BevelBorderUIResource(int bevelType,
+ Color highlight,
+ Color shadow)
{
- this.delegate = delegate;
+ super(bevelType, highlight, shadow);
}
+
/**
+ * Constructs a BevelBorderUIResource given its appearance type
+ * and all its colors.
+ *
+ * <p><img src="../border/BevelBorder-3.png" width="500" height="150"
+ * alt="[An illustration showing BevelBorders that were constructed
+ * with this method]" />
+ *
+ * @param bevelType the desired appearance of the border. The value
+ * must be either {@link javax.swing.border.BevelBorder#RAISED}
+ * or {@link javax.swing.border.BevelBorder#LOWERED}.
+ *
+ * @param highlightOuter the color that will be used for the outer
+ * side of the highlighted edges (top and left if
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#RAISED}; bottom and right
+ * otherwise).
+ *
+ * @param highlightInner the color that will be used for the inner
+ * side of the highlighted edges.
+ *
+ * @param shadowOuter the color that will be used for the outer
+ * side of the shadowed edges (bottom and right if
+ * <code>bevelType</code> is {@link
+ * javax.swing.border.BevelBorder#RAISED}; top and left
+ * otherwise).
+ *
+ * @param shadowInner the color that will be used for the inner
+ * side of the shadowed edges.
+ *
+ * @throws IllegalArgumentException if <code>bevelType</code> has
+ * an unsupported value.
+ *
+ * @throws NullPointerException if one of the passed colors
+ * is <code>null</code>.
*/
- public static Border getEtchedBorderUIResource() {
- return null;
+ public BevelBorderUIResource(int bevelType,
+ Color highlightOuter,
+ Color highlightInner,
+ Color shadowOuter,
+ Color shadowInner)
+ {
+ super(bevelType,
+ highlightOuter, highlightInner,
+ shadowOuter, shadowInner);
}
-
+ }
+
+
+ /**
+ * A {@link javax.swing.border.CompoundBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class CompoundBorderUIResource
+ extends CompoundBorder
+ implements UIResource, Serializable
+ {
/**
+ * Constructs a CompoundBorderUIResource with the specified inside
+ * and outside borders.
+ *
+ * @param outsideBorder the outside border, which is painted to the
+ * outside of both <code>insideBorder</code> and the enclosed
+ * component. It is acceptable to pass <code>null</code>, in
+ * which case no outside border is painted.
+ *
+ * @param insideBorder the inside border, which is painted to
+ * between <code>outsideBorder</code> and the enclosed
+ * component. It is acceptable to pass <code>null</code>, in
+ * which case no inside border is painted.
*/
- public static Border getLoweredBevelBorderUIResource() {
- return null;
+ public CompoundBorderUIResource(Border outsideBorder,
+ Border insideBorder)
+ {
+ super(outsideBorder, insideBorder);
}
-
+ }
+
+
+ /**
+ * An {@link javax.swing.border.EmptyBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * <p><img src="../border/EmptyBorder-1.png" width="290" height="200"
+ * alt="[An illustration of EmptyBorder]" />
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class EmptyBorderUIResource
+ extends EmptyBorder
+ implements UIResource, Serializable
+ {
/**
+ * Constructs an empty border given the number of pixels required
+ * on each side.
+ *
+ * @param top the number of pixels that the border will need
+ * for its top edge.
+ *
+ * @param left the number of pixels that the border will need
+ * for its left edge.
+ *
+ * @param bottom the number of pixels that the border will need
+ * for its bottom edge.
+ *
+ * @param right the number of pixels that the border will need
+ * for its right edge.
*/
- public static Border getRaisedBevelBorderUIResource() {
- return null;
+ public EmptyBorderUIResource(int top, int left, int bottom, int right)
+ {
+ super(top, left, bottom, right);
}
-
+
+
/**
+ * Constructs an empty border given the number of pixels required
+ * on each side, passed in an Insets object.
+ *
+ * @param insets the Insets for the new border.
*/
- public static Border getBlackLineBorderUIResource() {
- return null;
+ public EmptyBorderUIResource(Insets insets)
+ {
+ super(insets);
}
-
+ }
+
+
+ /**
+ * An {@link javax.swing.border.EtchedBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * <p><img src="../border/EtchedBorder-1.png" width="500" height="200"
+ * alt="[An illustration of the two EtchedBorder variants]" />
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class EtchedBorderUIResource
+ extends EtchedBorder
+ implements UIResource, Serializable
+ {
/**
+ * Constructs an EtchedBorderUIResource that appears lowered into
+ * the surface. The colors will be derived from the background
+ * color of the enclosed Component when the border gets painted.
*/
- public void paintBorder(Component c, Graphics g, int x, int y,
- int width, int height) { }
-
+ public EtchedBorderUIResource()
+ {
+ super();
+ }
+
+
/**
+ * Constructs an EtchedBorderUIResource with the specified
+ * appearance. The colors will be derived from the background
+ * color of the enclosed Component when the border gets painted.
+ *
+ * <p><img src="../border/EtchedBorder-1.png" width="500" height="200"
+ * alt="[An illustration of the two EtchedBorder variants]" />
+ *
+ * @param etchType the desired appearance of the border. The value
+ * must be either {@link javax.swing.border.EtchedBorder#RAISED}
+ * or {@link javax.swing.border.EtchedBorder#LOWERED}.
+ *
+ * @throws IllegalArgumentException if <code>etchType</code> has
+ * an unsupported value.
*/
- public Insets getBorderInsets(Component c) {
- return null;
+ public EtchedBorderUIResource(int etchType)
+ {
+ super(etchType);
}
-
+
+
/**
+ * Constructs a lowered EtchedBorderUIResource, explicitly
+ * selecting the colors that will be used for highlight and
+ * shadow.
+ *
+ * @param highlight the color that will be used for painting
+ * the highlight part of the border.
+ *
+ * @param shadow the color that will be used for painting
+ * the shadow part of the border.
+ *
+ * @see #EtchedBorderUIResource(int, Color, Color)
*/
- public boolean isBorderOpaque() {
- return false;
+ public EtchedBorderUIResource(Color highlight, Color shadow)
+ {
+ super(highlight, shadow);
}
-
+
+
/**
- * @serial
+ * Constructs an EtchedBorderUIResource with the specified
+ * appearance, explicitly selecting the colors that will be used
+ * for highlight and shadow.
+ *
+ * <p><img src="../border/EtchedBorder-2.png" width="500"
+ * height="200" alt="[An illustration that shows which pixels get
+ * painted in what color]" />
+ *
+ * @param etchType the desired appearance of the border. The value
+ * must be either {@link javax.swing.border.EtchedBorder#RAISED}
+ * or {@link javax.swing.border.EtchedBorder#LOWERED}.
+ *
+ * @param highlight the color that will be used for painting
+ * the highlight part of the border.
+ *
+ * @param shadow the color that will be used for painting
+ * the shadow part of the border.
+ *
+ * @throws IllegalArgumentException if <code>etchType</code> has
+ * an unsupported value.
*/
- public static class BevelBorderUIResource
- extends BevelBorder
- implements UIResource, Serializable
+ public EtchedBorderUIResource(int etchType,
+ Color highlight, Color shadow)
{
- public BevelBorderUIResource(int bevelType)
- {
-
- }
-
- public BevelBorderUIResource(int bevelType,
- Color highlight,
- Color shadow)
- {
- this(bevelType);
- }
- public BevelBorderUIResource(int bevelType,
- Color highlightOuter,
- Color highlightInner,
- Color shadowOuter,
- Color shadowInner)
- {
- this(bevelType);
- }
+ super(etchType, highlight, shadow);
}
-
+ }
+
+
+ /**
+ * A {@link javax.swing.border.LineBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * <p><img src="../border/LineBorder-1.png" width="500" height="200"
+ * alt="[An illustration of two LineBorders] />
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class LineBorderUIResource
+ extends LineBorder
+ implements UIResource, Serializable
+ {
/**
- * @serial
+ * Constructs a LineBorderUIResource given its color. The border
+ * will be one pixel thick and have plain corners.
+ *
+ * @param color the color for drawing the border.
*/
- public static class CompoundBorderUIResource
- extends CompoundBorder
- implements UIResource, Serializable
+ public LineBorderUIResource(Color color)
{
- public CompoundBorderUIResource(Border outsideBorder,
- Border insideBorder)
- {
-
- }
+ super(color);
}
-
+
+
/**
- * @serial
+ * Constructs a LineBorder given its color and thickness. The
+ * border will have plain corners.
+ *
+ * @param color the color for drawing the border.
+ * @param thickness the width of the line in pixels.
*/
- public static class EmptyBorderUIResource
- extends EmptyBorder
- implements UIResource, Serializable
+ public LineBorderUIResource(Color color, int thickness)
{
- public EmptyBorderUIResource(int top, int left, int bottom, int right)
- {
- this(new Insets(top,left,bottom,right));
- }
-
- public EmptyBorderUIResource(Insets insets)
- {
-
- }
+ super(color, thickness);
}
-
+
+
+ /* Note: Since JDK1.3, javax.swing.border.LineBorder also has a
+ * constructor which accepts a value for the roundedCorners
+ * property. However, as of JDK1.4.1, the LineBorderUIResource
+ * subclass does not have a corresponding constructor.
+ *
+ * A request for enhancing the Swing API has been filed with Sun:
+ * http://developer.java.sun.com/developer/bugParade/bugs/4879999.html
+ */
+ }
+
+
+ /**
+ * A {@link javax.swing.border.MatteBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * <p><img src="../border/MatteBorder-1.png" width="500" height="150"
+ * alt="[An illustration of two MatteBorders] />
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class MatteBorderUIResource
+ extends MatteBorder
+ implements UIResource, Serializable
+ {
/**
- * @serial
+ * Constructs a MatteBorderUIResource given the width on each side
+ * and a fill color.
+ *
+ * <p><img src="../border/MatteBorder-2.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param top the width of the border at its top edge.
+ * @param left the width of the border at its left edge.
+ * @param bottom the width of the border at its bottom edge.
+ * @param right the width of the border at its right edge.
+ * @param matteColor the color for filling the border.
*/
- public static class EtchedBorderUIResource
- extends EtchedBorder
- implements UIResource, Serializable
+ public MatteBorderUIResource(int top, int left,
+ int bottom, int right,
+ Color color)
{
- public EtchedBorderUIResource() { }
- public EtchedBorderUIResource(int etchType)
- {
-
- }
- public EtchedBorderUIResource(Color highlight, Color shadow)
- {
-
- }
- public EtchedBorderUIResource(int etchType, Color highlight,
- Color shadow)
- {
-
- }
-
+ super(top, left, bottom, right, color);
}
-
+
+
/**
- * @serial
+ * Constructs a MatteBorderUIResource given the width on each side
+ * and an icon for tiling the border area.
+ *
+ * <p><img src="../border/MatteBorder-4.png" width="500"
+ * height="150" alt="[A picture of a MatteBorder made by this
+ * constructor]" />
+ *
+ * @param top the width of the border at its top edge.
+ * @param left the width of the border at its left edge.
+ * @param bottom the width of the border at its bottom edge.
+ * @param right the width of the border at its right edge.
+ * @param tileIcon an icon for tiling the border area.
*/
- public static class LineBorderUIResource
- extends LineBorder
- implements UIResource, Serializable
+ public MatteBorderUIResource(int top, int left,
+ int bottom, int right,
+ Icon tileIcon)
{
- public LineBorderUIResource(Color color)
- {
-
- }
- public LineBorderUIResource(Color color,
- int thickness)
- {
-
- }
+ super(top, left, bottom, right, tileIcon);
}
-
+
+
/**
- * @serial
+ * Constructs a MatteBorderUIResource given an icon for tiling the
+ * border area. The icon width is used for the border insets at
+ * the left and right edge, the icon height for the top and bottom
+ * edge.
+ *
+ * <p><img src="../border/MatteBorder-6.png" width="500" height="150"
+ * alt="[A picture of a MatteBorder made by this constructor]" />
+ *
+ * @param tileIcon an icon for tiling the border area.
*/
- public static class MatteBorderUIResource
- extends MatteBorder
- implements UIResource, Serializable
+ public MatteBorderUIResource(Icon tileIcon)
{
- public MatteBorderUIResource(int top, int left, int bottom,
- int right, Color color)
- {
-
- }
- public MatteBorderUIResource(int top, int left, int bottom,
- int right, Icon tileIcon)
- {
+ super(tileIcon);
+ }
+ }
+
+
+ /**
+ * A {@link javax.swing.border.TitledBorder} that also implements the
+ * {@link UIResource} marker interface. This is useful for
+ * implementing pluggable look-and-feels: When switching the current
+ * LookAndFeel, only those borders are replaced that are marked as
+ * {@link UIResource}. For this reason, a look-and-feel should
+ * always install borders that implement <code>UIResource</code>,
+ * such as the borders provided by this class.
+ *
+ * @author Brian Jones (cbj@gnu.org)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ public static class TitledBorderUIResource
+ extends TitledBorder
+ implements UIResource, Serializable
+ {
+ /**
+ * Constructs a TitledBorderUIResource given the text of its title.
+ *
+ * @param title the title text, or <code>null</code> to use no
+ * title text.
+ */
+ public TitledBorderUIResource(String title)
+ {
+ super(title);
+ }
+
+
+ /**
+ * Constructs an initially untitled TitledBorderUIResource
+ * given another border.
+ *
+ * @param border the border underneath the title, or
+ * <code>null</code> to use a default from
+ * the current look and feel.
+ */
+ public TitledBorderUIResource(Border border)
+ {
+ super(border);
+ }
+
+
+ /**
+ * Constructs a TitledBorder given its border and title text.
+ *
+ * @param border the border underneath the title, or
+ * <code>null</code> to use a default from
+ * the current look and feel.
+ *
+ * @param title the title text, or <code>null</code>
+ * to use no title text.
+ */
+ public TitledBorderUIResource(Border border, String title)
+ {
+ super(border, title);
+ }
- }
- public MatteBorderUIResource(Icon tileIcon)
- {
- }
+ /**
+ * Constructs a TitledBorderUIResource given its border, title
+ * text, horizontal alignment, and vertical position.
+ *
+ * @param border the border underneath the title, or
+ * <code>null</code> to use a default
+ * from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code>
+ * to use no title text.
+ *
+ * @param titleJustification the horizontal alignment of the title
+ * text in relation to the border. The value must be one of
+ * {@link javax.swing.border.TitledBorder#LEFT},
+ * {@link javax.swing.border.TitledBorder#CENTER},
+ * {@link javax.swing.border.TitledBorder#RIGHT},
+ * {@link javax.swing.border.TitledBorder#LEADING},
+ * {@link javax.swing.border.TitledBorder#TRAILING}, or
+ * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
+ *
+ * @param titlePosition the vertical position of the title text
+ * in relation to the border. The value must be one of
+ * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
+ * {@link javax.swing.border.TitledBorder#TOP},
+ * {@link javax.swing.border.TitledBorder#BELOW_TOP},
+ * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
+ * {@link javax.swing.border.TitledBorder#BOTTOM},
+ * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
+ * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
+ *
+ * @throws IllegalArgumentException if <code>titleJustification</code>
+ * or <code>titlePosition</code> have an unsupported value.
+ */
+ public TitledBorderUIResource(Border border, String title,
+ int titleJustification,
+ int titlePosition)
+ {
+ super(border, title, titleJustification, titlePosition);
}
+
+ /**
+ * Constructs a TitledBorder given its border, title text,
+ * horizontal alignment, vertical position, and font.
+ *
+ * @param border the border underneath the title, or
+ * <code>null</code> to use a default
+ * from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code>
+ * to use no title text.
+ *
+ * @param titleJustification the horizontal alignment of the title
+ * text in relation to the border. The value must be one of
+ * {@link javax.swing.border.TitledBorder#LEFT},
+ * {@link javax.swing.border.TitledBorder#CENTER},
+ * {@link javax.swing.border.TitledBorder#RIGHT},
+ * {@link javax.swing.border.TitledBorder#LEADING},
+ * {@link javax.swing.border.TitledBorder#TRAILING}, or
+ * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
+ *
+ * @param titlePosition the vertical position of the title text
+ * in relation to the border. The value must be one of
+ * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
+ * {@link javax.swing.border.TitledBorder#TOP},
+ * {@link javax.swing.border.TitledBorder#BELOW_TOP},
+ * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
+ * {@link javax.swing.border.TitledBorder#BOTTOM},
+ * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
+ * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
+ *
+ * @param titleFont the font for the title text, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @throws IllegalArgumentException if <code>titleJustification</code>
+ * or <code>titlePosition</code> have an unsupported value.
+ */
+ public TitledBorderUIResource(Border border, String title,
+ int titleJustification,
+ int titlePosition,
+ Font titleFont)
+ {
+ super(border, title, titleJustification, titlePosition,
+ titleFont);
+ }
+
+
/**
- * @serial
+ * Constructs a TitledBorder given its border, title text,
+ * horizontal alignment, vertical position, font, and color.
+ *
+ * @param border the border underneath the title, or
+ * <code>null</code> to use a default
+ * from the current look and feel.
+ *
+ * @param title the title text, or <code>null</code>
+ * to use no title text.
+ *
+ * @param titleJustification the horizontal alignment of the title
+ * text in relation to the border. The value must be one of
+ * {@link javax.swing.border.TitledBorder#LEFT},
+ * {@link javax.swing.border.TitledBorder#CENTER},
+ * {@link javax.swing.border.TitledBorder#RIGHT},
+ * {@link javax.swing.border.TitledBorder#LEADING},
+ * {@link javax.swing.border.TitledBorder#TRAILING}, or
+ * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
+ *
+ * @param titlePosition the vertical position of the title text
+ * in relation to the border. The value must be one of
+ * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
+ * {@link javax.swing.border.TitledBorder#TOP},
+ * {@link javax.swing.border.TitledBorder#BELOW_TOP},
+ * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
+ * {@link javax.swing.border.TitledBorder#BOTTOM},
+ * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
+ * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
+ *
+ * @param titleFont the font for the title text, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @param titleColor the color for the title text, or <code>null</code>
+ * to use a default from the current look and feel.
+ *
+ * @throws IllegalArgumentException if <code>titleJustification</code>
+ * or <code>titlePosition</code> have an unsupported value.
*/
- public static class TitledBorderUIResource
- extends TitledBorder
- implements UIResource, Serializable
+ public TitledBorderUIResource(Border border, String title,
+ int titleJustification, int titlePosition,
+ Font titleFont, Color titleColor)
{
- TitledBorderUIResource(String title)
- {
-
- }
- TitledBorderUIResource(Border border)
- {
-
- }
- TitledBorderUIResource(Border border, String title)
- {
-
- }
- TitledBorderUIResource(Border border, String title,
- int titleJustification, int titlePosition)
- {
-
- }
- TitledBorderUIResource(Border border, String title,
- int titleJustification, int titlePosition,
- Font titleFont)
- {
-
- }
- TitledBorderUIResource(Border border, String title,
- int titleJustification, int titlePosition,
- Font titleFont, Color titleColor)
- {
-
- }
+ super(border, title, titleJustification, titlePosition,
+ titleFont, titleColor);
}
+ }
}
diff --git a/libjava/javax/swing/plaf/ButtonUI.java b/libjava/javax/swing/plaf/ButtonUI.java
index 56599af7709..4fdaee5055f 100644
--- a/libjava/javax/swing/plaf/ButtonUI.java
+++ b/libjava/javax/swing/plaf/ButtonUI.java
@@ -1,5 +1,5 @@
/* ButtonUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,15 @@ exception statement from your version. */
package javax.swing.plaf;
-public class ButtonUI extends ComponentUI
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JButton</code>.
+ *
+ * @see javax.swing.JButton
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class ButtonUI
+ extends ComponentUI
{
}
diff --git a/libjava/javax/swing/plaf/ColorChooserUI.java b/libjava/javax/swing/plaf/ColorChooserUI.java
index e2a839ac28d..e290a972a69 100644
--- a/libjava/javax/swing/plaf/ColorChooserUI.java
+++ b/libjava/javax/swing/plaf/ColorChooserUI.java
@@ -1,5 +1,5 @@
/* ColorChooserUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,22 +38,23 @@ exception statement from your version. */
package javax.swing.plaf;
/**
- * ColorChooserUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JColorChooser</code>.
+ *
+ * @see javax.swing.JColorChooser
+ *
+ * @author Andrew Selkirk
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ColorChooserUI extends ComponentUI {
+public abstract class ColorChooserUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a ColorChooserUI.
+ */
+ public ColorChooserUI()
+ {
+ /* The constructor does not do anything. */
+ }
+}
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ColorChooserUI
- */
- public ColorChooserUI() {
- // TODO
- } // ColorChooserUI()
-
-
-} // ColorChooserUI
diff --git a/libjava/javax/swing/plaf/ColorUIResource.java b/libjava/javax/swing/plaf/ColorUIResource.java
index 18b6b83a3fe..caa644c4952 100644
--- a/libjava/javax/swing/plaf/ColorUIResource.java
+++ b/libjava/javax/swing/plaf/ColorUIResource.java
@@ -1,5 +1,5 @@
/* ColorUIResource.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,26 +37,78 @@ exception statement from your version. */
package javax.swing.plaf;
+
import java.awt.Color;
+
+
/**
- * STUBBED
+ * A Color that is marked as <code>UIResource</code>, which indicates that
+ * the color has been installed by a pluggable LookAndFeel. Such colors
+ * are replaced when the LookAndFeel changes.
+ *
+ * @see java.awt.Color
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ColorUIResource extends Color implements UIResource
+public class ColorUIResource
+ extends Color
+ implements UIResource
{
- public ColorUIResource(Color c)
+ /**
+ * Constructs a <code>ColorUIResource</code> using the specified
+ * red, green, and blue values, which must be given as integers in
+ * the range of 0-255. The alpha channel value will default to 255,
+ * meaning that the color is fully opaque.
+ *
+ * @param r the red intensity, which must be in the range [0 .. 255].
+ * @param g the green intensity, which must be in the range [0 .. 255].
+ * @param b the blue intensity, which must be in the range [0 .. 255].
+ */
+ public ColorUIResource(int r, int g, int b)
{
- super(c.getRGB());
+ super(r, g, b);
}
- public ColorUIResource(float r, float g, float b)
+
+
+ /**
+ * Consructs a <code>ColorUIResource</code> using the specified
+ * RGB value. The blue value is in bits 0-7, green in bits 8-15, and
+ * red in bits 16-23. The other bits are ignored. The alpha value is set
+ * to 255, meaning that the color is fully opaque.
+ *
+ * @param rgb the rgb value, as discussed above.
+ */
+ public ColorUIResource(int rgb)
{
- super(r, g, b, 1.0f);
+ super(rgb);
}
- public ColorUIResource(int rgb)
+
+
+ /**
+ * Constructs a <code>ColorUIResource</code> using the specified
+ * red, green, and blue intensities, which must be given as floats in
+ * the range of 0-1. The alpha channel value will default to 1.0f,
+ * meaning that the color is fully opaque.
+ *
+ * @param r the red intensity, which must be in the range [0.0 .. 1.0].
+ * @param g the green intensity, which must be in the range [0.0 .. 1.0].
+ * @param b the blue intensity, which must be in the range [0.0 .. 1.0].
+ */
+ public ColorUIResource(float r, float g, float b)
{
- super(rgb, false);
+ super(r, g, b);
}
- public ColorUIResource(int r, int g, int b)
+
+
+ /**
+ * Constructs a <code>ColorUIResource</code>, using the intensities
+ * of another color.
+ *
+ * @param c the color whose intensities will be considered when
+ * constructing this <code>ColorUIResource</code>.
+ */
+ public ColorUIResource(Color c)
{
- super(r, g, b, 255);
+ super(c.getRGB());
}
-} // class ColorUIResource
+}
diff --git a/libjava/javax/swing/plaf/ComboBoxUI.java b/libjava/javax/swing/plaf/ComboBoxUI.java
index 9c045e6f8c3..83286d95ba6 100644
--- a/libjava/javax/swing/plaf/ComboBoxUI.java
+++ b/libjava/javax/swing/plaf/ComboBoxUI.java
@@ -1,5 +1,5 @@
/* ComboBoxUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,52 +37,60 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import javax.swing.*;
+import javax.swing.JComboBox;
/**
- * ComboBoxUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JButton</code>.
+ *
+ * @see javax.swing.JComboBox
+ *
+ * @author Andrew Selkirk
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ComboBoxUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ComboBoxUI
- */
- public ComboBoxUI() {
- // TODO
- } // ComboBoxUI()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * setPopupVisible
- * @param combobox TODO
- * @param visible TODO
- */
- public abstract void setPopupVisible(JComboBox combobox, boolean visible);
-
- /**
- * isPopupVisible
- * @param combobox TODO
- * @returns boolean
- */
- public abstract boolean isPopupVisible(JComboBox combobox);
-
- /**
- * isFocusTraversable
- * @param combobox TODO
- * @returns boolean
- */
- public abstract boolean isFocusTraversable(JComboBox combobox);
-
-
-} // ComboBoxUI
+public abstract class ComboBoxUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>ComboBoxUI</code>.
+ */
+ public ComboBoxUI()
+ {
+ }
+
+
+ /**
+ * Sets the visibility of the popup button.
+ *
+ * @param c the <code>JComboBox</code> whose popup
+ * is shown or hidden.
+ *
+ * @param visible <code>true</code> to show the popup, <code>false</code>
+ * to hide it.
+ */
+ public abstract void setPopupVisible(JComboBox c, boolean visible);
+
+
+ /**
+ * Determines whether the popup button is currently visible.
+ *
+ * @param c the <code>JComboBox</code> whose popup visibility
+ * is retrieved.
+ *
+ * @return <code>true</code> if the popup button is currently
+ * visible, <code>false</code> otherwise.
+ */
+ public abstract boolean isPopupVisible(JComboBox c);
+
+
+ /**
+ * Determines whether the combo box can receive input focus.
+ *
+ * @param c <code>JComboBox</code> whose focus traversability
+ * is to be retrieved.
+ *
+ * @returns <code>true</code> if <code>c</code> can receive
+ * input focus, <code>false</code> otherwise.
+ */
+ public abstract boolean isFocusTraversable(JComboBox c);
+}
diff --git a/libjava/javax/swing/plaf/ComponentInputMapUIResource.java b/libjava/javax/swing/plaf/ComponentInputMapUIResource.java
index 376da1ada8c..40a70552ee3 100644
--- a/libjava/javax/swing/plaf/ComponentInputMapUIResource.java
+++ b/libjava/javax/swing/plaf/ComponentInputMapUIResource.java
@@ -1,5 +1,5 @@
/* ComponentInputMapUIResource.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,28 +37,34 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import javax.swing.*;
+import javax.swing.ComponentInputMap;
+import javax.swing.JComponent;
+
/**
- * ComponentInputMapUIResource
- * @author Andrew Selkirk
- * @version 1.0
+ * A <code>ComponentInputMap</code> that implements the {@link UIResource}
+ * interface to indicate that it belongs to a pluggable
+ * LookAndFeel.
+ *
+ * @see javax.swing.ComponentInputMap
+ * @see javax.swing.InputMap
+ *
+ * @author Andrew Selkirk
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ComponentInputMapUIResource extends ComponentInputMap implements UIResource {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ComponentInputMapUIResource
- * @param component TODO
- */
- public ComponentInputMapUIResource(JComponent component) {
- super(component);
- // TODO
- } // ComponentInputMapUIResource()
-
+public class ComponentInputMapUIResource
+ extends ComponentInputMap
+ implements UIResource
+{
+ /**
+ * Constructs a new <code>ComponentInputMapUIResource</code>.
+ *
+ * @param component the <code>JComponent</code> associated with
+ * this <code>InputMap</code>.
+ */
+ public ComponentInputMapUIResource(JComponent component)
+ {
+ super(component);
+ }
+}
-} // ComponentInputMapUIResource
diff --git a/libjava/javax/swing/plaf/ComponentUI.java b/libjava/javax/swing/plaf/ComponentUI.java
index dba15f71c4f..22c2f30fd7b 100644
--- a/libjava/javax/swing/plaf/ComponentUI.java
+++ b/libjava/javax/swing/plaf/ComponentUI.java
@@ -1,5 +1,5 @@
/* ComponentUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,89 +38,291 @@ exception statement from your version. */
package javax.swing.plaf;
-import java.awt.*;
-import javax.swing.border.*;
-import javax.swing.*;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import javax.accessibility.Accessible;
+import javax.swing.JComponent;
-import javax.accessibility.*;
+/**
+ * The abstract base class for all delegates that provide the
+ * pluggable look and feel for Swing components. User applications
+ * should not need to access this class; it is internal to Swing
+ * and the look-and-feel implementations.
+ *
+ * <p><img src="ComponentUI-1.png" width="700" height="550"
+ * alt="[UML diagram illustrating the architecture for pluggable
+ * look and feels]" />
+ *
+ * <p>Components such as {@link javax.swing.JSlider} do not directly
+ * implement operations related to the look and feel of the user
+ * interface, such as painting or layout. Instead, they use a delegate
+ * object for all such tasks. In the case of <code>JSlider</code>, the
+ * user interface would be provided by some concrete subclass of
+ * {@link javax.swing.plaf.SliderUI}.
+ *
+ * <p>Soon after its creation, a <code>ComponentUI</code> will be sent
+ * an {@link #installUI} message. The <code>ComponentUI</code> will
+ * react by setting properties such as the border or the background
+ * color of the <code>JComponent</code> for which it provides its
+ * services. Soon before the end of its lifecycle, the
+ * <code>ComponentUI</code> will receive an {@link #uninstallUI}
+ * message, at which time the <code>ComponentUI</code> is expected to
+ * undo any changes.
+ *
+ * <p>Note that the <code>ui</code> of a <code>JComponent</code>
+ * changes whenever the user switches between look and feels. For
+ * example, the <code>ui</code> property of a <code>JSlider</code>
+ * could change from an instance of <code>MetalSliderUI</code> to an
+ * instance of <code>FooSliderUI</code>. This switch can happen at any
+ * time, but it will always be performed from inside the Swing thread.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public abstract class ComponentUI
- implements UIResource // ??
{
- boolean contains(JComponent c, int x, int y)
- {
- return c.inside(x,y);
- }
+ /**
+ * Constructs a new UI delegate.
+ */
+ public ComponentUI()
+ {
+ }
+
+
+ /**
+ * Sets up the specified component so it conforms the the design
+ * guidelines of the implemented look and feel. When the look and
+ * feel changes, a <code>ComponentUI</code> delegate is created.
+ * The delegate object then receives an <code>installUI</code>
+ * message.
+ *
+ * <p>This method should perform the following tasks:
+ *
+ * <ul><li>Set visual properties such as borders, fonts, colors, or
+ * icons. However, no change should be performed for those
+ * properties whose values have been directly set by the client
+ * application. To allow the distinction, LookAndFeels are expected
+ * to use values that implement the {@link UIResource} marker
+ * interface, such as {@link BorderUIResource} or {@link
+ * ColorUIResource}.</li>
+ *
+ * <li>If necessary, install a {@link java.awt.LayoutManager}.</li>
+ *
+ * <li>Embed custom sub-components. For instance, the UI delegate
+ * for a {@link javax.swing.JSplitPane} might install a special
+ * component for the divider.</li>
+ *
+ * <li>Register event listeners.</li>
+ *
+ * <li>Set up properties related to keyborad navigation, such as
+ * mnemonics or focus traversal policies.</li></ul>
+ *
+ * @param c the component for which this delegate will provide
+ * services.
+ *
+ * @see #uninstallUI
+ * @see javax.swing.JComponent#setUI
+ * @see javax.swing.JComponent#updateUI
+ */
+ public void installUI(JComponent c)
+ {
+ // The default implementation does not change any properties.
+ }
- // this SHOULD thow an error:
- public static ComponentUI createUI(JComponent c)
- {
- Exception e = new Exception("createUI from ComponentUI should never be called");
- e.printStackTrace();
- System.exit(1);
- return null;
- }
- public Accessible getAccessibleChild(JComponent c, int i)
- {
- //Return the nth Accessible child of the object.
- return null;
- }
+ /**
+ * Puts the specified component into the state it had before
+ * {@link #installUI} was called.
+ *
+ * @param c the component for which this delegate has provided
+ * services.
+ *
+ * @see #installUI
+ * @see javax.swing.JComponent#setUI
+ * @see javax.swing.JComponent#updateUI
+ */
+ public void uninstallUI(JComponent c)
+ {
+ // The default implementation does not change any properties.
+ }
+
+
+ /**
+ * Paints the component according to the design guidelines
+ * of the look and feel. Most subclasses will want to override
+ * this method.
+ *
+ * @param g the graphics for painting.
+ *
+ * @param c the component for which this delegate performs
+ * services.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ }
- public int getAccessibleChildrenCount(JComponent c)
- {
- //Returns the number of accessible children in the object.
- return 0;
- }
- public Dimension getMaximumSize(JComponent c)
+ /**
+ * Fills the specified component with its background color
+ * (unless the <code>opaque</code> property is <code>false</code>)
+ * before calling {@link #paint}.
+ *
+ * <p>It is unlikely that a subclass needs to override this method.
+ * The actual rendering should be performed by the {@link #paint}
+ * method.
+ *
+ * @param g the graphics for painting.
+ *
+ * @param c the component for which this delegate performs
+ * services.
+ *
+ * @see #paint
+ * @see javax.swing.JComponent#paintComponent
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ if (c.isOpaque())
{
- return getPreferredSize(c);
+ g.setColor(c.getBackground());
+ g.fillRect(0, 0, c.getWidth(), c.getHeight());
}
+ paint(g, c);
+ }
+
+
+ /**
+ * Determines the preferred size of a component. The default
+ * implementation returns <code>null</code>, which means that
+ * <code>c</code>&#x2019;s layout manager should be asked to
+ * calculate the preferred size.
+ *
+ * @param c the component for which this delegate performs services.
+ *
+ * @return the preferred size, or <code>null</code> to indicate that
+ * <code>c</code>&#x2019;s layout manager should be asked
+ * for the preferred size.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ return null;
+ }
+
+
+ /**
+ * Determines the minimum size of a component. The default
+ * implementation calls {@link #getPreferredSize}, but subclasses
+ * might want to override this.
+ *
+ * @param c the component for which this delegate performs services.
+ *
+ * @return the minimum size, or <code>null</code> to indicate that
+ * <code>c</code>&#x2019;s layout manager should be asked
+ * to calculate the minimum size.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ return getPreferredSize(c);
+ }
- public Dimension getMinimumSize(JComponent c)
- {
- return getPreferredSize(c);
- }
- public Dimension getPreferredSize(JComponent c)
- {
- return null;
- }
+ /**
+ * Determines the maximum size of a component. The default
+ * implementation calls {@link #getPreferredSize}, but subclasses
+ * might want to override this.
+ *
+ * @param c the component for which this delegate performs services.
+ *
+ * @return the maximum size, or <code>null</code> to indicate that
+ * <code>c</code>&#x2019;s layout manager should be asked
+ * to calculate the maximum size.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ return getPreferredSize(c);
+ }
- public void installUI(JComponent c)
- {
- String id = c.getUIClassID() + ".border";
-
- Border s = UIManager.getBorder( id );
-
- if (s != null)
- {
- c.setBorder( s );
- //System.out.println("OK-INSTALL: " + this + ", ID=" + id + ",B="+s);
- }
- else
- {
- ///System.out.println("FAIL-INSTALL: " + this + ", " + id);
- }
- }
- public void paint(Graphics g, JComponent c)
- {
- // System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this);
- }
+ /**
+ * Determines whether a click into the component at a specified
+ * location is considered as having hit the component. The default
+ * implementation checks whether the point falls into the
+ * component&#x2019;s bounding rectangle. Some subclasses might want
+ * to override this, for example in the case of a rounded button.
+ *
+ * @param c the component for which this delegate performs services.
+ *
+ * @param x the x coordinate of the point, relative to the local
+ * coordinate system of the component. Zero would be be
+ * component&#x2019;s left edge, irrespective of the location
+ * inside its parent.
+ *
+ * @param y the y coordinate of the point, relative to the local
+ * coordinate system of the component. Zero would be be
+ * component&#x2019;s top edge, irrespective of the location
+ * inside its parent.
+ */
+ public boolean contains(JComponent c, int x, int y)
+ {
+ /* JComponent.contains calls the ui delegate for hit
+ * testing. Therefore, endless mutual recursion would result if we
+ * called c.contains(x, y) here.
+ *
+ * The previous Classpath implementation called the deprecated
+ * method java.awt.Component.inside. In the Sun implementation, it
+ * can be observed that inside, other than contains, does not call
+ * the ui delegate. But that inside() behaves different to
+ * contains() clearly is in violation of the method contract, and
+ * it is not something that a good implementation should rely upon
+ * -- even if Classpath ends up being forced to replicate this
+ * apparent bug of the Sun implementation.
+ */
+ return (x >= 0) && (x < c.getWidth())
+ && (y >= 0) && (y < c.getHeight());
+ }
+
+
+ /**
+ * Creates a delegate object for the specified component. Users
+ * should use the <code>createUI</code> method of a suitable
+ * subclass. The implementation of <code>ComponentUI</code>
+ * always throws an error.
+ *
+ * @param c the component for which a UI delegate is requested.
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ throw new Error(
+ "javax.swing.plaf.ComponentUI does not implement createUI; call "
+ + "createUI on a subclass.");
+ }
+
- public void uninstallUI(JComponent c)
- {
- }
+ /**
+ * Counts the number of accessible children in the component. The
+ * default implementation delegates the inquiry to the {@link
+ * javax.accessibility.AccessibleContext} of <code>c</code>.
+ *
+ * @param c the component whose accessible children
+ * are to be counted.
+ */
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ return c.getAccessibleContext().getAccessibleChildrenCount();
+ }
- public void update(Graphics g, JComponent c) {
- if (c.isOpaque()) {
- g.setColor(c.getBackground());
- g.fillRect(0, 0, c.getWidth(),c.getHeight());
- }
- paint(g, c);
- }
-
-}
+ /**
+ * Returns the specified accessible child of the component. The
+ * default implementation delegates the inquiry to the {@link
+ * javax.accessibility.AccessibleContext} of <code>c</code>.
+ *
+ * @param i the index of the accessible child, starting at zero.
+ *
+ * @param c the component whose <code>i</code>-th accessible child
+ * is requested.
+ */
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ return c.getAccessibleContext().getAccessibleChild(i);
+ }
+}
diff --git a/libjava/javax/swing/plaf/DesktopIconUI.java b/libjava/javax/swing/plaf/DesktopIconUI.java
index 880fa43915c..dfe69cc637d 100644
--- a/libjava/javax/swing/plaf/DesktopIconUI.java
+++ b/libjava/javax/swing/plaf/DesktopIconUI.java
@@ -1,5 +1,5 @@
/* DesktopIconUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,22 +38,19 @@ exception statement from your version. */
package javax.swing.plaf;
/**
- * DesktopIconUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a desktop icon.
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class DesktopIconUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DesktopIconUI
- */
- public DesktopIconUI() {
- // TODO
- } // DesktopIconUI()
-
-
-} // DesktopIconUI
+public abstract class DesktopIconUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>DesktopIconUI</code>.
+ */
+ public DesktopIconUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/DesktopPaneUI.java b/libjava/javax/swing/plaf/DesktopPaneUI.java
index 9cb278839fb..6943bf30f60 100644
--- a/libjava/javax/swing/plaf/DesktopPaneUI.java
+++ b/libjava/javax/swing/plaf/DesktopPaneUI.java
@@ -1,5 +1,5 @@
/* DesktopPaneUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,22 +38,22 @@ exception statement from your version. */
package javax.swing.plaf;
/**
- * DesktopPaneUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JDesktopPane</code>.
+ *
+ * @see javax.swing.JDesktopPane
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class DesktopPaneUI extends ComponentUI {
+public abstract class DesktopPaneUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>DesktopPaneUI</code>.
+ */
+ public DesktopPaneUI()
+ {
+ }
+}
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DesktopPaneUI
- */
- public DesktopPaneUI() {
- // TODO
- } // DesktopPaneUI()
-
-
-} // DesktopPaneUI
diff --git a/libjava/javax/swing/plaf/DimensionUIResource.java b/libjava/javax/swing/plaf/DimensionUIResource.java
index 52ea7a912f6..06ec16670cd 100644
--- a/libjava/javax/swing/plaf/DimensionUIResource.java
+++ b/libjava/javax/swing/plaf/DimensionUIResource.java
@@ -1,5 +1,5 @@
/* DimensionUIResource.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,14 +37,32 @@ exception statement from your version. */
package javax.swing.plaf;
+
import java.awt.Dimension;
+
/**
- * STUBBED
+ * A Dimension that is marked as <code>UIResource</code>, which
+ * indicates that it has been installed by a pluggable
+ * LookAndFeel. Such dimensions are replaced when the LookAndFeel
+ * changes.
+ *
+ * @see java.awt.Dimension
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class DimensionUIResource extends Dimension implements UIResource
+public class DimensionUIResource
+ extends Dimension
+ implements UIResource
{
- public DimensionUIResource(int w, int h)
+ /**
+ * Constructs a new DimensionUIResource, given its width and height.
+ *
+ * @param width the width in pixels.
+ * @param height the height in pixels.
+ */
+ public DimensionUIResource(int width, int height)
{
- super(w, h);
+ super(width, height);
}
-} // class DimensionUIResource
+}
diff --git a/libjava/javax/swing/plaf/FileChooserUI.java b/libjava/javax/swing/plaf/FileChooserUI.java
index 00595eb7c66..6031c4216b8 100644
--- a/libjava/javax/swing/plaf/FileChooserUI.java
+++ b/libjava/javax/swing/plaf/FileChooserUI.java
@@ -1,5 +1,5 @@
/* FileChooserUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,75 +37,100 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import java.io.*;
-import javax.swing.*;
-import javax.swing.filechooser.*;
+import java.io.File;
+import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileView;
/**
- * FileChooserUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JFileChooser</code>.
+ *
+ * @see javax.swing.JFileChooser
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class FileChooserUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor FileChooserUI
- */
- public FileChooserUI() {
- // TODO
- } // FileChooserUI()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getAcceptAllFileFilter
- * @param chooser TODO
- * @returns FileFilter
- */
- public abstract FileFilter getAcceptAllFileFilter(JFileChooser chooser);
-
- /**
- * getFileView
- * @param chooser TODO
- * @returns FileView
- */
- public abstract FileView getFileView(JFileChooser chooser);
-
- /**
- * getApproveButtonText
- * @param chooser TODO
- * @returns String
- */
- public abstract String getApproveButtonText(JFileChooser chooser);
-
- /**
- * getDialogTitle
- * @param chooser TODO
- * @returns String
- */
- public abstract String getDialogTitle(JFileChooser chooser);
-
- /**
- * rescanCurrentDirectory
- * @param value0 TODO
- */
- public abstract void rescanCurrentDirectory(JFileChooser chooser);
-
- /**
- * ensureFileIsVisible
- * @param chooser TODO
- * @param file TODO
- */
- public abstract void ensureFileIsVisible(JFileChooser chooser, File file);
-
-
-} // FileChooserUI
+public abstract class FileChooserUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>FileChooserUI</code>.
+ */
+ public FileChooserUI()
+ {
+ }
+
+
+ /**
+ * Returns a <code>FileFilter</code> that accepts every file. While
+ * the filtering itself is not specific to any look and feel, the
+ * text returned by <code>FileFilter.getDescription()</code> need
+ * not be the same across all look and feels.
+ *
+ * @param chooser the <code>JFileChooser</code> for which
+ * a <code>FileFilter</code> is requested.
+ *
+ * @see javax.swing.JFileChooser#getAcceptAllFileFilter
+ * @see javax.swing.filechooser.FileFilter#getDescription
+ */
+ public abstract FileFilter getAcceptAllFileFilter(JFileChooser chooser);
+
+
+ /**
+ * Returns a view to a file, which is able to retrieve its name,
+ * icon, and other properties that are relevant for presenting
+ * the file to the user.
+ *
+ * @param chooser the <code>JFileChooser</code> for which
+ * a <code>FileFilter</code> is requested.
+ */
+ public abstract FileView getFileView(JFileChooser chooser);
+
+
+ /**
+ * Determines which text is appropriate for the approve button
+ * according to the design guidelines of the implemented
+ * look and feel.
+ *
+ * @param chooser the <code>JFileChooser</code> whose
+ * button text is requested.
+ *
+ * @see javax.swing.JFileChoose#getApproveButtonText
+ */
+ public abstract String getApproveButtonText(JFileChooser chooser);
+
+
+ /**
+ * Determines which text is appropriate for the title bar of a
+ * <code>JFileChooser</code> according to the design guidelines of
+ * the implemented look and feel.
+ *
+ * @param chooser the <code>JFileChooser</code> whose
+ * dialog title is requested.
+ *
+ * @see javax.swing.JFileChoose#getDialogtitle
+ */
+ public abstract String getDialogTitle(JFileChooser chooser);
+
+
+ /**
+ * Refreshes the currently displayed directory.
+ *
+ * @param chooser the <code>JFileChooser</code> whose
+ * dialog title needs re-scanning.
+ */
+ public abstract void rescanCurrentDirectory(JFileChooser chooser);
+
+
+ /**
+ * Ensures that a specified file is visible in the
+ * <code>JFileChooser</code>
+ *
+ * @param chooser the <code>JFileChooser</code> that
+ * should display the file <code>file</code>.
+ *
+ * @param file the file that needs to be made visible.
+ */
+ public abstract void ensureFileIsVisible(JFileChooser chooser, File file);
+}
diff --git a/libjava/javax/swing/plaf/FontUIResource.java b/libjava/javax/swing/plaf/FontUIResource.java
index e158ced7403..a4a45de724f 100644
--- a/libjava/javax/swing/plaf/FontUIResource.java
+++ b/libjava/javax/swing/plaf/FontUIResource.java
@@ -1,5 +1,5 @@
/* FontUIResource.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,18 +37,65 @@ exception statement from your version. */
package javax.swing.plaf;
+
import java.awt.Font;
+
+
/**
- * STUBBED
+ * A font that is marked as <code>UIResource</code>, which
+ * indicates that it has been installed by a pluggable
+ * LookAndFeel. Such dimensions are replaced when the LookAndFeel
+ * changes.
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class FontUIResource extends Font implements UIResource
+public class FontUIResource
+ extends Font
+ implements UIResource
{
- public FontUIResource(Font f)
- {
- super(f.getName(), f.getStyle(), f.getSize());
- }
+ /**
+ * Constructs a new <code>FontUIResource</code> given
+ * the name, style and size of the font.
+ *
+ * @param name the name of the font. A number of
+ * &#x201c;logical&#x201d; names are supported by any Java
+ * implementation. These are
+ * <code>&#x201c;Dialog&#x201d;</code>,
+ * <code>&#x201c;DialogInput&#x201d;</code>,
+ * <code>&#x201c;Monospaced&#x201d;</code>,
+ * <code>&#x201c;Serif&#x201d;</code>, and
+ * <code>&#x201c;SansSerif&#x201d;</code>.
+ *
+ * @param style the style of the font, for instance {@link
+ * java.awt.Font#BOLD} or {@link java.awt.Font#PLAIN}.
+ *
+ * @param size the size of the font in typographic points, for
+ * instance 10, 12 or 13. Designers of LookAndFeels should be
+ * aware that some languages (like Japanese and Chinese) have
+ * glyphs that are too complex to be legible at small point
+ * sizes.
+ */
public FontUIResource(String name, int style, int size)
{
super(name, style, size);
}
-} // class FontUIResource
+
+
+ /**
+ * Constructs a new <code>FontUIResource</code> given
+ * an existing font.
+ *
+ * @param f the font that serves as a template.
+ */
+ public FontUIResource(Font f)
+ {
+ /* This implementation will get rid of many font properties,
+ * such as skewing, values of multiple master design axes,
+ * etc., unless they get encoded into the name. It probably
+ * is not a problem for LookAndFeels because user interfaces
+ * are usually not very advanced with respect to typography.
+ */
+ super(f.getName(), f.getStyle(), f.getSize());
+ }
+}
diff --git a/libjava/javax/swing/plaf/IconUIResource.java b/libjava/javax/swing/plaf/IconUIResource.java
index 2d948d7823d..ca1ee7dee10 100644
--- a/libjava/javax/swing/plaf/IconUIResource.java
+++ b/libjava/javax/swing/plaf/IconUIResource.java
@@ -1,5 +1,5 @@
/* IconUIResource.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,29 +37,86 @@ exception statement from your version. */
package javax.swing.plaf;
+
import java.awt.Component;
import java.awt.Graphics;
import java.io.Serializable;
import javax.swing.Icon;
+
+
/**
- * STUBBED
+ * An icon that is marked as <code>UIResource</code>, which
+ * indicates that it has been installed by a pluggable
+ * LookAndFeel. Such icons are replaced when the LookAndFeel
+ * changes.
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class IconUIResource implements Icon, UIResource, Serializable
+public class IconUIResource
+ implements Icon, UIResource, Serializable
{
+ /**
+ * Verified using the <code>serialver</code> tool of Sun JDK 1.4.1_01
+ * on GNU/Linux 2.4.18.
+ */
static final long serialVersionUID = 3327049506004830542L;
+
+ /**
+ * The icon that is wrapped by this <code>IconUIResource</code>.
+ */
+ private Icon delegate;
+
+
+ /**
+ * Constructs a <code>IconUIResource</code> that wraps another
+ * icon. All messages are forwarded to the delegate icon.
+ *
+ * @param delegate the icon that is wrapped by this
+ * <code>IconUIResource</code>.
+ */
public IconUIResource(Icon delegate)
{
+ this.delegate = delegate;
}
+
+
+ /**
+ * Paints the icon by asking the delegate icon to paint itself.
+ *
+ * @param c the Component whose icon is being painted. Some icons
+ * use this argument to retrieve properties like the
+ * background color.
+ *
+ * @param g the graphics into which the icon will be painted.
+ *
+ * @param x the horizontal position of the icon.
+ *
+ * @param y the vertical position of the icon.
+ */
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ delegate.paintIcon(c, g, x, y);
}
+
+
+ /**
+ * Returns the width of the icon in pixels. The implementation
+ * determines and returns the width of the delegate icon.
+ */
public int getIconWidth()
{
- return 0;
+ return delegate.getIconWidth();
}
+
+
+ /**
+ * Returns the height of the icon in pixels. The implementation
+ * determines and returns the height of the delegate icon.
+ */
public int getIconHeight()
{
- return 0;
+ return delegate.getIconHeight();
}
-} // class IconUIResource
+}
diff --git a/libjava/javax/swing/plaf/InputMapUIResource.java b/libjava/javax/swing/plaf/InputMapUIResource.java
index 4d6793bd0a8..f638dd7b8cd 100644
--- a/libjava/javax/swing/plaf/InputMapUIResource.java
+++ b/libjava/javax/swing/plaf/InputMapUIResource.java
@@ -1,5 +1,5 @@
/* InputMapUIResource.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,26 +37,27 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import javax.swing.*;
+import javax.swing.InputMap;
+
/**
- * InputMapUIResource
- * @author Andrew Selkirk
- * @version 1.0
+ * An <code>InputMap</code> that is marked as <code>UIResource</code>,
+ * which indicates that it has been installed by a pluggable
+ * LookAndFeel. Such dimensions are replaced when the LookAndFeel
+ * changes.
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class InputMapUIResource extends InputMap implements UIResource {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor InputMapUIResource
- */
- public InputMapUIResource() {
- // TODO
- } // InputMapUIResource()
-
+public class InputMapUIResource
+ extends InputMap
+ implements UIResource
+{
+ /**
+ * Constructs a new <code>InputMapUIResource</code>.
+ */
+ public InputMapUIResource()
+ {
+ }
+}
-} // InputMapUIResource
diff --git a/libjava/javax/swing/plaf/InsetsUIResource.java b/libjava/javax/swing/plaf/InsetsUIResource.java
index 7c989ab2ee0..ad2eb1b214b 100644
--- a/libjava/javax/swing/plaf/InsetsUIResource.java
+++ b/libjava/javax/swing/plaf/InsetsUIResource.java
@@ -1,5 +1,5 @@
/* InsetsUIResource.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,14 +37,41 @@ exception statement from your version. */
package javax.swing.plaf;
+
import java.awt.Insets;
+import java.io.Serializable;
+
+
/**
- * STUBBED
+ * An <code>Insets</code> that is marked as <code>UIResource</code>,
+ * which indicates that it has been installed by a pluggable
+ * LookAndFeel. Such insets are replaced when the LookAndFeel changes.
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class InsetsUIResource extends Insets implements UIResource
+public class InsetsUIResource
+ extends Insets
+ implements Cloneable, UIResource, Serializable
{
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 5622110143266315421L;
+
+
+ /**
+ * Constructs a new <code>InsetsUIResource</code> given the
+ * inset at each edge.
+ *
+ * @param top the inset at the top, in pixels.
+ * @param left the inset at the left, in pixels.
+ * @param bottom the inset at the bottom, in pixels.
+ * @param right the inset at the right, in pixels.
+ */
public InsetsUIResource(int top, int left, int bottom, int right)
{
super(top, left, bottom, right);
}
-} // class InsetsUIResource
+}
diff --git a/libjava/javax/swing/plaf/InternalFrameUI.java b/libjava/javax/swing/plaf/InternalFrameUI.java
index 3019460c74a..69bfb6506e2 100644
--- a/libjava/javax/swing/plaf/InternalFrameUI.java
+++ b/libjava/javax/swing/plaf/InternalFrameUI.java
@@ -1,5 +1,5 @@
/* InternalFrameUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * InternalFrameUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JInternalFrame</code>.
+ *
+ * @see javax.swing.JInternalFrame
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class InternalFrameUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor InternalFrameUI
- */
- public InternalFrameUI() {
- // TODO
- } // InternalFrameUI()
-
-
-} // InternalFrameUI
+public abstract class InternalFrameUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>InternalFrameUI</code>.
+ */
+ public InternalFrameUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/LabelUI.java b/libjava/javax/swing/plaf/LabelUI.java
index dc70ae284a8..bda4448b9fe 100644
--- a/libjava/javax/swing/plaf/LabelUI.java
+++ b/libjava/javax/swing/plaf/LabelUI.java
@@ -1,5 +1,5 @@
/* LabelUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,22 @@ exception statement from your version. */
package javax.swing.plaf;
-
-public class LabelUI extends ComponentUI
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JLabel</code>.
+ *
+ * @see javax.swing.JLabel
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class LabelUI
+ extends ComponentUI
{
+ /**
+ * Constructs a new <code>LabelUI</code>.
+ */
+ public LabelUI()
+ {
+ }
}
diff --git a/libjava/javax/swing/plaf/ListUI.java b/libjava/javax/swing/plaf/ListUI.java
index be60eb4863b..71ec7704cc7 100644
--- a/libjava/javax/swing/plaf/ListUI.java
+++ b/libjava/javax/swing/plaf/ListUI.java
@@ -1,5 +1,5 @@
/* ListUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,77 @@ exception statement from your version. */
package javax.swing.plaf;
+import java.awt.Point;
+import java.awt.Rectangle;
+import javax.swing.JList;
-public class ListUI extends ComponentUI
+
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JList</code>.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class ListUI
+ extends ComponentUI
{
+ /**
+ * Constructs a new <code>ListUI</code>.
+ */
+ public ListUI()
+ {
+ }
+
+
+ /**
+ * Determines the cell index which is the closest to the specified
+ * location. The find out whether the returned cell actually
+ * contains the location, the caller should also use {@link
+ * #getCellBounds}.
+ *
+ * @param list the <code>JList</code> for which this delegate object
+ * provides the pluggable user interface.
+ *
+ * @param location a point in the <code>JList</code> coordinate
+ * system.
+ *
+ * @return the index of the closest cell, or -1 if the list model
+ * is empty.
+ */
+ public abstract int locationToIndex(JList index, Point location);
+
+
+ /**
+ * Determines the location of the specified cell.
+ *
+ * @param list the <code>JList</code> for which this delegate object
+ * provides the pluggable user interface.
+ *
+ * @param index the zero-based index of the cell whose location shall be
+ * determined.
+ *
+ * @return the position of the top left corner of the cell in the
+ * <code>JList</code> coordinate system, or <code>null</code>
+ * if <code>cell</code> does not designate a valid cell.
+ */
+ public abstract Point indexToLocation(JList list, int index);
+
+
+ /**
+ * Determines the bounding box of the rectangle spanned by
+ * two list indices.
+ *
+ * @param list the <code>JList</code> for which this delegate object
+ * provides the pluggable user interface.
+ *
+ * @param index1 the zero-based index of the first cell.
+ *
+ * @param index2 the zero-based index of the second cell.
+ *
+ * @return the spanned rectangle, or <code>null</code> if either
+ * <code>index1</code> or <code>index2</code> does not
+ * designate a valid cell.
+ */
+ public abstract Rectangle getCellBounds(JList list,
+ int index1, int index2);
}
diff --git a/libjava/javax/swing/plaf/MenuBarUI.java b/libjava/javax/swing/plaf/MenuBarUI.java
index 84c29d13ef5..fa350b66015 100644
--- a/libjava/javax/swing/plaf/MenuBarUI.java
+++ b/libjava/javax/swing/plaf/MenuBarUI.java
@@ -1,5 +1,5 @@
/* MenuBarUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * MenuBarUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JMenuBar</code>.
+ *
+ * @see javax.swing.JMenuBar
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class MenuBarUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor MenuBarUI
- */
- public MenuBarUI() {
- // TODO
- } // MenuBarUI()
-
-
-} // MenuBarUI
+public abstract class MenuBarUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>MenuBarUI</code>.
+ */
+ public MenuBarUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/MenuItemUI.java b/libjava/javax/swing/plaf/MenuItemUI.java
index a9271219c83..c44d1f441a9 100644
--- a/libjava/javax/swing/plaf/MenuItemUI.java
+++ b/libjava/javax/swing/plaf/MenuItemUI.java
@@ -1,5 +1,5 @@
/* MenuItemUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * MenuItemUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JMenuItem</code>.
+ *
+ * @see javax.swing.JMenuItem
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class MenuItemUI extends ButtonUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor MenuItemUI
- */
- public MenuItemUI() {
- // TODO
- } // MenuItemUI()
-
-
-} // MenuItemUI
+public abstract class MenuItemUI
+ extends ButtonUI
+{
+ /**
+ * Constructs a new <code>MenuItemUI</code>.
+ */
+ public MenuItemUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/OptionPaneUI.java b/libjava/javax/swing/plaf/OptionPaneUI.java
index 94de7943292..8a954537a74 100644
--- a/libjava/javax/swing/plaf/OptionPaneUI.java
+++ b/libjava/javax/swing/plaf/OptionPaneUI.java
@@ -1,5 +1,5 @@
/* OptionPaneUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,41 @@ 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;
-import javax.accessibility.*;
-public class OptionPaneUI extends ComponentUI
+import javax.swing.JOptionPane;
+
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JOptionPane</code>.
+ *
+ * @see javax.swing.JOptionPane
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class OptionPaneUI
+ extends ComponentUI
{
+ /**
+ * Gives keyboard input focus to the component that represents
+ * the default value.
+ *
+ * @param pane the <code>JOptionPane</code> for which this delegate
+ * object provides the pluggable user interface.
+ */
+ public abstract void selectInitialValue(JOptionPane pane);
+
+
+ /**
+ * Determines whether the user has provided custom components
+ * for the options or the message.
+ *
+ * @param pane the <code>JOptionPane</code> for which this delegate
+ * object provides the pluggable user interface.
+ *
+ * @return <code>true</code> if the user has supplied any custom
+ * components; <code>false</code> if all components are
+ * provided by Swing or a LookAndFeel.
+ */
+ public abstract boolean containsCustomComponents(JOptionPane pane);
}
diff --git a/libjava/javax/swing/plaf/PanelUI.java b/libjava/javax/swing/plaf/PanelUI.java
index 8a418342e82..d39d2e54735 100644
--- a/libjava/javax/swing/plaf/PanelUI.java
+++ b/libjava/javax/swing/plaf/PanelUI.java
@@ -1,5 +1,5 @@
/* PanelUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,21 @@ exception statement from your version. */
package javax.swing.plaf;
-
-public class PanelUI extends ComponentUI
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JPanel</code>.
+ *
+ * @see javax.swing.JPanel
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class PanelUI
+ extends ComponentUI
{
+ /**
+ * Constructs a new <code>PanelUI</code>.
+ */
+ public PanelUI()
+ {
+ }
}
diff --git a/libjava/javax/swing/plaf/PopupMenuUI.java b/libjava/javax/swing/plaf/PopupMenuUI.java
index d1faa78d146..1871b9b7985 100644
--- a/libjava/javax/swing/plaf/PopupMenuUI.java
+++ b/libjava/javax/swing/plaf/PopupMenuUI.java
@@ -1,5 +1,5 @@
/* PopupMenuUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,40 +37,80 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import java.awt.event.*;
+import java.awt.event.MouseEvent;
+import javax.swing.JPopupMenu;
+import javax.swing.Popup;
+import javax.swing.PopupFactory;
+
/**
- * PopupMenuUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JPopupMenu</code>.
+ *
+ * @see javax.swing.JPopupMenu
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class PopupMenuUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor PopupMenuUI
- */
- public PopupMenuUI() {
- // TODO
- } // PopupMenuUI()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * isPopupTrigger
- * @param event TODO
- * @returns boolean
- */
- public boolean isPopupTrigger(MouseEvent event) {
- return false; // TODO
- } // isPopupTrigger()
-
-
-} // PopupMenuUI
+public abstract class PopupMenuUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>PopupMenuUI</code>.
+ */
+ public PopupMenuUI()
+ {
+ }
+
+
+ /**
+ * Tests whether or not a mouse event triggers a popup menu.
+ *
+ * <p>The default implementation calls
+ * <code>event.isPopupTrigger()</code>, which checks for the gesture
+ * that is common for the platform on which the application runs. If
+ * a look and feel wants to employ non-standard conventions for
+ * triggering a popup menu, it can override this method.
+ *
+ * @param event the event to check.
+ *
+ * @return <code>true</code> if the event triggers a popup menu;
+ * <code>false</code> otherwise.
+ *
+ * @since 1.3
+ */
+ public boolean isPopupTrigger(MouseEvent event)
+ {
+ return event.isPopupTrigger();
+ }
+
+
+ /**
+ * Creates a <code>Popup</code> for displaying the popup menu. The
+ * default implementation uses the {@link javax.swing.PopupFactory}
+ * for retrieving a suitable <code>Popup</code>, but subclasses
+ * might want to override this method if a LookAndFeel needs special
+ * Popups.
+ *
+ * @param popup the <code>JPopupMenu</code> for whose display
+ * a <code>Popup</code> is needed.
+ *
+ * @param x the horizontal position where the popup will be
+ * displayed.
+ *
+ * @param y the vertical position where the popup will be
+ * displayed.
+ *
+ * @return a <code>Popup</code> for showing and hiding
+ * the menu.
+ *
+ * @since 1.4
+ */
+ public Popup getPopup(JPopupMenu popup, int x, int y)
+ {
+ return PopupFactory.getSharedInstance().getPopup(
+ /* origin/owner of the popup */ popup.getInvoker(),
+ /* contents */ popup,
+ x, y);
+ }
+}
diff --git a/libjava/javax/swing/plaf/ProgressBarUI.java b/libjava/javax/swing/plaf/ProgressBarUI.java
index c5f6466e7ab..28ea6f3a97a 100644
--- a/libjava/javax/swing/plaf/ProgressBarUI.java
+++ b/libjava/javax/swing/plaf/ProgressBarUI.java
@@ -1,5 +1,5 @@
/* ProgressBarUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * ProgressBarUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JProgressBar</code>.
+ *
+ * @see javax.swing.JProgressBar
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ProgressBarUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ProgressBarUI
- */
- public ProgressBarUI() {
- // TODO
- } // ProgressBarUI()
-
-
-} // ProgressBarUI
+public abstract class ProgressBarUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>ProgressBarUI</code>.
+ */
+ public ProgressBarUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/RootPaneUI.java b/libjava/javax/swing/plaf/RootPaneUI.java
index 53529fa6e89..0943c9882e4 100644
--- a/libjava/javax/swing/plaf/RootPaneUI.java
+++ b/libjava/javax/swing/plaf/RootPaneUI.java
@@ -1,5 +1,5 @@
/* RootPaneUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,22 +38,21 @@ exception statement from your version. */
package javax.swing.plaf;
/**
- * RootPaneUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JRootPane</code>.
+ *
+ * @see javax.swing.JRootPane
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class RootPaneUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor RootPaneUI
- */
- public RootPaneUI() {
- // TODO
- } // RootPaneUI()
-
-
-} // RootPaneUI
+public abstract class RootPaneUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>RootPaneUI</code>.
+ */
+ public RootPaneUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/ScrollBarUI.java b/libjava/javax/swing/plaf/ScrollBarUI.java
index 0d778f3daa4..37c0cf783cd 100644
--- a/libjava/javax/swing/plaf/ScrollBarUI.java
+++ b/libjava/javax/swing/plaf/ScrollBarUI.java
@@ -1,5 +1,5 @@
/* ScrollBarUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,22 +38,21 @@ exception statement from your version. */
package javax.swing.plaf;
/**
- * ScrollBarUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JScrollBar</code>.
+ *
+ * @see javax.swing.JScrollBar
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ScrollBarUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ScrollBarUI
- */
- public ScrollBarUI() {
- // TODO
- } // ScrollBarUI()
-
-
-} // ScrollBarUI
+public abstract class ScrollBarUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>ScrollBarUI</code>.
+ */
+ public ScrollBarUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/ScrollPaneUI.java b/libjava/javax/swing/plaf/ScrollPaneUI.java
index 3b36b08012b..7d0bb892ada 100644
--- a/libjava/javax/swing/plaf/ScrollPaneUI.java
+++ b/libjava/javax/swing/plaf/ScrollPaneUI.java
@@ -1,5 +1,5 @@
/* ScrollPaneUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * ScrollPaneUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JScrollPane</code>.
+ *
+ * @see javax.swing.JScrollPane
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ScrollPaneUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ScrollPaneUI
- */
- public ScrollPaneUI() {
- // TODO
- } // ScrollPaneUI()
-
-
-} // ScrollPaneUI
+public abstract class ScrollPaneUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>ScrollPaneUI</code>.
+ */
+ public ScrollPaneUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/SeparatorUI.java b/libjava/javax/swing/plaf/SeparatorUI.java
index 23622a06286..03778b95d14 100644
--- a/libjava/javax/swing/plaf/SeparatorUI.java
+++ b/libjava/javax/swing/plaf/SeparatorUI.java
@@ -1,5 +1,5 @@
/* SeparatorUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,22 +38,21 @@ exception statement from your version. */
package javax.swing.plaf;
/**
- * SeparatorUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JSeparator</code>.
+ *
+ * @see javax.swing.JSeparator
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SeparatorUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor SeparatorUI
- */
- public SeparatorUI() {
- // TODO
- } // SeparatorUI()
-
-
-} // SeparatorUI
+public abstract class SeparatorUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>SeparatorUI</code>.
+ */
+ public SeparatorUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/SliderUI.java b/libjava/javax/swing/plaf/SliderUI.java
index 59d51c10d51..2a839f802d6 100644
--- a/libjava/javax/swing/plaf/SliderUI.java
+++ b/libjava/javax/swing/plaf/SliderUI.java
@@ -1,5 +1,5 @@
/* SliderUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * SliderUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JSlider</code>.
+ *
+ * @see javax.swing.JSlider
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SliderUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor SliderUI
- */
- public SliderUI() {
- // TODO
- } // SliderUI()
-
-
-} // SliderUI
+public abstract class SliderUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>SliderUI</code>.
+ */
+ public SliderUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/SplitPaneUI.java b/libjava/javax/swing/plaf/SplitPaneUI.java
index 6448ba86653..020a54a626f 100644
--- a/libjava/javax/swing/plaf/SplitPaneUI.java
+++ b/libjava/javax/swing/plaf/SplitPaneUI.java
@@ -1,5 +1,5 @@
/* SplitPaneUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,75 +37,97 @@ exception statement from your version. */
package javax.swing.plaf;
-// Imports
-import java.awt.*;
-import javax.swing.*;
+
+import java.awt.Graphics;
+import javax.swing.JSplitPane;
+
/**
- * SplitPaneUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JSplitPane</code>.
+ *
+ * @see javax.swing.JSplitPane
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SplitPaneUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor SplitPaneUI
- */
- public SplitPaneUI() {
- // TODO
- } // SplitPaneUI()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * resetToPreferredSizes
- * @param splitpane TODO
- */
- public abstract void resetToPreferredSizes(JSplitPane splitpane);
-
- /**
- * setDividerLocation
- * @param splitpane TODO
- * @param location TODO
- */
- public abstract void setDividerLocation(JSplitPane splitpane,
- int location);
-
- /**
- * getDividerLocation
- * @param splitpane TODO
- * @returns int
- */
- public abstract int getDividerLocation(JSplitPane splitpane);
-
- /**
- * getMinimumDividerLocation
- * @param splitpane TODO
- * @returns int
- */
- public abstract int getMinimumDividerLocation(JSplitPane splitpane);
-
- /**
- * getMaximumDividerLocation
- * @param splitpane TODO
- * @returns int
- */
- public abstract int getMaximumDividerLocation(JSplitPane splitpane);
-
- /**
- * finishedPaintingChildren
- * @param splitpane TODO
- * @param graphics TODO
- */
- public abstract void finishedPaintingChildren(JSplitPane splitpane,
- Graphics graphics);
-
-
-} // SplitPaneUI
+public abstract class SplitPaneUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>SplitPaneUI</code>.
+ */
+ public SplitPaneUI()
+ {
+ }
+
+
+ /**
+ * Moves the divider to the location which best respects
+ * the preferred sizes of the children.
+ *
+ * @param pane the <code>JSplitPane</code> for thich this
+ * delegate provides the look and feel.
+ */
+ public abstract void resetToPreferredSizes(JSplitPane pane);
+
+
+ /**
+ * Moves the divider to the specified location.
+ *
+ * @param pane the <code>JSplitPane</code> for thich this
+ * delegate provides the look and feel.
+ *
+ * @param location the new location of the divider.
+ */
+ public abstract void setDividerLocation(JSplitPane pane,
+ int location);
+
+
+ /**
+ * Determines the current location of the divider.
+ *
+ * @param pane the <code>JSplitPane</code> for thich this
+ * delegate provides the look and feel.
+ *
+ * @return the current location of the divider.
+ */
+ public abstract int getDividerLocation(JSplitPane pane);
+
+
+ /**
+ * Determines the minimum location of the divider.
+ *
+ * @param pane the <code>JSplitPane</code> for thich this
+ * delegate provides the look and feel.
+ *
+ * @return the leftmost (or topmost) possible location
+ * of the divider.
+ */
+ public abstract int getMinimumDividerLocation(JSplitPane pane);
+
+
+ /**
+ * Determines the maximum location of the divider.
+ *
+ * @param pane the <code>JSplitPane</code> for thich this
+ * delegate provides the look and feel.
+ *
+ * @return the bottommost (or rightmost) possible location
+ * of the divider.
+ */
+ public abstract int getMaximumDividerLocation(JSplitPane pane);
+
+
+ /**
+ * Called by the <code>JSplitPane</code> after it has finished
+ * painting its children.
+ *
+ * @param pane the <code>JSplitPane</code> for thich this
+ * delegate provides the look and feel.
+ *
+ * @param g the Graphics used for painting.
+ */
+ public abstract void finishedPaintingChildren(JSplitPane pane,
+ Graphics g);
+}
diff --git a/libjava/javax/swing/plaf/TabbedPaneUI.java b/libjava/javax/swing/plaf/TabbedPaneUI.java
index a9211c96705..20c36c30c21 100644
--- a/libjava/javax/swing/plaf/TabbedPaneUI.java
+++ b/libjava/javax/swing/plaf/TabbedPaneUI.java
@@ -1,5 +1,5 @@
/* TabbedPaneUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,24 +38,74 @@ exception statement from your version. */
package javax.swing.plaf;
-import java.awt.*;
-import javax.swing.*;
+import java.awt.Rectangle;
+import javax.swing.JTabbedPane;
-public class TabbedPaneUI extends ComponentUI
+
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JTabbedPane</code>.
+ *
+ * @see javax.swing.JTabbedPane
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class TabbedPaneUI
+ extends ComponentUI
{
- public Rectangle getTabBounds(JTabbedPane pane, int index)
- {
- return null;
- }
-
- public int getTabRunCount(JTabbedPane pane)
- {
- return 0;
- }
-
- public int tabForCoordinate(JTabbedPane pane, int x, int y)
- {
- return 0;
- }
+ /**
+ * Constructs a new <code>TabbedPaneUI</code>.
+ */
+ public TabbedPaneUI()
+ {
+ }
+
+
+ /**
+ * Determines which tab lies at a given position.
+ *
+ * @param pane the <code>JTabbedPane</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param x the horizontal position, where zero is the left
+ * edge of <code>pane</code>.
+ *
+ * @param y the vertical position, where zero is the top
+ * edge of <code>pane</code>.
+ *
+ * @return the zero-based index of the tab, or -1 if no
+ * tab is at the specified position.
+ */
+ public abstract int tabForCoordinate(JTabbedPane pane,
+ int x, int y);
+
+
+ /**
+ * Calculates the bounding box of a tab.
+ *
+ * @param pane the <code>JTabbedPane</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param index the index of the tab, which must be an integer
+ * in the range <code>[0 .. pane.getTabCount() - 1]</code>.
+ *
+ * @return the bounding box of the <code>index</code>-th tab,
+ * in the coordinate system of <code>pane</code>.
+ */
+ public abstract Rectangle getTabBounds(JTabbedPane pane, int index);
+
+
+ /**
+ * Determines how many runs are used to display tabs.
+ *
+ * @param pane the <code>JTabbedPane</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @return the number of tab runs.
+ *
+ * @see javax.swing.JTabbedPane#getTabRunCount()
+ */
+ public abstract int getTabRunCount(JTabbedPane pane);
}
diff --git a/libjava/javax/swing/plaf/TableHeaderUI.java b/libjava/javax/swing/plaf/TableHeaderUI.java
index 4510be588ea..26bc9e29b5d 100644
--- a/libjava/javax/swing/plaf/TableHeaderUI.java
+++ b/libjava/javax/swing/plaf/TableHeaderUI.java
@@ -1,5 +1,5 @@
/* TableHeaderUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * TableHeaderUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JTableHeader</code>.
+ *
+ * @see javax.swing.table.JTableHeader
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TableHeaderUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor TableHeaderUI
- */
- public TableHeaderUI() {
- // TODO
- } // TableHeaderUI()
-
-
-} // TableHeaderUI
+public abstract class TableHeaderUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>TableHeaderUI</code>.
+ */
+ public TableHeaderUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/TableUI.java b/libjava/javax/swing/plaf/TableUI.java
index 473e04ebad4..7062b93cc12 100644
--- a/libjava/javax/swing/plaf/TableUI.java
+++ b/libjava/javax/swing/plaf/TableUI.java
@@ -1,5 +1,5 @@
/* TableUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * TableUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JTable</code>.
+ *
+ * @see javax.swing.JTable
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TableUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor TableUI
- */
- public TableUI() {
- // TODO
- } // TableUI()
-
-
-} // TableUI
+public abstract class TableUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>TableUI</code>.
+ */
+ public TableUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/TextUI.java b/libjava/javax/swing/plaf/TextUI.java
index abf5316d215..14f89d6006e 100644
--- a/libjava/javax/swing/plaf/TextUI.java
+++ b/libjava/javax/swing/plaf/TextUI.java
@@ -1,5 +1,5 @@
/* TextUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,27 +38,247 @@ exception statement from your version. */
package javax.swing.plaf;
-import javax.swing.text.*;
-import java.awt.*;
+import java.awt.Point;
+import java.awt.Rectangle;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.EditorKit;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.Position;
+import javax.swing.text.View;
-public abstract class TextUI extends ComponentUI
+
+/**
+ * An abstract base class for delegates that provide the user
+ * interface for text editors.
+ *
+ * @see javax.swing.text.JTextComponent
+ *
+ * @author Ronald Veldema (rveldema@cs.vu.nl)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class TextUI
+ extends ComponentUI
{
- public TextUI()
- {
- }
-
- public abstract void damageRange(JTextComponent t, int p0, int p1);
- public abstract void damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, Position.Bias secondBias);
- public abstract EditorKit getEditorKit(JTextComponent t);
- public abstract int getNextVisualPositionFrom(JTextComponent t,
- int pos,
- Position.Bias b,
- int direction,
- Position.Bias[] biasRet);
- public abstract View getRootView(JTextComponent t);
- public abstract Rectangle modelToView(JTextComponent t, int pos);
- public abstract Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias);
- public abstract int viewToModel(JTextComponent t, Point pt);
- public abstract int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn);
+ /**
+ * Constructs a new <code>TextUI</code>.
+ */
+ public TextUI()
+ {
+ }
+
+
+ /**
+ * Calculates the geometric extent of the character at the
+ * given offset.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param pos the zero-based index of the character into the
+ * document model.
+ *
+ * @return the bounding box of the character at index
+ * <code>pos</code>, in view coordinates.
+ *
+ * @throws BadLocationException if <code>pos</code> does not
+ * designate a valid position in the document model.
+ *
+ * @see javax.swing.text.View#modelToView(int,
+ * javax.swing.text.Position.Bias, int,
+ * javax.swing.text.position.Bias, java.awt.Shape)
+ */
+ public abstract Rectangle modelToView(JTextComponent tc, int pos)
+ throws BadLocationException;
+
+
+ /**
+ * Calculates the geometric extent of the character at the
+ * given offset.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param pos the zero-based index of the character into the
+ * document model.
+ *
+ * @param bias whether to take the character before or after the
+ * caret position indicated by <code>pos</code>. The value
+ * must be either {@link
+ * javax.swing.text.Position.Bias#Backward} or {@link
+ * javax.swing.text.Position.Bias#Forward}.
+ *
+ * @return the bounding box of the character at index
+ * <code>pos</code>, in view coordinates.
+ *
+ * @throws BadLocationException if <code>pos</code> does not
+ * designate a valid position in the document model.
+ *
+ * @see javax.swing.text.View#modelToView(int,
+ * javax.swing.text.Position.Bias, int,
+ * javax.swing.text.position.Bias, java.awt.Shape)
+ */
+ public abstract Rectangle modelToView(JTextComponent tc, int pos,
+ Position.Bias bias)
+ throws BadLocationException;
+
+
+ /**
+ * Finds the caret position which is closest to the specified visual
+ * location.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param loc the position in view coordinates.
+ *
+ * @return the caret position which is closest to <code>loc</code>.
+ *
+ * @see #viewToModel(JTextComponent, Point, Position.Bias[])
+ */
+ public abstract int viewToModel(JTextComponent t, Point pt);
+
+
+ /**
+ * Finds the caret position which is closest to the specified visual
+ * location.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param loc the position in view coordinates.
+ *
+ * @param outBias an array whose size must be at least one.
+ * After the call, <code>outBias[0]</code> will indicate
+ * whether <code>loc</code> is in the glyph before
+ * (<code>Position.Bias.Backward</code>) or after
+ * (<code>Position.Bias.Forward</code>) the returned
+ * caret position.
+ *
+ * @return the caret position which is closest to <code>loc</code>.
+ */
+ public abstract int viewToModel(JTextComponent tc, Point loc,
+ Position.Bias[] outBias);
+
+
+ /**
+ * Calculates the caret position that is visually next to the given
+ * position. This is useful to determine where to move the caret
+ * after the user has pressed an arrow key.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param pos the current caret position, a zero-based index
+ * into the document model.
+ *
+ * @param bias whether to take the character before or after the
+ * caret position indicated by <code>pos</code>. The value
+ * must be either {@link
+ * javax.swing.text.Position.Bias#Backward} or {@link
+ * javax.swing.text.Position.Bias#Forward}.
+ *
+ * @param direction the visual direction. Pass
+ * {@link javax.swing.SwingConstants#WEST} for the left
+ * arrow key, {@link javax.swing.SwingConstants#EAST}
+ * for the right arrow key, {@link
+ * javax.swing.SwingConstants#NORTH} for the up arrow
+ * key, or {@link javax.swing.SwingConstants#SOUTH}
+ * for the down arrow key.
+ *
+ * @throws BadLocationException if <code>pos</code> does not
+ * designate a valid position in the document model.
+ *
+ * @throws IllegalArgumentException if <code>direction</code>
+ * is not one of <code>Position.Bias.Forward</code>
+ * or <code>Position.Biad.Backward</code>.
+ */
+ public abstract int getNextVisualPositionFrom(JTextComponent tc,
+ int pos,
+ Position.Bias bias,
+ int direction,
+ Position.Bias[] outBias)
+ throws BadLocationException;
+
+
+ /**
+ * Repaints a range of characters.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param start the first character in the range that needs
+ * painting, indicated as an index into the document model.
+ *
+ * @param end the last character in the range that needs
+ * painting, indicated as an index into the document model.
+ * <code>end</code> must be greater than or equal to
+ * <code>start</code>.
+ */
+ public abstract void damageRange(JTextComponent tc, int start, int end);
+
+
+ /**
+ * Repaints a range of characters, also specifying the bias for the
+ * start and end of the range.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param start the first character in the range that needs
+ * painting, indicated as an index into the document model.
+ *
+ * @param end the last character in the range that needs
+ * painting, indicated as an index into the document model.
+ * <code>end</code> must be greater than or equal to
+ * <code>start</code>.
+ */
+ public abstract void damageRange(JTextComponent tc,
+ int start, int end,
+ Position.Bias startBias,
+ Position.Bias endBias);
+
+
+ /**
+ * Retrieves the <code>EditorKit</code> managing policies and
+ * persistent state.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @return the <code>EditorKit</code> used by <code>tc</code>.
+ */
+ public abstract EditorKit getEditorKit(JTextComponent tc);
+
+
+ /**
+ * Retrieves the root of the view tree that visually presents
+ * the text.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @return the root <code>View</code> used by <code>tc</code>.
+ */
+ public abstract View getRootView(JTextComponent tc);
+
+
+ /**
+ * Returns a String for presenting a tool tip at the specified
+ * location.
+ *
+ * @param tc the <code>JTextComponent</code> for which this
+ * delegate object provides the user interface.
+ *
+ * @param loc the location for which the tool tip is requested.
+ *
+ * @return the text for the tool tip, or <code>null</code> to
+ * display no tool tip.
+ *
+ * @since 1.4
+ */
+ public String getToolTipText(JTextComponent tc, Point loc)
+ {
+ return null;
+ }
}
diff --git a/libjava/javax/swing/plaf/ToolBarUI.java b/libjava/javax/swing/plaf/ToolBarUI.java
index 80d0d1db317..18b27d3aebd 100644
--- a/libjava/javax/swing/plaf/ToolBarUI.java
+++ b/libjava/javax/swing/plaf/ToolBarUI.java
@@ -1,5 +1,5 @@
/* ToolBarUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * ToolBarUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JToolBar</code>.
+ *
+ * @see javax.swing.JToolBar
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ToolBarUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ToolBarUI
- */
- public ToolBarUI() {
- // TODO
- } // ToolBarUI()
-
-
-} // ToolBarUI
+public abstract class ToolBarUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>ToolBarUI</code>.
+ */
+ public ToolBarUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/ToolTipUI.java b/libjava/javax/swing/plaf/ToolTipUI.java
index f325fd0f718..4f332a635e6 100644
--- a/libjava/javax/swing/plaf/ToolTipUI.java
+++ b/libjava/javax/swing/plaf/ToolTipUI.java
@@ -1,5 +1,5 @@
/* ToolTipUI.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,23 @@ exception statement from your version. */
package javax.swing.plaf;
+
/**
- * ToolTipUI
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JToolTip</code>.
+ *
+ * @see javax.swing.JToolTip
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ToolTipUI extends ComponentUI {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ToolTipUI
- */
- public ToolTipUI() {
- // TODO
- } // ToolTipUI()
-
-
-} // ToolTipUI
+public abstract class ToolTipUI
+ extends ComponentUI
+{
+ /**
+ * Constructs a new <code>ToolTipUI</code>.
+ */
+ public ToolTipUI()
+ {
+ }
+}
diff --git a/libjava/javax/swing/plaf/TreeUI.java b/libjava/javax/swing/plaf/TreeUI.java
index f5f884fca2a..59dca9d877f 100644
--- a/libjava/javax/swing/plaf/TreeUI.java
+++ b/libjava/javax/swing/plaf/TreeUI.java
@@ -1,5 +1,5 @@
/* TreeUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,174 @@ exception statement from your version. */
package javax.swing.plaf;
+import java.awt.Rectangle;
+import javax.swing.JTree;
+import javax.swing.tree.TreePath;
-public class TreeUI extends ComponentUI
+
+/**
+ * An abstract base class for delegates that provide the user
+ * interface for <code>JTree</code>.
+ *
+ * @see javax.swing.JTree
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class TreeUI
+ extends ComponentUI
{
+ /**
+ * Constructs a new <code>TreeUI</code>.
+ */
+ public TreeUI()
+ {
+ }
+
+
+ /**
+ * Determines the geometric extent of the label that is
+ * drawn for a path.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param path the path whose label extent is requested.
+ *
+ * @return a rectangle enclosing the label, or <code>null</code>
+ * if <code>path</code> contains invalid nodes.
+ */
+ public abstract Rectangle getPathBounds(JTree tree, TreePath path);
+
+
+ /**
+ * Creates a <code>TreePath</code> for the specified row.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param row the index of the row, which should be a number
+ * in the range <code>[0, getRowCount(tree) - 1]</code>.
+ *
+ * @return a <code>TreePath</code> for the specified row, or
+ * <code>null</code> if <code>row</code> is outside
+ * the valid range.
+ */
+ public abstract TreePath getPathForRow(JTree tree, int row);
+
+
+ /**
+ * Determines in which row a <code>TreePath</code> is currently
+ * being displayed.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param path the path for which the caller wants to know
+ * in which row it is being displayed.
+ *
+ * @return a number in the range <code>[0, getRowCount(tree)
+ * - 1]</code> if the path is currently on display;
+ * <code>-1</code> if the path is not shown to the
+ * user.
+ */
+ public abstract int getRowForPath(JTree tree, TreePath path);
+
+
+ /**
+ * Counts how many rows are currently displayed.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @return the number of visible rows.
+ */
+ public abstract int getRowCount(JTree tree);
+
+
+ /**
+ * Finds the path that is closest to the specified position.
+ *
+ * <p><img src="TreeUI-1.png" width="300" height="250"
+ * alt="[A screen shot of a JTree] />
+ *
+ * <p>As shown by the above illustration, the bounds of the
+ * closest path do not necessarily need to contain the passed
+ * location.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param x the horizontal location, relative to the origin
+ * of <code>tree</code>.
+ *
+ * @param y the vertical location, relative to the origin
+ * of <code>tree</code>.
+ *
+ * @return the closest path, or <code>null</code> if the
+ * tree is currenlty not displaying any paths at all.
+ */
+ public abstract TreePath getClosestPathForLocation(JTree tree,
+ int x, int y);
+
+
+ /**
+ * Determines whether the user is currently editing a tree cell.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @see #getEditingPath
+ */
+ public abstract boolean isEditing(JTree tree);
+
+
+ /**
+ * Stops editing a tree cell, committing the entered value into the
+ * tree&#x2019;s model. If no editing session is active, or if the
+ * active editor does not agree to stopping, nothing happens. In
+ * some look and feels, this action happens when the user has
+ * pressed the enter key.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @return <code>false</code> if the editing still goes on because
+ * the cell editor has objected to stopping the session;
+ * <code>true</code> if editing has been stopped.
+ */
+ public abstract boolean stopEditing(JTree tree);
+
+
+ /**
+ * Cancels editing a tree cell, discarding any entered value.
+ * If no editing session is active, nothing happens. The cell
+ * editor is not given an opportunity to veto the canceling.
+ * In some look and feels, this action happens when the user has
+ * pressed the escape key.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ */
+ public abstract void cancelEditing(JTree tree);
+
+
+ /**
+ * Starts a session to edit a tree cell. If the cell editor
+ * rejects editing the cell, it will just be selected.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param path the cell to edit.
+ */
+ public abstract void startEditingAtPath(JTree tree, TreePath path);
+
+
+ /**
+ * Retrieves the tree cell that is currently being edited.
+ *
+ * @return the currently edited path, or <code>null</code>
+ * if no editing session is currently active.
+ */
+ public abstract TreePath getEditingPath(JTree tree);
}
diff --git a/libjava/javax/swing/plaf/ViewportUI.java b/libjava/javax/swing/plaf/ViewportUI.java
index f9a8476936b..3b28920496c 100644
--- a/libjava/javax/swing/plaf/ViewportUI.java
+++ b/libjava/javax/swing/plaf/ViewportUI.java
@@ -1,5 +1,5 @@
/* ViewportUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,22 @@ exception statement from your version. */
package javax.swing.plaf;
-public class ViewportUI extends ComponentUI
+/**
+ * An abstract base class for delegates that implement the pluggable
+ * look and feel for a <code>JViewport</code>.
+ *
+ * @see javax.swing.JViewport
+ *
+ * @author Andrew Selkirk (aselkirk@sympatico.ca)
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public abstract class ViewportUI
+ extends ComponentUI
{
+ /**
+ * Constructs a new <code>ViewportUI</code>.
+ */
+ public ViewportUI()
+ {
+ }
}
diff --git a/libjava/javax/swing/plaf/basic/BasicBorders.java b/libjava/javax/swing/plaf/basic/BasicBorders.java
index 3b2f2d128e1..8b8a8513fc3 100644
--- a/libjava/javax/swing/plaf/basic/BasicBorders.java
+++ b/libjava/javax/swing/plaf/basic/BasicBorders.java
@@ -1,5 +1,5 @@
/* BasicBorders.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,44 +37,1778 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+
import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.io.Serializable;
+import javax.swing.AbstractButton;
+import javax.swing.ButtonModel;
+import javax.swing.JButton;
+import javax.swing.JPopupMenu;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.border.AbstractBorder;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
+import javax.swing.plaf.UIResource;
+import javax.swing.plaf.BorderUIResource;
+import javax.swing.text.JTextComponent;
+
+
/**
- * STUBBED
+ * Provides various borders for the Basic look and feel.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
public class BasicBorders
{
+ /**
+ * A MarginBorder that gets shared by multiple components.
+ * Created on demand by the private helper function {@link
+ * #getMarginBorder()}.
+ */
+ private static MarginBorder sharedMarginBorder;
+
+
+ /**
+ * Returns a border for drawing push buttons.
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;Button.shadow&#x201d;</code>,
+ * <code>&#x201c;Button.darkShadow&#x201d;</code>,
+ * <code>&#x201c;Button.light&#x201d;</code>, and
+ * <code>&#x201c;Button.highlight&#x201d;</code>.
+ *
+ * <p><img src="BasicBorders.ButtonBorder-1.png" width="300"
+ * height="170" alt="[A screen shot of the returned border]" />
+ *
+ * @return a {@link
+ * javax.swing.plaf.BorderUIResource#CompoundBorderUIResource}
+ * whose outer border is a {@link #ButtonBorder} and whose
+ * inner border is a {@link #MarginBorder}.
+ */
+ public static Border getButtonBorder()
+ {
+ UIDefaults defaults;
+ Border outer;
+
+ defaults = UIManager.getLookAndFeelDefaults();
+
+ /* The keys for UIDefaults have been determined by writing a
+ * test program that dumps the UIDefaults to stdout; that program
+ * was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API,
+ * the key "light" is usually called "highlight", and "highlight"
+ * is usually called "lightHighlight".
+ */
+ outer = new ButtonBorder(defaults.getColor("Button.shadow"),
+ defaults.getColor("Button.darkShadow"),
+ defaults.getColor("Button.light"),
+ defaults.getColor("Button.highlight"));
+
+ /* While the inner border is shared between multiple buttons,
+ * we do not share the outer border because ButtonBorders store
+ * their border colors. We cannot guarantee that the colors
+ * (which come from UIDefaults) are unchanged between invocations
+ * of getButtonBorder. We could store the last colors, and share
+ * the button border if the colors are the same as in the last
+ * invocation, but it probably is not worth the effort.
+ */
+ return new BorderUIResource.CompoundBorderUIResource(
+ outer,
+ /* inner */ getMarginBorder());
+ }
+
+
+ /**
+ * Returns a border for drawing radio buttons.
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;RadioButton.shadow&#x201d;</code>,
+ * <code>&#x201c;RadioButton.darkShadow&#x201d;</code>,
+ * <code>&#x201c;RadioButton.light&#x201d;</code>, and
+ * <code>&#x201c;RadioButton.highlight&#x201d;</code>.
+ *
+ * <p><img src="BasicBorders.RadioButtonBorder-1.png" width="300"
+ * height="135" alt="[A screen shot of the returned border]" />
+ *
+ * @return a {@link
+ * javax.swing.plaf.BorderUIResource#CompoundBorderUIResource}
+ * whose outer border is a {@link #RadioButtonBorder} and whose
+ * inner border is a {@link #MarginBorder}.
+ */
+ public static Border getRadioButtonBorder()
+ {
+ UIDefaults defaults;
+ Border outer;
+
+ defaults = UIManager.getLookAndFeelDefaults();
+
+ /* The keys for UIDefaults have been determined by writing a
+ * test program that dumps the UIDefaults to stdout; that program
+ * was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API,
+ * the key "light" is usually called "highlight", and "highlight"
+ * is usually called "lightHighlight".
+ */
+ outer = new RadioButtonBorder(
+ defaults.getColor("RadioButton.shadow"),
+ defaults.getColor("RadioButton.darkShadow"),
+ defaults.getColor("RadioButton.light"),
+ defaults.getColor("RadioButton.highlight"));
+
+ /* While the inner border is shared between multiple buttons, we
+ * do not share the outer border because RadioButtonBorders, being
+ * ButtonBorders, store their border colors. We cannot guarantee
+ * that the colors (which come from UIDefaults) are unchanged
+ * between invocations of getButtonBorder. We could store the last
+ * colors, and share the button border if the colors are the same
+ * as in the last invocation, but it probably is not worth the
+ * effort.
+ */
+ return new BorderUIResource.CompoundBorderUIResource(
+ outer,
+ /* inner */ getMarginBorder());
+ }
+
+
+ /**
+ * Returns a border for drawing toggle buttons.
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;ToggleButton.shadow&#x201d;</code>,
+ * <code>&#x201c;ToggleButton.darkShadow&#x201d;</code>,
+ * <code>&#x201c;ToggleButton.light&#x201d;</code>, and
+ * <code>&#x201c;ToggleButton.highlight&#x201d;</code>.
+ *
+ * <p><img src="BasicBorders.ToggleButtonBorder-1.png" width="270"
+ * height="135" alt="[A screen shot of the returned border]" />
+ *
+ * @return a {@link
+ * javax.swing.plaf.BorderUIResource#CompoundBorderUIResource}
+ * whose outer border is a {@link #ToggleButtonBorder} and whose
+ * inner border is a {@link #MarginBorder}.
+ */
+ public static Border getToggleButtonBorder()
+ {
+ UIDefaults defaults;
+ Border outer;
+
+ defaults = UIManager.getLookAndFeelDefaults();
+
+ /* The keys for UIDefaults have been determined by writing a
+ * test program that dumps the UIDefaults to stdout; that program
+ * was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API,
+ * the key "light" is usually called "highlight", and "highlight"
+ * is usually called "lightHighlight".
+ */
+ outer = new ToggleButtonBorder(
+ defaults.getColor("ToggleButton.shadow"),
+ defaults.getColor("ToggleButton.darkShadow"),
+ defaults.getColor("ToggleButton.light"),
+ defaults.getColor("ToggleButton.highlight"));
+
+ /* While the inner border is shared between multiple buttons, we
+ * do not share the outer border because ToggleButtonBorders, being
+ * ButtonBorders, store their border colors. We cannot guarantee
+ * that the colors (which come from UIDefaults) are unchanged
+ * between invocations of getButtonBorder. We could store the last
+ * colors, and share the button border if the colors are the same
+ * as in the last invocation, but it probably is not worth the
+ * effort.
+ */
+ return new BorderUIResource.CompoundBorderUIResource(
+ outer,
+ /* inner */ getMarginBorder());
+ }
+
+
+ /**
+ * Returns a border for drawing a two-pixel thick separator line
+ * below menu bars.
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;MenuBar.shadow&#x201d;</code> and
+ * <code>&#x201c;MenuBar.highlight&#x201d;</code>.
+ *
+ * <p><img src="BasicBorders.MenuBarBorder-1.png" width="500"
+ * height="140" alt="[A screen shot of a JMenuBar with this border]" />
+ *
+ * @return a {@link #MenuBarBorder}.
+ *
+ * @see javax.swing.JMenuBar
+ */
+ public static Border getMenuBarBorder()
+ {
+ UIDefaults defaults;
+
+ /* See comment in methods above for why this border is not shared. */
+ defaults = UIManager.getLookAndFeelDefaults();
+ return new MenuBarBorder(defaults.getColor("MenuBar.shadow"),
+ defaults.getColor("MenuBar.highlight"));
+ }
+
+
+ /**
+ * Returns a border for drawing a one-pixel thick border around
+ * split panes that are interrupted where the divider joins the
+ * border.
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;SplitPane.darkShadow&#x201d;</code> and
+ * <code>&#x201c;SplitPane.highlight&#x201d;</code>.
+ *
+ * <p><img src="BasicBorders.SplitPaneBorder-1.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.HORIZONTAL_SPLIT]" />
+ *
+ * <p><img src="BasicBorders.SplitPaneBorder-2.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.VERTICAL_SPLIT]" />
+ *
+ * @return a {@link #SplitPaneBorder}.
+ *
+ * @see javax.swing.JSplitPane
+ * @see #getSplitPaneDividerBorder()
+ */
+ public static Border getSplitPaneBorder()
+ {
+ UIDefaults defaults;
+
+ /* See comment in methods above for why this border is not shared. */
+ defaults = UIManager.getLookAndFeelDefaults();
+ return new SplitPaneBorder(defaults.getColor("SplitPane.highlight"),
+ defaults.getColor("SplitPane.darkShadow"));
+ }
+
+
+ /**
+ * Returns a border for drawing a one-pixel thick border around
+ * the divider of split panes.
+ *
+ * <p>The colors of the edges that are adjacent to the child components
+ * of the <code>JSplitPane</code> are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;SplitPane.darkShadow&#x201d;</code> and
+ * <code>&#x201c;SplitPane.highlight&#x201d;</code>. The color of the
+ * other two edges is the background color of the divider.
+ *
+ * <p><img src="BasicBorders.SplitPaneDividerBorder-1.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.HORIZONTAL_SPLIT]" />
+ *
+ * @return an instance of <code>SplitPaneDividerBorder</code>, which is
+ * not a public API class of this package.
+ *
+ * @see javax.swing.JSplitPane
+ * @see javax.swing.plaf.basic.BasicSplitPaneDivider
+ * @see #getSplitPaneBorder()
+ *
+ * @since 1.3
+ */
+ public static Border getSplitPaneDividerBorder()
+ {
+ UIDefaults defaults;
+
+ /* See comment in methods above for why this border is not shared. */
+ defaults = UIManager.getLookAndFeelDefaults();
+ return new SplitPaneDividerBorder(
+ defaults.getColor("SplitPane.highlight"),
+ defaults.getColor("SplitPane.darkShadow"));
+ }
+
+
+ /**
+ * Returns a border for drawing a border around a text field
+ * that makes the field appear as etched into the surface.
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;TextField.shadow&#x201d;</code>,
+ * <code>&#x201c;TextField.darkShadow&#x201d;</code>,
+ * <code>&#x201c;TextField.light&#x201d;</code>, and
+ * <code>&#x201c;TextField.highlight&#x201d;</code>.
+ *
+ * <p><img src="BasicBorders.FieldBorder-1.png" width="500"
+ * height="200" alt="[A screen shot of a border returned by
+ * this method]" />
+ *
+ * @return an instance of
+ * {@link javax.swing.plaf.basic.BasicBorders$FieldBorder}.
+ *
+ * @see javax.swing.JTextField
+ * @see javax.swing.text.JTextComponent
+ */
+ public static Border getTextFieldBorder()
+ {
+ UIDefaults defaults;
+
+ /* See comment in methods above for why this border is not shared. */
+ defaults = UIManager.getLookAndFeelDefaults();
+ return new FieldBorder(
+ defaults.getColor("TextField.shadow"),
+ defaults.getColor("TextField.darkShadow"),
+ defaults.getColor("TextField.light"),
+ defaults.getColor("TextField.highlight"));
+ }
+
+
+ /**
+ * Returns a two-pixel thick, green
+ * <code>LineBorderUIResource</code>. This is so ugly that look and
+ * feels better use different borders for their progress bars, or
+ * they will look really terrible.
+ *
+ * <p><img src="BasicBorders-1.png" width="120" height="80"
+ * alt="[A screen shot of a border returned by this method]" />
+ */
+ public static Border getProgressBarBorder()
+ {
+ /* There does not seem to exist a way to parametrize the color
+ * or thickness of the border through UIDefaults.
+ */
+ return new BorderUIResource.LineBorderUIResource(Color.green, 2);
+ }
+
+
+ /**
+ * Returns a border that is composed of a raised bevel border and a
+ * one-pixel thick line border.
+ *
+ * <p><img src="BasicBorders-2.png" width="300" height="200"
+ * alt="[A screen shot of a border returned by this method]" />
+ *
+ * <p>The colors of the border are retrieved from the
+ * <code>UIDefaults</code> of the currently active look and feel
+ * using the keys <code>&#x201c;InternalFrame.borderShadow&#x201d;</code>,
+ * <code>&#x201c;InternalFrame.borderDarkShadow&#x201d;</code>,
+ * <code>&#x201c;InternalFrame.borderLight&#x201d;</code>,
+ * <code>&#x201c;InternalFrame.borderHighlight&#x201d;</code>, and
+ * (for the inner one-pixel thick line)
+ * <code>&#x201c;InternalFrame.borderColor&#x201d;</code>.
+ */
+ public static Border getInternalFrameBorder()
+ {
+ UIDefaults defaults;
+ Color shadow, darkShadow, highlight, lightHighlight, line;
+
+ /* See comment in methods above for why this border is not shared. */
+ defaults = UIManager.getLookAndFeelDefaults();
+
+ shadow = defaults.getColor("InternalFrame.borderShadow");
+ darkShadow = defaults.getColor("InternalFrame.borderDarkShadow");
+ highlight = defaults.getColor("InternalFrame.borderLight");
+ lightHighlight = defaults.getColor("InternalFrame.borderHighlight");
+ line = defaults.getColor("InternalFrame.borderColor");
+
+ return new BorderUIResource.CompoundBorderUIResource(
+ /* outer border */
+ new BorderUIResource.BevelBorderUIResource(
+ BevelBorder.RAISED,
+ (highlight != null) ? highlight : Color.lightGray,
+ (lightHighlight != null) ? lightHighlight : Color.white,
+ (darkShadow != null) ? darkShadow : Color.black,
+ (shadow != null) ? shadow : Color.gray),
+
+ /* inner border */
+ new BorderUIResource.LineBorderUIResource(
+ (line != null) ? line : Color.lightGray));
+ }
+
+
+ /**
+ * Returns a shared MarginBorder.
+ */
+ static Border getMarginBorder() // intentionally not public
+ {
+ /* Swing is not designed to be thread-safe, so there is no
+ * need to synchronize the access to the global variable.
+ */
+ if (sharedMarginBorder == null)
+ sharedMarginBorder = new MarginBorder();
+
+ return sharedMarginBorder;
+ }
+
+
+ /**
+ * A border whose appearance depends on the state of
+ * the enclosed button.
+ *
+ * <p><img src="BasicBorders.ButtonBorder-1.png" width="300"
+ * height="170" alt="[A screen shot of this border]" />
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class ButtonBorder
+ extends AbstractBorder
+ implements Serializable, UIResource
{
- } // class ButtonBorder
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -157053874580739687L;
+
+
+ /**
+ * The color for drawing the shaded parts of the border.
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ protected Color shadow;
+
+
+ /**
+ * The color for drawing the dark shaded parts of the border.
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ protected Color darkShadow;
+
+
+ /**
+ * The color for drawing the highlighted parts of the border.
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ protected Color highlight;
+
+
+ /**
+ * The color for drawing the bright highlighted parts of the border.
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ protected Color lightHighlight;
+
+
+ /**
+ * Constructs a new border for drawing a button in the Basic
+ * look and feel.
+ *
+ * @param shadow the shadow color.
+ * @param darkShadow a darker variant of the shadow color.
+ * @param highlight the highlight color.
+ * @param lightHighlight a brighter variant of the highlight color.
+ */
+ public ButtonBorder(Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ /* These colors usually come from the UIDefaults of the current
+ * look and feel. Use fallback values if the colors are not
+ * supplied. The API specification is silent about what
+ * behavior is expected for null colors, so users should not
+ * rely on this fallback (which is why it is not documented in
+ * the above Javadoc).
+ */
+ this.shadow = (shadow != null) ? shadow : Color.gray;
+ this.darkShadow = (darkShadow != null) ? darkShadow : Color.black;
+ this.highlight = (highlight != null) ? highlight : Color.lightGray;
+ this.lightHighlight = (lightHighlight != null)
+ ? lightHighlight
+ : Color.white;
+ }
+
+
+ /**
+ * Paints the ButtonBorder around a given component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ ButtonModel bmodel = null;
+
+ if (c instanceof AbstractButton)
+ bmodel = ((AbstractButton) c).getModel();
+
+ BasicGraphicsUtils.drawBezel(
+ g, x, y, width, height,
+ /* pressed */ (bmodel != null)
+ && /* mouse button pressed */ bmodel.isPressed()
+ && /* mouse inside */ bmodel.isArmed(),
+ /* default */ (c instanceof JButton)
+ && ((JButton) c).isDefaultButton(),
+ shadow, darkShadow, highlight, lightHighlight);
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * <p>Although the thickness of the actually painted border
+ * depends on the state of the enclosed component, this
+ * measurement always returns the same amount of pixels. Indeed,
+ * it would be rather confusing if a button was appearing to
+ * change its size depending on whether it is pressed or not.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ /* There is no obvious reason for overriding this method, but we
+ * try to have exactly the same API as the Sun reference
+ * implementation.
+ */
+ return getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * <p>Although the thickness of the actually painted border
+ * depends on the state of the enclosed component, this
+ * measurement always returns the same amount of pixels. Indeed,
+ * it would be rather confusing if a button was appearing to
+ * change its size depending on whether it is pressed or not.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ /* The exact amount has been determined using a test program
+ * that was run on the Sun reference implementation. With
+ * Apple/Sun JDK 1.3.1 on MacOS X 10.1.5, the result is
+ * [3, 3, 3, 3]. With Sun JDK 1.4.1_01 on Linux/x86, the
+ * result is [2, 3, 3, 3]. We use the values from the 1.4.1_01
+ * release.
+ */
+ if (insets == null)
+ return new Insets(2, 3, 3, 3);
+
+ insets.top = 2;
+ insets.bottom = insets.left = insets.right = 3;
+ return insets;
+ }
+ }
+
+
+ /**
+ * A border that makes its enclosed component appear as lowered
+ * into the surface. Typically used for text fields.
+ *
+ * <p><img src="BasicBorders.FieldBorder-1.png" width="500"
+ * height="200" alt="[A screen shot of this border]" />
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawEtchedRect
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class FieldBorder
+ extends AbstractBorder
+ implements UIResource
{
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 949220756998454908L;
+
+
+ /**
+ * The color for drawing the outer half of the top and left
+ * edges.
+ */
+ protected Color shadow;
+
+
+ /**
+ * The color for drawing the inner half of the top and left
+ * edges.
+ */
+ protected Color darkShadow;
+
+
+ /**
+ * The color for drawing the inner half of the bottom and right
+ * edges.
+ */
+ protected Color highlight;
+
+
+ /**
+ * The color for drawing the outer half of the bottom and right
+ * edges.
+ */
+ protected Color lightHighlight;
+
+
+ /**
+ * Constructs a new border for drawing a text field in the Basic
+ * look and feel.
+ *
+ * @param shadow the color for drawing the outer half
+ * of the top and left edges.
+ *
+ * @param darkShadow the color for drawing the inner half
+ * of the top and left edges.
+ *
+ * @param highlight the color for drawing the inner half
+ * of the bottom and right edges.
+ *
+ * @param lightHighlight the color for drawing the outer half
+ * of the bottom and right edges.
+ */
public FieldBorder(Color shadow, Color darkShadow,
Color highlight, Color lightHighlight)
{
+ /* These colors usually come from the UIDefaults of the current
+ * look and feel. Use fallback values if the colors are not
+ * supplied. The API specification is silent about what
+ * behavior is expected for null colors, so users should not
+ * rely on this fallback (which is why it is not documented in
+ * the above Javadoc).
+ */
+ this.shadow = (shadow != null) ? shadow : Color.gray;
+ this.darkShadow = (darkShadow != null) ? darkShadow : Color.black;
+ this.highlight = (highlight != null) ? highlight : Color.lightGray;
+ this.lightHighlight = (lightHighlight != null)
+ ? lightHighlight : Color.white;
}
- } // class FieldBorder
+
+
+ /**
+ * Paints the FieldBorder around a given component.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawEtchedRect
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ BasicGraphicsUtils.drawEtchedRect(g, x, y, width, height,
+ shadow, darkShadow,
+ highlight, lightHighlight);
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ * If <code>c</code> is an instance of {@link
+ * javax.swing.text.JTextComponent}, its margin is
+ * added to the border size.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param c the component whose border is to be measured.
+ * If <code>c</code> is an instance of {@link
+ * javax.swing.text.JTextComponent}, its margin is
+ * added to the border size.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ if (insets == null)
+ insets = new Insets(2, 2, 2, 2);
+ else
+ insets.top = insets.left = insets.bottom = insets.right = 2;
+
+ if (c instanceof JTextComponent)
+ {
+ Insets margin = ((JTextComponent) c).getMargin();
+ insets.top += margin.top;
+ insets.left += margin.left;
+ insets.bottom += margin.bottom;
+ insets.right += margin.right;
+ }
+
+ return insets;
+ }
+ }
+
+
+ /**
+ * An invisible, but spacing border whose margin is determined
+ * by calling the <code>getMargin()</code> method of the enclosed
+ * component. If the enclosed component has no such method,
+ * this border will not occupy any space.
+ *
+ * <p><img src="BasicBorders.MarginBorder-1.png" width="325"
+ * height="200" alt="[An illustration that shows how MarginBorder
+ * determines its borders]" />
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class MarginBorder
+ extends AbstractBorder
+ implements Serializable, UIResource
{
- } // class MarginBorder
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -3035848353448896090L;
+
+
+ /**
+ * Constructs a new MarginBorder.
+ */
+ public MarginBorder()
+ {
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, new Insets(0, 0, 0, 0));
+ }
+
+
+ /**
+ * Determines the insets of this border by calling the
+ * <code>getMargin()</code> method of the enclosed component. The
+ * resulting margin will be stored into the the <code>left</code>,
+ * <code>right</code>, <code>top</code> and <code>bottom</code>
+ * fields of the passed <code>insets</code> parameter.
+ *
+ * <p>Unfortunately, <code>getMargin()</code> is not a method of
+ * {@link javax.swing.JComponent} or some other common superclass
+ * of things with margins. While reflection could be used to
+ * determine the existence of this method, this would be slow on
+ * many virtual machines. Therefore, the current implementation
+ * knows about {@link javax.swing.AbstractButton#getMargin()},
+ * {@link javax.swing.JPopupMenu#getMargin()}, {@link
+ * javax.swing.JToolBar#getMargin()}, and {@link
+ * javax.swing.text.JTextComponent}. If <code>c</code> is an
+ * instance of a known class, the respective
+ * <code>getMargin()</code> method is called to determine the
+ * correct margin. Otherwise, a zero-width margin is returned.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return the same object that was passed for <code>insets</code>,
+ * but with changed fields.
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ Insets margin = null;
+
+ /* This is terrible object-oriented design. See the above Javadoc
+ * for an excuse.
+ */
+ if (c instanceof AbstractButton)
+ margin = ((AbstractButton) c).getMargin();
+ else if (c instanceof JPopupMenu)
+ margin = ((JPopupMenu) c).getMargin();
+ else if (c instanceof JToolBar)
+ margin = ((JToolBar) c).getMargin();
+ else if (c instanceof JTextComponent)
+ margin = ((JTextComponent) c).getMargin();
+
+ if (margin == null)
+ insets.top = insets.left = insets.bottom = insets.right = 0;
+ else
+ {
+ insets.top = margin.top;
+ insets.left = margin.left;
+ insets.bottom = margin.bottom;
+ insets.right = margin.right;
+ }
+
+ return insets;
+ }
+ }
+
+
+ /**
+ * A border for drawing a separator line below JMenuBar.
+ *
+ * <p><img src="BasicBorders.MenuBarBorder-1.png" width="500"
+ * height="140" alt="[A screen shot of a JMenuBar with this border]" />
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class MenuBarBorder
+ extends AbstractBorder
+ implements UIResource
{
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -6909056571935227506L;
+
+
+ /**
+ * The shadow color, which is used for the upper line of the
+ * two-pixel thick bottom edge.
+ */
+ private Color shadow;
+
+
+ /**
+ * The highlight color, which is used for the lower line of the
+ * two-pixel thick bottom edge.
+ */
+ private Color highlight;
+
+
+ /**
+ * Constructs a new MenuBarBorder for drawing a JMenuBar in
+ * the Basic look and feel.
+ *
+ * <p><img src="BasicBorders.MenuBarBorder-1.png" width="500"
+ * height="140" alt="[A screen shot of a JMenuBar with this
+ * border]" />
+ *
+ * @param shadow the shadow color, which is used for the upper
+ * line of the two-pixel thick bottom edge.
+ *
+ * @param highlight the shadow color, which is used for the lower
+ * line of the two-pixel thick bottom edge.
+ */
public MenuBarBorder(Color shadow, Color highlight)
{
+ /* These colors usually come from the UIDefaults of the current
+ * look and feel. Use fallback values if the colors are not
+ * supplied. The API specification is silent about what
+ * behavior is expected for null colors, so users should not
+ * rely on this fallback (which is why it is not documented in
+ * the above Javadoc).
+ */
+ this.shadow = (shadow != null) ? shadow : Color.gray;
+ this.highlight = (highlight != null) ? highlight : Color.white;
+ }
+
+
+ /**
+ * Paints the MenuBarBorder around a given component.
+ *
+ * @param c the component whose border is to be painted, usually
+ * an instance of {@link javax.swing.JMenuBar}.
+ *
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ Color oldColor;
+
+ /* To understand this code, it might be helpful to look at the
+ * image "BasicBorders.MenuBarBorder-1.png" that is included
+ * with the JavaDoc. It is located in the "doc-files"
+ * subdirectory.
+ */
+ oldColor = g.getColor();
+ y = y + height - 2;
+ try
+ {
+ g.setColor(shadow);
+ g.drawLine(x, y, x + width - 2, y);
+ g.drawLine(x, y + 1, x, y + 1);
+ g.drawLine(x + width - 2, y + 1, x + width - 2, y + 1);
+
+ g.setColor(highlight);
+ g.drawLine(x + 1, y + 1, x + width - 3, y + 1);
+ g.drawLine(x + width - 1, y, x + width - 1, y + 1);
+ }
+ finally
+ {
+ g.setColor(oldColor);
+ }
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ /* There is no obvious reason for overriding this method, but we
+ * try to have exactly the same API as the Sun reference
+ * implementation.
+ */
+ return getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ /* The exact amount has been determined using a test program
+ * that was run on the Apple/Sun JDK 1.3.1 on MacOS X, and the
+ * Sun JDK 1.4.1_01 on GNU/Linux for x86. Both gave [0,0,2,0],
+ * which was expected from looking at the screen shot.
+ */
+ if (insets == null)
+ return new Insets(0, 0, 2, 0);
+
+ insets.left = insets.right = insets.top = 0;
+ insets.bottom = 2;
+ return insets;
}
- } // class MenuBarBorder
+ }
+
+
+ /**
+ * A border for drawing radio buttons in the Basic look and feel.
+ *
+ * <p><img src="BasicBorders.RadioButtonBorder-1.png" width="300"
+ * height="135" alt="[A screen shot of this border]" />
+ *
+ * <p>Note about the screen shot: Normally, the
+ * <code>borderPainted</code> property is <code>false</code> for
+ * JRadioButtons. For this screen shot, it has been set to
+ * <code>true</code> so the borders get drawn. Also, a
+ * concretization of the Basic look and would typically provide
+ * icons for the various states of radio buttons.
+ *
+ * <p>Note that the focus rectangle is invisible If the radio button
+ * is currently selected. While it might be debatable whether this
+ * makes a lot of sense, this behavior can be observed in the Sun
+ * reference implementation (in JDK 1.3.1 and 1.4.1). The Classpath
+ * implementation tries to exactly replicate the JDK appearance.
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class RadioButtonBorder
+ extends ButtonBorder
{
- } // class RadioButtonBorder
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = 1596945751743747369L;
+
+
+ /**
+ * Constructs a new border for drawing a JRadioButton in
+ * the Basic look and feel.
+ *
+ * @param shadow the shadow color.
+ * @param darkShadow a darker variant of the shadow color.
+ * @param highlight the highlight color.
+ * @param lightHighlight a brighter variant of the highlight color.
+ */
+ public RadioButtonBorder(Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ /* The superclass ButtonBorder substitutes null arguments
+ * with fallback colors.
+ */
+ super(shadow, darkShadow, highlight, lightHighlight);
+ }
+
+
+ /**
+ * Paints the RadioButtonBorder around a given component.
+ *
+ * <p>The Sun implementation always seems to draw exactly
+ * the same border, irrespective of the state of the button.
+ * This is rather surprising, but GNU Classpath emulates the
+ * observable behavior.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ AbstractButton button = null;
+ ButtonModel bmodel = null;
+ boolean lowered = false;
+ boolean focused = false;
+
+ if (c instanceof AbstractButton)
+ {
+ button = (AbstractButton) c;
+ bmodel = button.getModel();
+ }
+
+ if (bmodel != null)
+ {
+ lowered = button.isSelected()
+ || (/* mouse inside */ bmodel.isArmed() && bmodel.isPressed());
+ focused = button.hasFocus() && button.isFocusPainted();
+ }
+
+ if (lowered)
+ BasicGraphicsUtils.drawLoweredBezel(g, x, y, width, height,
+ shadow, darkShadow,
+ highlight, lightHighlight);
+ else
+ BasicGraphicsUtils.drawBezel(g, x, y, width, height,
+ /* isPressed */ false,
+ /* isPefault */ focused,
+ shadow, darkShadow,
+ highlight, lightHighlight);
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ /* There is no obvious reason for overriding this method, but we
+ * try to have exactly the same API as the Sun reference
+ * implementation.
+ */
+ return getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ /* The exact amount has been determined using a test program
+ * that was run on the Apple/Sun JDK 1.3.1 on MacOS X, and the
+ * Sun JDK 1.4.1_01 on GNU/Linux for x86. Both gave [2,2,2,2].
+ */
+ if (insets == null)
+ return new Insets(2, 2, 2, 2);
+
+ insets.left = insets.right = insets.top = insets.bottom = 2;
+ return insets;
+ }
+ }
+
+
+ /**
+ * A one-pixel thick border for rollover buttons, for example in
+ * tool bars.
+ *
+ * @since 1.4
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class RolloverButtonBorder
+ extends ButtonBorder
{
- } // class RolloverButtonBorder
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Sun JDK 1.4.1_01 on GNU/Linux 2.4.20 for x86.
+ */
+ static final long serialVersionUID = 1976364864896996846L;
+
+
+ /**
+ * Constructs a new border for drawing a roll-over button
+ * in the Basic look and feel.
+ *
+ * @param shadow the shadow color.
+ * @param darkShadow a darker variant of the shadow color.
+ * @param highlight the highlight color.
+ * @param lightHighlight a brighter variant of the highlight color.
+ */
+ public RolloverButtonBorder(Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ super(shadow, darkShadow, highlight, lightHighlight);
+ }
+
+
+ /**
+ * Paints the border around a rollover button. If <code>c</code>
+ * is not an {@link javax.swing.AbstractButton} whose model
+ * returns <code>true</code> for {@link
+ * javax.swing.ButtonModel#isRollver}, nothing gets painted at
+ * all.
+ *
+ * @param c the button whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ ButtonModel bmodel = null;
+ boolean drawPressed;
+ Color oldColor = g.getColor();
+ int x2, y2;
+
+ if (c instanceof AbstractButton)
+ bmodel = ((AbstractButton) c).getModel();
+
+ /* Draw nothing if c is not a rollover button. */
+ if ((bmodel == null) || !bmodel.isRollover())
+ return;
+
+ /* Draw nothing if the mouse is pressed, but outside the button. */
+ if (bmodel.isPressed() && !bmodel.isArmed())
+ return;
+
+ drawPressed = bmodel.isSelected() || bmodel.isPressed();
+ x2 = x + width - 1;
+ y2 = y + height - 1;
+
+ try
+ {
+ g.setColor(drawPressed ? shadow : lightHighlight);
+ g.drawLine(x, y, x2 - 1, y); // top edge
+ g.drawLine(x, y + 1, x, y2 - 1); // left edge
+
+ g.setColor(drawPressed ? lightHighlight : shadow);
+ g.drawLine(x, y2, x2, y2); // bottom edge
+ g.drawLine(x2, y, x2, y2 - 1); // right edge
+ }
+ finally
+ {
+ g.setColor(oldColor);
+ }
+ }
+ }
+
+
+ /**
+ * A border for JSplitPanes in the Basic look and feel. The divider
+ * in the middle of the JSplitPane has its own border class, of which
+ * an instance can be obtained with {@link #getSplitPaneDividerBorder()}.
+ *
+ * <p><img src="BasicBorders.SplitPaneBorder-1.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.HORIZONTAL_SPLIT]" />
+ *
+ * <p><img src="BasicBorders.SplitPaneBorder-2.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.VERTICAL_SPLIT]" />
+ *
+ * <p>In contrast to the other borders of the Basic look and feel,
+ * this class is not serializable. While this might be unintended,
+ * GNU Classpath follows the specification in order to be fully
+ * compatible with the Sun reference implementation.
+ *
+ * <p>In the Sun JDK, the bottom edge of the divider also gets
+ * painted if the orientation of the enclosed JSplitPane is
+ * <code>JSplitPane.VERTICAL_SPLIT</code> (at least in versions
+ * 1.3.1 and 1.4.1). GNU Classpath does not replicate this bug. A
+ * report has been filed with Sun (review ID 188773).
+ *
+ * <p>Note that the bottom left pixel of the border has a different
+ * color depending on the orientation of the enclosed JSplitPane.
+ * Although this is visually inconsistent, Classpath replicates the
+ * appearance of the Sun reference implementation. A bug report has
+ * been filed with Sun (review ID 188774).
+ *
+ * @see {@link #getSplitPaneBorder()}
+ * @see {@link #getSplitPaneDividerBorder()}
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class SplitPaneBorder
+ implements Border, UIResource
{
+ /**
+ * Indicates that the top edge shall be not be painted
+ * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ */
+ private static final int SUPPRESS_TOP = 1;
+
+
+ /**
+ * Indicates that the left edge shall be not be painted
+ * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ */
+ private static final int SUPPRESS_LEFT = 2;
+
+
+ /**
+ * Indicates that the bottom edge shall be not be painted
+ * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ */
+ private static final int SUPPRESS_BOTTOM = 4;
+
+
+ /**
+ * Indicates that the right edge shall be not be painted
+ * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ */
+ private static final int SUPPRESS_RIGHT = 8;
+
+
+ /**
+ * The color for drawing the bottom and right edges of the border.
+ */
+ protected Color highlight;
+
+
+ /**
+ * The color for drawing the top and left edges of the border.
+ */
+ protected Color shadow;
+
+
+ /**
+ * Constructs a new border for drawing a JSplitPane in the Basic
+ * look and feel. The divider in the middle of the JSplitPane has
+ * its own border class, <code>SplitPaneDividerBorder</code>.
+ *
+ * @param shadow the shadow color.
+ * @param highlight the highlight color.
+ */
public SplitPaneBorder(Color highlight, Color shadow)
{
+ /* These colors usually come from the UIDefaults of the current
+ * look and feel. Use fallback values if the colors are not
+ * supplied. The API specification is silent about what
+ * behavior is expected for null colors, so users should not
+ * rely on this fallback (which is why it is not documented in
+ * the above Javadoc).
+ */
+ this.shadow = (shadow != null) ? shadow : Color.black;
+ this.highlight = (highlight != null) ? highlight : Color.white;
+ }
+
+
+ /**
+ * Paints the border around a <code>JSplitPane</code>.
+ *
+ * <p><img src="BasicBorders.SplitPaneBorder-1.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.HORIZONTAL_SPLIT]" />
+ *
+ * <p><img src="BasicBorders.SplitPaneBorder-2.png" width="520"
+ * height="200" alt="[A screen shot for JSplitPane.VERTICAL_SPLIT]" />
+ *
+ * @param c the <code>JSplitPane</code> whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ JSplitPane splitPane;
+ Component content;
+
+ if (!(c instanceof JSplitPane))
+ return;
+
+ splitPane = (JSplitPane) c;
+ switch (splitPane.getOrientation())
+ {
+ case JSplitPane.HORIZONTAL_SPLIT:
+ if ((content = splitPane.getLeftComponent()) != null)
+ paintRect(g, SUPPRESS_RIGHT, true, x, y, content.getBounds());
+ if ((content = splitPane.getRightComponent()) != null)
+ paintRect(g, SUPPRESS_LEFT, true, x, y, content.getBounds());
+ break;
+
+ case JSplitPane.VERTICAL_SPLIT:
+ if ((content = splitPane.getTopComponent()) != null)
+ paintRect(g, SUPPRESS_BOTTOM, false, x, y, content.getBounds());
+ if ((content = splitPane.getBottomComponent()) != null)
+ paintRect(g, SUPPRESS_TOP, false, x, y, content.getBounds());
+ break;
+ }
}
- } // class SplitPaneBorder
+
+
+ /**
+ * Paints a border around a child of a <code>JSplitPane</code>,
+ * omitting some of the edges.
+ *
+ * @param g the graphics for painting.
+ *
+ * @param suppress a bit mask indicating the set of suppressed
+ * edges, for example <code>SUPPRESS_TOP | SUPPRESS_RIGHT</code>.
+ *
+ * @param x the x coordinate of the SplitPaneBorder.
+ *
+ * @param y the y coordinate of the SplitPaneBorder.
+ *
+ * @param shadeBottomLeftPixel <code>true</code> to paint the
+ * bottom left pixel in the shadow color,
+ * <code>false</code> for the highlight color. The Basic
+ * look and feel uses the highlight color for the bottom
+ * left pixel of the border of a JSplitPane whose
+ * orientation is VERTICAL_SPLIT, and the shadow color
+ * otherwise. While this might be a strange distinction,
+ * Classpath tries to look identical to the reference
+ * implementation. A bug report has been filed with Sun;
+ * its review ID is 188774. We currently replicate the
+ * Sun behavior.
+ *
+ * @param rect the bounds of the child of JSplitPane whose
+ * border is to be painted.
+ */
+ private void paintRect(Graphics g, int suppress,
+ boolean shadeBottomLeftPixel,
+ int x, int y,
+ Rectangle rect)
+ {
+ if (rect == null)
+ return;
+
+ /* On each edge, the border exceeds the enclosed child by one
+ * pixel. See the image "BasicBorders.SplitPaneBorder-1.png" in
+ * the directory "doc-files".
+ */
+ x += rect.x - 1;
+ y += rect.y - 1;
+ int right = x + rect.width + 1;
+ int bottom = y + rect.height + 1;
+
+ Color oldColor = g.getColor();
+ try
+ {
+ g.setColor(shadow);
+ if ((suppress & SUPPRESS_TOP) == 0)
+ g.drawLine(x, y, right, y);
+ if ((suppress & SUPPRESS_LEFT) == 0)
+ g.drawLine(x, y, x, bottom);
+ else
+ g.drawLine(x, bottom, x, bottom); // one pixel
+
+ g.setColor(highlight);
+ if ((suppress & SUPPRESS_BOTTOM) == 0)
+ g.drawLine(x + (shadeBottomLeftPixel ? 1 : 0), bottom, right, bottom);
+ else if (!shadeBottomLeftPixel)
+ g.drawLine(x, bottom, x, bottom); // one pixel
+
+ if ((suppress & SUPPRESS_RIGHT) == 0)
+ g.drawLine(right, y, right, bottom);
+ }
+ finally
+ {
+ g.setColor(oldColor);
+ }
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured, usually
+ * an instance of {@link javax.swing.JSplitPane}.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(1, 1, 1, 1);
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * @return <code>false</code> because this border does not
+ * paint over the pixels where the divider joins
+ * the border.
+ */
+ public boolean isBorderOpaque()
+ {
+ /* Strangely, the Sun implementation (tested with JDK 1.3.1 and
+ * 1.4.1_01) seems to always return true. It could be a bug,
+ * but without knowing the details of their implementation, it is
+ * hard to decide.
+ */
+ return false;
+ }
+ }
+
+
+ /**
+ * A border for the divider inside a JSplitPane.
+ *
+ * <p><img src="BasicBorders.SplitPaneDividerBorder-1.png"
+ * width="520" height="200" alt="[A screen shot of this border]" />
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+ private static class SplitPaneDividerBorder
+ implements Border, UIResource, Serializable
+ {
+ /**
+ * The highlight color, which is drawn on the left or top edge
+ * depending on the orientation of the JSplitPanel.
+ */
+ protected Color highlight;
+
+
+ /**
+ * The highlight color, which is drawn on the right or bottom edge
+ * depending on the orientation of the JSplitPanel.
+ */
+ protected Color shadow;
+
+
+ /**
+ * Constructs a new border for drawing the divider of a JSplitPane
+ * in the Basic look and feel. The outer parts of the JSplitPane have
+ * their own border class, <code>SplitPaneBorder</code>.
+ *
+ * @param shadow the shadow color.
+ * @param highlight the highlight color.
+ */
+ public SplitPaneDividerBorder(Color highlight, Color shadow)
+ {
+ this.highlight = (highlight != null) ? highlight : Color.white;
+ this.shadow = (shadow != null) ? shadow : Color.black;
+ }
+
+
+ /**
+ * Paints the border around the divider of a <code>JSplitPane</code>.
+ *
+ * <p><img src="BasicBorders.SplitPaneDividerBorder-1.png" width="520"
+ * height="200" alt="[A picture that shows which pixels get painted
+ * in what color]" />
+ *
+ * @param c the <code>JSplitPane</code> whose divider&#x2019;s border
+ * is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ Color oldColor, dcol;
+ int x2, y2;
+ JSplitPane sp;
+
+ sp = getSplitPane(c);
+ if (sp == null)
+ return;
+
+ x2 = x + width - 1;
+ y2 = y + height - 1;
+ oldColor = g.getColor();
+ dcol = c.getBackground();
+ try
+ {
+ switch (sp.getOrientation())
+ {
+ case JSplitPane.HORIZONTAL_SPLIT:
+ g.setColor(dcol);
+ g.drawLine(x + 1, y, x2 - 1, y);
+ g.drawLine(x + 1, y2, x2 - 1, y2);
+ g.setColor(sp.getLeftComponent() != null ? highlight : dcol);
+ g.drawLine(x, y, x, y2);
+ g.setColor(sp.getRightComponent() != null ? shadow : dcol);
+ g.drawLine(x2, y, x2, y2);
+ break;
+
+ case JSplitPane.VERTICAL_SPLIT:
+ g.setColor(dcol);
+ g.drawLine(x, y + 1, x, y2 - 1);
+ g.drawLine(x2, y + 1, x2, y2 - 1);
+ g.setColor(sp.getTopComponent() != null ? highlight : dcol);
+ g.drawLine(x, y, x2, y);
+ g.setColor(sp.getBottomComponent() != null ? shadow : dcol);
+ g.drawLine(x, y2, x2, y2);
+ break;
+ }
+ }
+ finally
+ {
+ g.setColor(oldColor);
+ }
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured, usually
+ * an instance of {@link javax.swing.JSplitPane}.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(1, 1, 1, 1);
+ }
+
+
+ /**
+ * Determines whether this border fills every pixel in its area
+ * when painting.
+ *
+ * @return <code>true</code> if both highlight and shadow
+ * color are fully opaque.
+ */
+ public boolean isBorderOpaque()
+ {
+ return (highlight.getAlpha() == 255) && (shadow.getAlpha() == 255);
+ }
+
+
+ /**
+ * Determines the JSplitPane whose divider is being painted.
+ *
+ * @param c an instance of BasicSplitPaneDivider.
+ *
+ * @return a <code>JSplitPane</code>, or <code>null</code> if
+ * <code>c</code> is not an instance of {@link
+ * javax.swing.plaf.basic.BasicSplitPaneDivider}.
+ */
+ private JSplitPane getSplitPane(Component c)
+ {
+ if (c instanceof BasicSplitPaneDivider)
+ return (((BasicSplitPaneDivider) c).getBasicSplitPaneUI())
+ .getSplitPane();
+ else
+ return null;
+ }
+ }
+
+
+ /**
+ * A border for toggle buttons in the Basic look and feel.
+ *
+ * <p><img src="BasicBorders.ToggleButtonBorder-1.png" width="270"
+ * height="135" alt="[A screen shot of this border]" />
+ *
+ * <p>The Sun implementation always seems to draw exactly
+ * the same border, irrespective of the state of the button.
+ * This is rather surprising, but GNU Classpath emulates the
+ * observable behavior.
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public static class ToggleButtonBorder
+ extends ButtonBorder
{
- } // class ToggleButtonBorder
-} // class BasicBorders
+ /**
+ * Determined using the <code>serialver</code> tool
+ * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
+ */
+ static final long serialVersionUID = -3528666548001058394L;
+
+
+ /**
+ * Constructs a new border for drawing a JToggleButton in
+ * the Basic look and feel.
+ *
+ * @param shadow the shadow color.
+ * @param darkShadow a darker variant of the shadow color.
+ * @param highlight the highlight color.
+ * @param lightHighlight a brighter variant of the highlight color.
+ */
+ public ToggleButtonBorder(Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ /* The superclass ButtonBorder substitutes null arguments
+ * with fallback colors.
+ */
+ super(shadow, darkShadow, highlight, lightHighlight);
+ }
+
+
+ /**
+ * Paints the ToggleButtonBorder around a given component.
+ *
+ * <p>The Sun implementation always seems to draw exactly
+ * the same border, irrespective of the state of the button.
+ * This is rather surprising, but GNU Classpath emulates the
+ * observable behavior.
+ *
+ * @param c the component whose border is to be painted.
+ * @param g the graphics for painting.
+ * @param x the horizontal position for painting the border.
+ * @param y the vertical position for painting the border.
+ * @param width the width of the available area for painting the border.
+ * @param height the height of the available area for painting the border.
+ *
+ * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
+ */
+ public void paintBorder(Component c, Graphics g,
+ int x, int y, int width, int height)
+ {
+ /* The author of this code tried various variants for setting
+ * the state of the enclosed JToggleButton, but it seems that
+ * the drawn border is always identical. Weird, because this
+ * means that the user does not see whether the JToggleButton
+ * is selected or not.
+ */
+ BasicGraphicsUtils.drawBezel(g, x, y, width, height,
+ /* pressed */ false,
+ /* default */ false,
+ shadow, darkShadow,
+ highlight, lightHighlight);
+ }
+
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ /* There is no obvious reason for overriding this method, but we
+ * try to have exactly the same API as the Sun reference
+ * implementation.
+ */
+ return getBorderInsets(c, null);
+ }
+
+
+ /**
+ * Measures the width of this border, storing the results into a
+ * pre-existing Insets object.
+ *
+ * @param insets an Insets object for holding the result values.
+ * After invoking this method, the <code>left</code>,
+ * <code>right</code>, <code>top</code> and
+ * <code>bottom</code> fields indicate the width of the
+ * border at the respective edge.
+ *
+ * @return the same object that was passed for <code>insets</code>.
+ *
+ * @see #getBorderInsets()
+ */
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ /* The exact amount has been determined using a test program
+ * that was run on the Apple/Sun JDK 1.3.1 on MacOS X, and the
+ * Sun JDK 1.4.1_01 on GNU/Linux for x86. Both gave [2,2,2,2].
+ */
+ if (insets == null)
+ return new Insets(2, 2, 2, 2);
+
+ insets.left = insets.right = insets.top = insets.bottom = 2;
+ return insets;
+ }
+ }
+}
diff --git a/libjava/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/javax/swing/plaf/basic/BasicButtonUI.java
index 3f67c512874..d901e7ddeb7 100644
--- a/libjava/javax/swing/plaf/basic/BasicButtonUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicButtonUI.java
@@ -74,14 +74,7 @@ public class BasicButtonUI extends ButtonUI
public Dimension getPreferredSize(JComponent c)
{
AbstractButton b = (AbstractButton)c;
- Dimension d = BasicGraphicsUtils.getPreferredSize(b,
- gap,
- b.getText(),
- b.getIcon(),
- b.getVerticalAlignment(),
- b.getHorizontalAlignment(),
- b.getHorizontalTextPosition(),
- b.getVerticalTextPosition());
+ Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, gap);
// System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
return d;
}
@@ -99,7 +92,7 @@ public class BasicButtonUI extends ButtonUI
g.setFont(f);
- FontMetrics fm = SwingUtilities.getFontMetrics(f);
+ FontMetrics fm = g.getFontMetrics(f);
Insets i = c.getInsets();
@@ -198,7 +191,7 @@ public class BasicButtonUI extends ButtonUI
g.setFont(f);
- FontMetrics fm = SwingUtilities.getFontMetrics(f);
+ FontMetrics fm = g.getFontMetrics(f);
g.setColor(c.isEnabled() ? textColor : disabledTextColor);
diff --git a/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java b/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java
index 25fb0180b2a..54a9c69862e 100644
--- a/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicCheckBoxUI.java
@@ -57,15 +57,7 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI
public Dimension getPreferredSize(JComponent c)
{
AbstractButton b = (AbstractButton)c;
- Dimension d = BasicGraphicsUtils.getPreferredSize(b,
- gap,
- b.getText(),
- b.getIcon(),
- b.getVerticalAlignment(),
- b.getHorizontalAlignment(),
- b.getHorizontalTextPosition(),
- b.getVerticalTextPosition());
-
+ Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, gap);
//System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
return d;
}
diff --git a/libjava/javax/swing/plaf/basic/BasicDefaults.java b/libjava/javax/swing/plaf/basic/BasicDefaults.java
index 5bfb5d96106..046a7316c93 100644
--- a/libjava/javax/swing/plaf/basic/BasicDefaults.java
+++ b/libjava/javax/swing/plaf/basic/BasicDefaults.java
@@ -38,9 +38,12 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import javax.swing.*;
-import java.awt.*;
-import javax.swing.border.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import javax.swing.UIDefaults;
+import javax.swing.border.MatteBorder;
class BasicBorder extends MatteBorder
{
@@ -48,7 +51,7 @@ class BasicBorder extends MatteBorder
BasicBorder()
{
- super(5,5,5,5, null);
+ super(5,5,5,5, Color.black);
}
public void paintBorder(Component c,
@@ -72,7 +75,7 @@ class PanelBorder extends MatteBorder
{
PanelBorder()
{
- super(5,5,5,5, null);
+ super(5,5,5,5, Color.black);
}
public void paintBorder(Component c,
diff --git a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 55e9728567a..a7b64111f53 100644
--- a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -1,5 +1,5 @@
/* BasicGraphicsUtils.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,81 +35,602 @@ 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.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.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.awt.font.TextLayout;
-import java.awt.*;
-import javax.swing.*;
+import java.awt.geom.Rectangle2D;
+import javax.swing.AbstractButton;
+import javax.swing.SwingUtilities;
+
+/**
+ * A utility class providing commonly used drawing and measurement
+ * routines.
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
public class BasicGraphicsUtils
-{
- public static Dimension getPreferredSize(JComponent b,
- int gap,
- String text,
- Icon icon,
- int va,
- int ha,
- int htp,
- int vtp)
+{
+ /**
+ * Constructor. It is utterly unclear why this class should
+ * be constructable, but this is what the API specification
+ * says.
+ */
+ public BasicGraphicsUtils()
+ {
+ }
+
+
+ /**
+ * Draws a rectangle that appears etched into the surface, given
+ * four colors that are used for drawing.
+ *
+ * <p><img src="BasicGraphicsUtils-1.png" width="360"
+ * height="200" alt="[An illustration that shows which pixels
+ * get painted in what color]" />
+ *
+ * @param g the graphics into which the rectangle is drawn.
+ * @param x the x coordinate of the rectangle.
+ * @param y the y coordinate of the rectangle.
+ * @param width the width of the rectangle in pixels.
+ * @param height the height of the rectangle in pixels.
+ *
+ * @param shadow the color that will be used for painting
+ * the outer side of the top and left edges.
+ *
+ * @param darkShadow the color that will be used for painting
+ * the inner side of the top and left edges.
+ *
+ * @param highlight the color that will be used for painting
+ * the inner side of the bottom and right edges.
+ *
+ * @param lightHighlight the color that will be used for painting
+ * the outer side of the bottom and right edges.
+ *
+ * @see #getEtchedInsets()
+ * @see javax.swing.border.EtchedBorder
+ */
+ public static void drawEtchedRect(Graphics g,
+ int x, int y, int width, int height,
+ Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ Color oldColor;
+ int x2, y2;
+
+ oldColor = g.getColor();
+ x2 = x + width - 1;
+ y2 = y + height - 1;
+
+ try
{
- JComponent c = b;
- // this is a staight copy from BasicButtonUI.paint()
- //
- Rectangle tr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle vr = new Rectangle();
-
- Font f = c.getFont();
-
- FontMetrics fm = SwingUtilities.getFontMetrics(f);
-
- Insets i = c.getInsets();
-
- vr.x = i.left;
- vr.y = i.top;
- vr.width = b.getWidth() - (i.right + i.left);
- vr.height = b.getHeight() - (i.bottom + i.top);
-
- // System.out.println(" VIEW-RECT-BUTTON="+vr+", insets="+i);
-
- String tt = SwingUtilities.layoutCompoundLabel(b,
- fm,
- text,
- icon,
- va,
- ha,
- vtp,
- htp,
- vr,
- ir,
- tr,
- gap);
-
- Rectangle r = ir.union(tr);
-
- Insets insets = b.getInsets();
- r.width += insets.left + insets.right;
- r.height += insets.top + insets.bottom;
-
- // System.out.println("COMPUTED SIZE FOR PREF_SIZE="+r);
-
- return r.getSize();
+ /* To understand this code, it might be helpful to look at the
+ * image "BasicGraphicsUtils-1.png" that is included with the
+ * JavaDoc. The file is located in the "doc-files" subdirectory.
+ *
+ * (x2, y2) is the coordinate of the most right and bottom pixel
+ * to be painted.
+ */
+ g.setColor(shadow);
+ g.drawLine(x, y, x2 - 1, y); // top, outer
+ g.drawLine(x, y + 1, x, y2 - 1); // left, outer
+
+ g.setColor(darkShadow);
+ g.drawLine(x + 1, y + 1, x2 - 2, y + 1); // top, inner
+ g.drawLine(x + 1, y + 2, x + 1, y2 - 2); // left, inner
+
+ g.setColor(highlight);
+ g.drawLine(x + 1, y2 - 1, x2 - 1, y2 - 1); // bottom, inner
+ g.drawLine(x2 - 1, y + 1, x2 - 1, y2 - 2); // right, inner
+
+ g.setColor(lightHighlight);
+ g.drawLine(x, y2, x2, y2); // bottom, outer
+ g.drawLine(x2, y, x2, y2 - 1); // right, outer
+ }
+ finally
+ {
+ g.setColor(oldColor);
}
+ }
+
+
+ /**
+ * Determines the width of the border that gets painted by
+ * {@link #drawEtchedRect}.
+ *
+ * @return an <code>Insets</code> object whose <code>top</code>,
+ * <code>left</code>, <code>bottom</code> and
+ * <code>right</code> field contain the border width at the
+ * respective edge in pixels.
+ */
+ public static Insets getEtchedInsets()
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
+
+ /**
+ * Draws a rectangle that appears etched into the surface, given
+ * two colors that are used for drawing.
+ *
+ * <p><img src="BasicGraphicsUtils-2.png" width="360"
+ * height="200" alt="[An illustration that shows which pixels
+ * get painted in what color]" />
+ *
+ * @param g the graphics into which the rectangle is drawn.
+ * @param x the x coordinate of the rectangle.
+ * @param y the y coordinate of the rectangle.
+ * @param width the width of the rectangle in pixels.
+ * @param height the height of the rectangle in pixels.
+ *
+ * @param shadow the color that will be used for painting the outer
+ * side of the top and left edges, and for the inner side of
+ * the bottom and right ones.
+ *
+ * @param highlight the color that will be used for painting the
+ * inner side of the top and left edges, and for the outer
+ * side of the bottom and right ones.
+ *
+ * @see #getGrooveInsets()
+ * @see javax.swing.border.EtchedBorder
+ */
+ public static void drawGroove(Graphics g,
+ int x, int y, int width, int height,
+ Color shadow, Color highlight)
+ {
+ /* To understand this, it might be helpful to look at the image
+ * "BasicGraphicsUtils-2.png" that is included with the JavaDoc,
+ * and to compare it with "BasicGraphicsUtils-1.png" which shows
+ * the pixels painted by drawEtchedRect. These image files are
+ * located in the "doc-files" subdirectory.
+ */
+ drawEtchedRect(g, x, y, width, height,
+ /* outer topLeft */ shadow,
+ /* inner topLeft */ highlight,
+ /* inner bottomRight */ shadow,
+ /* outer bottomRight */ highlight);
+ }
+
- public static void drawString(Graphics g,
- String text,
- int underlinedChar,
- int x,
- int y)
+ /**
+ * Determines the width of the border that gets painted by
+ * {@link #drawGroove}.
+ *
+ * @return an <code>Insets</code> object whose <code>top</code>,
+ * <code>left</code>, <code>bottom</code> and
+ * <code>right</code> field contain the border width at the
+ * respective edge in pixels.
+ */
+ public static Insets getGrooveInsets()
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
+
+ /**
+ * Draws a border that is suitable for buttons of the Basic look and
+ * feel.
+ *
+ * <p><img src="BasicGraphicsUtils-3.png" width="500"
+ * height="300" alt="[An illustration that shows which pixels
+ * get painted in what color]" />
+ *
+ * @param g the graphics into which the rectangle is drawn.
+ * @param x the x coordinate of the rectangle.
+ * @param y the y coordinate of the rectangle.
+ * @param width the width of the rectangle in pixels.
+ * @param height the height of the rectangle in pixels.
+ *
+ * @param isPressed <code>true</code> to draw the button border
+ * with a pressed-in appearance; <code>false</code> for
+ * normal (unpressed) appearance.
+ *
+ * @param isDefault <code>true</code> to draw the border with
+ * the appearance it has when hitting the enter key in a
+ * dialog will simulate a click to this button;
+ * <code>false</code> for normal appearance.
+ *
+ * @param shadow the shadow color.
+ * @param darkShadow a darker variant of the shadow color.
+ * @param highlight the highlight color.
+ * @param lightHighlight a brighter variant of the highlight color.
+ */
+ public static void drawBezel(Graphics g,
+ int x, int y, int width, int height,
+ boolean isPressed, boolean isDefault,
+ Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ Color oldColor = g.getColor();
+
+ /* To understand this, it might be helpful to look at the image
+ * "BasicGraphicsUtils-3.png" that is included with the JavaDoc,
+ * and to compare it with "BasicGraphicsUtils-1.png" which shows
+ * the pixels painted by drawEtchedRect. These image files are
+ * located in the "doc-files" subdirectory.
+ */
+ try
{
- g.drawString(text, x, y);
+ if ((isPressed == false) && (isDefault == false))
+ {
+ drawEtchedRect(g, x, y, width, height,
+ lightHighlight, highlight,
+ shadow, darkShadow);
+ }
+
+ if ((isPressed == true) && (isDefault == false))
+ {
+ g.setColor(shadow);
+ g.drawRect(x + 1, y + 1, width - 2, height - 2);
+ }
+
+ if ((isPressed == false) && (isDefault == true))
+ {
+ g.setColor(darkShadow);
+ g.drawRect(x, y, width - 1, height - 1);
+ drawEtchedRect(g, x + 1, y + 1, width - 2, height - 2,
+ lightHighlight, highlight,
+ shadow, darkShadow);
+ }
+
+ if ((isPressed == true) && (isDefault == true))
+ {
+ g.setColor(darkShadow);
+ g.drawRect(x, y, width - 1, height - 1);
+ g.setColor(shadow);
+ g.drawRect(x + 1, y + 1, width - 3, height - 3);
+ }
}
-}
+ finally
+ {
+ g.setColor(oldColor);
+ }
+ }
+
+
+ /**
+ * Draws a rectangle that appears lowered into the surface, given
+ * four colors that are used for drawing.
+ *
+ * <p><img src="BasicGraphicsUtils-4.png" width="360"
+ * height="200" alt="[An illustration that shows which pixels
+ * get painted in what color]" />
+ *
+ * <p><strong>Compatibility with the Sun reference
+ * implementation:</strong> The Sun reference implementation seems
+ * to ignore the <code>x</code> and <code>y</code> arguments, at
+ * least in JDK 1.3.1 and 1.4.1_01. The method always draws the
+ * rectangular area at location (0, 0). A bug report has been filed
+ * with Sun; its &#x201c;bug ID&#x201d; is 4880003. The GNU Classpath
+ * implementation behaves correctly, thus not replicating this bug.
+ *
+ * @param g the graphics into which the rectangle is drawn.
+ * @param x the x coordinate of the rectangle.
+ * @param y the y coordinate of the rectangle.
+ * @param width the width of the rectangle in pixels.
+ * @param height the height of the rectangle in pixels.
+ *
+ * @param shadow the color that will be used for painting
+ * the inner side of the top and left edges.
+ *
+ * @param darkShadow the color that will be used for painting
+ * the outer side of the top and left edges.
+ *
+ * @param highlight the color that will be used for painting
+ * the inner side of the bottom and right edges.
+ *
+ * @param lightHighlight the color that will be used for painting
+ * the outer side of the bottom and right edges.
+ */
+ public static void drawLoweredBezel(Graphics g,
+ int x, int y, int width, int height,
+ Color shadow, Color darkShadow,
+ Color highlight, Color lightHighlight)
+ {
+ /* Like drawEtchedRect, but swapping darkShadow and shadow.
+ *
+ * To understand this, it might be helpful to look at the image
+ * "BasicGraphicsUtils-4.png" that is included with the JavaDoc,
+ * and to compare it with "BasicGraphicsUtils-1.png" which shows
+ * the pixels painted by drawEtchedRect. These image files are
+ * located in the "doc-files" subdirectory.
+ */
+ drawEtchedRect(g, x, y, width, height,
+ darkShadow, shadow,
+ highlight, lightHighlight);
+ }
+
+
+ /**
+ * Draws a String at the given location, underlining the first
+ * occurence of a specified character. The algorithm for determining
+ * the underlined position is not sensitive to case. If the
+ * character is not part of <code>text</code>, the text will be
+ * drawn without underlining. Drawing is performed in the current
+ * color and font of <code>g</code>.
+ *
+ * <p><img src="BasicGraphicsUtils-5.png" width="500"
+ * height="100" alt="[An illustration showing how to use the
+ * method]" />
+ *
+ * @param g the graphics into which the String is drawn.
+ *
+ * @param text the String to draw.
+ *
+ * @param underlinedChar the character whose first occurence in
+ * <code>text</code> will be underlined. It is not clear
+ * why the API specification declares this argument to be
+ * of type <code>int</code> instead of <code>char</code>.
+ * While this would allow to pass Unicode characters outside
+ * Basic Multilingual Plane 0 (U+0000 .. U+FFFE), at least
+ * the GNU Classpath implementation does not underline
+ * anything if <code>underlinedChar</code> is outside
+ * the range of <code>char</code>.
+ *
+ * @param x the x coordinate of the text, as it would be passed to
+ * {@link java.awt.Graphics#drawString(java.lang.String,
+ * int, int)}.
+ *
+ * @param y the y coordinate of the text, as it would be passed to
+ * {@link java.awt.Graphics#drawString(java.lang.String,
+ * int, int)}.
+ */
+ public static void drawString(Graphics g, String text,
+ int underlinedChar, int x, int y)
+ {
+ int index = -1;
+
+ /* It is intentional that lower case is used. In some languages,
+ * the set of lowercase characters is larger than the set of
+ * uppercase ones. Therefore, it is good practice to use lowercase
+ * for such comparisons (which really means that the author of this
+ * code can vaguely remember having read some Unicode techreport
+ * with this recommendation, but is too lazy to look for the URL).
+ */
+ if ((underlinedChar >= 0) || (underlinedChar <= 0xffff))
+ index = text.toLowerCase().indexOf(
+ Character.toLowerCase((char) underlinedChar));
+
+ drawStringUnderlineCharAt(g, text, index, x, y);
+ }
+ /**
+ * Draws a String at the given location, underlining the character
+ * at the specified index. Drawing is performed in the current color
+ * and font of <code>g</code>.
+ *
+ * <p><img src="BasicGraphicsUtils-5.png" width="500"
+ * height="100" alt="[An illustration showing how to use the
+ * method]" />
+ *
+ * @param g the graphics into which the String is drawn.
+ *
+ * @param text the String to draw.
+ *
+ * @param underlinedIndex the index of the underlined character in
+ * <code>text</code>. If <code>underlinedIndex</code> falls
+ * outside the range <code>[0, text.length() - 1]</code>, the
+ * text will be drawn without underlining anything.
+ *
+ * @param x the x coordinate of the text, as it would be passed to
+ * {@link java.awt.Graphics#drawString(java.lang.String,
+ * int, int)}.
+ *
+ * @param y the y coordinate of the text, as it would be passed to
+ * {@link java.awt.Graphics#drawString(java.lang.String,
+ * int, int)}.
+ *
+ * @since 1.4
+ */
+ public static void drawStringUnderlineCharAt(Graphics g, String text,
+ int underlinedIndex,
+ int x, int y)
+ {
+ Graphics2D g2;
+ Rectangle2D.Double underline;
+ FontRenderContext frc;
+ FontMetrics fmet;
+ LineMetrics lineMetrics;
+ Font font;
+ TextLayout layout;
+ double underlineX1, underlineX2;
+ boolean drawUnderline;
+ int textLength;
+ textLength = text.length();
+ if (textLength == 0)
+ return;
+ drawUnderline = (underlinedIndex >= 0) && (underlinedIndex < textLength);
+ if (!(g instanceof Graphics2D))
+ {
+ /* Fall-back. This is likely to produce garbage for any text
+ * containing right-to-left (Hebrew or Arabic) characters, even
+ * if the underlined character is left-to-right.
+ */
+ g.drawString(text, x, y);
+ if (drawUnderline)
+ {
+ fmet = g.getFontMetrics();
+ g.fillRect(
+ /* x */ x + fmet.stringWidth(text.substring(0, underlinedIndex)),
+ /* y */ y + fmet.getDescent() - 1,
+ /* width */ fmet.charWidth(text.charAt(underlinedIndex)),
+ /* height */ 1);
+ }
+
+ return;
+ }
+ g2 = (Graphics2D) g;
+ font = g2.getFont();
+ frc = g2.getFontRenderContext();
+ lineMetrics = font.getLineMetrics(text, frc);
+ layout = new TextLayout(text, font, frc);
+
+ /* Draw the text. */
+ layout.draw(g2, x, y);
+ if (!drawUnderline)
+ return;
+
+ underlineX1 = x + layout.getLogicalHighlightShape(
+ underlinedIndex, underlinedIndex).getBounds2D().getX();
+ underlineX2 = x + layout.getLogicalHighlightShape(
+ underlinedIndex + 1, underlinedIndex + 1).getBounds2D().getX();
+
+ underline = new Rectangle2D.Double();
+ if (underlineX1 < underlineX2)
+ {
+ underline.x = underlineX1;
+ underline.width = underlineX2 - underlineX1;
+ }
+ else
+ {
+ underline.x = underlineX2;
+ underline.width = underlineX1 - underlineX2;
+ }
+
+
+ underline.height = lineMetrics.getUnderlineThickness();
+ underline.y = lineMetrics.getUnderlineOffset();
+ if (underline.y == 0)
+ {
+ /* Some fonts do not specify an underline offset, although they
+ * actually should do so. In that case, the result of calling
+ * lineMetrics.getUnderlineOffset() will be zero. Since it would
+ * look very ugly if the underline was be positioned immediately
+ * below the baseline, we check for this and move the underline
+ * below the descent, as shown in the following ASCII picture:
+ *
+ * ##### ##### #
+ * # # # #
+ * # # # #
+ * # # # #
+ * ##### ###### ---- baseline (0)
+ * #
+ * #
+ * ------------------###----------- lineMetrics.getDescent()
+ */
+ underline.y = lineMetrics.getDescent();
+ }
+
+ underline.y += y;
+ g2.fill(underline);
+ }
+
+
+ /**
+ * Draws a rectangle, simulating a dotted stroke by painting only
+ * every second pixel along the one-pixel thick edge. The color of
+ * those pixels is the current color of the Graphics <code>g</code>.
+ * Any other pixels are left unchanged.
+ *
+ * <p><img src="BasicGraphicsUtils-7.png" width="360"
+ * height="200" alt="[An illustration that shows which pixels
+ * get painted]" />
+ *
+ * @param g the graphics into which the rectangle is drawn.
+ * @param x the x coordinate of the rectangle.
+ * @param y the y coordinate of the rectangle.
+ * @param width the width of the rectangle in pixels.
+ * @param height the height of the rectangle in pixels.
+ */
+ public static void drawDashedRect(Graphics g,
+ int x, int y, int width, int height)
+ {
+ int right = x + width - 1;
+ int bottom = y + height - 1;
+
+ /* Draw the top and bottom edge of the dotted rectangle. */
+ for (int i = x; i <= right; i += 2)
+ {
+ g.drawLine(i, y, i, y);
+ g.drawLine(i, bottom, i, bottom);
+ }
+
+ /* Draw the left and right edge of the dotted rectangle. */
+ for (int i = y; i <= bottom; i += 2)
+ {
+ g.drawLine(x, i, x, i);
+ g.drawLine(right, i, right, i);
+ }
+ }
+
+
+ /**
+ * Determines the preferred width and height of an AbstractButton,
+ * given the gap between the button&#x2019;s text and icon.
+ *
+ * @param b the button whose preferred size is determined.
+ *
+ * @param textIconGap the gap between the button&#x2019;s text and
+ * icon.
+ *
+ * @return a <code>Dimension</code> object whose <code>width</code>
+ * and <code>height</code> fields indicate the preferred
+ * extent in pixels.
+ *
+ * @see javax.swing.SwingUtilities#layoutCompoundLabel
+ */
+ public static Dimension getPreferredButtonSize(AbstractButton b,
+ int textIconGap)
+ {
+ Rectangle contentRect;
+ Rectangle viewRect;
+ Rectangle iconRect = new Rectangle();
+ Rectangle textRect = new Rectangle();
+ Insets insets = b.getInsets();
+
+ /* For determining the ideal size, do not assume a size restriction. */
+ viewRect = new Rectangle(0, 0,
+ /* width */ Integer.MAX_VALUE,
+ /* height */ Integer.MAX_VALUE);
+
+ /* java.awt.Toolkit.getFontMetrics is deprecated. However, it
+ * seems not obvious how to get to the correct FontMetrics object
+ * otherwise. The real problem probably is that the method
+ * javax.swing.SwingUtilities.layoutCompundLabel should take a
+ * LineMetrics, not a FontMetrics argument. But fixing this that
+ * would change the public API.
+ */
+ SwingUtilities.layoutCompoundLabel(
+ b, // for the component orientation
+ b.getToolkit().getFontMetrics(b.getFont()), // see comment above
+ b.getText(),
+ b.getIcon(),
+ b.getVerticalAlignment(),
+ b.getHorizontalAlignment(),
+ b.getVerticalTextPosition(),
+ b.getHorizontalTextPosition(),
+ viewRect, iconRect, textRect,
+ textIconGap);
+
+
+ /* +------------------------+ +------------------------+
+ * | | | |
+ * | ICON | | CONTENTCONTENTCONTENT |
+ * | TEXTTEXTTEXT | --> | CONTENTCONTENTCONTENT |
+ * | TEXTTEXTTEXT | | CONTENTCONTENTCONTENT |
+ * +------------------------+ +------------------------+
+ */
+ contentRect = textRect.union(iconRect);
+
+ return new Dimension(insets.left + contentRect.width + insets.right,
+ insets.top + contentRect.height + insets.bottom);
+ }
+}
diff --git a/libjava/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/javax/swing/plaf/basic/BasicLabelUI.java
index 82623a6d3f0..0adad4dafa5 100644
--- a/libjava/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicLabelUI.java
@@ -65,6 +65,10 @@ public class BasicLabelUI extends LabelUI
public Dimension getPreferredSize(JComponent c)
{
JLabel b = (JLabel)c;
+ /*
+ We cannot use this method because it is not part of the
+ official Swing API.
+
Dimension d = BasicGraphicsUtils.getPreferredSize(b,
gap,
b.getText(),
@@ -74,7 +78,8 @@ public class BasicLabelUI extends LabelUI
b.getHorizontalTextPosition(),
b.getVerticalTextPosition());
System.out.println("JLABEL->^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.getText());
- return d;
+ */
+ return new Dimension(100, 30);
}
@@ -90,7 +95,7 @@ public class BasicLabelUI extends LabelUI
g.setFont(f);
- FontMetrics fm = SwingUtilities.getFontMetrics(f);
+ FontMetrics fm = g.getFontMetrics(f);
Insets i = c.getInsets();
diff --git a/libjava/javax/swing/plaf/basic/BasicListUI.java b/libjava/javax/swing/plaf/basic/BasicListUI.java
index 24c40727155..fd4f095cc9b 100644
--- a/libjava/javax/swing/plaf/basic/BasicListUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicListUI.java
@@ -159,12 +159,19 @@ public class BasicListUI extends ListUI
a.y += dim.height + gap_between_cells;
}
}
-}
-
-
-
-
-
+ public int locationToIndex(JList list, Point location)
+ {
+ throw new Error ("Not implemented");
+ }
+ public Point indexToLocation(JList list, int index)
+ {
+ throw new Error ("Not implemented");
+ }
+ public Rectangle getCellBounds(JList list, int index1, int index2)
+ {
+ throw new Error ("Not implemented");
+ }
+}
diff --git a/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
index e3023a85473..5df1157cc07 100644
--- a/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -64,7 +64,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
System.out.println(" -------------: " + pane);
- JLabel message = pane.msg != null ? new JLabel((String)pane.msg) : null;
+ JLabel message = null;
JButton ok_button = new JButton("Ok");
ok_button.addActionListener(new ActionListener()
@@ -83,11 +83,12 @@ public class BasicOptionPaneUI extends OptionPaneUI
}
});
- if (pane.args != null)
+ Object[] options = null;
+ if (options != null)
{
- for (int i=0; i<pane.args.length; i++)
+ for (int i=0; i<options.length; i++)
{
- Object o = pane.args[i];
+ Object o = options[i];
if (o != null)
{
if (o instanceof String)
@@ -138,4 +139,14 @@ public class BasicOptionPaneUI extends OptionPaneUI
return d2;
}
+
+ public void selectInitialValue(JOptionPane op)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public boolean containsCustomComponents(JOptionPane op)
+ {
+ throw new Error ("Not implemented");
+ }
}
diff --git a/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java
index 0f7f6a0faf1..bcc730c48f1 100644
--- a/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -60,14 +60,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
public Dimension getPreferredSize(JComponent c)
{
AbstractButton b = (AbstractButton)c;
- Dimension d = BasicGraphicsUtils.getPreferredSize(b,
- gap,
- b.getText(),
- b.getIcon(),
- b.getVerticalAlignment(),
- b.getHorizontalAlignment(),
- b.getHorizontalTextPosition(),
- b.getVerticalTextPosition());
+ Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, gap);
// and add a little something for the circles:
diff --git a/libjava/javax/swing/plaf/basic/BasicTextUI.java b/libjava/javax/swing/plaf/basic/BasicTextUI.java
index 66af1b65d50..0930610a3a9 100644
--- a/libjava/javax/swing/plaf/basic/BasicTextUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTextUI.java
@@ -1,5 +1,5 @@
/* BasicTextUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,10 +46,16 @@ import javax.swing.*;
public class BasicTextUI extends TextUI
{
int gap = 3;
- View view = new RootView();
+ View view = null; // was: new RootView();
Color textColor, disabledTextColor, normalBackgroundColor;
EditorKit kit = new DefaultEditorKit();
+ /* *****************************************************************
+ * This View is way too incomplete to be of any use. To avoid errors
+ * when compiling with the Sun JDK, it has been commented out.
+ * -- Sascha Brawer (brawer@dandelis.ch)
+ *
+ * (begin of commented out section)
class RootView extends View
{
RootView()
@@ -68,6 +74,8 @@ public class BasicTextUI extends TextUI
}
}
}
+ * (end of commented out section)
+ *************************************************************** */
public BasicTextUI()
{
@@ -128,6 +136,7 @@ public class BasicTextUI extends TextUI
Position.Bias b,
int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
return 0;
}
@@ -138,11 +147,13 @@ public class BasicTextUI extends TextUI
}
public Rectangle modelToView(JTextComponent t, int pos)
+ throws BadLocationException
{
return modelToView(t, pos, null);
}
public Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias)
+ throws BadLocationException
{
return null;
}
diff --git a/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java b/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java
index 4b9260e8d8f..441c60696d5 100644
--- a/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicToggleButtonUI.java
@@ -58,14 +58,7 @@ public class BasicToggleButtonUI extends BasicButtonUI
public Dimension getPreferredSize(JComponent c)
{
AbstractButton b = (AbstractButton)c;
- Dimension d = BasicGraphicsUtils.getPreferredSize(b,
- gap,
- b.getText(),
- b.getIcon(),
- b.getVerticalAlignment(),
- b.getHorizontalAlignment(),
- b.getHorizontalTextPosition(),
- b.getVerticalTextPosition());
+ Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, gap);
//System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
return d;
diff --git a/libjava/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/javax/swing/plaf/basic/BasicTreeUI.java
index 17ba4b56e61..d9af1010ba7 100644
--- a/libjava/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTreeUI.java
@@ -1,5 +1,5 @@
/* BasicTreeUI.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,199 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import javax.swing.plaf.*;
+import java.awt.Rectangle;
+import javax.swing.JTree;
+import javax.swing.plaf.TreeUI;
+import javax.swing.tree.TreePath;
-public class BasicTreeUI extends TreeUI
+
+/**
+ * A delegate providing the user interface for <code>JTree</code>
+ * according to the Basic look and feel. The current implementation
+ * of GNU Classpath does really work; it is just a stub that allows
+ * compiling the code.
+ *
+ * @see javax.swing.JTree
+ *
+ * @author Sascha Brawer (brawer@dandelis.ch)
+ */
+public class BasicTreeUI
+ extends TreeUI
{
+ /**
+ * Determines the geometric extent of the label that is
+ * drawn for a path.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param path the path whose label extent is requested.
+ *
+ * @return a rectangle enclosing the label, or <code>null</code>
+ * if <code>path</code> contains invalid nodes.
+ */
+ public Rectangle getPathBounds(JTree tree, TreePath path)
+ {
+ return null; // FIXME: not implemented
+ }
+
+
+ /**
+ * Creates a <code>TreePath</code> for the specified row.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param row the index of the row, which should be a number
+ * in the range <code>[0, getRowCount(tree) - 1]</code>.
+ *
+ * @return a <code>TreePath</code> for the specified row, or
+ * <code>null</code> if <code>row</code> is outside
+ * the valid range.
+ */
+ public TreePath getPathForRow(JTree tree, int row)
+ {
+ return null; // FIXME: not implemented
+ }
+
+
+ /**
+ * Determines in which row a <code>TreePath</code> is currently
+ * being displayed.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param path the path for which the caller wants to know
+ * in which row it is being displayed.
+ *
+ * @return a number in the range <code>[0, getRowCount(tree)
+ * - 1]</code> if the path is currently on display;
+ * <code>-1</code> if the path is not shown to the
+ * user.
+ */
+ public int getRowForPath(JTree tree, TreePath path)
+ {
+ return -1; // FIXME: not implemented
+ }
+
+
+ /**
+ * Counts how many rows are currently displayed.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @return the number of visible rows.
+ */
+ public int getRowCount(JTree tree)
+ {
+ return 0; // FIXME: not implemented
+ }
+
+
+ /**
+ * Finds the path that is closest to the specified position.
+ *
+ * <p><img src="../TreeUI-1.png" width="300" height="250"
+ * alt="[A screen shot of a JTree] />
+ *
+ * <p>As shown by the above illustration, the bounds of the
+ * closest path do not necessarily need to contain the passed
+ * location.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param x the horizontal location, relative to the origin
+ * of <code>tree</code>.
+ *
+ * @param y the vertical location, relative to the origin
+ * of <code>tree</code>.
+ *
+ * @return the closest path, or <code>null</code> if the
+ * tree is currenlty not displaying any paths at all.
+ */
+ public TreePath getClosestPathForLocation(JTree tree,
+ int x, int y)
+ {
+ return null; // FIXME: not implemented
+ }
+
+
+ /**
+ * Determines whether the user is currently editing a tree cell.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @see #getEditingPath
+ */
+ public boolean isEditing(JTree tree)
+ {
+ return false; // FIXME: not implemented
+ }
+
+
+ /**
+ * Stops editing a tree cell, committing the entered value into the
+ * tree&#x2019;s model. If no editing session is active, or if the
+ * active editor does not agree to stopping, nothing happens. In
+ * some look and feels, this action happens when the user has
+ * pressed the enter key.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @return <code>false</code> if the editing still goes on because
+ * the cell editor has objected to stopping the session;
+ * <code>true</code> if editing has been stopped.
+ */
+ public boolean stopEditing(JTree tree)
+ {
+ return true; // FIXME: not implemented
+ }
+
+
+ /**
+ * Cancels editing a tree cell, discarding any entered value.
+ * If no editing session is active, nothing happens. The cell
+ * editor is not given an opportunity to veto the canceling.
+ * In some look and feels, this action happens when the user has
+ * pressed the escape key.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ */
+ public void cancelEditing(JTree tree)
+ {
+ // FIXME: not implemented
+ }
+
+
+ /**
+ * Starts a session to edit a tree cell. If the cell editor
+ * rejects editing the cell, it will just be selected.
+ *
+ * @param tree the <code>JTree</code> for which this delegate
+ * object provides the user interface.
+ *
+ * @param path the cell to edit.
+ */
+ public void startEditingAtPath(JTree tree, TreePath path)
+ {
+ // FIXME: not implemented
+ }
+
+
+ /**
+ * Retrieves the tree cell that is currently being edited.
+ *
+ * @return the currently edited path, or <code>null</code>
+ * if no editing session is currently active.
+ */
+ public TreePath getEditingPath(JTree tree)
+ {
+ return null; // FIXME: not implemented
+ }
}
diff --git a/libjava/javax/swing/table/AbstractTableModel.java b/libjava/javax/swing/table/AbstractTableModel.java
index 08eeb829a74..2f7ce40ce87 100644
--- a/libjava/javax/swing/table/AbstractTableModel.java
+++ b/libjava/javax/swing/table/AbstractTableModel.java
@@ -35,12 +35,14 @@ 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.table;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.Serializable;
+import java.util.EventListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
/**
* AbstractTableModel
diff --git a/libjava/javax/swing/table/DefaultTableCellRenderer.java b/libjava/javax/swing/table/DefaultTableCellRenderer.java
index a7bcc5c36b7..fdecedd8acf 100644
--- a/libjava/javax/swing/table/DefaultTableCellRenderer.java
+++ b/libjava/javax/swing/table/DefaultTableCellRenderer.java
@@ -37,10 +37,13 @@ exception statement from your version. */
package javax.swing.table;
+
import java.awt.Component;
import java.io.Serializable;
import javax.swing.JLabel;
import javax.swing.JTable;
+import javax.swing.border.Border;
+
/**
* STUBBED
*/
diff --git a/libjava/javax/swing/table/DefaultTableColumnModel.java b/libjava/javax/swing/table/DefaultTableColumnModel.java
index 9ab2fff8116..2946829f99c 100644
--- a/libjava/javax/swing/table/DefaultTableColumnModel.java
+++ b/libjava/javax/swing/table/DefaultTableColumnModel.java
@@ -35,14 +35,22 @@ 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.table;
-// Imports
-import java.beans.*;
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-import javax.swing.event.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Vector;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableColumnModelEvent;
+import javax.swing.event.TableColumnModelListener;
/**
* DefaultTableColumnModel
diff --git a/libjava/javax/swing/table/DefaultTableModel.java b/libjava/javax/swing/table/DefaultTableModel.java
index 1587310856e..473229bea1d 100644
--- a/libjava/javax/swing/table/DefaultTableModel.java
+++ b/libjava/javax/swing/table/DefaultTableModel.java
@@ -35,12 +35,12 @@ 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.table;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.Serializable;
+import java.util.Vector;
+import javax.swing.event.TableModelEvent;
/**
* DefaultTableModel
diff --git a/libjava/javax/swing/table/TableColumn.java b/libjava/javax/swing/table/TableColumn.java
index f5ace625675..d228d8aae92 100644
--- a/libjava/javax/swing/table/TableColumn.java
+++ b/libjava/javax/swing/table/TableColumn.java
@@ -35,12 +35,12 @@ 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.table;
-// Imports
-import java.beans.*;
-import java.io.*;
-import javax.swing.event.*;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import javax.swing.event.SwingPropertyChangeSupport;
/**
* TableColumn
diff --git a/libjava/javax/swing/text/JTextComponent.java b/libjava/javax/swing/text/JTextComponent.java
index 9a6d350f048..e53b20f2f70 100644
--- a/libjava/javax/swing/text/JTextComponent.java
+++ b/libjava/javax/swing/text/JTextComponent.java
@@ -41,15 +41,23 @@ import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Image;
+import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Point;
-import javax.accessibility.*;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
import javax.swing.Scrollable;
import javax.swing.UIManager;
-import javax.swing.event.*;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
import javax.swing.plaf.TextUI;
public abstract class JTextComponent extends JComponent
@@ -377,6 +385,12 @@ public abstract class JTextComponent extends JComponent
return null;
}
+ public Insets getMargin()
+ {
+ // FIXME: Not implemented.
+ return null;
+ }
+
public void setText(String text)
{
getDocument().remove(0,doc.getLength());
diff --git a/libjava/javax/swing/tree/AbstractLayoutCache.java b/libjava/javax/swing/tree/AbstractLayoutCache.java
index 5be988ca604..4362684fda3 100644
--- a/libjava/javax/swing/tree/AbstractLayoutCache.java
+++ b/libjava/javax/swing/tree/AbstractLayoutCache.java
@@ -35,18 +35,19 @@ 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.tree;
-// Imports
-import java.awt.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.awt.Rectangle;
+import java.util.Enumeration;
+import javax.swing.event.TreeModelEvent;
/**
* AbstractLayoutCache
* @author Andrew Selkirk
*/
-public abstract class AbstractLayoutCache implements RowMapper {
+public abstract class AbstractLayoutCache implements RowMapper
+{
//-------------------------------------------------------------
// Classes ----------------------------------------------------
diff --git a/libjava/javax/swing/tree/DefaultMutableTreeNode.java b/libjava/javax/swing/tree/DefaultMutableTreeNode.java
index 0c2b5459f99..01be46aeced 100644
--- a/libjava/javax/swing/tree/DefaultMutableTreeNode.java
+++ b/libjava/javax/swing/tree/DefaultMutableTreeNode.java
@@ -35,11 +35,18 @@ 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.tree;
-// Imports
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Random;
+import java.util.Stack;
+import java.util.Vector;
/**
* DefaultMutableTreeNode
diff --git a/libjava/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/javax/swing/tree/DefaultTreeCellEditor.java
index 732077b3adb..6d922a42437 100644
--- a/libjava/javax/swing/tree/DefaultTreeCellEditor.java
+++ b/libjava/javax/swing/tree/DefaultTreeCellEditor.java
@@ -35,16 +35,29 @@ 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.tree;
-// Imports
-import java.awt.*;
-import java.awt.event.*;
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.EventObject;
+import javax.swing.Icon;
+import javax.swing.JTextField;
+import javax.swing.JTree;
+import javax.swing.border.Border;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
/**
* DefaultTreeCellEditor
diff --git a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java
index 6de55deae32..f0eb454db5c 100644
--- a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -35,11 +35,18 @@ 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.tree;
-// Imports
-import java.awt.*;
-import javax.swing.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import javax.swing.Icon;
+import javax.swing.JLabel;
+import javax.swing.JTree;
/**
* DefaultTreeCellRenderer
diff --git a/libjava/javax/swing/tree/DefaultTreeModel.java b/libjava/javax/swing/tree/DefaultTreeModel.java
index d905be96cb8..4f546acca3e 100644
--- a/libjava/javax/swing/tree/DefaultTreeModel.java
+++ b/libjava/javax/swing/tree/DefaultTreeModel.java
@@ -35,12 +35,16 @@ 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.tree;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.EventListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.TreeModelListener;
/**
* DefaultTreeModel
diff --git a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java
index 9b5358241bd..79f642afc28 100644
--- a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java
+++ b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java
@@ -35,14 +35,21 @@ 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.tree;
-// Imports
-import java.beans.*;
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-import javax.swing.event.*;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.EventListener;
+import java.util.Vector;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.event.SwingPropertyChangeSupport;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
/**
* DefaultTreeSelectionModel
diff --git a/libjava/javax/swing/tree/FixedHeightLayoutCache.java b/libjava/javax/swing/tree/FixedHeightLayoutCache.java
index 279eec0278b..dae34229c3a 100644
--- a/libjava/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/libjava/javax/swing/tree/FixedHeightLayoutCache.java
@@ -35,12 +35,12 @@ 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.tree;
-// Imports
-import java.awt.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.awt.Rectangle;
+import java.util.Enumeration;
+import javax.swing.event.TreeModelEvent;
/**
* FixedHeightLayoutCache
diff --git a/libjava/javax/swing/tree/TreeCellEditor.java b/libjava/javax/swing/tree/TreeCellEditor.java
index c55b97d339a..503cd2d4deb 100644
--- a/libjava/javax/swing/tree/TreeCellEditor.java
+++ b/libjava/javax/swing/tree/TreeCellEditor.java
@@ -35,9 +35,9 @@ 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.tree;
-// Imports
import java.awt.Component;
import javax.swing.JTree;
diff --git a/libjava/javax/swing/tree/TreeModel.java b/libjava/javax/swing/tree/TreeModel.java
index 6763544fb9e..5c3a12516d6 100644
--- a/libjava/javax/swing/tree/TreeModel.java
+++ b/libjava/javax/swing/tree/TreeModel.java
@@ -35,10 +35,10 @@ 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.tree;
-// Imports
-import javax.swing.event.*;
+import javax.swing.event.TreeModelListener;
/**
* TreeModel interface
diff --git a/libjava/javax/swing/tree/TreeNode.java b/libjava/javax/swing/tree/TreeNode.java
index 46464d2d73e..4fd7ec630c6 100644
--- a/libjava/javax/swing/tree/TreeNode.java
+++ b/libjava/javax/swing/tree/TreeNode.java
@@ -35,10 +35,10 @@ 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.tree;
-// Imports
-import java.util.*;
+import java.util.Enumeration;
/**
* TreeNode interface
diff --git a/libjava/javax/swing/tree/TreePath.java b/libjava/javax/swing/tree/TreePath.java
index 77627db77b1..ba0a00ba95e 100644
--- a/libjava/javax/swing/tree/TreePath.java
+++ b/libjava/javax/swing/tree/TreePath.java
@@ -35,10 +35,13 @@ 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.tree;
-// Imports
-import java.io.*;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
/**
* TreePath
diff --git a/libjava/javax/swing/tree/TreeSelectionModel.java b/libjava/javax/swing/tree/TreeSelectionModel.java
index ef8e0b44772..3f28450d86f 100644
--- a/libjava/javax/swing/tree/TreeSelectionModel.java
+++ b/libjava/javax/swing/tree/TreeSelectionModel.java
@@ -35,9 +35,9 @@ 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.tree;
-// Imports
import java.beans.PropertyChangeListener;
import javax.swing.event.TreeSelectionListener;
diff --git a/libjava/javax/swing/tree/VariableHeightLayoutCache.java b/libjava/javax/swing/tree/VariableHeightLayoutCache.java
index 8e9015399a6..445faa9c230 100644
--- a/libjava/javax/swing/tree/VariableHeightLayoutCache.java
+++ b/libjava/javax/swing/tree/VariableHeightLayoutCache.java
@@ -35,12 +35,12 @@ 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.tree;
-// Imports
-import java.awt.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.awt.Rectangle;
+import java.util.Enumeration;
+import javax.swing.event.TreeModelEvent;
/**
* VariableHeightLayoutCache
diff --git a/libjava/javax/swing/undo/AbstractUndoableEdit.java b/libjava/javax/swing/undo/AbstractUndoableEdit.java
index 68c28130e0f..d845e4341bb 100644
--- a/libjava/javax/swing/undo/AbstractUndoableEdit.java
+++ b/libjava/javax/swing/undo/AbstractUndoableEdit.java
@@ -35,9 +35,9 @@ 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.undo;
-// Imports
import java.io.Serializable;
/**
diff --git a/libjava/javax/swing/undo/CompoundEdit.java b/libjava/javax/swing/undo/CompoundEdit.java
index 37a7c4ca4eb..be612dad77b 100644
--- a/libjava/javax/swing/undo/CompoundEdit.java
+++ b/libjava/javax/swing/undo/CompoundEdit.java
@@ -35,9 +35,9 @@ 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.undo;
-// Imports
import java.util.Vector;
/**
diff --git a/libjava/javax/swing/undo/StateEdit.java b/libjava/javax/swing/undo/StateEdit.java
index f617bc3a455..6a32fbdb48d 100644
--- a/libjava/javax/swing/undo/StateEdit.java
+++ b/libjava/javax/swing/undo/StateEdit.java
@@ -35,10 +35,11 @@ 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.undo;
-// Imports
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Iterator;
/**
* StateEdit
diff --git a/libjava/javax/swing/undo/UndoManager.java b/libjava/javax/swing/undo/UndoManager.java
index f13cd3b3faa..56e1c1b7247 100644
--- a/libjava/javax/swing/undo/UndoManager.java
+++ b/libjava/javax/swing/undo/UndoManager.java
@@ -35,10 +35,11 @@ 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.undo;
-// Imports
-import javax.swing.event.*;
+import javax.swing.event.UndoableEditEvent;
+import javax.swing.event.UndoableEditListener;
/**
* UndoManager
diff --git a/libjava/javax/swing/undo/UndoableEditSupport.java b/libjava/javax/swing/undo/UndoableEditSupport.java
index f09f3ffad4b..4e12c7c6b16 100644
--- a/libjava/javax/swing/undo/UndoableEditSupport.java
+++ b/libjava/javax/swing/undo/UndoableEditSupport.java
@@ -35,11 +35,12 @@ 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.undo;
-// Imports
-import java.util.*;
-import javax.swing.event.*;
+import java.util.Vector;
+import javax.swing.event.UndoableEditEvent;
+import javax.swing.event.UndoableEditListener;
/**
* UndoableEditSupport
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 7dd98364118..81ef0f7d36a 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -35,10 +35,13 @@ details. */
#include <java/lang/reflect/Method.h>
#include <java/lang/reflect/Modifier.h>
#include <java/lang/OutOfMemoryError.h>
-#include <java/util/IdentityHashMap.h>
#include <java/lang/Integer.h>
#include <java/lang/ThreadGroup.h>
#include <java/lang/Thread.h>
+#include <java/lang/IllegalAccessError.h>
+#include <java/nio/DirectByteBufferImpl.h>
+#include <java/util/IdentityHashMap.h>
+#include <gnu/gcj/RawData.h>
#include <gcj/method.h>
#include <gcj/field.h>
@@ -384,6 +387,22 @@ static jobject
return _Jv_JNI_PopLocalFrame (env, result, MARK_USER);
}
+// Make sure an array's type is compatible with the type of the
+// destination.
+template<typename T>
+static bool
+_Jv_JNI_check_types (JNIEnv *env, JArray<T> *array, jclass K)
+{
+ jclass klass = array->getClass()->getComponentType();
+ if (__builtin_expect (klass != K, false))
+ {
+ env->ex = new java::lang::IllegalAccessError ();
+ return false;
+ }
+ else
+ return true;
+}
+
// Pop a `system' frame from the stack. This is `extern "C"' as it is
// used by the compiler.
extern "C" void
@@ -1446,12 +1465,14 @@ static JArray<T> *
}
}
-template<typename T>
+template<typename T, jclass K>
static T *
-(JNICALL _Jv_JNI_GetPrimitiveArrayElements) (JNIEnv *, JArray<T> *array,
+(JNICALL _Jv_JNI_GetPrimitiveArrayElements) (JNIEnv *env, JArray<T> *array,
jboolean *isCopy)
{
array = unwrap (array);
+ if (! _Jv_JNI_check_types (env, array, K))
+ return NULL;
T *elts = elements (array);
if (isCopy)
{
@@ -1462,25 +1483,28 @@ static T *
return elts;
}
-template<typename T>
+template<typename T, jclass K>
static void
-(JNICALL _Jv_JNI_ReleasePrimitiveArrayElements) (JNIEnv *, JArray<T> *array,
+(JNICALL _Jv_JNI_ReleasePrimitiveArrayElements) (JNIEnv *env, JArray<T> *array,
T *, jint /* mode */)
{
array = unwrap (array);
+ _Jv_JNI_check_types (env, array, K);
// Note that we ignore MODE. We can do this because we never copy
// the array elements. My reading of the JNI documentation is that
// this is an option for the implementor.
unmark_for_gc (array, global_ref_table);
}
-template<typename T>
+template<typename T, jclass K>
static void
(JNICALL _Jv_JNI_GetPrimitiveArrayRegion) (JNIEnv *env, JArray<T> *array,
jsize start, jsize len,
T *buf)
{
array = unwrap (array);
+ if (! _Jv_JNI_check_types (env, array, K))
+ return;
// The cast to unsigned lets us save a comparison.
if (start < 0 || len < 0
@@ -1504,12 +1528,14 @@ static void
}
}
-template<typename T>
+template<typename T, jclass K>
static void
(JNICALL _Jv_JNI_SetPrimitiveArrayRegion) (JNIEnv *env, JArray<T> *array,
jsize start, jsize len, T *buf)
{
array = unwrap (array);
+ if (! _Jv_JNI_check_types (env, array, K))
+ return;
// The cast to unsigned lets us save a comparison.
if (start < 0 || len < 0
@@ -1696,24 +1722,28 @@ void
// Direct byte buffers.
static jobject
-(JNICALL _Jv_JNI_NewDirectByteBuffer) (JNIEnv *, void *, jlong)
+(JNICALL _Jv_JNI_NewDirectByteBuffer) (JNIEnv *, void *address, jlong length)
{
- // For now we don't support this.
- return NULL;
+ using namespace gnu::gcj;
+ using namespace java::nio;
+ return new DirectByteBufferImpl (reinterpret_cast<RawData *> (address),
+ length);
}
static void *
-(JNICALL _Jv_JNI_GetDirectBufferAddress) (JNIEnv *, jobject)
+(JNICALL _Jv_JNI_GetDirectBufferAddress) (JNIEnv *, jobject buffer)
{
- // For now we don't support this.
- return NULL;
+ using namespace java::nio;
+ DirectByteBufferImpl* bb = static_cast<DirectByteBufferImpl *> (buffer);
+ return reinterpret_cast<void *> (bb->address);
}
static jlong
-(JNICALL _Jv_JNI_GetDirectBufferCapacity) (JNIEnv *, jobject)
+(JNICALL _Jv_JNI_GetDirectBufferCapacity) (JNIEnv *, jobject buffer)
{
- // For now we don't support this.
- return -1;
+ using namespace java::nio;
+ DirectByteBufferImpl* bb = static_cast<DirectByteBufferImpl *> (buffer);
+ return bb->capacity();
}
@@ -2688,38 +2718,70 @@ struct JNINativeInterface _Jv_JNIFunctions =
_Jv_JNI_NewPrimitiveArray<jlong, JvPrimClass (long)>, // NewLongArray
_Jv_JNI_NewPrimitiveArray<jfloat, JvPrimClass (float)>, // NewFloatArray
_Jv_JNI_NewPrimitiveArray<jdouble, JvPrimClass (double)>, // NewDoubleArray
- _Jv_JNI_GetPrimitiveArrayElements, // GetBooleanArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetByteArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetCharArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetShortArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetIntArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetLongArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetFloatArrayElements
- _Jv_JNI_GetPrimitiveArrayElements, // GetDoubleArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseBooleanArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseByteArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseCharArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseShortArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseIntArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseLongArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseFloatArrayElements
- _Jv_JNI_ReleasePrimitiveArrayElements, // ReleaseDoubleArrayElements
- _Jv_JNI_GetPrimitiveArrayRegion, // GetBooleanArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetByteArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetCharArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetShortArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetIntArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetLongArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetFloatArrayRegion
- _Jv_JNI_GetPrimitiveArrayRegion, // GetDoubleArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetBooleanArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetByteArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetCharArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetShortArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetIntArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetLongArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetFloatArrayRegion
- _Jv_JNI_SetPrimitiveArrayRegion, // SetDoubleArrayRegion
+ _Jv_JNI_GetPrimitiveArrayElements<jboolean, JvPrimClass (boolean)>,
+ // GetBooleanArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jbyte, JvPrimClass (byte)>,
+ // GetByteArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jchar, JvPrimClass (char)>,
+ // GetCharArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jshort, JvPrimClass (short)>,
+ // GetShortArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jint, JvPrimClass (int)>,
+ // GetIntArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jlong, JvPrimClass (long)>,
+ // GetLongArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jfloat, JvPrimClass (float)>,
+ // GetFloatArrayElements
+ _Jv_JNI_GetPrimitiveArrayElements<jdouble, JvPrimClass (double)>,
+ // GetDoubleArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jboolean, JvPrimClass (boolean)>,
+ // ReleaseBooleanArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jbyte, JvPrimClass (byte)>,
+ // ReleaseByteArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jchar, JvPrimClass (char)>,
+ // ReleaseCharArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jshort, JvPrimClass (short)>,
+ // ReleaseShortArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jint, JvPrimClass (int)>,
+ // ReleaseIntArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jlong, JvPrimClass (long)>,
+ // ReleaseLongArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jfloat, JvPrimClass (float)>,
+ // ReleaseFloatArrayElements
+ _Jv_JNI_ReleasePrimitiveArrayElements<jdouble, JvPrimClass (double)>,
+ // ReleaseDoubleArrayElements
+ _Jv_JNI_GetPrimitiveArrayRegion<jboolean, JvPrimClass (boolean)>,
+ // GetBooleanArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jbyte, JvPrimClass (byte)>,
+ // GetByteArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jchar, JvPrimClass (char)>,
+ // GetCharArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jshort, JvPrimClass (short)>,
+ // GetShortArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jint, JvPrimClass (int)>,
+ // GetIntArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jlong, JvPrimClass (long)>,
+ // GetLongArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jfloat, JvPrimClass (float)>,
+ // GetFloatArrayRegion
+ _Jv_JNI_GetPrimitiveArrayRegion<jdouble, JvPrimClass (double)>,
+ // GetDoubleArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jboolean, JvPrimClass (boolean)>,
+ // SetBooleanArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jbyte, JvPrimClass (byte)>,
+ // SetByteArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jchar, JvPrimClass (char)>,
+ // SetCharArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jshort, JvPrimClass (short)>,
+ // SetShortArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jint, JvPrimClass (int)>,
+ // SetIntArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jlong, JvPrimClass (long)>,
+ // SetLongArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jfloat, JvPrimClass (float)>,
+ // SetFloatArrayRegion
+ _Jv_JNI_SetPrimitiveArrayRegion<jdouble, JvPrimClass (double)>,
+ // SetDoubleArrayRegion
_Jv_JNI_RegisterNatives, // RegisterNatives
_Jv_JNI_UnregisterNatives, // UnregisterNatives
_Jv_JNI_MonitorEnter, // MonitorEnter
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index 41e9db6b8fa..2c574942b21 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -1,5 +1,5 @@
/* gdkgraphics.c
- Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,7 @@ exception statement from your version. */
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
-#define GDK_STABLE_IS_PIXMAP(d) (((GdkWindowPrivate *)d)->window_type == GDK_WINDOW_PIXMAP)
+#define GDK_STABLE_IS_PIXMAP(d) (GDK_IS_PIXMAP(d))
GdkPoint *
translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
index e33aff046fc..e87a9c4d7f0 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
@@ -42,47 +42,43 @@ exception statement from your version. */
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
(JNIEnv *env, jobject obj)
{
- gpointer widget;
+ GtkButton *button;
gdk_threads_enter ();
- widget = gtk_type_new (gtk_button_get_type ());
+ button = gtk_button_new();
+ gtk_widget_show (GTK_WIDGET(button));
gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
+ NSA_SET_PTR (env, obj, button);
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont
(JNIEnv *env, jobject obj, jstring jname, jint size)
{
- const char *xlfd;
-# define FBUFSZ 200
- char buf[FBUFSZ];
+ const char *font_name;
void *ptr;
- GdkFont * new_font;
- GtkStyle * style;
- GtkWidget * button;
- GtkWidget * label;
+ GtkWidget *button;
+ GtkWidget *label;
+ PangoFontDescription *font_desc;
ptr = NSA_GET_PTR (env, obj);
+
button = GTK_WIDGET (ptr);
- label = GTK_BIN(button)->child;
+ label = gtk_bin_get_child (GTK_BIN(button));
- if (label == NULL) return;
- xlfd = (*env)->GetStringUTFChars (env, jname, NULL);
- snprintf(buf, FBUFSZ, xlfd, size);
- (*env)->ReleaseStringUTFChars (env, jname, xlfd);
- gdk_threads_enter();
- new_font = gdk_font_load (buf); /* FIXME: deprecated. Replacement? */
- if (new_font == NULL)
- {
- /* Fail quietly for now. */
- gdk_threads_leave();
+ if (!label)
return;
- }
- style = gtk_style_copy (gtk_widget_get_style (label));
- style -> font = new_font;
- gtk_widget_set_style (label, style);
- /* FIXME: Documentation varies as to whether we should unref style. */
+
+ font_name = (*env)->GetStringUTFChars (env, jname, NULL);
+
+ gdk_threads_enter();
+
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size);
+ gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
+ pango_font_description_free (font_desc);
+
gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, jname, font_name);
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index 5522354e35d..6d3e06b0c4b 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -40,22 +40,6 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include <gtk/gtkprivate.h>
-#define GTK_OBJECT_SETV(ptr, arg) \
- gdk_threads_enter (); \
- { \
- GtkArgInfo *info = NULL; \
- char *error; \
- \
- error = gtk_object_arg_get_info (GTK_OBJECT_TYPE (ptr), arg.name, &info); \
- if (error) \
- { \
- /* assume the argument is destined for the container's only child */ \
- ptr = gtk_container_children (GTK_CONTAINER (ptr))->data; \
- } \
- gtk_object_setv (GTK_OBJECT (ptr), 1, &arg); \
- } \
- gdk_threads_leave (); \
-
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
(JNIEnv *env, jobject obj)
{
@@ -519,8 +503,9 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_S
arg.type = GTK_TYPE_STRING;
arg.name = (char *) name;
GTK_VALUE_STRING (arg) = (char *) value;
-
- GTK_OBJECT_SETV (ptr, arg);
+ gdk_threads_enter();
+ g_object_set(ptr, name, value, NULL);
+ gdk_threads_leave();
(*env)->ReleaseStringUTFChars (env, jname, name);
(*env)->ReleaseStringUTFChars (env, jvalue, value);
@@ -540,7 +525,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_la
arg.name = (char *) name;
GTK_VALUE_BOOL (arg) = value;
- GTK_OBJECT_SETV (ptr, arg);
+ gdk_threads_enter();
+ g_object_set(ptr, name, value, NULL);
+ gdk_threads_leave();
(*env)->ReleaseStringUTFChars (env, jname, name);
}
@@ -559,7 +546,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_la
arg.name = (char *) name;
GTK_VALUE_INT (arg) = value;
- GTK_OBJECT_SETV (ptr, arg);
+ gdk_threads_enter();
+ g_object_set(ptr, name, value, NULL);
+ gdk_threads_leave();
(*env)->ReleaseStringUTFChars (env, jname, name);
}
@@ -578,7 +567,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_la
arg.name = (char *) name;
GTK_VALUE_FLOAT (arg) = value;
- GTK_OBJECT_SETV (ptr, arg);
+ gdk_threads_enter();
+ g_object_set(ptr, name, value, NULL);
+ gdk_threads_leave();
(*env)->ReleaseStringUTFChars (env, jname, name);
}
@@ -611,7 +602,9 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_O
arg.name = (char *) name;
GTK_VALUE_OBJECT (arg) = GTK_OBJECT (ptr2);
- GTK_OBJECT_SETV (ptr1, arg);
+ gdk_threads_enter();
+ g_object_set(ptr1, name, ptr2, NULL);
+ gdk_threads_leave();
(*env)->ReleaseStringUTFChars (env, jname, name);
}
@@ -644,6 +637,15 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks
gdk_threads_enter ();
gtk_widget_realize (GTK_WIDGET (ptr));
+ if(GTK_IS_BUTTON(ptr))
+ {
+ g_print("-- connecting a button --\n");
+ connect_awt_hook (env, obj, 1, GTK_BUTTON(ptr)->event_window);
+ }
+ else
+ {
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+ g_print("Connection object %p with window %p (but ptr is %p)\n", obj, GTK_WIDGET(ptr)->window, ptr);
+ }
gdk_threads_leave ();
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
index 99ca0934c3d..2573a1823c3 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
@@ -526,6 +526,7 @@ attach_jobject (GdkWindow *window, jobject *obj)
| GDK_KEY_PRESS_MASK
| GDK_FOCUS_CHANGE_MASK);
+ // g_print("storing obj %p property on window %p\n", obj, window);
gdk_property_change (window,
addr_atom,
type_atom,
@@ -538,15 +539,22 @@ attach_jobject (GdkWindow *window, jobject *obj)
void
connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...)
{
- int i;
va_list ap;
jobject *obj;
obj = (jobject *) malloc (sizeof (jobject));
*obj = (*env)->NewGlobalRef (env, peer_obj);
+ //g_print("Connection obj %p\n", peer_obj);
va_start (ap, nwindows);
+ {
+ int i;
for (i = 0; i < nwindows; i++)
- attach_jobject (va_arg (ap, GdkWindow *), obj);
+ {
+ GdkWindow* attach = (va_arg (ap, GdkWindow *));
+ //g_print("attach peer obj %p and %p\n", peer_obj, attach);
+ attach_jobject(attach, obj);
+ }
+ }
va_end (ap);
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
index 5787ce5083e..bdf064ff8f3 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
@@ -251,33 +251,9 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize
list = GTK_WIDGET (CLIST_FROM_SW (ptr));
sw = GTK_SCROLLED_WINDOW (ptr);
- /*
- gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
- &myreq);
- dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
- */
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- "size_request", &myreq);
- /*
-
- gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- &myreq);
- */
-
- dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
-
- gtk_signal_emit_by_name (GTK_OBJECT (list), "size_request", &myreq);
-
- // gtk_widget_size_request(GTK_WIDGET (list), &myreq);
-
- dims[0] += myreq.width + gdk_char_width (list->style->font, 'W');
-
- dims[1] += ((rows * (gdk_char_height (list->style->font, 'W')+7))
- + (2 * (list->style->klass->ythickness)));
-
+ gtk_widget_size_request(list, &myreq);
+ dims[1]=myreq.height;
+ dims[0]=myreq.width;
gdk_threads_leave ();
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
index af14f0be8a9..cd4d7e2fe7b 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
@@ -56,6 +56,10 @@ jmethodID postItemEventID;
jmethodID postListItemEventID;
JNIEnv *gdk_env;
+#ifdef PORTABLE_NATIVE_SYNC
+JavaVM *gdk_vm;
+#endif
+
/*
* Call gtk_init. It is very important that this happen before any other
* gtk calls.
@@ -81,7 +85,16 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz)
/* until we have JDK 1.2 JNI, assume we have a VM with threads that
match what GLIB was compiled for */
- g_thread_init (NULL);
+#ifdef PORTABLE_NATIVE_SYNC
+ (*env)->GetJavaVM( env, &gdk_vm );
+ g_thread_init ( &g_thread_jni_functions );
+ printf("called gthread init\n");
+#else
+ g_thread_init ( NULL );
+#endif
+
+ /* From GDK 2.0 onwards we have to explicitly call gdk_threads_init */
+ gdk_threads_init();
gtk_init (&argc, &argv);
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
index 9237a01b5a8..a246b372904 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
@@ -46,11 +46,15 @@ struct range_scrollbar
};
static void
-post_adjustment_event (GtkAdjustment *adj, struct range_scrollbar *rs)
+post_adjustment_event (GtkRange *range, GtkScrollType scroll,
+ struct range_scrollbar *rs)
{
jint type;
+ GtkAdjustment *adj;
+
+ adj = gtk_range_get_adjustment (range);
- switch (rs->range->scroll_type)
+ switch (scroll)
{
case GTK_SCROLL_STEP_FORWARD:
type = AWT_ADJUSTMENT_UNIT_INCREMENT;
@@ -113,15 +117,11 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectHooks
rs->range = GTK_RANGE (ptr);
rs->scrollbar = (jobject *) malloc (sizeof (jobject));
*(rs->scrollbar) = (*env)->NewGlobalRef (env, obj);
- gtk_signal_connect (GTK_OBJECT (GTK_RANGE (ptr)->adjustment),
- "value_changed",
+ gtk_signal_connect (GTK_OBJECT (GTK_RANGE (ptr)),
+ "move_slider",
GTK_SIGNAL_FUNC (post_adjustment_event), rs);
- connect_awt_hook (env, obj, 4,
- GTK_RANGE (ptr)->trough,
- GTK_RANGE (ptr)->slider,
- GTK_RANGE (ptr)->step_forw,
- GTK_RANGE (ptr)->step_back);
+ connect_awt_hook (env, obj, 1, GTK_SCROLLBAR (ptr)->range);
gdk_threads_leave ();
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
index 27f27461518..103ddd22a9a 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
@@ -39,7 +39,7 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkTextAreaPeer.h"
-#define TEXT_FROM_SW(obj) (GTK_TEXT(GTK_SCROLLED_WINDOW (obj)->container.child))
+#define TEXT_FROM_SW(obj) (GTK_TEXT_VIEW(GTK_SCROLLED_WINDOW (obj)->container.child))
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
(JNIEnv *env, jobject obj, jint scroll)
@@ -47,7 +47,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
GtkWidget *text, *sw;
gdk_threads_enter ();
- text = gtk_text_new (NULL, NULL);
+ text = gtk_text_view_new ();
gtk_widget_show (text);
sw = gtk_scrolled_window_new (NULL, NULL);
@@ -64,54 +64,9 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
(scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
|| scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ?
GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, sw);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_old_create
- (JNIEnv *env, jobject obj, jobject parent_obj,
- jstring contents, jint scroll)
-{
- GtkWidget *text, *sw;
- const char *str;
- int pos=0;
- void *parent;
-
- parent = NSA_GET_PTR (env, parent_obj);
- str = (*env)->GetStringUTFChars (env, contents, NULL);
-
- gdk_threads_enter ();
-
- text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (text), TRUE);
-
- gtk_editable_insert_text (GTK_EDITABLE (text), str,
- strlen (str), &pos);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (sw), text);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
-
- /* horizontal scrollbar */
- (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
- || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ?
- GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
-
- /* vertical scrollbar */
- (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
- || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ?
- GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
-
- set_visible (text, TRUE);
- set_parent (sw, GTK_CONTAINER (parent));
gdk_threads_leave ();
- (*env)->ReleaseStringUTFChars (env, contents, str);
-
NSA_SET_PTR (env, obj, sw);
}
@@ -122,8 +77,8 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkTextGetSize
void *ptr;
jint *dims;
GtkWidget *text;
- GtkScrolledWindow *sw;
- GtkRequisition myreq;
+/* GtkScrolledWindow *sw; */
+ GtkRequisition requisition;
ptr = NSA_GET_PTR (env, obj);
@@ -133,35 +88,11 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkTextGetSize
gdk_threads_enter ();
text = GTK_WIDGET (TEXT_FROM_SW (ptr));
- sw = GTK_SCROLLED_WINDOW (ptr);
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- "size_request", &myreq);
- //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
- // &myreq);
- dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
- "size_request", &myreq);
- //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- // &myreq);
- dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
-
- /* The '1' in the following assignments is from
- #define TEXT_BORDER_ROOM 1
- in gtktext.c */
-
- /* Gtk text seems to wrap slightly prematurely. Compensate. */
- ++cols;
- ++dims[0];
+ /* sw = GTK_SCROLLED_WINDOW (ptr); */
- dims[0] += ((cols * gdk_char_width (text->style->font, 'W'))
- + (2 * (text->style->klass->xthickness + 1)));
- /* Guess at the height. Is there a better way? */
- dims[1] += ((rows * gdk_string_height (text->style->font, "Wg"))
- + (2 * (text->style->klass->ythickness + 1)));
+ gtk_widget_size_request(GTK_WIDGET (text), &requisition);
+ dims[0] = requisition.width;
+ dims[1] = requisition.height;
gdk_threads_leave ();
@@ -173,6 +104,9 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
(JNIEnv *env, jobject obj, jstring contents, jint position)
{
+ GtkTextBuffer *buf;
+ GtkTextIter iter;
+ GtkWidget *text;
void *ptr;
const char *str;
int pos=position;
@@ -181,8 +115,13 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
str = (*env)->GetStringUTFChars (env, contents, NULL);
gdk_threads_enter ();
- gtk_editable_insert_text (GTK_EDITABLE (TEXT_FROM_SW (ptr)),
- str, strlen (str), &pos);
+
+ text = GTK_WIDGET (TEXT_FROM_SW (ptr));
+
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ gtk_text_buffer_get_iter_at_offset (buf, &iter, pos);
+ gtk_text_buffer_insert (buf, &iter, str, strlen (str));
+
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, contents, str);
@@ -192,21 +131,29 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
(JNIEnv *env, jobject obj, jstring contents, jint start, jint end)
{
+ GtkWidget *text;
+ GtkTextBuffer *buf;
+ GtkTextIter iter, startIter, endIter;
void *ptr;
- GtkEditable *text;
const char *str;
- int pos = start;
+ int mystart = start;
+ int myend = end;
ptr = NSA_GET_PTR (env, obj);
str = (*env)->GetStringUTFChars (env, contents, NULL);
gdk_threads_enter ();
- text = GTK_EDITABLE (TEXT_FROM_SW (ptr));
- gtk_text_freeze (GTK_TEXT (text));
- gtk_editable_delete_text (text, start, end);
- gtk_editable_insert_text (text, str, strlen (str), &pos);
- gtk_text_thaw (GTK_TEXT (text));
+ text = GTK_WIDGET (TEXT_FROM_SW (ptr));
+
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+ gtk_text_buffer_get_iter_at_offset (buf, &startIter, mystart);
+ gtk_text_buffer_get_iter_at_offset (buf, &endIter, myend);
+ gtk_text_buffer_delete (buf, &startIter, &endIter);
+
+ gtk_text_buffer_get_iter_at_offset (buf, &iter, mystart);
+ gtk_text_buffer_insert(buf, &iter, str, strlen (str));
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, contents, str);
@@ -216,31 +163,25 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkSetFont
(JNIEnv *env, jobject obj, jstring jname, jint size)
{
- const char *xlfd;
-# define FBUFSZ 200
- char buf[FBUFSZ];
+ const char *font_name;
void *ptr;
- GdkFont * new_font;
- GtkStyle * style;
- GtkWidget * text;
+ GtkWidget *text;
+ PangoFontDescription *font_desc;
ptr = NSA_GET_PTR (env, obj);
text = GTK_WIDGET (TEXT_FROM_SW (ptr));
- xlfd = (*env)->GetStringUTFChars (env, jname, NULL);
- snprintf(buf, FBUFSZ, xlfd, size);
- (*env)->ReleaseStringUTFChars (env, jname, xlfd);
+ font_name = (*env)->GetStringUTFChars (env, jname, NULL);
+
gdk_threads_enter();
- new_font = gdk_font_load (buf); /* FIXME: deprecated. Replacement? */
- if (new_font == NULL)
- {
- /* Fail quietly for now. */
- gdk_threads_leave();
- return;
- }
- style = gtk_style_copy (gtk_widget_get_style (text));
- style -> font = new_font;
- gtk_widget_set_style (text , style);
- /* FIXME: Documentation varies as to whether we should unref style. */
+
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size);
+ gtk_widget_modify_font (GTK_WIDGET(text), font_desc);
+ pango_font_description_free (font_desc);
+
gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, jname, font_name);
+
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
index 0b6db8f1840..8cdff34f11b 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
@@ -39,20 +39,47 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkTextComponentPeer.h"
-#define GET_EDITABLE(obj) (GTK_IS_EDITABLE (obj) ? GTK_EDITABLE (obj) : \
- GTK_EDITABLE (GTK_SCROLLED_WINDOW (obj)->container.child))
-
JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getCaretPosition
(JNIEnv *env, jobject obj)
{
void *ptr;
int pos;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
+ GtkTextMark *mark;
+ GtkTextIter iter;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- pos = gtk_editable_get_position (GET_EDITABLE (ptr));
+
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ pos = gtk_editable_get_position (editable);
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ mark = gtk_text_buffer_get_insert (buf);
+ gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
+ pos = gtk_text_iter_get_offset (&iter);
+ }
+ }
+
gdk_threads_leave ();
return pos;
@@ -63,11 +90,40 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setCaretPosition
(JNIEnv *env, jobject obj, jint pos)
{
void *ptr;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
+ GtkTextMark *mark;
+ GtkTextIter iter;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- gtk_editable_set_position (GET_EDITABLE (ptr), pos);
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ gtk_editable_set_position (editable, pos);
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ mark = gtk_text_buffer_get_insert (buf);
+ gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
+ gtk_text_iter_set_offset (&iter, pos);
+ }
+ }
+
gdk_threads_leave ();
}
@@ -77,11 +133,42 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
{
void *ptr;
int pos;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
+ GtkTextIter start;
+ GtkTextIter end;
+ int starti, endi;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- pos = GET_EDITABLE (ptr)->selection_start_pos;
+
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ if (gtk_editable_get_selection_bounds (editable, &starti, &endi))
+ pos = starti;
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ if (gtk_text_buffer_get_selection_bounds(buf, &start, &end))
+ pos = gtk_text_iter_get_offset (&start);
+ }
+ }
+
gdk_threads_leave ();
return pos;
@@ -93,11 +180,42 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
{
void *ptr;
int pos;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
+ GtkTextIter start;
+ GtkTextIter end;
+ int starti, endi;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- pos = GET_EDITABLE (ptr)->selection_end_pos;
+
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ if (gtk_editable_get_selection_bounds (editable, &starti, &endi))
+ pos = endi;
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ if (gtk_text_buffer_get_selection_bounds(buf, &start, &end))
+ pos = gtk_text_iter_get_offset (&end);
+ }
+ }
+
gdk_threads_leave ();
return pos;
@@ -108,11 +226,44 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_select
(JNIEnv *env, jobject obj, jint start, jint end)
{
void *ptr;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
+ GtkTextIter iter;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- gtk_editable_select_region (GET_EDITABLE (ptr), start, end);
+
+
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ gtk_editable_select_region (editable, start, end);
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ gtk_text_buffer_get_iter_at_offset (buf, &iter, start);
+ /* quickly move both 'insert' and 'selection_bound' to the
+ same position */
+ gtk_text_buffer_place_cursor (buf, &iter);
+ gtk_text_buffer_get_iter_at_offset (buf, &iter, end);
+ gtk_text_buffer_move_mark_by_name (buf, "selection_bound", &iter);
+ }
+ }
+
gdk_threads_leave ();
}
@@ -121,11 +272,35 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setEditable
(JNIEnv *env, jobject obj, jboolean state)
{
void *ptr;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- gtk_editable_set_editable (GET_EDITABLE (ptr), state);
+
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ gtk_editable_set_editable (editable, state);
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (text), state);
+ }
+ }
+
gdk_threads_leave ();
}
@@ -136,11 +311,40 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getText
void *ptr;
char *contents;
jstring jcontents;
+ GtkEditable *editable; // type of GtkEntry (TextField)
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
+ GtkTextIter start, end;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- contents = gtk_editable_get_chars (GET_EDITABLE (ptr), 0, -1);
+
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ editable = GTK_EDITABLE (ptr);
+ contents = gtk_editable_get_chars (editable, 0, -1);
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ gtk_text_buffer_get_start_iter (buf, &start);
+ gtk_text_buffer_get_end_iter (buf, &end);
+ contents = gtk_text_buffer_get_text (buf, &start, &end, FALSE);
+ }
+ }
+
gdk_threads_leave ();
jcontents = (*env)->NewStringUTF (env, contents);
@@ -154,25 +358,36 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setText
(JNIEnv *env, jobject obj, jstring contents)
{
void *ptr;
- GtkEditable *text;
const char *str;
- int pos = 0;
+ GtkWidget *text = NULL; // type of GtkTextView (TextArea)
+ GtkTextBuffer *buf;
ptr = NSA_GET_PTR (env, obj);
str = (*env)->GetStringUTFChars (env, contents, NULL);
gdk_threads_enter ();
- text = GET_EDITABLE (ptr);
-
- if (GTK_IS_TEXT (text))
- gtk_text_freeze (GTK_TEXT (text));
-
- gtk_editable_delete_text (text, 0, -1);
- gtk_editable_insert_text (text, str, strlen (str), &pos);
-
- if (GTK_IS_TEXT (text))
- gtk_text_thaw (GTK_TEXT (text));
+ if (GTK_IS_EDITABLE (ptr))
+ {
+ gtk_entry_set_text (GTK_ENTRY (ptr), str);
+ }
+ else
+ {
+ if (GTK_IS_SCROLLED_WINDOW (ptr))
+ {
+ text = GTK_WIDGET (GTK_TEXT_VIEW (GTK_SCROLLED_WINDOW (ptr)->container.child));
+ }
+ else if (GTK_IS_TEXT_VIEW (ptr))
+ {
+ text = GTK_WIDGET (ptr);
+ }
+
+ if (text)
+ {
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ gtk_text_buffer_set_text (buf, str, strlen (str));
+ }
+ }
gdk_threads_leave ();
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
index 658c8639bb7..69b3e521abc 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
@@ -43,10 +43,10 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create
(JNIEnv *env, jobject obj)
{
- gpointer widget;
+ GtkWidget *widget;
gdk_threads_enter ();
- widget = gtk_type_new (gtk_entry_get_type ());
+ widget = gtk_entry_new ();
gdk_threads_leave ();
NSA_SET_PTR (env, obj, widget);
@@ -68,36 +68,6 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectHooks
gdk_threads_leave ();
}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_old_create
- (JNIEnv *env, jobject obj, jobject parent_obj, jstring text)
-{
- GtkWidget *entry;
- const char *str;
- void *parent;
-
- parent = NSA_GET_PTR (env, parent_obj);
-
- str = (*env)->GetStringUTFChars (env, text, NULL);
- gdk_threads_enter ();
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), str);
-
- set_parent (entry, GTK_CONTAINER (parent));
-
- gtk_widget_realize (entry);
- connect_awt_hook (env, obj, 2,
- entry->window, GTK_ENTRY (entry)->text_area);
-
- NSA_SET_PTR (env, obj, entry);
-
- gdk_threads_leave ();
- (*env)->ReleaseStringUTFChars (env, text, str);
-}
-
-
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetSize
(JNIEnv *env, jobject obj, jint cols, jintArray jdims)
@@ -105,19 +75,16 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetSize
void *ptr;
jint *dims;
GtkRequisition myreq;
- GtkEntry *entry;
+ GtkWidget *entry;
ptr = NSA_GET_PTR (env, obj);
dims = (*env)->GetIntArrayElements (env, jdims, 0);
gdk_threads_enter ();
- entry = GTK_ENTRY (ptr);
-
- gtk_signal_emit_by_name (GTK_OBJECT (entry), "size_request", &myreq);
- dims[0]=myreq.width-150 + (cols *
- gdk_char_width (GTK_WIDGET (entry)->style->font,
- 'W'));
+ entry = GTK_WIDGET (ptr);
+ gtk_widget_size_request(entry, &myreq);
+ dims[0]=myreq.width;
dims[1]=myreq.height;
gdk_threads_leave ();
@@ -153,31 +120,24 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkSetFont
(JNIEnv *env, jobject obj, jstring jname, jint size)
{
- const char *xlfd;
-# define FBUFSZ 200
- char buf[FBUFSZ];
+ const char *font_name;
void *ptr;
- GdkFont * new_font;
- GtkStyle * style;
- GtkWidget * text;
+ GtkWidget *entry;
+ PangoFontDescription *font_desc;
ptr = NSA_GET_PTR (env, obj);
- text = GTK_WIDGET (ptr);
- xlfd = (*env)->GetStringUTFChars (env, jname, NULL);
- snprintf(buf, FBUFSZ, xlfd, size);
- (*env)->ReleaseStringUTFChars (env, jname, xlfd);
+ entry = GTK_WIDGET (ptr);
+ font_name = (*env)->GetStringUTFChars (env, jname, NULL);
+
gdk_threads_enter();
- new_font = gdk_font_load(buf); /* FIXME: deprecated. Replacement? */
- if (new_font == NULL)
- {
- /* Fail quietly for now. */
- gdk_threads_leave();
- return;
- }
- style = gtk_style_copy (gtk_widget_get_style (text));
- style -> font = new_font;
- gtk_widget_set_style (text , style);
- /* FIXME: Documentation varies as to whether we should unref style. */
+
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size);
+ gtk_widget_modify_font (GTK_WIDGET(entry), font_desc);
+ pango_font_description_free (font_desc);
+
gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, jname, font_name);
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 3b7c06bf057..9a8cc32efd8 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -93,17 +93,37 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
(JNIEnv *env, jobject obj)
{
void *ptr;
+ GtkVBox* vbox;
GtkWidget *layout;
-
+ GList* children;
+ char* name;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- layout = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child))->data);
+
+ children = gtk_container_get_children(GTK_CONTAINER(ptr));
+ vbox = children->data;
+ name = GTK_OBJECT_TYPE_NAME(vbox);
+ if(!GTK_IS_VBOX(vbox))
+ {
+ printf("*** this is not a vbox\n");
+ }
+ children = gtk_container_get_children(GTK_CONTAINER(vbox));
+ layout = children->data;
+ name = GTK_OBJECT_TYPE_NAME(layout);
+ if(!GTK_IS_LAYOUT(layout))
+ {
+ printf("*** widget is not a layout ***");
+ }
+
gtk_widget_realize (layout);
+
connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
- gtk_widget_realize (GTK_WIDGET (ptr));
+ gtk_widget_realize (ptr);
+
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+
gdk_threads_leave ();
}
@@ -112,8 +132,8 @@ setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
jint height, jboolean visible)
{
GtkWidget *layout, *vbox;
- gint x, y;
+ gdk_threads_enter();
gtk_window_set_policy (GTK_WINDOW (window), 1, 1, 0);
gtk_widget_set_usize (window, width, height);
@@ -131,6 +151,7 @@ setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
connect_awt_hook (env, obj, 1, window->window);
set_visible (window, visible);
+ gdk_threads_leave ();
}
/*
@@ -212,9 +233,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
static void
setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height)
{
- gint current_x, current_y;
- gint origin_x, origin_y;
-
/* gdk_window_get_root_origin (widget->window, &current_x, &current_y); */
/* if (current_x != x || current_y != y) */
@@ -295,16 +313,12 @@ gdk_window_get_root_geometry (GdkWindow *window,
gint *border,
gint *depth)
{
- GdkWindowPrivate *private;
- Window xwindow;
- Window xparent;
- Window root;
- Window *children;
+ GdkWindow *private;
unsigned int nchildren;
g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindow*) window;
if (x)
*x = 0;
if (y)
@@ -318,48 +332,14 @@ gdk_window_get_root_geometry (GdkWindow *window,
if (depth)
*depth = 0;
- if (private->destroyed)
+ if (GDK_WINDOW_DESTROYED (private))
return;
- while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
- private = (GdkWindowPrivate*) private->parent;
- if (private->destroyed)
+ private = gdk_window_get_toplevel (private);
+ if (GDK_WINDOW_DESTROYED(private))
return;
- xparent = private->xwindow;
- do
- {
- xwindow = xparent;
- if (!XQueryTree (private->xdisplay, xwindow,
- &root, &xparent,
- &children, &nchildren))
- return;
+ gdk_window_get_geometry (private, x, y, width, height, depth);
- if (children)
- XFree (children);
- }
- while (xparent != root);
-
- if (xparent == root)
- {
- unsigned int ww, wh, wb, wd;
- int wx, wy;
-
- if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
- {
- if (x)
- *x = wx;
- if (y)
- *y = wy;
- if (width)
- *width = ww;
- if (height)
- *height = wh;
- if (border)
- *border = wb;
- if (depth)
- *depth = wd;
- }
- }
}
diff --git a/libjava/jni/gtk-peer/gthread-jni.c b/libjava/jni/gtk-peer/gthread-jni.c
index 9409720f9ac..b1077a79677 100644
--- a/libjava/jni/gtk-peer/gthread-jni.c
+++ b/libjava/jni/gtk-peer/gthread-jni.c
@@ -35,116 +35,430 @@ 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. */
+/************************************************************************/
+/* Header */
+/************************************************************************/
+
+/*
+ * Julian Dolby (dolby@us.ibm.com)
+ * February 7, 2003
+ *
+ * This code implements the GThreadFunctions interface for GLIB using
+ * Java threading primitives. All of the locking and conditional variable
+ * functionality required by GThreadFunctions is implemented using the
+ * monitor and wait/notify functionality of Java objects. The thread-
+ * local fucntionality uses the java.lang.ThreadLocal class.
+ *
+ * This code is designed to be portable in that it makes no assumptions
+ * about the underlying VM beyond that it implements the JNI functionality
+ * that this code uses.
+ *
+ * The one piece that does not really work is trylock for mutexes. The
+ * Java locking model does not include such functionality, and I do not
+ * see how to implement it without knowing something about how the VM
+ * implements locking.
+ *
+ * NOTES:
+ *
+ * I have tested it only on JikesRVM---the CVS head as of early February
+ * 2003.
+ *
+ * Currently, use of this code is governed by the configuration option
+ * --enable-portable-native-sync
+ *
+ */
+
+
+/************************************************************************/
+/* Global data */
+/************************************************************************/
#include "gthread-jni.h"
-/*
- * This code has been written specifically to be used with GTK+ 1.2.
- * `Real' GLIB threading is not supported. We fake things where necessary.
- * Once we know we're running on a 1.2 VM, we can write a real implementation.
+/* The VM handle. This is set in GtkToolkitMain.gtkInit */
+JavaVM *gdk_vm;
+
+
+/************************************************************************/
+/* Utilities to reflect exceptions back to the VM */
+/************************************************************************/
+
+/* This function checks for a pending exception, and rethrows it with
+ * a wrapper RuntimeException to deal with possible type problems (in
+ * case some calling piece of code does not expect the exception being
+ * thrown) and to include the given extra message.
*/
+static void maybe_rethrow(JNIEnv *gdk_env, char *message, char *file, int line) {
+ jthrowable cause;
-static GMutex *
-g_mutex_new_jni_impl (void)
-{
+ /* rethrow if an exception happened */
+ if ((cause = (*gdk_env)->ExceptionOccurred(gdk_env)) != NULL) {
+ jstring jmessage;
jclass obj_class;
- jobject *mutex;
+ jobject obj;
+ jmethodID ctor;
- obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/Object");
- if (obj_class == NULL)
- return NULL;
-
- mutex = (jobject *) g_malloc (sizeof (jobject));
- *mutex = (*gdk_env)->AllocObject (gdk_env, obj_class);
- if (*mutex == NULL)
- {
- g_free (mutex);
- return NULL;
+ /* allocate local message in Java */
+ int len = strlen(message) + strlen(file) + 25;
+ char buf[ len ];
+ bzero(buf, len);
+ sprintf(buf, "%s (at %s:%d)", message, file, line);
+ jmessage = (*gdk_env)->NewStringUTF(gdk_env, buf);
+
+ /* create RuntimeException wrapper object */
+ obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/RuntimeException");
+ ctor = (*gdk_env)->GetMethodID(gdk_env, obj_class, "<init>", "(Ljava/langString;Ljava/lang/Throwable)V");
+ obj = (*gdk_env)->NewObject (gdk_env, obj_class, ctor, jmessage, cause);
+
+ /* throw it */
+ (*gdk_env)->Throw(gdk_env, (jthrowable)obj);
}
- *mutex = (*gdk_env)->NewGlobalRef (gdk_env, *mutex);
+}
+
+/* This macro is used to include a source location in the exception message */
+#define MAYBE_RETHROW(_class, _message) \
+maybe_rethrow(_class, _message, __FILE__, __LINE__)
+
- return (GMutex *) mutex;
+/************************************************************************/
+/* Utilities to allocate and free java.lang.Objects */
+/************************************************************************/
+
+/* Both the mutexes and the condition variables are java.lang.Object objects,
+ * which this method allocates and returns a global ref. Note that global
+ * refs must be explicitly freed (isn't C fun?).
+ */
+static jobject *allocatePlainObject() {
+ jclass obj_class;
+ jobject *obj;
+ JNIEnv *gdk_env;
+ jmethodID ctor;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/Object");
+ MAYBE_RETHROW(gdk_env, "cannot find Object");
+
+ ctor = (*gdk_env)->GetMethodID(gdk_env, obj_class, "<init>", "()V");
+ MAYBE_RETHROW(gdk_env, "cannot find constructor");
+
+ obj = (jobject *) g_malloc (sizeof (jobject));
+ *obj = (*gdk_env)->NewObject (gdk_env, obj_class, ctor);
+ MAYBE_RETHROW(gdk_env, "cannot allocate object");
+
+ *obj = (*gdk_env)->NewGlobalRef (gdk_env, *obj);
+ MAYBE_RETHROW(gdk_env, "cannot make global ref");
+
+ return obj;
}
-static void
-g_mutex_lock_jni_impl (GMutex *mutex)
-{
- if (mutex && mutex == gdk_threads_mutex)
- (*gdk_env)->MonitorEnter (gdk_env, *((jobject *)mutex));
+/* Frees a Java object given a global ref (isn't C fun?) */
+static void freePlainObject(jobject *obj) {
+ JNIEnv *gdk_env;
+
+ if (obj) {
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ (*gdk_env)->DeleteGlobalRef (gdk_env, *obj);
+ MAYBE_RETHROW(gdk_env, "cannot delete global ref");
+
+ g_free (obj);
+ }
}
-static gboolean
-g_mutex_trylock_jni_impl (GMutex *mutex)
-{
- return FALSE;
+
+/************************************************************************/
+/* Locking code */
+/************************************************************************/
+
+/* Lock a Java object */
+static void takeLock(JNIEnv *gdk_env, void *mutex) {
+ (*gdk_env)->MonitorEnter (gdk_env, *((jobject *)mutex));
+ MAYBE_RETHROW(gdk_env, "cannot get lock");
}
-static void
-g_mutex_unlock_jni_impl (GMutex *mutex)
-{
- if (mutex && mutex == gdk_threads_mutex)
+/* Unlock a Java object */
+static void releaseLock(JNIEnv *gdk_env, void *mutex) {
(*gdk_env)->MonitorExit (gdk_env, *((jobject *)mutex));
+ MAYBE_RETHROW(gdk_env, "cannot release lock");
}
-static void
-g_mutex_free_jni_impl (GMutex *mutex)
-{
- if (mutex && mutex == gdk_threads_mutex)
- {
- (*gdk_env)->DeleteGlobalRef (gdk_env, *((jobject *)mutex));
- g_free (mutex);
- }
+/* Create a mutex, which is a java.lang.Object for us */
+static GMutex *g_mutex_new_jni_impl (void) {
+ return (GMutex*) allocatePlainObject();
}
-static GPrivate *
-g_private_new_jni_impl (GDestroyNotify notify)
-{
- return NULL;
+/* Lock a mutex. */
+static void g_mutex_lock_jni_impl (GMutex *mutex) {
+ JNIEnv *gdk_env;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ takeLock(gdk_env, mutex);
}
-static gpointer
-g_private_get_jni_impl (GPrivate *private)
-{
- return NULL;
+/* Try to lock a mutex. Actually, do not try because Java objects
+ * do not provide such an interface. To be at least minimally correct,
+ * pretend we tried and failed.
+ */
+static gboolean g_mutex_trylock_jni_impl (GMutex *mutex) {
+ // Shall we implement this in a JikesRVM-specific way under a flag?
+ return FALSE;
}
-static void
-g_private_set_jni_impl (GPrivate *private, gpointer data)
-{
+/* Unlock a mutex. */
+static void g_mutex_unlock_jni_impl (GMutex *mutex) {
+ JNIEnv *gdk_env;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ releaseLock(gdk_env, mutex);
}
-static GCond *
-g_cond_new_jni_impl ()
+/* Free a mutex (isn't C fun?) */
+static void g_mutex_free_jni_impl (GMutex *mutex)
{
- return NULL;
+ freePlainObject( (jobject*)mutex );
}
-static void
-g_cond_signal_jni_impl (GCond *cond)
-{
+
+/************************************************************************/
+/* Condition variable code */
+/************************************************************************/
+
+/* Create a new condition variable. This is a java.lang.Object for us. */
+static GCond *g_cond_new_jni_impl () {
+ return (GCond*)allocatePlainObject();
}
-static void
-g_cond_broadcast_jni_impl (GCond *cond)
-{
+/* Signal on a condition variable. This is simply calling Object.notify
+ * for us.
+ */
+static void g_cond_signal_jni_impl (GCond *cond) {
+ jclass lcl_class;
+ jmethodID signal_mth;
+ JNIEnv *gdk_env;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.Object");
+ MAYBE_RETHROW(gdk_env, "cannot find Object");
+
+ signal_mth = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "notify", "()V");
+ MAYBE_RETHROW(gdk_env, "cannot find Object.<notify>");
+
+ /* Must have locked an object to call notify */
+ takeLock(gdk_env, cond);
+
+ (*gdk_env)->CallVoidMethod(gdk_env, *(jobject*)cond, signal_mth);
+ MAYBE_RETHROW(gdk_env, "cannot signal mutex");
+
+ releaseLock(gdk_env, cond);
}
-static void
-g_cond_wait_jni_impl (GCond *cond, GMutex *mutex)
-{
+/* Broadcast to all waiting on a condition variable. This is simply
+ * calling Object.notifyAll for us.
+ */
+static void g_cond_broadcast_jni_impl (GCond *cond) {
+ jclass lcl_class;
+ jmethodID bcast_mth;
+ JNIEnv *gdk_env;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.Object");
+ MAYBE_RETHROW(gdk_env, "cannot find Object");
+
+ bcast_mth = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "notifyAll", "()V");
+ MAYBE_RETHROW(gdk_env, "cannot find Object.<notifyAll>");
+
+ /* Must have locked an object to call notifyAll */
+ takeLock(gdk_env, cond);
+
+ (*gdk_env)->CallVoidMethod(gdk_env, *(jobject*)cond, bcast_mth);
+ MAYBE_RETHROW(gdk_env, "cannot broadcast to mutex");
+
+ releaseLock(gdk_env, cond);
}
+
+/* Wait on a condition variable. For us, this simply means call
+ * Object.wait.
+ */
+static void g_cond_wait_jni_impl (GCond *cond, GMutex *mutex) {
+ jclass lcl_class;
+ jmethodID wait_mth;
+ JNIEnv *gdk_env;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.Object");
+ MAYBE_RETHROW(gdk_env, "cannot find Object");
+
+ wait_mth = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "wait", "()V");
+ MAYBE_RETHROW(gdk_env, "cannot find Object.<wait>");
+
+ /* Must have locked an object to call wait */
+ takeLock(gdk_env, cond);
+
+ (*gdk_env)->CallVoidMethod(gdk_env, *(jobject*)cond, wait_mth);
+ MAYBE_RETHROW(gdk_env, "cannot wait on mutex");
+
+ releaseLock(gdk_env, cond);
+}
+
+/* Wait on a condition vairable until a timeout. This is a little tricky
+ * for us. We first call Object.wait(J) giving it the appropriate timeout
+ * value. On return, we check whether an InterruptedException happened. If
+ * so, that is Java-speak for wait timing out.
+ */
static gboolean
-g_cond_timed_wait_jni_impl (GCond *cond, GMutex *mutex)
-{
+g_cond_timed_wait_jni_impl (GCond *cond, GMutex *mutex, GTimeVal *end_time) {
+ jclass lcl_class;
+ jmethodID wait_mth;
+ JNIEnv *gdk_env;
+ jlong time;
+ jthrowable cause;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.Object");
+ MAYBE_RETHROW(gdk_env, "cannot find Object");
+
+ wait_mth = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "wait", "(J)V");
+ MAYBE_RETHROW(gdk_env, "cannot find Object.<wait(J)>");
+
+ time = end_time->tv_sec*1000;
+ time += end_time->tv_usec/1000;
+
+ /* Must have locked an object to call wait */
+ takeLock(gdk_env, cond);
+
+ (*gdk_env)->CallVoidMethod(gdk_env, *(jobject*)cond, wait_mth, time);
+
+ if ((cause = (*gdk_env)->ExceptionOccurred(gdk_env)) != NULL) {
+ jclass intr = (*gdk_env)->FindClass (gdk_env, "java.lang.InterruptedException");
+ if ( (*gdk_env)->IsInstanceOf(gdk_env, cause, intr) ) {
+ releaseLock(gdk_env, cond);
return FALSE;
+ } else {
+ MAYBE_RETHROW(gdk_env, "error in timed wait");
+ }
+ }
+
+ releaseLock(gdk_env, cond);
+
+ return TRUE;
}
-static void
-g_cond_free_jni_impl (GCond *cond)
-{
+/* Free a condition variable. (isn't C fun?) */
+static void g_cond_free_jni_impl (GCond *cond) {
+ freePlainObject( (jobject*)cond );
+}
+
+
+/************************************************************************/
+/* Thread-local data code */
+/************************************************************************/
+
+/* Create a new thread-local key. We use java.lang.ThreadLocal objects
+ * for this.
+ */
+static GPrivate *g_private_new_jni_impl (GDestroyNotify notify) {
+ jclass lcl_class;
+ jobject *local;
+ JNIEnv *gdk_env;
+ jmethodID ctor;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.ThreadLocal");
+ MAYBE_RETHROW(gdk_env, "cannot find ThreadLocal");
+
+ ctor = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "<init>", "()V");
+ MAYBE_RETHROW(gdk_env, "cannot find ThreadLocal.<init>");
+
+ local = (jobject *) g_malloc (sizeof (jobject));
+ *local = (*gdk_env)->NewObject(gdk_env, lcl_class, ctor);
+ MAYBE_RETHROW(gdk_env, "cannot allocate a ThreadLocal");
+
+ *local = ((*gdk_env)->NewGlobalRef (gdk_env, *local));
+ MAYBE_RETHROW(gdk_env, "cannot create a GlobalRef");
+
+ return (GPrivate*) local;
+}
+
+/* Get this thread's value for a thread-local key. This is simply
+ * ThreadLocal.get for us.
+ */
+static gpointer g_private_get_jni_impl (GPrivate *private) {
+ jclass lcl_class;
+ jobject lcl_obj;
+ JNIEnv *gdk_env;
+ jmethodID get_mth;
+ jclass int_class;
+ jmethodID val_mth;
+ jint int_val;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.ThreadLocal");
+ MAYBE_RETHROW(gdk_env, "cannot find ThreadLocal");
+
+ get_mth = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "get", "()Ljava/lang/Object;");
+ MAYBE_RETHROW(gdk_env, "cannot find ThreadLocal.<get>");
+
+ lcl_obj = (*gdk_env)->CallObjectMethod(gdk_env, *(jobject*)private, get_mth);
+ MAYBE_RETHROW(gdk_env, "cannot find thread-local object");
+
+ int_class = (*gdk_env)->FindClass (gdk_env, "java.lang.Integer");
+ MAYBE_RETHROW(gdk_env, "cannot find Integer");
+
+ val_mth = (*gdk_env)->GetMethodID(gdk_env, int_class, "intValue", "()I");
+ MAYBE_RETHROW(gdk_env, "cannot find Integer.<intValue>");
+
+ int_val = (*gdk_env)->CallIntMethod(gdk_env, lcl_obj, val_mth);
+ MAYBE_RETHROW(gdk_env, "cannot get thread local value");
+
+ return (gpointer) int_val;
}
+/* Set this thread's value for a thread-local key. This is simply
+ * ThreadLocal.set for us.
+ */
+static void g_private_set_jni_impl (GPrivate *private, gpointer data) {
+ jclass lcl_class, int_class;
+ jobject lcl_obj;
+ JNIEnv *gdk_env;
+ jmethodID new_int, set_mth;
+
+ (*gdk_vm)->GetEnv(gdk_vm, (void **)&gdk_env, JNI_VERSION_1_1);
+
+ int_class = (*gdk_env)->FindClass (gdk_env, "java.lang.Integer");
+ MAYBE_RETHROW(gdk_env, "cannot find Integer");
+
+ new_int = (*gdk_env)->GetMethodID(gdk_env, int_class, "<init>", "(I)V");
+ MAYBE_RETHROW(gdk_env, "cannot find Integer.<init>");
+
+ lcl_obj = (*gdk_env)->NewObject(gdk_env, int_class, new_int, (jint)data);
+ MAYBE_RETHROW(gdk_env, "cannot create an Integer");
+
+ lcl_class = (*gdk_env)->FindClass (gdk_env, "java.lang.ThreadLocal");
+ MAYBE_RETHROW(gdk_env, "cannot find ThreadLocal");
+
+ set_mth = (*gdk_env)->GetMethodID(gdk_env, lcl_class, "set", "(Ljava/lang/Object;)V");
+ MAYBE_RETHROW(gdk_env, "cannot find ThreadLocal.<set>");
+
+ (*gdk_env)->CallVoidMethod(gdk_env, *(jobject*)private, set_mth, lcl_obj);
+ MAYBE_RETHROW(gdk_env, "cannot set thread local value");
+}
+
+
+/************************************************************************/
+/* GLIB interface */
+/************************************************************************/
+
+/* set of function pointers to give to glib. */
GThreadFunctions g_thread_jni_functions =
{
g_mutex_new_jni_impl, /* mutex_new */
@@ -163,7 +477,7 @@ GThreadFunctions g_thread_jni_functions =
g_private_set_jni_impl /* private_set */
};
-void
-gdk_threads_wake ()
-{
+/* ??? */
+void gdk_threads_wake () {
+
}
diff --git a/libjava/jni/gtk-peer/gthread-jni.h b/libjava/jni/gtk-peer/gthread-jni.h
index 0bb5a56f1d8..a0d093dccc8 100644
--- a/libjava/jni/gtk-peer/gthread-jni.h
+++ b/libjava/jni/gtk-peer/gthread-jni.h
@@ -43,5 +43,6 @@ exception statement from your version. */
#include "gtkpeer.h"
extern GThreadFunctions g_thread_jni_functions;
+extern JavaVM *gdk_vm;
#endif /* __GTHREADJNI_H__ */
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 9ddd1d2c2af..8d9cc6d97d7 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -122,39 +122,27 @@ void (*_Jv_JVMPI_Notify_THREAD_END) (JVMPI_Event *event);
#endif
-extern "C" void _Jv_ThrowSignal (jthrowable) __attribute ((noreturn));
-
-// Just like _Jv_Throw, but fill in the stack trace first. Although
-// this is declared extern in order that its name not be mangled, it
-// is not intended to be used outside this file.
-void
-_Jv_ThrowSignal (jthrowable throwable)
-{
- throwable->fillInStackTrace ();
- throw throwable;
-}
-
#ifdef HANDLE_SEGV
-static java::lang::NullPointerException *nullp;
-
SIGNAL_HANDLER (catch_segv)
{
+ java::lang::NullPointerException *nullp
+ = new java::lang::NullPointerException;
MAKE_THROW_FRAME (nullp);
- _Jv_ThrowSignal (nullp);
+ throw nullp;
}
#endif
-static java::lang::ArithmeticException *arithexception;
-
#ifdef HANDLE_FPE
SIGNAL_HANDLER (catch_fpe)
{
+ java::lang::ArithmeticException *arithexception
+ = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero"));
#ifdef HANDLE_DIVIDE_OVERFLOW
HANDLE_DIVIDE_OVERFLOW;
#else
MAKE_THROW_FRAME (arithexception);
#endif
- _Jv_ThrowSignal (arithexception);
+ throw arithexception;
}
#endif
@@ -921,9 +909,6 @@ _Jv_CreateJavaVM (void* /*vm_args*/)
INIT_SEGV;
#ifdef HANDLE_FPE
INIT_FPE;
-#else
- arithexception = new java::lang::ArithmeticException
- (JvNewStringLatin1 ("/ by zero"));
#endif
no_memory = new java::lang::OutOfMemoryError;
@@ -1093,7 +1078,11 @@ jint
_Jv_divI (jint dividend, jint divisor)
{
if (__builtin_expect (divisor == 0, false))
- _Jv_ThrowSignal (arithexception);
+ {
+ java::lang::ArithmeticException *arithexception
+ = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero"));
+ throw arithexception;
+ }
if (dividend == (jint) 0x80000000L && divisor == -1)
return dividend;
@@ -1105,11 +1094,15 @@ jint
_Jv_remI (jint dividend, jint divisor)
{
if (__builtin_expect (divisor == 0, false))
- _Jv_ThrowSignal (arithexception);
+ {
+ java::lang::ArithmeticException *arithexception
+ = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero"));
+ throw arithexception;
+ }
if (dividend == (jint) 0x80000000L && divisor == -1)
return 0;
-
+
return dividend % divisor;
}
@@ -1117,8 +1110,12 @@ jlong
_Jv_divJ (jlong dividend, jlong divisor)
{
if (__builtin_expect (divisor == 0, false))
- _Jv_ThrowSignal (arithexception);
-
+ {
+ java::lang::ArithmeticException *arithexception
+ = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero"));
+ throw arithexception;
+ }
+
if (dividend == (jlong) 0x8000000000000000LL && divisor == -1)
return dividend;
@@ -1129,8 +1126,12 @@ jlong
_Jv_remJ (jlong dividend, jlong divisor)
{
if (__builtin_expect (divisor == 0, false))
- _Jv_ThrowSignal (arithexception);
-
+ {
+ java::lang::ArithmeticException *arithexception
+ = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero"));
+ throw arithexception;
+ }
+
if (dividend == (jlong) 0x8000000000000000LL && divisor == -1)
return 0;
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index 6ea10fff1be..ac9493bd357 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,3 +1,23 @@
+2003-06-08 Roger Sayle <roger@eyesopen.com>
+
+ * libjava.lang/MathBuiltin.java: New test case.
+ * libjava.lang/MathBuiltin.out: New file.
+
+2003-06-05 Mark Wielaard <mark@klomp.org>
+
+ * libjava.mauve/mauve.exp (test_mauve): Add -wno-deprecated to GCJ.
+
+ PR libgcj/6181:
+ * libjava.mauve/xfails: Remove getBeanInfo() failures.
+
+ PR libgcj/6293:
+ * libjava.mauve/xfails: Remove PipedStream.close() failure.
+
+2003-05-31 Roger Sayle <roger@eyesopen.com>
+
+ * libjava.lang/Overflow.java: New test.
+ * libjava.lang/Overflow.out: New file.
+
2003-05-06 Tom Tromey <tromey@redhat.com>
* libjava.lang/verify.java: New file.
diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in
index 86079be8e0b..091051224b9 100644
--- a/libjava/testsuite/Makefile.in
+++ b/libjava/testsuite/Makefile.in
@@ -87,10 +87,11 @@ GCOBJS = @GCOBJS@
GCSPEC = @GCSPEC@
GCTESTSPEC = @GCTESTSPEC@
GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
GTK_CFLAGS = @GTK_CFLAGS@
-GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
IEEESPEC = @IEEESPEC@
@@ -117,6 +118,7 @@ OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
PLATFORMOBJS = @PLATFORMOBJS@
RANLIB = @RANLIB@
STRIP = @STRIP@
diff --git a/libjava/testsuite/libjava.mauve/mauve.exp b/libjava/testsuite/libjava.mauve/mauve.exp
index cdc7e21f2dd..dcd8a57fd1a 100644
--- a/libjava/testsuite/libjava.mauve/mauve.exp
+++ b/libjava/testsuite/libjava.mauve/mauve.exp
@@ -111,7 +111,8 @@ proc test_mauve {} {
# Append -B and -I so that libgcj.spec and libgcj.jar are found
# before they're installed.
- set env(GCJ) "$GCJ_UNDER_TEST -B$objdir/../ -I$libgcj_jar"
+ # Append -Wno-deprecated since Mauve tests lots of deprecated stuff.
+ set env(GCJ) "$GCJ_UNDER_TEST -Wno-deprecated -B$objdir/../ -I$libgcj_jar"
if {[catch {
system "$env(MAUVEDIR)/configure --with-gcj 2>&1"
diff --git a/libjava/testsuite/libjava.mauve/xfails b/libjava/testsuite/libjava.mauve/xfails
index cf82adeeb57..6a2ec18b79f 100644
--- a/libjava/testsuite/libjava.mauve/xfails
+++ b/libjava/testsuite/libjava.mauve/xfails
@@ -1,15 +1,5 @@
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 16)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 17)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 19)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 21)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 22)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 24)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 25)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 27)
-FAIL: gnu.testlet.java.beans.Introspector.jdk11: getBeanInfo (number 28)
FAIL: gnu.testlet.java.io.BufferedByteOutputStream.interrupt: single-byte writes (number 3)
FAIL: gnu.testlet.java.io.BufferedByteOutputStream.interrupt: single-byte writes (number 4)
-FAIL: gnu.testlet.java.io.PipedStream.close (number 1)
FAIL: gnu.testlet.java.io.Utf8Encoding.mojo: Four Byte Range Error (0) (number 1)
FAIL: gnu.testlet.java.io.Utf8Encoding.mojo: Four Byte Range Error (1) (number 1)
FAIL: gnu.testlet.java.io.Utf8Encoding.mojo: Five Bytes (0) (number 1)