AWT/Swing merge from GNU Classpath.
From-SVN: r56147
This commit is contained in:
parent
097684ce62
commit
7bde45b2eb
490 changed files with 86038 additions and 9753 deletions
|
@ -1,3 +1,401 @@
|
|||
2002-08-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
|
||||
|
||||
AWT/Swing merge from GNU Classpath.
|
||||
|
||||
* java/awt/AlphaComposite.java, java/awt/AttributeValue.java,
|
||||
java/awt/BasicStroke.java, java/awt/BufferCapabilities.java,
|
||||
java/awt/color/CMMException.java, java/awt/ColorPaintContext.java,
|
||||
java/awt/color/ProfileDataException.java,
|
||||
java/awt/CompositeContext.java, java/awt/Composite.java,
|
||||
java/awt/ContainerOrderFocusTraversalPolicy.java,
|
||||
java/awt/datatransfer/FlavorTable.java,
|
||||
java/awt/DefaultFocusTraversalPolicy.java,
|
||||
java/awt/DefaultKeyboardFocusManager.java, java/awt/DisplayMode.java,
|
||||
java/awt/dnd/DnDConstants.java, java/awt/dnd/DragGestureEvent.java,
|
||||
java/awt/dnd/DragGestureListener.java,
|
||||
java/awt/dnd/DragGestureRecognizer.java,
|
||||
java/awt/dnd/DragSourceAdapter.java,
|
||||
java/awt/dnd/DragSourceContext.java,
|
||||
java/awt/dnd/DragSourceDragEvent.java,
|
||||
java/awt/dnd/DragSourceEvent.java, java/awt/dnd/DragSource.java,
|
||||
java/awt/dnd/DragSourceListener.java,
|
||||
java/awt/dnd/DragSourceMotionListener.java,
|
||||
java/awt/dnd/DropTarget.java,
|
||||
java/awt/dnd/InvalidDnDOperationException.java,
|
||||
java/awt/dnd/peer/DragSourceContextPeer.java,
|
||||
java/awt/event/AWTEventListenerProxy.java,
|
||||
java/awt/event/MouseWheelEvent.java,
|
||||
java/awt/event/MouseWheelListener.java,
|
||||
java/awt/event/WindowFocusListener.java,
|
||||
java/awt/event/WindowStateListener.java,
|
||||
java/awt/FocusTraversalPolicy.java, java/awt/FontFormatException.java,
|
||||
java/awt/font/TextHitInfo.java, java/awt/geom/Arc2D.java,
|
||||
java/awt/geom/Area.java, java/awt/geom/CubicCurve2D.java,
|
||||
java/awt/geom/FlatteningPathIterator.java,
|
||||
java/awt/geom/GeneralPath.java, java/awt/geom/QuadCurve2D.java,
|
||||
java/awt/GradientPaint.java, java/awt/GraphicsConfigTemplate.java,
|
||||
java/awt/GraphicsDevice.java, java/awt/GraphicsEnvironment.java,
|
||||
java/awt/HeadlessException.java, java/awt/image/BufferedImageOp.java,
|
||||
java/awt/image/BufferStrategy.java, java/awt/ImageCapabilities.java,
|
||||
java/awt/image/ImagingOpException.java,
|
||||
java/awt/image/RasterFormatException.java,
|
||||
java/awt/image/RenderedImage.java, java/awt/image/TileObserver.java,
|
||||
java/awt/image/VolatileImage.java,
|
||||
java/awt/image/WritableRenderedImage.java,
|
||||
java/awt/im/InputContext.java, java/awt/im/InputMethodHighlight.java
|
||||
java/awt/im/InputMethodRequests.java, java/awt/im/InputSubset.java,
|
||||
java/awt/JobAttributes.java, java/awt/KeyboardFocusManager.java,
|
||||
java/awt/KeyEventDispatcher.java, java/awt/KeyEventPostProcessor.java
|
||||
java/awt/PageAttributes.java, java/awt/print/Book.java,
|
||||
java/awt/print/Pageable.java, java/awt/print/PageFormat.java,
|
||||
java/awt/print/Paper.java, java/awt/print/Printable.java,
|
||||
java/awt/print/PrinterAbortException.java,
|
||||
java/awt/print/PrinterException.java,
|
||||
java/awt/print/PrinterGraphics.java,
|
||||
java/awt/print/PrinterIOException.java, java/awt/print/PrinterJob.java,
|
||||
java/awt/Robot.java, java/awt/ScrollPaneAdjustable.java,
|
||||
java/awt/Stroke.java, java/awt/TexturePaint.java,
|
||||
javax/accessibility/AccessibleAction.java,
|
||||
javax/accessibility/AccessibleBundle.java,
|
||||
javax/accessibility/AccessibleComponent.java,
|
||||
javax/accessibility/AccessibleContext.java,
|
||||
javax/accessibility/AccessibleEditableText.java,
|
||||
javax/accessibility/AccessibleExtendedComponent.java,
|
||||
javax/accessibility/AccessibleExtendedTable.java,
|
||||
javax/accessibility/AccessibleHyperlink.java,
|
||||
javax/accessibility/AccessibleHypertext.java,
|
||||
javax/accessibility/AccessibleIcon.java,
|
||||
javax/accessibility/Accessible.java,
|
||||
javax/accessibility/AccessibleKeyBinding.java,
|
||||
javax/accessibility/AccessibleRelation.java,
|
||||
javax/accessibility/AccessibleRelationSet.java,
|
||||
javax/accessibility/AccessibleResourceBundle.java,
|
||||
javax/accessibility/AccessibleRole.java,
|
||||
javax/accessibility/AccessibleSelection.java,
|
||||
javax/accessibility/AccessibleState.java,
|
||||
javax/accessibility/AccessibleStateSet.java,
|
||||
javax/accessibility/AccessibleTable.java,
|
||||
javax/accessibility/AccessibleTableModelChange.java,
|
||||
javax/accessibility/AccessibleText.java,
|
||||
javax/accessibility/AccessibleValue.java,
|
||||
javax/swing/AbstractAction.java,
|
||||
javax/swing/AbstractButton.java,
|
||||
javax/swing/AbstractCellEditor.java,
|
||||
javax/swing/AbstractListModel.java,
|
||||
javax/swing/AbstractSet.java, javax/swing/Action.java,
|
||||
javax/swing/ActionMap.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/BorderFactory.java,
|
||||
javax/swing/border/LineBorder.java,
|
||||
javax/swing/border/MatteBorder.java,
|
||||
javax/swing/border/TitledBorder.java,
|
||||
javax/swing/BoundedRangeModel.java, javax/swing/Box.java,
|
||||
javax/swing/BoxLayout.java, javax/swing/ButtonGroup.java,
|
||||
javax/swing/ButtonModel.java, javax/swing/CellEditor.java,
|
||||
javax/swing/CellRendererPane.java,
|
||||
javax/swing/colorchooser/AbstractColorChooserPanel.java,
|
||||
javax/swing/colorchooser/ColorChooserComponentFactory.java,
|
||||
javax/swing/colorchooser/ColorSelectionModel.java,
|
||||
javax/swing/colorchooser/DefaultColorSelectionModel.java,
|
||||
javax/swing/ComboBoxEditor.java, javax/swing/ComboBoxModel.java,
|
||||
javax/swing/ComponentInputMap.java, javax/swing/DebugGraphics.java,
|
||||
javax/swing/DefaultBoundedRangeModel.java,
|
||||
javax/swing/DefaultButtonModel.java,
|
||||
javax/swing/DefaultCellEditor.java,
|
||||
javax/swing/DefaultCellRenderer.java,
|
||||
javax/swing/DefaultComboBoxModel.java,
|
||||
javax/swing/DefaultDesktopManager.java,
|
||||
javax/swing/DefaultFocusManager.java,
|
||||
javax/swing/DefaultListCellRenderer.java,
|
||||
javax/swing/DefaultListModel.java,
|
||||
javax/swing/DefaultListSelectionModel.java,
|
||||
javax/swing/DefaultSingleSelectionModel.java,
|
||||
javax/swing/DesktopManager.java,
|
||||
javax/swing/event/AncestorEvent.java,
|
||||
javax/swing/event/AncestorListener.java,
|
||||
javax/swing/event/CaretEvent.java,
|
||||
javax/swing/event/CaretListener.java,
|
||||
javax/swing/event/CellEditorListener.java,
|
||||
javax/swing/event/ChangeEvent.java,
|
||||
javax/swing/event/ChangeListener.java,
|
||||
javax/swing/event/DocumentEvent.java,
|
||||
javax/swing/event/DocumentListener.java,
|
||||
javax/swing/event/EventListenerList.java,
|
||||
javax/swing/event/HyperlinkEvent.java,
|
||||
javax/swing/event/HyperlinkListener.java,
|
||||
javax/swing/event/InternalFrameAdapter.java,
|
||||
javax/swing/event/InternalFrameEvent.java,
|
||||
javax/swing/event/InternalFrameListener.java,
|
||||
javax/swing/event/ListDataEvent.java,
|
||||
javax/swing/event/ListDataListener.java,
|
||||
javax/swing/event/ListSelectionEvent.java,
|
||||
javax/swing/event/ListSelectionListener.java,
|
||||
javax/swing/event/MenuDragMouseEvent.java,
|
||||
javax/swing/event/MenuDragMouseListener.java,
|
||||
javax/swing/event/MenuEvent.java,
|
||||
javax/swing/event/MenuKeyEvent.java,
|
||||
javax/swing/event/MenuKeyListener.java,
|
||||
javax/swing/event/MenuListener.java,
|
||||
javax/swing/event/MouseInputAdapter.java,
|
||||
javax/swing/event/MouseInputListener.java,
|
||||
javax/swing/event/PopupMenuEvent.java,
|
||||
javax/swing/event/PopupMenuListener.java,
|
||||
javax/swing/event/SwingPropertyChangeSupport.java,
|
||||
javax/swing/event/TableColumnModelEvent.java,
|
||||
javax/swing/event/TableColumnModelListener.java,
|
||||
javax/swing/event/TableModelEvent.java,
|
||||
javax/swing/event/TableModelListener.java,
|
||||
javax/swing/event/TreeExpansionEvent.java,
|
||||
javax/swing/event/TreeExpansionListener.java,
|
||||
javax/swing/event/TreeModelEvent.java,
|
||||
javax/swing/event/TreeModelListener.java,
|
||||
javax/swing/event/TreeSelectionEvent.java,
|
||||
javax/swing/event/TreeSelectionListener.java,
|
||||
javax/swing/event/TreeWillExpandListener.java,
|
||||
javax/swing/event/UndoableEditEvent.java,
|
||||
javax/swing/event/UndoableEditListener.java,
|
||||
javax/swing/filechooser/FileFilter.java,
|
||||
javax/swing/filechooser/FileSystemView.java,
|
||||
javax/swing/filechooser/FileView.java,
|
||||
javax/swing/FocusManager.java, javax/swing/GrayFilter.java,
|
||||
javax/swing/Icon.java, javax/swing/ImageIcon.java,
|
||||
javax/swing/InputMap.java, javax/swing/InputVerifier.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/JFrame.java,
|
||||
javax/swing/JInternalFrame.java, javax/swing/JLabel.java,
|
||||
javax/swing/JLayeredPane.java, javax/swing/JList.java,
|
||||
javax/swing/JMenuBar.java, javax/swing/JMenuItem.java,
|
||||
javax/swing/JMenu.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/JSplitPane.java,
|
||||
javax/swing/JTabbedPane.java, javax/swing/JTable.java,
|
||||
javax/swing/JTextField.java, javax/swing/JTextPane.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/ListCellRenderer.java,
|
||||
javax/swing/ListModel.java, javax/swing/ListSelectionModel.java,
|
||||
javax/swing/LookAndFeel.java, javax/swing/MenuElement.java,
|
||||
javax/swing/MenuSelectionManager.java,
|
||||
javax/swing/MutableComboBoxModel.java,
|
||||
javax/swing/OverlayLayout.java,
|
||||
javax/swing/plaf/ActionMapUIResource.java,
|
||||
javax/swing/plaf/basic/BasicBorders.java,
|
||||
javax/swing/plaf/basic/BasicButtonUI.java,
|
||||
javax/swing/plaf/basic/BasicCheckBoxUI.java,
|
||||
javax/swing/plaf/basic/BasicDefaults.java,
|
||||
javax/swing/plaf/basic/BasicGraphicsUtils.java,
|
||||
javax/swing/plaf/basic/BasicIconFactory.java,
|
||||
javax/swing/plaf/basic/BasicLabelUI.java,
|
||||
javax/swing/plaf/basic/BasicListUI.java,
|
||||
javax/swing/plaf/basic/BasicLookAndFeel.java,
|
||||
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/BasicTabbedPaneUI.java,
|
||||
javax/swing/plaf/basic/BasicTextUI.java,
|
||||
javax/swing/plaf/basic/BasicToggleButtonUI.java,
|
||||
javax/swing/plaf/basic/BasicTreeUI.java,
|
||||
javax/swing/plaf/basic/BasicViewportUI.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/PopupMenuUI.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/SplitPaneUI.java,
|
||||
javax/swing/plaf/TabbedPaneUI.java,
|
||||
javax/swing/plaf/TableHeaderUI.java,
|
||||
javax/swing/plaf/TableUI.java,
|
||||
javax/swing/plaf/TextUI.java,
|
||||
javax/swing/plaf/ToolBarUI.java,
|
||||
javax/swing/plaf/ToolTipUI.java,
|
||||
javax/swing/plaf/TreeUI.java,
|
||||
javax/swing/plaf/UIResource.java,
|
||||
javax/swing/plaf/ViewportUI.java,
|
||||
javax/swing/ProgressMonitorInputStream.java,
|
||||
javax/swing/ProgressMonitor.java,
|
||||
javax/swing/Renderer.java,
|
||||
javax/swing/RepaintManager.java,
|
||||
javax/swing/RootPaneContainer.java,
|
||||
javax/swing/Scrollable.java,
|
||||
javax/swing/ScrollPaneConstants.java,
|
||||
javax/swing/ScrollPaneLayout.java,
|
||||
javax/swing/SingleSelectionModel.java,
|
||||
javax/swing/SizeRequirements.java,
|
||||
javax/swing/SizeSequence.java,
|
||||
javax/swing/SwingConstants.java,
|
||||
javax/swing/SwingUtilities.java,
|
||||
javax/swing/table/AbstractTableModel.java,
|
||||
javax/swing/table/DefaultTableCellRenderer.java,
|
||||
javax/swing/table/DefaultTableColumnModel.java,
|
||||
javax/swing/table/DefaultTableModel.java,
|
||||
javax/swing/table/TableCellEditor.java,
|
||||
javax/swing/table/TableCellRenderer.java,
|
||||
javax/swing/table/TableColumn.java,
|
||||
javax/swing/table/TableColumnModel.java,
|
||||
javax/swing/table/TableModel.java,
|
||||
javax/swing/text/AbstractDocument.java,
|
||||
javax/swing/text/AttributeSet.java,
|
||||
javax/swing/text/BadLocationException.java,
|
||||
javax/swing/text/Caret.java,
|
||||
javax/swing/text/CharacterIterator.java,
|
||||
javax/swing/text/ComponentView.java,
|
||||
javax/swing/text/DefaultCaret.java,
|
||||
javax/swing/text/DefaultEditorKit.java,
|
||||
javax/swing/text/Document.java,
|
||||
javax/swing/text/EditorKit.java,
|
||||
javax/swing/text/Element.java,
|
||||
javax/swing/text/GapContent.java,
|
||||
javax/swing/text/JTextComponent.java,
|
||||
javax/swing/text/Keymap.java,
|
||||
javax/swing/text/MutableAttributeSet.java,
|
||||
javax/swing/text/PlainDocument.java,
|
||||
javax/swing/text/PlainEditorKit.java,
|
||||
javax/swing/text/Position.java,
|
||||
javax/swing/text/Segment.java,
|
||||
javax/swing/text/StyledDocument.java,
|
||||
javax/swing/text/StyledEditorKit.java,
|
||||
javax/swing/text/Style.java,
|
||||
javax/swing/text/TextAction.java,
|
||||
javax/swing/text/ViewFactory.java,
|
||||
javax/swing/text/View.java,
|
||||
javax/swing/Timer.java,
|
||||
javax/swing/ToggleButtonModel.java,
|
||||
javax/swing/ToolTipManager.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/ExpandVetoException.java,
|
||||
javax/swing/tree/FixedHeightLayoutCache.java,
|
||||
javax/swing/tree/MutableTreeNode.java,
|
||||
javax/swing/tree/RowMapper.java,
|
||||
javax/swing/tree/TreeCellEditor.java,
|
||||
javax/swing/tree/TreeCellRenderer.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/UIDefaults.java,
|
||||
javax/swing/UIManager.java,
|
||||
javax/swing/undo/AbstractUndoableEdit.java,
|
||||
javax/swing/undo/CannotRedoException.java,
|
||||
javax/swing/undo/CannotUndoException.java,
|
||||
javax/swing/undo/CompoundEdit.java,
|
||||
javax/swing/undo/StateEditable.java,
|
||||
javax/swing/undo/StateEdit.java,
|
||||
javax/swing/undo/UndoableEdit.java,
|
||||
javax/swing/undo/UndoableEditSupport.java,
|
||||
javax/swing/undo/UndoManager.java,
|
||||
javax/swing/UnsupportedLookAndFeelException.java,
|
||||
javax/swing/ViewportLayout.java,
|
||||
javax/swing/WindowConstants.java: New files, from GNU Classpath.
|
||||
|
||||
* gnu/awt/xlib/XGraphicsConfiguration.java,
|
||||
gnu/awt/xlib/XToolkit.java, java/awt/ActiveEvent.java,
|
||||
java/awt/Adjustable.java, java/awt/AWTError.java,
|
||||
java/awt/AWTEvent.java, java/awt/AWTEventMulticaster.java,
|
||||
java/awt/AWTException.java, java/awt/AWTPermission.java,
|
||||
java/awt/BorderLayout.java, java/awt/Button.java, java/awt/Choice.java,
|
||||
java/awt/Color.java, java/awt/Component.java,
|
||||
java/awt/ComponentOrientation.java, java/awt/Container.java,
|
||||
java/awt/datatransfer/MimeTypeParseException.java,
|
||||
java/awt/datatransfer/Transferable.java,
|
||||
java/awt/datatransfer/UnsupportedFlavorException.java,
|
||||
java/awt/Dimension.java, java/awt/event/ActionEvent.java,
|
||||
java/awt/event/ActionListener.java,
|
||||
java/awt/event/AdjustmentEvent.java,
|
||||
java/awt/event/AdjustmentListener.java,
|
||||
java/awt/event/AWTEventListener.java,
|
||||
java/awt/event/ComponentAdapter.java,
|
||||
java/awt/event/ComponentEvent.java,
|
||||
java/awt/event/ComponentListener.java,
|
||||
java/awt/event/ContainerAdapter.java,
|
||||
java/awt/event/ContainerEvent.java,
|
||||
java/awt/event/ContainerListener.java,
|
||||
java/awt/event/FocusAdapter.java,
|
||||
java/awt/event/FocusEvent.java, java/awt/event/FocusListener.java,
|
||||
java/awt/event/HierarchyBoundsAdapter.java,
|
||||
java/awt/event/HierarchyBoundsListener.java,
|
||||
java/awt/event/HierarchyEvent.java,
|
||||
java/awt/event/HierarchyListener.java,
|
||||
java/awt/event/InputEvent.java, java/awt/event/InputMethodEvent.java,
|
||||
java/awt/event/InputMethodListener.java,
|
||||
java/awt/event/InvocationEvent.java, java/awt/event/ItemEvent.java,
|
||||
java/awt/event/ItemListener.java, java/awt/event/KeyAdapter.java,
|
||||
java/awt/event/KeyEvent.java, java/awt/event/KeyListener.java,
|
||||
java/awt/event/MouseAdapter.java, java/awt/event/MouseEvent.java,
|
||||
java/awt/event/MouseListener.java,
|
||||
java/awt/event/MouseMotionAdapter.java,
|
||||
java/awt/event/MouseMotionListener.java,
|
||||
java/awt/event/PaintEvent.java, java/awt/EventQueue.java,
|
||||
java/awt/event/TextEvent.java, java/awt/event/TextListener.java,
|
||||
java/awt/event/WindowAdapter.java, java/awt/event/WindowEvent.java,
|
||||
java/awt/event/WindowListener.java, java/awt/Font.java,
|
||||
java/awt/geom/AffineTransform.java, java/awt/geom/Dimension2D.java,
|
||||
java/awt/geom/Ellipse2D.java,
|
||||
java/awt/geom/IllegalPathStateException.java,
|
||||
java/awt/geom/Line2D.java,
|
||||
java/awt/geom/NoninvertibleTransformException.java,
|
||||
java/awt/geom/PathIterator.java, java/awt/geom/Point2D.java,
|
||||
java/awt/geom/Rectangle2D.java, java/awt/geom/RectangularShape.java,
|
||||
java/awt/geom/RoundRectangle2D.java,
|
||||
java/awt/GraphicsConfiguration.java,
|
||||
java/awt/IllegalComponentStateException.java,
|
||||
java/awt/image/IndexColorModel.java,
|
||||
java/awt/Image.java, java/awt/image/MemoryImageSource.java,
|
||||
java/awt/image/PixelGrabber.java, java/awt/Insets.java,
|
||||
java/awt/ItemSelectable.java, java/awt/LayoutManager2.java,
|
||||
java/awt/LayoutManager.java, java/awt/MenuContainer.java,
|
||||
java/awt/MenuItem.java, java/awt/PaintContext.java,
|
||||
java/awt/Paint.java, java/awt/Panel.java, java/awt/Point.java,
|
||||
java/awt/Polygon.java, java/awt/PrintGraphics.java,
|
||||
java/awt/PrintJob.java, java/awt/Rectangle.java,
|
||||
java/awt/RenderingHints.java, java/awt/ScrollPane.java,
|
||||
java/awt/Shape.java, java/awt/SystemColor.java, java/awt/Toolkit.java,
|
||||
java/awt/Transparency.java, java/awt/Window.java: Merge from classpath.
|
||||
|
||||
* Makefile.am: Add new files.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
2002-08-07 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
|
||||
|
||||
* java/lang/ClassLoader.java (getSystemClassLoader, findClass,
|
||||
|
|
|
@ -573,6 +573,9 @@ 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/image/ImageDecoder.java \
|
||||
gnu/java/awt/image/XBMDecoder.java \
|
||||
gnu/java/beans/editors/ColorEditor.java \
|
||||
gnu/java/beans/editors/FontEditor.java \
|
||||
gnu/java/beans/editors/NativeBooleanEditor.java \
|
||||
|
@ -608,12 +611,12 @@ java/awt/CheckboxGroup.java \
|
|||
java/awt/CheckboxMenuItem.java \
|
||||
java/awt/Choice.java \
|
||||
java/awt/Color.java \
|
||||
java/awt/Component.java \
|
||||
java/awt/Component.java \
|
||||
java/awt/ComponentOrientation.java \
|
||||
java/awt/Container.java \
|
||||
java/awt/Container.java \
|
||||
java/awt/Cursor.java \
|
||||
java/awt/Dialog.java \
|
||||
java/awt/Dimension.java \
|
||||
java/awt/Dimension.java \
|
||||
java/awt/Event.java \
|
||||
java/awt/EventDispatchThread.java \
|
||||
java/awt/EventQueue.java \
|
||||
|
@ -635,7 +638,6 @@ java/awt/Label.java \
|
|||
java/awt/LayoutManager.java \
|
||||
java/awt/LayoutManager2.java \
|
||||
java/awt/List.java \
|
||||
java/awt/MediaTracker.java \
|
||||
java/awt/Menu.java \
|
||||
java/awt/MenuBar.java \
|
||||
java/awt/MenuComponent.java \
|
||||
|
@ -646,25 +648,23 @@ java/awt/Paint.java \
|
|||
java/awt/PaintContext.java \
|
||||
java/awt/Panel.java \
|
||||
java/awt/Point.java \
|
||||
java/awt/Polygon.java \
|
||||
java/awt/PopupMenu.java \
|
||||
java/awt/PrintGraphics.java \
|
||||
java/awt/PrintJob.java \
|
||||
java/awt/Rectangle.java \
|
||||
java/awt/PopupMenu.java \
|
||||
java/awt/Rectangle.java \
|
||||
java/awt/RenderingHints.java \
|
||||
java/awt/ScrollPane.java \
|
||||
java/awt/Scrollbar.java \
|
||||
java/awt/Scrollbar.java \
|
||||
java/awt/Shape.java \
|
||||
java/awt/SystemColor.java \
|
||||
java/awt/TextArea.java \
|
||||
java/awt/TextComponent.java \
|
||||
java/awt/TextField.java \
|
||||
java/awt/TextField.java \
|
||||
java/awt/Toolkit.java \
|
||||
java/awt/Transparency.java \
|
||||
java/awt/Window.java \
|
||||
java/awt/color/ColorSpace.java \
|
||||
java/awt/color/ICC_ColorSpace.java \
|
||||
java/awt/color/ICC_Profile.java \
|
||||
java/awt/color/ICC_Profile.java \
|
||||
java/awt/color/CMMException.java \
|
||||
java/awt/color/ProfileDataException.java \
|
||||
java/awt/datatransfer/Clipboard.java \
|
||||
java/awt/datatransfer/ClipboardOwner.java \
|
||||
java/awt/datatransfer/DataFlavor.java \
|
||||
|
@ -672,10 +672,11 @@ java/awt/datatransfer/FlavorMap.java \
|
|||
java/awt/datatransfer/MimeTypeParseException.java \
|
||||
java/awt/datatransfer/StringSelection.java \
|
||||
java/awt/datatransfer/SystemFlavorMap.java \
|
||||
java/awt/datatransfer/Transferable.java \
|
||||
java/awt/datatransfer/Transferable.java \
|
||||
java/awt/datatransfer/UnsupportedFlavorException.java \
|
||||
java/awt/datatransfer/FlavorTable.java \
|
||||
java/awt/event/AWTEventListener.java \
|
||||
java/awt/event/ActionEvent.java \
|
||||
java/awt/event/ActionEvent.java \
|
||||
java/awt/event/ActionListener.java \
|
||||
java/awt/event/AdjustmentEvent.java \
|
||||
java/awt/event/AdjustmentListener.java \
|
||||
|
@ -694,66 +695,92 @@ java/awt/event/HierarchyEvent.java \
|
|||
java/awt/event/HierarchyListener.java \
|
||||
java/awt/event/InputEvent.java \
|
||||
java/awt/event/InputMethodEvent.java \
|
||||
java/awt/event/InputMethodListener.java \
|
||||
java/awt/event/InputMethodListener.java \
|
||||
java/awt/event/InvocationEvent.java \
|
||||
java/awt/event/ItemEvent.java \
|
||||
java/awt/event/ItemListener.java \
|
||||
java/awt/event/KeyAdapter.java \
|
||||
java/awt/event/KeyEvent.java \
|
||||
java/awt/event/KeyListener.java \
|
||||
java/awt/event/KeyListener.java \
|
||||
java/awt/event/MouseAdapter.java \
|
||||
java/awt/event/MouseEvent.java \
|
||||
java/awt/event/MouseListener.java \
|
||||
java/awt/event/MouseMotionAdapter.java \
|
||||
java/awt/event/MouseMotionListener.java \
|
||||
java/awt/event/MouseMotionListener.java \
|
||||
java/awt/event/PaintEvent.java \
|
||||
java/awt/event/TextEvent.java \
|
||||
java/awt/event/TextListener.java \
|
||||
java/awt/event/WindowAdapter.java \
|
||||
java/awt/event/WindowEvent.java \
|
||||
java/awt/event/WindowEvent.java \
|
||||
java/awt/event/WindowListener.java \
|
||||
java/awt/event/AWTEventListenerProxy.java \
|
||||
java/awt/event/MouseWheelEvent.java \
|
||||
java/awt/event/MouseWheelListener.java \
|
||||
java/awt/event/WindowFocusListener.java \
|
||||
java/awt/event/WindowStateListener.java \
|
||||
java/awt/geom/AffineTransform.java \
|
||||
java/awt/geom/Dimension2D.java \
|
||||
java/awt/geom/Ellipse2D.java \
|
||||
java/awt/geom/IllegalPathStateException.java \
|
||||
java/awt/geom/Line2D.java \
|
||||
java/awt/geom/NoninvertibleTransformException.java \
|
||||
java/awt/geom/PathIterator.java \
|
||||
java/awt/geom/PathIterator.java \
|
||||
java/awt/geom/Point2D.java \
|
||||
java/awt/geom/Rectangle2D.java \
|
||||
java/awt/geom/RectangularShape.java \
|
||||
java/awt/geom/RoundRectangle2D.java \
|
||||
java/awt/image/AreaAveragingScaleFilter.java \
|
||||
java/awt/geom/Line2D.java \
|
||||
java/awt/geom/Arc2D.java \
|
||||
java/awt/geom/Area.java \
|
||||
java/awt/geom/CubicCurve2D.java \
|
||||
java/awt/geom/FlatteningPathIterator.java \
|
||||
java/awt/geom/GeneralPath.java \
|
||||
java/awt/geom/QuadCurve2D.java \
|
||||
java/awt/image/BufferedImage.java \
|
||||
java/awt/image/ColorModel.java \
|
||||
java/awt/image/ComponentColorModel.java \
|
||||
java/awt/image/ComponentColorModel.java \
|
||||
java/awt/image/ComponentSampleModel.java \
|
||||
java/awt/image/CropImageFilter.java \
|
||||
java/awt/image/DataBuffer.java \
|
||||
java/awt/image/DataBufferByte.java \
|
||||
java/awt/image/DataBufferInt.java \
|
||||
java/awt/image/DataBufferUShort.java \
|
||||
java/awt/image/DirectColorModel.java \
|
||||
java/awt/image/FilteredImageSource.java \
|
||||
java/awt/image/ImageConsumer.java \
|
||||
java/awt/image/ImageFilter.java \
|
||||
java/awt/image/ImageObserver.java \
|
||||
java/awt/image/ImageProducer.java \
|
||||
java/awt/image/IndexColorModel.java \
|
||||
java/awt/image/MemoryImageSource.java \
|
||||
java/awt/image/PackedColorModel.java \
|
||||
java/awt/image/PixelGrabber.java \
|
||||
java/awt/image/RGBImageFilter.java \
|
||||
java/awt/image/Raster.java \
|
||||
java/awt/image/RasterOp.java \
|
||||
java/awt/image/ReplicateScaleFilter.java \
|
||||
java/awt/image/SampleModel.java \
|
||||
java/awt/image/SampleModel.java \
|
||||
java/awt/image/SinglePixelPackedSampleModel.java \
|
||||
java/awt/image/WritableRaster.java \
|
||||
java/awt/image/AreaAveragingScaleFilter.java \
|
||||
java/awt/image/CropImageFilter.java \
|
||||
java/awt/image/FilteredImageSource.java \
|
||||
java/awt/image/ImageFilter.java \
|
||||
java/awt/image/MemoryImageSource.java \
|
||||
java/awt/image/PixelGrabber.java \
|
||||
java/awt/image/RGBImageFilter.java \
|
||||
java/awt/image/ReplicateScaleFilter.java \
|
||||
java/awt/image/BufferStrategy.java \
|
||||
java/awt/image/BufferedImageOp.java \
|
||||
java/awt/image/ImagingOpException.java \
|
||||
java/awt/image/RasterFormatException.java \
|
||||
java/awt/image/RenderedImage.java \
|
||||
java/awt/image/TileObserver.java \
|
||||
java/awt/image/VolatileImage.java \
|
||||
java/awt/image/WritableRenderedImage.java \
|
||||
java/awt/image/renderable/ContextualRenderedImageFactory.java \
|
||||
java/awt/image/renderable/ParameterBlock.java \
|
||||
java/awt/image/renderable/RenderContext.java \
|
||||
java/awt/image/renderable/RenderableImage.java \
|
||||
java/awt/image/renderable/RenderableImageOp.java \
|
||||
java/awt/image/renderable/RenderableImageProducer.java \
|
||||
java/awt/image/renderable/RenderedImageFactory.java \
|
||||
java/awt/peer/ButtonPeer.java \
|
||||
java/awt/peer/CanvasPeer.java \
|
||||
java/awt/peer/CheckboxMenuItemPeer.java \
|
||||
java/awt/peer/CheckboxPeer.java \
|
||||
java/awt/peer/CheckboxMenuItemPeer.java \
|
||||
java/awt/peer/CheckboxPeer.java \
|
||||
java/awt/peer/ChoicePeer.java \
|
||||
java/awt/peer/ComponentPeer.java \
|
||||
java/awt/peer/ContainerPeer.java \
|
||||
|
@ -766,17 +793,83 @@ java/awt/peer/LightweightPeer.java \
|
|||
java/awt/peer/ListPeer.java \
|
||||
java/awt/peer/MenuBarPeer.java \
|
||||
java/awt/peer/MenuComponentPeer.java \
|
||||
java/awt/peer/MenuItemPeer.java \
|
||||
java/awt/peer/MenuItemPeer.java \
|
||||
java/awt/peer/MenuPeer.java \
|
||||
java/awt/peer/PanelPeer.java \
|
||||
java/awt/peer/PopupMenuPeer.java \
|
||||
java/awt/peer/ScrollPanePeer.java \
|
||||
java/awt/peer/ScrollbarPeer.java \
|
||||
java/awt/peer/TextAreaPeer.java \
|
||||
java/awt/peer/TextAreaPeer.java \
|
||||
java/awt/peer/TextComponentPeer.java \
|
||||
java/awt/peer/TextFieldPeer.java \
|
||||
java/awt/peer/WindowPeer.java \
|
||||
java/beans/beancontext/BeanContext.java \
|
||||
java/awt/SystemColor.java \
|
||||
java/awt/Polygon.java \
|
||||
java/awt/MediaTracker.java \
|
||||
java/awt/PrintGraphics.java \
|
||||
java/awt/PrintJob.java \
|
||||
java/awt/AWTKeyStroke.java \
|
||||
java/awt/AlphaComposite.java \
|
||||
java/awt/AttributeValue.java \
|
||||
java/awt/BasicStroke.java \
|
||||
java/awt/BufferCapabilities.java \
|
||||
java/awt/ColorPaintContext.java \
|
||||
java/awt/Composite.java \
|
||||
java/awt/CompositeContext.java \
|
||||
java/awt/ContainerOrderFocusTraversalPolicy.java \
|
||||
java/awt/DefaultFocusTraversalPolicy.java \
|
||||
java/awt/DefaultKeyboardFocusManager.java \
|
||||
java/awt/DisplayMode.java \
|
||||
java/awt/FocusTraversalPolicy.java \
|
||||
java/awt/FontFormatException.java \
|
||||
java/awt/GradientPaint.java \
|
||||
java/awt/GraphicsConfigTemplate.java \
|
||||
java/awt/GraphicsDevice.java \
|
||||
java/awt/GraphicsEnvironment.java \
|
||||
java/awt/HeadlessException.java \
|
||||
java/awt/ImageCapabilities.java \
|
||||
java/awt/JobAttributes.java \
|
||||
java/awt/KeyEventDispatcher.java \
|
||||
java/awt/KeyEventPostProcessor.java \
|
||||
java/awt/KeyboardFocusManager.java \
|
||||
java/awt/PageAttributes.java \
|
||||
java/awt/Robot.java \
|
||||
java/awt/ScrollPaneAdjustable.java \
|
||||
java/awt/Stroke.java \
|
||||
java/awt/TexturePaint.java \
|
||||
java/awt/dnd/DnDConstants.java \
|
||||
java/awt/dnd/DragGestureEvent.java \
|
||||
java/awt/dnd/DragGestureListener.java \
|
||||
java/awt/dnd/DragGestureRecognizer.java \
|
||||
java/awt/dnd/DragSource.java \
|
||||
java/awt/dnd/DragSourceAdapter.java \
|
||||
java/awt/dnd/DragSourceContext.java \
|
||||
java/awt/dnd/DragSourceDragEvent.java \
|
||||
java/awt/dnd/DragSourceEvent.java \
|
||||
java/awt/dnd/DragSourceListener.java \
|
||||
java/awt/dnd/DragSourceMotionListener.java \
|
||||
java/awt/dnd/DropTarget.java \
|
||||
java/awt/dnd/InvalidDnDOperationException.java \
|
||||
java/awt/dnd/peer/DragSourceContextPeer.java \
|
||||
java/awt/font/TextHitInfo.java \
|
||||
java/awt/im/spi/InputMethod.java \
|
||||
java/awt/im/spi/InputMethodContext.java \
|
||||
java/awt/im/spi/InputMethodDescriptor.java \
|
||||
java/awt/im/InputContext.java \
|
||||
java/awt/im/InputMethodHighlight.java \
|
||||
java/awt/im/InputMethodRequests.java \
|
||||
java/awt/im/InputSubset.java \
|
||||
java/awt/print/Book.java \
|
||||
java/awt/print/PageFormat.java \
|
||||
java/awt/print/Pageable.java \
|
||||
java/awt/print/Paper.java \
|
||||
java/awt/print/Printable.java \
|
||||
java/awt/print/PrinterAbortException.java \
|
||||
java/awt/print/PrinterException.java \
|
||||
java/awt/print/PrinterGraphics.java \
|
||||
java/awt/print/PrinterIOException.java \
|
||||
java/awt/print/PrinterJob.java \
|
||||
java/beans/beancontext/BeanContext.java \
|
||||
java/beans/beancontext/BeanContextChild.java \
|
||||
java/beans/beancontext/BeanContextChildComponentProxy.java \
|
||||
java/beans/beancontext/BeanContextChildSupport.java \
|
||||
|
@ -790,9 +883,8 @@ java/beans/beancontext/BeanContextServiceProvider.java \
|
|||
java/beans/beancontext/BeanContextServiceProviderBeanInfo.java \
|
||||
java/beans/beancontext/BeanContextServiceRevokedEvent.java \
|
||||
java/beans/beancontext/BeanContextServiceRevokedListener.java \
|
||||
java/beans/beancontext/BeanContextServices.java \
|
||||
java/beans/beancontext/BeanContextServicesListener.java \
|
||||
java/beans/AppletInitializer.java \
|
||||
java/beans/beancontext/BeanContextServices.java \
|
||||
java/beans/beancontext/BeanContextServicesListener.java \
|
||||
java/beans/BeanDescriptor.java \
|
||||
java/beans/BeanInfo.java \
|
||||
java/beans/Beans.java \
|
||||
|
@ -819,7 +911,295 @@ java/beans/SimpleBeanInfo.java \
|
|||
java/beans/VetoableChangeListener.java \
|
||||
java/beans/VetoableChangeListenerProxy.java \
|
||||
java/beans/VetoableChangeSupport.java \
|
||||
java/beans/Visibility.java
|
||||
java/beans/Visibility.java \
|
||||
java/beans/AppletInitializer.java \
|
||||
javax/swing/border/AbstractBorder.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/GrayFilter.java \
|
||||
javax/swing/AbstractAction.java \
|
||||
javax/swing/AbstractButton.java \
|
||||
javax/swing/plaf/basic/BasicButtonUI.java \
|
||||
javax/swing/plaf/basic/BasicCheckBoxUI.java \
|
||||
javax/swing/plaf/basic/BasicDefaults.java \
|
||||
javax/swing/plaf/basic/BasicGraphicsUtils.java \
|
||||
javax/swing/plaf/basic/BasicLabelUI.java \
|
||||
javax/swing/plaf/basic/BasicListUI.java \
|
||||
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/BasicTabbedPaneUI.java \
|
||||
javax/swing/plaf/basic/BasicTextUI.java \
|
||||
javax/swing/plaf/basic/BasicToggleButtonUI.java \
|
||||
javax/swing/plaf/basic/BasicTreeUI.java \
|
||||
javax/swing/plaf/basic/BasicViewportUI.java \
|
||||
javax/swing/plaf/basic/BasicLookAndFeel.java \
|
||||
javax/swing/plaf/basic/BasicBorders.java \
|
||||
javax/swing/plaf/basic/BasicIconFactory.java \
|
||||
javax/swing/plaf/BorderUIResource.java \
|
||||
javax/swing/plaf/UIResource.java \
|
||||
javax/swing/plaf/ButtonUI.java \
|
||||
javax/swing/plaf/ComponentUI.java \
|
||||
javax/swing/plaf/LabelUI.java \
|
||||
javax/swing/plaf/ListUI.java \
|
||||
javax/swing/plaf/OptionPaneUI.java \
|
||||
javax/swing/plaf/PanelUI.java \
|
||||
javax/swing/plaf/ScrollPaneUI.java \
|
||||
javax/swing/plaf/TabbedPaneUI.java \
|
||||
javax/swing/plaf/TextUI.java \
|
||||
javax/swing/plaf/TreeUI.java \
|
||||
javax/swing/plaf/ViewportUI.java \
|
||||
javax/swing/plaf/metal/MetalLookAndFeel.java \
|
||||
javax/swing/plaf/ColorUIResource.java \
|
||||
javax/swing/plaf/DimensionUIResource.java \
|
||||
javax/swing/plaf/FontUIResource.java \
|
||||
javax/swing/plaf/IconUIResource.java \
|
||||
javax/swing/plaf/InsetsUIResource.java \
|
||||
javax/swing/plaf/ActionMapUIResource.java \
|
||||
javax/swing/plaf/ColorChooserUI.java \
|
||||
javax/swing/plaf/ComboBoxUI.java \
|
||||
javax/swing/plaf/ComponentInputMapUIResource.java \
|
||||
javax/swing/plaf/DesktopIconUI.java \
|
||||
javax/swing/plaf/DesktopPaneUI.java \
|
||||
javax/swing/plaf/FileChooserUI.java \
|
||||
javax/swing/plaf/InputMapUIResource.java \
|
||||
javax/swing/plaf/InternalFrameUI.java \
|
||||
javax/swing/plaf/MenuBarUI.java \
|
||||
javax/swing/plaf/MenuItemUI.java \
|
||||
javax/swing/plaf/PopupMenuUI.java \
|
||||
javax/swing/plaf/ProgressBarUI.java \
|
||||
javax/swing/plaf/RootPaneUI.java \
|
||||
javax/swing/plaf/ScrollBarUI.java \
|
||||
javax/swing/plaf/SeparatorUI.java \
|
||||
javax/swing/plaf/SliderUI.java \
|
||||
javax/swing/plaf/SplitPaneUI.java \
|
||||
javax/swing/plaf/TableHeaderUI.java \
|
||||
javax/swing/plaf/TableUI.java \
|
||||
javax/swing/plaf/ToolBarUI.java \
|
||||
javax/swing/plaf/ToolTipUI.java \
|
||||
javax/swing/AbstractListModel.java \
|
||||
javax/swing/AbstractSet.java \
|
||||
javax/swing/colorchooser/AbstractColorChooserPanel.java \
|
||||
javax/swing/colorchooser/ColorChooserComponentFactory.java \
|
||||
javax/swing/colorchooser/ColorSelectionModel.java \
|
||||
javax/swing/colorchooser/DefaultColorSelectionModel.java \
|
||||
javax/swing/filechooser/FileFilter.java \
|
||||
javax/swing/filechooser/FileSystemView.java \
|
||||
javax/swing/filechooser/FileView.java \
|
||||
javax/swing/table/AbstractTableModel.java \
|
||||
javax/swing/table/DefaultTableColumnModel.java \
|
||||
javax/swing/table/DefaultTableModel.java \
|
||||
javax/swing/table/TableCellEditor.java \
|
||||
javax/swing/table/TableCellRenderer.java \
|
||||
javax/swing/table/TableColumn.java \
|
||||
javax/swing/table/TableColumnModel.java \
|
||||
javax/swing/table/TableModel.java \
|
||||
javax/swing/table/DefaultTableCellRenderer.java \
|
||||
javax/swing/Action.java \
|
||||
javax/swing/BorderFactory.java \
|
||||
javax/swing/Box.java \
|
||||
javax/swing/BoxLayout.java \
|
||||
javax/swing/ButtonGroup.java \
|
||||
javax/swing/ButtonModel.java \
|
||||
javax/swing/ComponentInputMap.java \
|
||||
javax/swing/DefaultButtonModel.java \
|
||||
javax/swing/DefaultCellRenderer.java \
|
||||
javax/swing/DefaultListModel.java \
|
||||
javax/swing/DefaultListSelectionModel.java \
|
||||
javax/swing/Icon.java \
|
||||
javax/swing/ImageIcon.java \
|
||||
javax/swing/InputMap.java \
|
||||
javax/swing/JApplet.java \
|
||||
javax/swing/JButton.java \
|
||||
javax/swing/JCheckBox.java \
|
||||
javax/swing/JComponent.java \
|
||||
javax/swing/JDialog.java \
|
||||
javax/swing/JEditorPane.java \
|
||||
javax/swing/JFrame.java \
|
||||
javax/swing/JLabel.java \
|
||||
javax/swing/JLayeredPane.java \
|
||||
javax/swing/JList.java \
|
||||
javax/swing/JMenuBar.java \
|
||||
javax/swing/JOptionPane.java \
|
||||
javax/swing/JPanel.java \
|
||||
javax/swing/JRadioButton.java \
|
||||
javax/swing/JRootPane.java \
|
||||
javax/swing/JScrollBar.java \
|
||||
javax/swing/JScrollPane.java \
|
||||
javax/swing/JTabbedPane.java \
|
||||
javax/swing/JTextField.java \
|
||||
javax/swing/JToggleButton.java \
|
||||
javax/swing/JToolTip.java \
|
||||
javax/swing/JTree.java \
|
||||
javax/swing/JViewport.java \
|
||||
javax/swing/JWindow.java \
|
||||
javax/swing/KeyStroke.java \
|
||||
javax/swing/ListCellRenderer.java \
|
||||
javax/swing/ListModel.java \
|
||||
javax/swing/ListSelectionModel.java \
|
||||
javax/swing/LookAndFeel.java \
|
||||
javax/swing/Scrollable.java \
|
||||
javax/swing/SwingConstants.java \
|
||||
javax/swing/SwingUtilities.java \
|
||||
javax/swing/Timer.java \
|
||||
javax/swing/ToggleButtonModel.java \
|
||||
javax/swing/UIDefaults.java \
|
||||
javax/swing/UIManager.java \
|
||||
javax/swing/UnsupportedLookAndFeelException.java \
|
||||
javax/swing/event/AncestorEvent.java \
|
||||
javax/swing/event/AncestorListener.java \
|
||||
javax/swing/event/ChangeEvent.java \
|
||||
javax/swing/event/ChangeListener.java \
|
||||
javax/swing/event/DocumentEvent.java \
|
||||
javax/swing/event/DocumentListener.java \
|
||||
javax/swing/event/HyperlinkEvent.java \
|
||||
javax/swing/event/HyperlinkListener.java \
|
||||
javax/swing/event/ListDataEvent.java \
|
||||
javax/swing/event/ListDataListener.java \
|
||||
javax/swing/event/ListSelectionEvent.java \
|
||||
javax/swing/event/ListSelectionListener.java \
|
||||
javax/swing/event/MenuEvent.java \
|
||||
javax/swing/event/UndoableEditEvent.java \
|
||||
javax/swing/event/UndoableEditListener.java \
|
||||
javax/swing/event/CaretEvent.java \
|
||||
javax/swing/event/CaretListener.java \
|
||||
javax/swing/event/CellEditorListener.java \
|
||||
javax/swing/event/EventListenerList.java \
|
||||
javax/swing/event/InternalFrameAdapter.java \
|
||||
javax/swing/event/InternalFrameEvent.java \
|
||||
javax/swing/event/InternalFrameListener.java \
|
||||
javax/swing/event/MenuDragMouseEvent.java \
|
||||
javax/swing/event/MenuDragMouseListener.java \
|
||||
javax/swing/event/MenuKeyEvent.java \
|
||||
javax/swing/event/MenuKeyListener.java \
|
||||
javax/swing/event/MenuListener.java \
|
||||
javax/swing/event/MouseInputAdapter.java \
|
||||
javax/swing/event/MouseInputListener.java \
|
||||
javax/swing/event/PopupMenuEvent.java \
|
||||
javax/swing/event/PopupMenuListener.java \
|
||||
javax/swing/event/SwingPropertyChangeSupport.java \
|
||||
javax/swing/event/TableColumnModelEvent.java \
|
||||
javax/swing/event/TableColumnModelListener.java \
|
||||
javax/swing/event/TableModelEvent.java \
|
||||
javax/swing/event/TableModelListener.java \
|
||||
javax/swing/event/TreeExpansionEvent.java \
|
||||
javax/swing/event/TreeExpansionListener.java \
|
||||
javax/swing/event/TreeModelEvent.java \
|
||||
javax/swing/event/TreeModelListener.java \
|
||||
javax/swing/event/TreeSelectionEvent.java \
|
||||
javax/swing/event/TreeSelectionListener.java \
|
||||
javax/swing/event/TreeWillExpandListener.java \
|
||||
javax/swing/ActionMap.java \
|
||||
javax/swing/text/AbstractDocument.java \
|
||||
javax/swing/text/AttributeSet.java \
|
||||
javax/swing/text/BadLocationException.java \
|
||||
javax/swing/text/Caret.java \
|
||||
javax/swing/text/CharacterIterator.java \
|
||||
javax/swing/text/ComponentView.java \
|
||||
javax/swing/text/DefaultCaret.java \
|
||||
javax/swing/text/DefaultEditorKit.java \
|
||||
javax/swing/text/Document.java \
|
||||
javax/swing/text/EditorKit.java \
|
||||
javax/swing/text/Element.java \
|
||||
javax/swing/text/GapContent.java \
|
||||
javax/swing/text/JTextComponent.java \
|
||||
javax/swing/text/Keymap.java \
|
||||
javax/swing/text/PlainDocument.java \
|
||||
javax/swing/text/PlainEditorKit.java \
|
||||
javax/swing/text/Position.java \
|
||||
javax/swing/text/Segment.java \
|
||||
javax/swing/text/Style.java \
|
||||
javax/swing/text/View.java \
|
||||
javax/swing/text/ViewFactory.java \
|
||||
javax/swing/text/MutableAttributeSet.java \
|
||||
javax/swing/text/StyledDocument.java \
|
||||
javax/swing/text/StyledEditorKit.java \
|
||||
javax/swing/text/TextAction.java \
|
||||
javax/swing/tree/TreeNode.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/ExpandVetoException.java \
|
||||
javax/swing/tree/FixedHeightLayoutCache.java \
|
||||
javax/swing/tree/MutableTreeNode.java \
|
||||
javax/swing/tree/RowMapper.java \
|
||||
javax/swing/tree/TreeCellEditor.java \
|
||||
javax/swing/tree/TreeCellRenderer.java \
|
||||
javax/swing/tree/TreeModel.java \
|
||||
javax/swing/tree/TreePath.java \
|
||||
javax/swing/tree/TreeSelectionModel.java \
|
||||
javax/swing/tree/VariableHeightLayoutCache.java \
|
||||
javax/swing/undo/UndoableEdit.java \
|
||||
javax/swing/undo/AbstractUndoableEdit.java \
|
||||
javax/swing/undo/CannotRedoException.java \
|
||||
javax/swing/undo/CannotUndoException.java \
|
||||
javax/swing/undo/CompoundEdit.java \
|
||||
javax/swing/undo/StateEdit.java \
|
||||
javax/swing/undo/StateEditable.java \
|
||||
javax/swing/undo/UndoManager.java \
|
||||
javax/swing/undo/UndoableEditSupport.java \
|
||||
javax/swing/BoundedRangeModel.java \
|
||||
javax/swing/CellEditor.java \
|
||||
javax/swing/ComboBoxEditor.java \
|
||||
javax/swing/ComboBoxModel.java \
|
||||
javax/swing/DefaultBoundedRangeModel.java \
|
||||
javax/swing/DesktopManager.java \
|
||||
javax/swing/InputVerifier.java \
|
||||
javax/swing/JInternalFrame.java \
|
||||
javax/swing/JTable.java \
|
||||
javax/swing/MenuElement.java \
|
||||
javax/swing/MenuSelectionManager.java \
|
||||
javax/swing/MutableComboBoxModel.java \
|
||||
javax/swing/Renderer.java \
|
||||
javax/swing/RootPaneContainer.java \
|
||||
javax/swing/ScrollPaneConstants.java \
|
||||
javax/swing/SingleSelectionModel.java \
|
||||
javax/swing/SizeRequirements.java \
|
||||
javax/swing/SizeSequence.java \
|
||||
javax/swing/WindowConstants.java \
|
||||
javax/swing/AbstractCellEditor.java \
|
||||
javax/swing/CellRendererPane.java \
|
||||
javax/swing/DebugGraphics.java \
|
||||
javax/swing/DefaultCellEditor.java \
|
||||
javax/swing/DefaultComboBoxModel.java \
|
||||
javax/swing/DefaultDesktopManager.java \
|
||||
javax/swing/DefaultFocusManager.java \
|
||||
javax/swing/DefaultListCellRenderer.java \
|
||||
javax/swing/DefaultSingleSelectionModel.java \
|
||||
javax/swing/FocusManager.java \
|
||||
javax/swing/JCheckBoxMenuItem.java \
|
||||
javax/swing/JColorChooser.java \
|
||||
javax/swing/JComboBox.java \
|
||||
javax/swing/JDesktopPane.java \
|
||||
javax/swing/JFileChooser.java \
|
||||
javax/swing/JMenu.java \
|
||||
javax/swing/JMenuItem.java \
|
||||
javax/swing/JPasswordField.java \
|
||||
javax/swing/JPopupMenu.java \
|
||||
javax/swing/JProgressBar.java \
|
||||
javax/swing/JRadioButtonMenuItem.java \
|
||||
javax/swing/JSeparator.java \
|
||||
javax/swing/JSlider.java \
|
||||
javax/swing/JSplitPane.java \
|
||||
javax/swing/JTextPane.java \
|
||||
javax/swing/JToolBar.java \
|
||||
javax/swing/OverlayLayout.java \
|
||||
javax/swing/ProgressMonitor.java \
|
||||
javax/swing/ProgressMonitorInputStream.java \
|
||||
javax/swing/RepaintManager.java \
|
||||
javax/swing/ScrollPaneLayout.java \
|
||||
javax/swing/ToolTipManager.java \
|
||||
javax/swing/ViewportLayout.java
|
||||
|
||||
rmi_java_source_files = \
|
||||
java/rmi/activation/Activatable.java \
|
||||
|
@ -912,6 +1292,29 @@ gnu/java/rmi/server/UnicastServer.java \
|
|||
gnu/java/rmi/server/UnicastServerRef.java
|
||||
|
||||
javax_source_files = \
|
||||
javax/accessibility/Accessible.java \
|
||||
javax/accessibility/AccessibleAction.java \
|
||||
javax/accessibility/AccessibleBundle.java \
|
||||
javax/accessibility/AccessibleComponent.java \
|
||||
javax/accessibility/AccessibleContext.java \
|
||||
javax/accessibility/AccessibleEditableText.java \
|
||||
javax/accessibility/AccessibleExtendedComponent.java \
|
||||
javax/accessibility/AccessibleExtendedTable.java \
|
||||
javax/accessibility/AccessibleHyperlink.java \
|
||||
javax/accessibility/AccessibleHypertext.java \
|
||||
javax/accessibility/AccessibleIcon.java \
|
||||
javax/accessibility/AccessibleKeyBinding.java \
|
||||
javax/accessibility/AccessibleRelation.java \
|
||||
javax/accessibility/AccessibleRelationSet.java \
|
||||
javax/accessibility/AccessibleResourceBundle.java \
|
||||
javax/accessibility/AccessibleRole.java \
|
||||
javax/accessibility/AccessibleSelection.java \
|
||||
javax/accessibility/AccessibleState.java \
|
||||
javax/accessibility/AccessibleStateSet.java \
|
||||
javax/accessibility/AccessibleTable.java \
|
||||
javax/accessibility/AccessibleTableModelChange.java \
|
||||
javax/accessibility/AccessibleText.java \
|
||||
javax/accessibility/AccessibleValue.java \
|
||||
javax/naming/directory/Attribute.java \
|
||||
javax/naming/directory/AttributeInUseException.java \
|
||||
javax/naming/directory/AttributeModificationException.java \
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,7 @@ import java.awt.GraphicsConfiguration;
|
|||
import java.awt.Rectangle;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.Point;
|
||||
import java.awt.Color;
|
||||
import java.awt.color.ColorSpace;
|
||||
|
@ -128,7 +129,8 @@ public class XGraphicsConfiguration extends GraphicsConfiguration
|
|||
* maybe be moved to a different location.]
|
||||
*
|
||||
* @param offset Offset to data. The given offset does not include
|
||||
* data buffer offset, which will also be added. */
|
||||
* data buffer offset, which will also be added.
|
||||
*/
|
||||
static void attachData(XImage ximage, DataBuffer dataB, int offset)
|
||||
{
|
||||
offset += dataB.getOffset();
|
||||
|
@ -236,13 +238,47 @@ public class XGraphicsConfiguration extends GraphicsConfiguration
|
|||
rmap, gmap, bmap, amap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated device that this configuration describes.
|
||||
*
|
||||
* @return the device
|
||||
*/
|
||||
public GraphicsDevice getDevice()
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffered image optimized to this device, so that blitting can
|
||||
* be supported in the buffered image.
|
||||
*
|
||||
* @param w the width of the buffer
|
||||
* @param h the height of the buffer
|
||||
* @return the buffered image, or null if none is supported
|
||||
*/
|
||||
public BufferedImage createCompatibleImage(int width,
|
||||
int height,
|
||||
int transparency)
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a buffered volatile image optimized to this device, so that
|
||||
* blitting can be supported in the buffered image. Because the buffer is
|
||||
* volatile, it can be optimized by native graphics accelerators.
|
||||
*
|
||||
* @param w the width of the buffer
|
||||
* @param h the height of the buffer
|
||||
* @return the buffered image, or null if none is supported
|
||||
* @see Component#createVolatileImage(int, int)
|
||||
* @since 1.4
|
||||
*/
|
||||
public VolatileImage createCompatibleVolatileImage(int w, int h)
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME: I'm not sure which color model that should be returned here.
|
||||
*/
|
||||
|
|
|
@ -9,12 +9,16 @@ details. */
|
|||
package gnu.awt.xlib;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.dnd.*;
|
||||
import java.awt.dnd.peer.*;
|
||||
import java.awt.im.*;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.image.ImageProducer;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.net.*;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.util.Properties;
|
||||
import java.util.Map;
|
||||
|
||||
import gnu.gcj.xlib.Display;
|
||||
import gnu.gcj.xlib.Screen;
|
||||
|
@ -318,22 +322,24 @@ public class XToolkit extends Toolkit
|
|||
return defaultConfig;
|
||||
}
|
||||
|
||||
public DragSourceContextPeer
|
||||
createDragSourceContextPeer(DragGestureEvent dge)
|
||||
throws InvalidDnDOperationException
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
/*
|
||||
public DragSourceContextPeer
|
||||
createDragSourceContextPeer(DragGestureEvent dge)
|
||||
throws InvalidDnDOperationException;
|
||||
|
||||
public DragGestureRecognizer
|
||||
createDragGestureRecognizer(Class abstractRecognizerClass,
|
||||
DragSource ds, Component c,
|
||||
int srcActions, DragGestureListener dgl) {
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
*/
|
||||
public DragGestureRecognizer
|
||||
createDragGestureRecognizer(Class abstractRecognizerClass,
|
||||
DragSource ds, Component c,
|
||||
int srcActions, DragGestureListener dgl)
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight);
|
||||
*/
|
||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
|
||||
{
|
||||
throw new UnsupportedOperationException("not implemented");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* AWTError.java -- A serious AWT error occurred.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,24 +39,26 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This error is thrown when a critical AWT error occurs.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This error is thrown when a critical Abstract Window Toolkit (AWT) error
|
||||
* occurs.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class AWTError extends Error
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -1819846354050686206L;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>AWTError</code> with the specified
|
||||
* descriptive error message.
|
||||
*
|
||||
* @param message The descriptive error message.
|
||||
*/
|
||||
public
|
||||
AWTError(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
} // class AWTError
|
||||
|
||||
/**
|
||||
* Create a new instance with the specified descriptive error message.
|
||||
*
|
||||
* @param message the descriptive error message
|
||||
*/
|
||||
public AWTError(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class AWTError
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
/* AWTEvent.java -- the root event in AWT
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,123 +38,169 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
/* Written using on-line Java 2 Platform Standard Edition v1.3 API
|
||||
* Specification, as well as "The Java Class Libraries", 2nd edition
|
||||
* (Addison-Wesley, 1998).
|
||||
* Status: Believed complete and correct, except for the java.awt.Event
|
||||
* compatibility constructor.
|
||||
*/
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* AWTEvent is the root event class for all AWT events in the JDK 1.1 event
|
||||
* model. It supersedes the Event class from JDK 1.0.
|
||||
* model. It supersedes the Event class from JDK 1.0. Subclasses outside of
|
||||
* the java.awt package should have IDs greater than RESERVED_ID_MAX.
|
||||
*
|
||||
* <p>Event masks defined here are used by components in
|
||||
* <code>enableEvents</code> to select event types not selected by registered
|
||||
* listeners. Event masks are appropriately set when registering on
|
||||
* components.
|
||||
*
|
||||
* @author Warren Levy <warrenl@cygnus.com>
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class AWTEvent extends java.util.EventObject
|
||||
public abstract class AWTEvent extends EventObject
|
||||
{
|
||||
/**
|
||||
* @serial Indicates whether or not this event has been consumed.
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
protected boolean consumed;
|
||||
private static final long serialVersionUID = -1825314779160409405L;
|
||||
|
||||
/**
|
||||
* @serial The identifier number of this event.
|
||||
* The ID of the event.
|
||||
*
|
||||
* @see #getID()
|
||||
* @see #AWTEvent(Object, int)
|
||||
* @serial the identifier number of this event
|
||||
*/
|
||||
protected int id;
|
||||
|
||||
/**
|
||||
* Mask for selecting component events.
|
||||
*/
|
||||
public static final long COMPONENT_EVENT_MASK = 0x001;
|
||||
* Indicates if the event has been consumed. False mean it is passed to
|
||||
* the peer, true means it has already been processed. Semantic events
|
||||
* generated by low-level events always have the value true.
|
||||
*
|
||||
* @see #consume()
|
||||
* @see #isConsumed()
|
||||
* @serial whether the event has been consumed
|
||||
*/
|
||||
protected boolean consumed;
|
||||
|
||||
/**
|
||||
* Mask for selecting container events.
|
||||
*/
|
||||
public static final long CONTAINER_EVENT_MASK = 0x002;
|
||||
* Who knows? It's in the serial version.
|
||||
*
|
||||
* @serial No idea what this is for.
|
||||
*/
|
||||
byte[] bdata;
|
||||
|
||||
/** Mask for selecting component events. */
|
||||
public static final long COMPONENT_EVENT_MASK = 0x00001;
|
||||
|
||||
/** Mask for selecting container events. */
|
||||
public static final long CONTAINER_EVENT_MASK = 0x00002;
|
||||
|
||||
/** Mask for selecting component focus events. */
|
||||
public static final long FOCUS_EVENT_MASK = 0x00004;
|
||||
|
||||
/** Mask for selecting keyboard events. */
|
||||
public static final long KEY_EVENT_MASK = 0x00008;
|
||||
|
||||
/** Mask for mouse button events. */
|
||||
public static final long MOUSE_EVENT_MASK = 0x00010;
|
||||
|
||||
/** Mask for mouse motion events. */
|
||||
public static final long MOUSE_MOTION_EVENT_MASK = 0x00020;
|
||||
|
||||
/** Mask for window events. */
|
||||
public static final long WINDOW_EVENT_MASK = 0x00040;
|
||||
|
||||
/** Mask for action events. */
|
||||
public static final long ACTION_EVENT_MASK = 0x00080;
|
||||
|
||||
/** Mask for adjustment events. */
|
||||
public static final long ADJUSTMENT_EVENT_MASK = 0x00100;
|
||||
|
||||
/** Mask for item events. */
|
||||
public static final long ITEM_EVENT_MASK = 0x00200;
|
||||
|
||||
/** Mask for text events. */
|
||||
public static final long TEXT_EVENT_MASK = 0x00400;
|
||||
|
||||
/**
|
||||
* Mask for selecting component focus events.
|
||||
*/
|
||||
public static final long FOCUS_EVENT_MASK = 0x004;
|
||||
* Mask for input method events.
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final long INPUT_METHOD_EVENT_MASK = 0x00800;
|
||||
|
||||
/**
|
||||
* Mask for selecting keyboard events.
|
||||
*/
|
||||
public static final long KEY_EVENT_MASK = 0x008;
|
||||
* Mask if input methods are enabled. Package visible only.
|
||||
*/
|
||||
static final long INPUT_ENABLED_EVENT_MASK = 0x01000;
|
||||
|
||||
/**
|
||||
* Mask for mouse button events.
|
||||
*/
|
||||
public static final long MOUSE_EVENT_MASK = 0x010;
|
||||
* Mask for paint events.
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final long PAINT_EVENT_MASK = 0x02000;
|
||||
|
||||
/**
|
||||
* Mask for mouse motion events.
|
||||
*/
|
||||
public static final long MOUSE_MOTION_EVENT_MASK = 0x020;
|
||||
* Mask for invocation events.
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final long INVOCATION_EVENT_MASK = 0x04000;
|
||||
|
||||
/**
|
||||
* Mask for window events.
|
||||
*/
|
||||
public static final long WINDOW_EVENT_MASK = 0x040;
|
||||
* Mask for hierarchy events.
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final long HIERARCHY_EVENT_MASK = 0x08000;
|
||||
|
||||
/**
|
||||
* Mask for action events.
|
||||
*/
|
||||
public static final long ACTION_EVENT_MASK = 0x080;
|
||||
* Mask for hierarchy bounds events.
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final long HIERARCHY_BOUNDS_EVENT_MASK = 0x10000;
|
||||
|
||||
/**
|
||||
* Mask for adjustment events.
|
||||
*/
|
||||
public static final long ADJUSTMENT_EVENT_MASK = 0x100;
|
||||
* Mask for mouse wheel events.
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final long MOUSE_WHEEL_EVENT_MASK = 0x20000;
|
||||
|
||||
/**
|
||||
* Mask for item events.
|
||||
*/
|
||||
public static final long ITEM_EVENT_MASK = 0x200;
|
||||
* Mask for window state events.
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final long WINDOW_STATE_EVENT_MASK = 0x40000;
|
||||
|
||||
/**
|
||||
* Mask for text events.
|
||||
*/
|
||||
public static final long TEXT_EVENT_MASK = 0x400;
|
||||
* Mask for window focus events.
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final long WINDOW_FOCUS_EVENT_MASK = 0x80000;
|
||||
|
||||
/**
|
||||
* This is the highest number for event ids that are reserved for use by
|
||||
* the AWT system itself.
|
||||
* the AWT system itself. Subclasses outside of java.awt should use higher
|
||||
* ids.
|
||||
*/
|
||||
public static final int RESERVED_ID_MAX = 1999;
|
||||
|
||||
public static final long INPUT_METHOD_EVENT_MASK = 1 << 11;
|
||||
|
||||
/* Additional event selection masks from JDK 1.3 javadocs */
|
||||
public static final long PAINT_EVENT_MASK = 1 << 13,
|
||||
INVOCATION_EVENT_MASK = 1 << 14,
|
||||
HIERARCHY_EVENT_MASK = 1 << 15,
|
||||
HIERARCHY_BOUNDS_EVENT_MASK = 1 << 16;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>AWTEvent</code> from the
|
||||
* specified Java 1.0 event object.
|
||||
*
|
||||
* @param event The Java 1.0 event to initialize from.
|
||||
*
|
||||
*
|
||||
* Removed this method because we no longer support Java 1.0
|
||||
* Initializes a new AWTEvent from the old Java 1.0 event object.
|
||||
*
|
||||
* @param event the old-style event
|
||||
* @throws NullPointerException if event is null
|
||||
*/
|
||||
public AWTEvent(Event event)
|
||||
{
|
||||
// FIXME??
|
||||
super(event.target);
|
||||
this.id = event.id;
|
||||
this(event.target, event.id);
|
||||
consumed = event.consumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>AWTEvent</code> with the specified
|
||||
* source and id.
|
||||
* Create an event on the specified source object and id.
|
||||
*
|
||||
* @param source The object that caused the event.
|
||||
* @param id The event id.
|
||||
* @param source the object that caused the event
|
||||
* @param id the event id
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public AWTEvent(Object source, int id)
|
||||
{
|
||||
|
@ -162,9 +209,21 @@ public abstract class AWTEvent extends java.util.EventObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the id number of this event.
|
||||
* Retarget the event, such as converting a heavyweight component to a
|
||||
* lightweight child of the original. This is not for general use, but
|
||||
* is for event targeting systems like KeyboardFocusManager.
|
||||
*
|
||||
* @return The id number of this event.
|
||||
* @param source the new source
|
||||
*/
|
||||
public void setSource(Object source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event type id.
|
||||
*
|
||||
* @return the id number of this event
|
||||
*/
|
||||
public int getID()
|
||||
{
|
||||
|
@ -172,23 +231,26 @@ public abstract class AWTEvent extends java.util.EventObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this event.
|
||||
* Returns a string representation of this event. This is in the format
|
||||
* <code>getClass().getName() + '[' + paramString() + "] on "
|
||||
* + source</code>.
|
||||
*
|
||||
* @return A string representation of this event.
|
||||
* @return a string representation of this event
|
||||
*/
|
||||
public String paramString ()
|
||||
public String toString()
|
||||
{
|
||||
return "";
|
||||
return getClass().getName() + "[" + paramString() + "] on " + source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this event.
|
||||
* Returns a string representation of the state of this event. It may be
|
||||
* empty, but must not be null; it is implementation defined.
|
||||
*
|
||||
* @return A string representation of this event.
|
||||
* @return a string representation of this event
|
||||
*/
|
||||
public String toString ()
|
||||
public String paramString()
|
||||
{
|
||||
return getClass().getName() + "[" + paramString() + "] on " + source;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,14 +263,13 @@ public abstract class AWTEvent extends java.util.EventObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests whether not not this event has been consumed. A consumed event
|
||||
* Tests whether not not this event has been consumed. A consumed event
|
||||
* is not processed in the default manner.
|
||||
*
|
||||
* @return <code>true</code> if this event has been consumed,
|
||||
* <code>false</code> otherwise.
|
||||
* @return true if this event has been consumed
|
||||
*/
|
||||
protected boolean isConsumed()
|
||||
{
|
||||
return consumed;
|
||||
}
|
||||
}
|
||||
} // class AWTEvent
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/* AWTException.java -- Generic AWT exception
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,25 +39,26 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This is a generic exception that indicates an error occurred in the
|
||||
* AWT system.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This is a generic exception that indicates an exception occurred in the
|
||||
* Abstract Window Toolkit (AWT) system.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class AWTException extends Exception
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -1900414231151323879L;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>AWTException</code> with the
|
||||
* specified detailed error message.
|
||||
*
|
||||
* @param message The detailed error message.
|
||||
*/
|
||||
public
|
||||
AWTException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
} // class AWTException
|
||||
|
||||
/**
|
||||
* Create a new instance with the specified detailed error message.
|
||||
*
|
||||
* @param message the detailed error message
|
||||
*/
|
||||
public AWTException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class AWTException
|
||||
|
|
653
libjava/java/awt/AWTKeyStroke.java
Normal file
653
libjava/java/awt/AWTKeyStroke.java
Normal file
|
@ -0,0 +1,653 @@
|
|||
/* AWTKeyStroke.java -- an immutable key stroke
|
||||
Copyright (C) 2002 Free Software Foundation
|
||||
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* This class mirrors KeyEvents, representing both low-level key presses and
|
||||
* key releases, and high level key typed inputs. However, this class forms
|
||||
* immutable strokes, and can be efficiently reused via the factory methods
|
||||
* for creating them.
|
||||
*
|
||||
* <p>For backwards compatibility with Swing, this supports a way to build
|
||||
* instances of a subclass, using reflection, provided the subclass has a
|
||||
* no-arg constructor (of any accessibility).
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see #getAWTKeyStroke(char)
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class AWTKeyStroke implements Serializable
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.4+.
|
||||
*/
|
||||
private static final long serialVersionUID = -6430539691155161871L;
|
||||
|
||||
/** The mask for modifiers. */
|
||||
private static final int MODIFIERS_MASK = 0x3fef;
|
||||
|
||||
/**
|
||||
* The cache of recently created keystrokes. This maps KeyStrokes to
|
||||
* KeyStrokes in a cache which removes the least recently accessed entry,
|
||||
* under the assumption that garbage collection of a new keystroke is
|
||||
* easy when we find the old one that it matches in the cache.
|
||||
*/
|
||||
private static final LinkedHashMap cache = new LinkedHashMap(11, 0.75f, true)
|
||||
{
|
||||
/** The largest the keystroke cache can grow. */
|
||||
private static final int MAX_CACHE_SIZE = 2048;
|
||||
|
||||
/** Prune stale entries. */
|
||||
protected boolean removeEldestEntry(Map.Entry eldest)
|
||||
{ // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
|
||||
return size() > MAX_CACHE_SIZE;
|
||||
}
|
||||
};
|
||||
|
||||
/** The most recently generated keystroke, or null. */
|
||||
private static AWTKeyStroke recent;
|
||||
|
||||
/**
|
||||
* The no-arg constructor of a subclass, or null to use AWTKeyStroke. Note
|
||||
* that this will be left accessible, to get around private access; but
|
||||
* it should not be a security risk as it is highly unlikely that creating
|
||||
* protected instances of the subclass via reflection will do much damage.
|
||||
*/
|
||||
private static Constructor ctor;
|
||||
|
||||
/**
|
||||
* A table of keyCode names to values.
|
||||
*
|
||||
* @see #getAWTKeyStroke(String)
|
||||
*/
|
||||
private static final HashMap vktable = new HashMap();
|
||||
static
|
||||
{
|
||||
// Using reflection saves the hassle of keeping this in sync with KeyEvent,
|
||||
// at the price of an expensive initialization.
|
||||
AccessController.doPrivileged(new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
Field[] fields = KeyEvent.class.getFields();
|
||||
int i = fields.length;
|
||||
try
|
||||
{
|
||||
while (--i >= 0)
|
||||
{
|
||||
Field f = fields[i];
|
||||
String name = f.getName();
|
||||
if (name.startsWith("VK_"))
|
||||
vktable.put(name.substring(3), f.get(null));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw (Error) new InternalError().initCause(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The typed character, or CHAR_UNDEFINED for key presses and releases.
|
||||
*
|
||||
* @serial the keyChar
|
||||
*/
|
||||
private char keyChar;
|
||||
|
||||
/**
|
||||
* The virtual key code, or VK_UNDEFINED for key typed. Package visible for
|
||||
* use by Component.
|
||||
*
|
||||
* @serial the keyCode
|
||||
*/
|
||||
int keyCode;
|
||||
|
||||
/**
|
||||
* The modifiers in effect. To match Sun, this stores the old style masks
|
||||
* for shift, control, alt, meta, and alt-graph (but not button1); as well
|
||||
* as the new style of extended modifiers for all modifiers.
|
||||
*
|
||||
* @serial bitwise or of the *_DOWN_MASK modifiers
|
||||
*/
|
||||
private int modifiers;
|
||||
|
||||
/**
|
||||
* True if this is a key release; should only be true if keyChar is
|
||||
* CHAR_UNDEFINED.
|
||||
*
|
||||
* @serial true to distinguish key pressed from key released
|
||||
*/
|
||||
private boolean onKeyRelease;
|
||||
|
||||
/**
|
||||
* Construct a keystroke with default values: it will be interpreted as a
|
||||
* key typed event with an invalid character and no modifiers. Client code
|
||||
* should use the factory methods instead.
|
||||
*
|
||||
* @see #getAWTKeyStroke(char)
|
||||
* @see #getAWTKeyStroke(Character, int)
|
||||
* @see #getAWTKeyStroke(int, int, boolean)
|
||||
* @see #getAWTKeyStroke(int, int)
|
||||
* @see #getAWTKeyStrokeForEvent(KeyEvent)
|
||||
* @see #getAWTKeyStroke(String)
|
||||
*/
|
||||
protected AWTKeyStroke()
|
||||
{
|
||||
keyChar = KeyEvent.CHAR_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a keystroke with the given values. Client code should use the
|
||||
* factory methods instead.
|
||||
*
|
||||
* @param keyChar the character entered, if this is a key typed
|
||||
* @param keyCode the key pressed or released, or VK_UNDEFINED for key typed
|
||||
* @param modifiers the modifier keys for the keystroke, in old or new style
|
||||
* @param onKeyRelease true if this is a key release instead of a press
|
||||
* @see #getAWTKeyStroke(char)
|
||||
* @see #getAWTKeyStroke(Character, int)
|
||||
* @see #getAWTKeyStroke(int, int, boolean)
|
||||
* @see #getAWTKeyStroke(int, int)
|
||||
* @see #getAWTKeyStrokeForEvent(KeyEvent)
|
||||
* @see #getAWTKeyStroke(String)
|
||||
*/
|
||||
protected AWTKeyStroke(char keyChar, int keyCode, int modifiers,
|
||||
boolean onKeyRelease)
|
||||
{
|
||||
this.keyChar = keyChar;
|
||||
this.keyCode = keyCode;
|
||||
// No need to call extend(), as only trusted code calls this constructor.
|
||||
this.modifiers = modifiers;
|
||||
this.onKeyRelease = onKeyRelease;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new subclass as being the type of keystrokes to generate in
|
||||
* the factory methods. This operation flushes the cache of stored keystrokes
|
||||
* if the class differs from the current one. The new class must be
|
||||
* AWTKeyStroke or a subclass, and must have a no-arg constructor (which may
|
||||
* be private).
|
||||
*
|
||||
* @param subclass the new runtime type of generated keystrokes
|
||||
* @throws IllegalArgumentException subclass doesn't have no-arg constructor
|
||||
* @throws ClassCastException subclass doesn't extend AWTKeyStroke
|
||||
*/
|
||||
protected static void registerSubclass(final Class subclass)
|
||||
{
|
||||
if (subclass == null)
|
||||
throw new IllegalArgumentException();
|
||||
if (subclass.equals(ctor == null ? AWTKeyStroke.class
|
||||
: ctor.getDeclaringClass()))
|
||||
return;
|
||||
if (subclass.equals(AWTKeyStroke.class))
|
||||
{
|
||||
cache.clear();
|
||||
recent = null;
|
||||
ctor = null;
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
ctor = (Constructor) AccessController.doPrivileged
|
||||
(new PrivilegedExceptionAction()
|
||||
{
|
||||
public Object run()
|
||||
throws NoSuchMethodException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException
|
||||
{
|
||||
Constructor c = subclass.getDeclaredConstructor(null);
|
||||
c.setAccessible(true);
|
||||
// Create a new instance, to make sure that we can, and
|
||||
// to cause any ClassCastException.
|
||||
AWTKeyStroke dummy = (AWTKeyStroke) c.newInstance(null);
|
||||
return c;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (PrivilegedActionException e)
|
||||
{
|
||||
// e.getCause() will not ever be ClassCastException; that should
|
||||
// escape on its own.
|
||||
throw (RuntimeException)
|
||||
new IllegalArgumentException().initCause(e.getCause());
|
||||
}
|
||||
cache.clear();
|
||||
recent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a keystroke representing a typed character.
|
||||
*
|
||||
* @param keyChar the typed character
|
||||
* @return the specified keystroke
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(char keyChar)
|
||||
{
|
||||
return getAWTKeyStroke(keyChar, KeyEvent.VK_UNDEFINED, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a keystroke representing a typed character with the given
|
||||
* modifiers. Note that keyChar is a <code>Character</code> instead of a
|
||||
* <code>char</code> to avoid accidental ambiguity with
|
||||
* <code>getAWTKeyStroke(int, int)</code>. The modifiers are the bitwise
|
||||
* or of the masks found in {@link InputEvent}; the new style (*_DOWN_MASK)
|
||||
* is preferred, but the old style will work.
|
||||
*
|
||||
* @param keyChar the typed character
|
||||
* @param modifiers the modifiers, or 0
|
||||
* @return the specified keystroke
|
||||
* @throws IllegalArgumentException if keyChar is null
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(Character keyChar, int modifiers)
|
||||
{
|
||||
if (keyChar == null)
|
||||
throw new IllegalArgumentException();
|
||||
return getAWTKeyStroke(keyChar.charValue(), KeyEvent.VK_UNDEFINED,
|
||||
extend(modifiers), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a keystroke representing a pressed or released key event, with
|
||||
* the given modifiers. The "virtual key" should be one of the VK_*
|
||||
* constants in {@link KeyEvent}. The modifiers are the bitwise or of the
|
||||
* masks found in {@link InputEvent}; the new style (*_DOWN_MASK) is
|
||||
* preferred, but the old style will work.
|
||||
*
|
||||
* @param keyCode the virtual key
|
||||
* @param modifiers the modifiers, or 0
|
||||
* @param release true if this is a key release instead of a key press
|
||||
* @return the specified keystroke
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers,
|
||||
boolean release)
|
||||
{
|
||||
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode,
|
||||
extend(modifiers), release);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a keystroke representing a pressed key event, with the given
|
||||
* modifiers. The "virtual key" should be one of the VK_* constants in
|
||||
* {@link KeyEvent}. The modifiers are the bitwise or of the masks found
|
||||
* in {@link InputEvent}; the new style (*_DOWN_MASK) is preferred, but the
|
||||
* old style will work.
|
||||
*
|
||||
* @param keyCode the virtual key
|
||||
* @param modifiers the modifiers, or 0
|
||||
* @return the specified keystroke
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers)
|
||||
{
|
||||
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode,
|
||||
extend(modifiers), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a keystroke representing what caused the key event.
|
||||
*
|
||||
* @param event the key event to convert
|
||||
* @return the specified keystroke, or null if the event is invalid
|
||||
* @throws NullPointerException if event is null
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent event)
|
||||
{
|
||||
switch (event.id)
|
||||
{
|
||||
case KeyEvent.KEY_TYPED:
|
||||
return getAWTKeyStroke(event.getKeyChar(), KeyEvent.VK_UNDEFINED,
|
||||
extend(event.getModifiersEx()), false);
|
||||
case KeyEvent.KEY_PRESSED:
|
||||
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(),
|
||||
extend(event.getModifiersEx()), false);
|
||||
case KeyEvent.KEY_RELEASED:
|
||||
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(),
|
||||
extend(event.getModifiersEx()), true);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string and returns the keystroke that it represents. The syntax
|
||||
* for keystrokes is listed below, with tokens separated by an arbitrary
|
||||
* number of spaces:
|
||||
* <pre>
|
||||
* keyStroke := <modifiers>* ( <typedID> | <codeID> )
|
||||
* modifiers := ( shift | control | ctrl | meta | alt
|
||||
* | button1 | button2 | button3 )
|
||||
* typedID := typed <single Unicode character>
|
||||
* codeID := ( pressed | released )? <name>
|
||||
* name := <the KeyEvent field name less the leading "VK_">
|
||||
* </pre>
|
||||
*
|
||||
* <p>Note that the grammar is rather weak, and not all valid keystrokes
|
||||
* can be generated in this manner (for example, a typed space, or anything
|
||||
* with the alt-graph modifier!). The output of AWTKeyStroke.toString()
|
||||
* will not meet the grammar. If pressed or released is not specified,
|
||||
* pressed is assumed. Examples:<br>
|
||||
* <code>
|
||||
* "INSERT" => getAWTKeyStroke(KeyEvent.VK_INSERT, 0);<br>
|
||||
* "control DELETE" =>
|
||||
* getAWTKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);<br>
|
||||
* "alt shift X" => getAWTKeyStroke(KeyEvent.VK_X,
|
||||
* InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);<br>
|
||||
* "alt shift released X" => getAWTKeyStroke(KeyEvent.VK_X,
|
||||
* InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);<br>
|
||||
* "typed a" => getAWTKeyStroke('a');
|
||||
* </code>
|
||||
*
|
||||
* @param s the string to parse
|
||||
* @return the specified keystroke
|
||||
* @throws NullPointerException if s is null
|
||||
* @throws IllegalArgumentException if s cannot be parsed
|
||||
*/
|
||||
public static AWTKeyStroke getAWTKeyStroke(String s)
|
||||
{
|
||||
StringTokenizer t = new StringTokenizer(s, " ");
|
||||
if (! t.hasMoreTokens())
|
||||
throw new IllegalArgumentException();
|
||||
int modifiers = 0;
|
||||
boolean released = false;
|
||||
String token = null;
|
||||
do
|
||||
{
|
||||
token = t.nextToken();
|
||||
if ("shift".equals(token))
|
||||
modifiers |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
|
||||
else if ("ctrl".equals(token) || "control".equals(token))
|
||||
modifiers |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
|
||||
else if ("meta".equals(token))
|
||||
modifiers |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
|
||||
else if ("alt".equals(token))
|
||||
modifiers |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
|
||||
else if ("button1".equals(token))
|
||||
modifiers |= KeyEvent.BUTTON1_DOWN_MASK;
|
||||
else if ("button2".equals(token))
|
||||
modifiers |= KeyEvent.BUTTON2_DOWN_MASK;
|
||||
else if ("button3".equals(token))
|
||||
modifiers |= KeyEvent.BUTTON3_DOWN_MASK;
|
||||
else if ("typed".equals(token))
|
||||
{
|
||||
if (t.hasMoreTokens())
|
||||
{
|
||||
token = t.nextToken();
|
||||
if (! t.hasMoreTokens() && token.length() == 1)
|
||||
return getAWTKeyStroke(token.charAt(0),
|
||||
KeyEvent.VK_UNDEFINED, modifiers,
|
||||
false);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
else if ("pressed".equals(token))
|
||||
{
|
||||
if (t.hasMoreTokens())
|
||||
token = t.nextToken();
|
||||
break;
|
||||
}
|
||||
else if ("released".equals(token))
|
||||
{
|
||||
released = true;
|
||||
if (t.hasMoreTokens())
|
||||
token = t.nextToken();
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
while (t.hasMoreTokens());
|
||||
// Now token contains the VK name we must parse.
|
||||
Integer code = (Integer) vktable.get(token);
|
||||
if (code == null || t.hasMoreTokens())
|
||||
throw new IllegalArgumentException();
|
||||
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, code.intValue(),
|
||||
modifiers, released);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character of this keystroke, if it was typed.
|
||||
*
|
||||
* @return the character value, or CHAR_UNDEFINED
|
||||
* @see #getAWTKeyStroke(char)
|
||||
*/
|
||||
public final char getKeyChar()
|
||||
{
|
||||
return keyChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the virtual key code of this keystroke, if it was pressed or
|
||||
* released. This will be a VK_* constant from KeyEvent.
|
||||
*
|
||||
* @return the virtual key code value, or VK_UNDEFINED
|
||||
* @see #getAWTKeyStroke(int, int)
|
||||
*/
|
||||
public final int getKeyCode()
|
||||
{
|
||||
return keyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the modifiers for this keystroke. This will be a bitwise or of
|
||||
* constants from InputEvent; it includes the old style masks for shift,
|
||||
* control, alt, meta, and alt-graph (but not button1); as well as the new
|
||||
* style of extended modifiers for all modifiers.
|
||||
*
|
||||
* @return the modifiers
|
||||
* @see #getAWTKeyStroke(Character, int)
|
||||
* @see #getAWTKeyStroke(int, int)
|
||||
*/
|
||||
public final int getModifiers()
|
||||
{
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if this keystroke is a key release.
|
||||
*
|
||||
* @return true if this is a key release
|
||||
* @see #getAWTKeyStroke(int, int, boolean)
|
||||
*/
|
||||
public final boolean isOnKeyRelease()
|
||||
{
|
||||
return onKeyRelease;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the AWT event type of this keystroke. This is one of
|
||||
* {@link KeyEvent#KEY_TYPED}, {@link KeyEvent#KEY_PRESSED}, or
|
||||
* {@link KeyEvent#KEY_RELEASED}.
|
||||
*
|
||||
* @return the key event type
|
||||
*/
|
||||
public final int getKeyEventType()
|
||||
{
|
||||
return keyCode == KeyEvent.VK_UNDEFINED ? KeyEvent.KEY_TYPED
|
||||
: onKeyRelease ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hashcode for this key event. It is not documented, but appears
|
||||
* to be: <code>(getKeyChar() + 1) * (getKeyCode() + 1)
|
||||
* * (getModifiers() + 1) * 2 + (isOnKeyRelease() ? 1 : 2)</code>.
|
||||
*
|
||||
* @return the hashcode
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
return (keyChar + 1) * (keyCode + 1) * (modifiers + 1) * 2
|
||||
+ (onKeyRelease ? 1 : 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests two keystrokes for equality.
|
||||
*
|
||||
* @param o the object to test
|
||||
* @return true if it is equal
|
||||
*/
|
||||
public final boolean equals(Object o)
|
||||
{
|
||||
if (! (o instanceof AWTKeyStroke))
|
||||
return false;
|
||||
AWTKeyStroke s = (AWTKeyStroke) o;
|
||||
return this == o || (keyChar == s.keyChar && keyCode == s.keyCode
|
||||
&& modifiers == s.modifiers
|
||||
&& onKeyRelease == s.onKeyRelease);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this keystroke. For typed keystrokes,
|
||||
* this is <code>"keyChar " + KeyEvent.getKeyModifiersText(getModifiers())
|
||||
+ getKeyChar()</code>; for pressed and released keystrokes, this is
|
||||
* <code>"keyCode " + KeyEvent.getKeyModifiersText(getModifiers())
|
||||
* + KeyEvent.getKeyText(getKeyCode())
|
||||
* + (isOnKeyRelease() ? "-R" : "-P")</code>.
|
||||
*
|
||||
* @return a string representation
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
if (keyCode == KeyEvent.VK_UNDEFINED)
|
||||
return "keyChar " + KeyEvent.getKeyModifiersText(modifiers) + keyChar;
|
||||
return "keyCode " + KeyEvent.getKeyModifiersText(modifiers)
|
||||
+ KeyEvent.getKeyText(keyCode) + (onKeyRelease ? "-R" : "-P");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a cached version of the deserialized keystroke, if available.
|
||||
*
|
||||
* @return a cached replacement
|
||||
* @throws ObjectStreamException if something goes wrong
|
||||
*/
|
||||
protected Object readResolve() throws ObjectStreamException
|
||||
{
|
||||
AWTKeyStroke s = (AWTKeyStroke) cache.get(this);
|
||||
if (s != null)
|
||||
return s;
|
||||
cache.put(this, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the appropriate keystroke, creating one if necessary.
|
||||
*
|
||||
* @param keyChar the keyChar
|
||||
* @param keyCode the keyCode
|
||||
* @param modifiers the modifiers
|
||||
* @param release true for key release
|
||||
* @return the specified keystroke
|
||||
*/
|
||||
private static AWTKeyStroke getAWTKeyStroke(char keyChar, int keyCode,
|
||||
int modifiers, boolean release)
|
||||
{
|
||||
// Check level 0 cache.
|
||||
AWTKeyStroke stroke = recent; // Avoid thread races.
|
||||
if (stroke != null && stroke.keyChar == keyChar
|
||||
&& stroke.keyCode == keyCode && stroke.modifiers == modifiers
|
||||
&& stroke.onKeyRelease == release)
|
||||
return stroke;
|
||||
// Create a new object, on the assumption that if it has a match in the
|
||||
// cache, the VM can easily garbage collect it as it is temporary.
|
||||
Constructor c = ctor; // Avoid thread races.
|
||||
if (c == null)
|
||||
stroke = new AWTKeyStroke(keyChar, keyCode, modifiers, release);
|
||||
else
|
||||
try
|
||||
{
|
||||
stroke = (AWTKeyStroke) c.newInstance(null);
|
||||
stroke.keyChar = keyChar;
|
||||
stroke.keyCode = keyCode;
|
||||
stroke.modifiers = modifiers;
|
||||
stroke.onKeyRelease = release;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw (Error) new InternalError().initCause(e);
|
||||
}
|
||||
// Check level 1 cache.
|
||||
AWTKeyStroke cached = (AWTKeyStroke) cache.get(stroke);
|
||||
if (cached == null)
|
||||
cache.put(stroke, stroke);
|
||||
else
|
||||
stroke = cached;
|
||||
return recent = stroke;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the modifiers to the appropriate format.
|
||||
*
|
||||
* @param mod the modifiers to convert
|
||||
* @return the adjusted modifiers
|
||||
*/
|
||||
private static int extend(int mod)
|
||||
{
|
||||
if ((mod & (KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK)) != 0)
|
||||
mod |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
|
||||
if ((mod & (KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK)) != 0)
|
||||
mod |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
|
||||
if ((mod & (KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK)) != 0)
|
||||
mod |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
|
||||
if ((mod & (KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK)) != 0)
|
||||
mod |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
|
||||
if ((mod & (KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK)) != 0)
|
||||
mod |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
|
||||
if ((mod & KeyEvent.BUTTON1_MASK) != 0)
|
||||
mod |= KeyEvent.BUTTON1_DOWN_MASK;
|
||||
return mod & MODIFIERS_MASK;
|
||||
}
|
||||
} // class AWTKeyStroke
|
|
@ -1,6 +1,5 @@
|
|||
// AWTPermission.java - AWT permissions
|
||||
|
||||
/* Copyright (C) 2000, 2002 Free Software Foundation
|
||||
/* AWTPermission.java -- AWT related permissions
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,11 +36,6 @@ obligated to do so. If you do not wish to do so, delete this
|
|||
exception statement from your version. */
|
||||
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@redhat.com>
|
||||
* @date December 2, 2000
|
||||
*/
|
||||
|
||||
package java.awt;
|
||||
|
||||
import java.security.BasicPermission;
|
||||
|
@ -49,25 +43,79 @@ import java.security.BasicPermission;
|
|||
/**
|
||||
* This class implements permissions for AWT. This is a named
|
||||
* permission. No actions are defined.
|
||||
*
|
||||
* <p>The following table provides a list of all the possible AWTPermission
|
||||
* permission names with a description of what that permission allows.<br>
|
||||
* <table border=1>
|
||||
* <tr><th>Permission Name</th><th>Permission Allows</th><th>Risks</th</tr>
|
||||
* <tr>
|
||||
* <td><code>accessClipboard</code></td>
|
||||
* <td>posting and reading the AWT clipboard</td>
|
||||
* <td>the clipboard may contain sensitive data</td></tr>
|
||||
* <tr>
|
||||
* <td><code>accessEventQueue</code></td>
|
||||
* <td>access to the AWT event queue</td>
|
||||
* <td>malicious code could remove real events and replace them with bogus
|
||||
* ones, including simulating the user granting permission</td></tr>
|
||||
* <tr>
|
||||
* <td><code>listenToAllAWTEvents</code></td>
|
||||
* <td>listen to system-wide AWT events</td>
|
||||
* <td>malicious code can read passwords entered in an AWT event, and in
|
||||
* combination with accessEventQueue, could fake system events</td></tr>
|
||||
* <tr>
|
||||
* <td><code>showWindowWithoutWarningBanner</code></td>
|
||||
* <td>display a window without a banner notification of insecurity</td>
|
||||
* <td>malicious code could install a Trojan horse applet that looks like
|
||||
* a normal window, and thus steal data like passwords</td></tr>
|
||||
* <tr>
|
||||
* <td><code>readDisplayPixels</code></td>
|
||||
* <td>read back pixels from the display screen</td>
|
||||
* <td>malicious code could snoop on the user's actions</td></tr>
|
||||
* <tr>
|
||||
* <td><code>createRobot</code></td>
|
||||
* <td>create an instance of java.awt.Robot</td>
|
||||
* <td>these objects can generate events as though they were the user; so
|
||||
* malicious code could control the system</td></tr>
|
||||
* <tr>
|
||||
* <td><code>fullScreenExclusive</code></td>
|
||||
* <td>enter full-screen exclusive mode</td>
|
||||
* <td>malicious code could masquerade as a trusted program</td><tr>
|
||||
* </table>
|
||||
*
|
||||
* @author Tom Tromey <tromey@redhat.com>
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public final class AWTPermission extends BasicPermission
|
||||
{
|
||||
/**
|
||||
* Construct a AWTPermission with the given name.
|
||||
* @param name The permission name
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
public AWTPermission (String name)
|
||||
{
|
||||
super (name);
|
||||
}
|
||||
private static final long serialVersionUID = 8890392402588814465L;
|
||||
|
||||
/**
|
||||
* Construct a AWTPermission with the given name.
|
||||
* @param name The permission name
|
||||
* @param actions The actions; this is ignored and should be null.
|
||||
*
|
||||
* @param name the permission name
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if name is invalid
|
||||
*/
|
||||
public AWTPermission (String name, String actions)
|
||||
public AWTPermission(String name)
|
||||
{
|
||||
super (name, actions);
|
||||
super(name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new permission with the specified name. The actions argument
|
||||
* is ignored, as AWT permissions have no actions.
|
||||
*
|
||||
* @param name the permission name
|
||||
* @param actions ignored
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if name is invalid
|
||||
*/
|
||||
public AWTPermission(String name, String actions)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
} // class AWTPermission
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2002 Free Software Foundation
|
||||
/* ActiveEvent.java -- a self-dispatching event
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,13 +39,23 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* An interface for events which can dispatch themselves in another thread.
|
||||
* This has two uses: first, if your code is in a critical section, calling a
|
||||
* synchronized method might deadlock. But by using an ActiveEvent to call
|
||||
* the second section, it will not obtain the lock until you have left the
|
||||
* critical section, avoiding deadlock. The second use is for calling
|
||||
* untrusted code. For example, system code should use an ActiveEvent to
|
||||
* invoke user code securely.
|
||||
*
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 8, 2000
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/* Status: Believed complete and correct to JDK 1.2. */
|
||||
|
||||
public interface ActiveEvent
|
||||
{
|
||||
public void dispatch ();
|
||||
}
|
||||
/**
|
||||
* Dispatch the event, according to what the event needs done. Invoked
|
||||
* automatically if this is placed on the <code>EventDispatchQueue</code>.
|
||||
*/
|
||||
public void dispatch();
|
||||
} // interface ActiveEvent
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Adjustable.java -- Objects with a numeric adjustment scale.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* Adjustable.java -- Objects with a numeric adjustment scale
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -41,183 +41,131 @@ package java.awt;
|
|||
import java.awt.event.AdjustmentListener;
|
||||
|
||||
/**
|
||||
* This interface is for objects that take a numeric value that
|
||||
* can be adjusted within a bounded range. For example, a scroll bar.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This interface is for objects that take a numeric value that can be
|
||||
* adjusted within a bounded range. For example, a scroll bar.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface Adjustable
|
||||
{
|
||||
/** Constant for an adjustable object with horizontal orientation. */
|
||||
int HORIZONTAL = 0;
|
||||
|
||||
/*
|
||||
* Static Variables
|
||||
*/
|
||||
/** Constant for an adjustable object with vertical orientation. */
|
||||
int VERTICAL = 1;
|
||||
|
||||
/**
|
||||
* Constant for a horizontal orientation
|
||||
*/
|
||||
public static final int HORIZONTAL = 0;
|
||||
/** Constant for an adjustable object with no orientation. */
|
||||
int NO_ORIENTATION = 2;
|
||||
|
||||
/**
|
||||
* Constant for a vertical orientation
|
||||
*/
|
||||
public static final int VERTICAL = 1;
|
||||
/**
|
||||
* Returns a constant representing the orientation of the object.
|
||||
*
|
||||
* @return the orientation of this object
|
||||
* @see #HORIZONTAL
|
||||
* @see #VERTICAL
|
||||
* @see #NO_ORIENTATION
|
||||
*/
|
||||
int getOrientation();
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Sets the minimum value this object can have.
|
||||
*
|
||||
* @param minimum the new minimum value
|
||||
*/
|
||||
void setMinimum(int minimum);
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
/**
|
||||
* Returns the minimum value this object can have.
|
||||
*
|
||||
* @return the minimum value
|
||||
*/
|
||||
int getMinimum();
|
||||
|
||||
/**
|
||||
* Returns the current value of the object.
|
||||
*
|
||||
* @return The current value of the object.
|
||||
*/
|
||||
public abstract int
|
||||
getValue();
|
||||
/**
|
||||
* Sets the maximum value this object can have.
|
||||
*
|
||||
* @param maximum the new maximum value
|
||||
*/
|
||||
void setMaximum(int maximum);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the maximum value this object can have.
|
||||
*
|
||||
* @return the maximum value
|
||||
*/
|
||||
int getMaximum();
|
||||
|
||||
/**
|
||||
* Sets the current value of the object.
|
||||
*
|
||||
* @param value The current value of the object.
|
||||
*/
|
||||
public abstract void
|
||||
setValue(int value);
|
||||
/**
|
||||
* Sets the increment value for incrementing the value by units.
|
||||
*
|
||||
* @param increment the unit increment value
|
||||
*/
|
||||
void setUnitIncrement(int increment);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the increment value for incrementing the value by units.
|
||||
*
|
||||
* @return the unit increment value
|
||||
*/
|
||||
int getUnitIncrement();
|
||||
|
||||
/**
|
||||
* Returns the orientation of the object, either <code>HORIZONTAL</code>
|
||||
* or <code>VERTICAL</code>.
|
||||
*
|
||||
* @return The orientation of this object.
|
||||
*/
|
||||
public abstract int
|
||||
getOrientation();
|
||||
/**
|
||||
* Sets the increment value for incrementing the value by blocks.
|
||||
*
|
||||
* @param increment the block increment value
|
||||
*/
|
||||
void setBlockIncrement(int increment);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the increment value for incrementing the value by blocks.
|
||||
*
|
||||
* @return the block increment value
|
||||
*/
|
||||
int getBlockIncrement();
|
||||
|
||||
/**
|
||||
* Returns the minimum value this object can take.
|
||||
*
|
||||
* @return The minimum value this object can take.
|
||||
*/
|
||||
public abstract int
|
||||
getMinimum();
|
||||
/**
|
||||
* Sets the length of the indicator for this object to the specified value.
|
||||
*
|
||||
* @param length the indicator length
|
||||
*/
|
||||
void setVisibleAmount(int length);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the length of the indicator for this object.
|
||||
*
|
||||
* @return the indicator length
|
||||
*/
|
||||
int getVisibleAmount();
|
||||
|
||||
/**
|
||||
* Sets the minimum value this object can take to the specified value.
|
||||
*
|
||||
* @param minimum The new minimum value for this object.
|
||||
*/
|
||||
public abstract void
|
||||
setMinimum(int minimum);
|
||||
/**
|
||||
* Sets the current value of the object.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
void setValue(int value);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the current value of the object.
|
||||
*
|
||||
* @return the current value
|
||||
*/
|
||||
int getValue();
|
||||
|
||||
/**
|
||||
* Returns the maximum value this object can take.
|
||||
*
|
||||
* @return The maximum value this object can take.
|
||||
*/
|
||||
public abstract int
|
||||
getMaximum();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the maximum value this object can take to the specified value.
|
||||
*
|
||||
* @param maximum The new maximum value for this object.
|
||||
*/
|
||||
public abstract void
|
||||
setMaximum(int maximum);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the increment value for incrementing by units.
|
||||
*
|
||||
* @return The unit increment value.
|
||||
*/
|
||||
public abstract int
|
||||
getUnitIncrement();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the increment value for incrementing by units to the specified value.
|
||||
*
|
||||
* @param increment The unit increment value.
|
||||
*/
|
||||
public abstract void
|
||||
setUnitIncrement(int increment);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the increment value for incrementing by blocks.
|
||||
*
|
||||
* @return The block increment value.
|
||||
*/
|
||||
public abstract int
|
||||
getBlockIncrement();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the increment value for incrementing by blocks to the specified value.
|
||||
*
|
||||
* @param increment The block increment value.
|
||||
*/
|
||||
public abstract void
|
||||
setBlockIncrement(int increment);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the length of the indicator for this object.
|
||||
*
|
||||
* @return The indicator length.
|
||||
*/
|
||||
public abstract int
|
||||
getVisibleAmount();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the length of the indicator for this object to the specified value.
|
||||
*
|
||||
* @param length The indicator length
|
||||
*/
|
||||
public abstract void
|
||||
setVisibleAmount(int length);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Adds a listener that will receive adjustment events for this object.
|
||||
*
|
||||
* @param listener The adjustment listener to add.
|
||||
*/
|
||||
public abstract void
|
||||
addAdjustmentListener(AdjustmentListener listener);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Removes an adjustment listener from this object. It will no longer
|
||||
* receive adjustment events.
|
||||
*
|
||||
* @param listener The adjustment listener to remove.
|
||||
*/
|
||||
public abstract void
|
||||
removeAdjustmentListener(AdjustmentListener listener);
|
||||
/**
|
||||
* Adds a listener that will receive adjustment events for this object.
|
||||
*
|
||||
* @param listener the adjustment listener to add
|
||||
* @see AdjustmentEvent
|
||||
*/
|
||||
void addAdjustmentListener(AdjustmentListener listener);
|
||||
|
||||
/**
|
||||
* Removes an adjustment listener from this object.
|
||||
*
|
||||
* @param listener the adjustment listener to remove
|
||||
* @see AdjustmentEvent
|
||||
*/
|
||||
void removeAdjustmentListener(AdjustmentListener listener);
|
||||
} // interface Adjustable
|
||||
|
||||
|
|
143
libjava/java/awt/AlphaComposite.java
Normal file
143
libjava/java/awt/AlphaComposite.java
Normal file
|
@ -0,0 +1,143 @@
|
|||
/* AlphaComposite.java -- provides a context for performing alpha compositing
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Composite
|
||||
* @see CompositeContext
|
||||
* @since 1.3
|
||||
* @status updated to 1.4 except for createContext, needs documentation
|
||||
*/
|
||||
public final class AlphaComposite implements Composite
|
||||
{
|
||||
/** Map Long to AlphaComposites. See getInstance for details. */
|
||||
private static final LinkedHashMap cache = new LinkedHashMap(11, 0.75f, true)
|
||||
{
|
||||
/** The largest the alpha composite cache can grow. */
|
||||
private static final int MAX_CACHE_SIZE = 2048;
|
||||
|
||||
/** Prune stale entries. */
|
||||
protected boolean removeEldestEntry(Map.Entry eldest)
|
||||
{ // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
|
||||
return size() > MAX_CACHE_SIZE;
|
||||
}
|
||||
};
|
||||
public static final int CLEAR = 1;
|
||||
public static final int SRC = 2;
|
||||
public static final int DST = 9;
|
||||
public static final int SRC_OVER = 3;
|
||||
public static final int DST_OVER = 4;
|
||||
public static final int SRC_IN = 5;
|
||||
public static final int DST_IN = 6;
|
||||
public static final int SRC_OUT = 7;
|
||||
public static final int DST_OUT = 8;
|
||||
public static final int SRC_ATOP = 10;
|
||||
public static final int DST_ATOP = 11;
|
||||
public static final int XOR = 12;
|
||||
public static final AlphaComposite Clear = getInstance(CLEAR);
|
||||
public static final AlphaComposite Src = getInstance(SRC);
|
||||
public static final AlphaComposite Dst = getInstance(DST);
|
||||
public static final AlphaComposite SrcOver = getInstance(SRC_OVER);
|
||||
public static final AlphaComposite DstOver = getInstance(DST_OVER);
|
||||
public static final AlphaComposite SrcIn = getInstance(SRC_IN);
|
||||
public static final AlphaComposite DstIn = getInstance(DST_IN);
|
||||
public static final AlphaComposite SrcOut = getInstance(SRC_OUT);
|
||||
public static final AlphaComposite DstOut = getInstance(DST_OUT);
|
||||
public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP);
|
||||
public static final AlphaComposite DstAtop = getInstance(DST_ATOP);
|
||||
public static final AlphaComposite Xor = getInstance(XOR);
|
||||
private final int rule;
|
||||
private final float alpha;
|
||||
private AlphaComposite(int rule, float alpha)
|
||||
{
|
||||
this.rule = rule;
|
||||
this.alpha = alpha;
|
||||
}
|
||||
public static AlphaComposite getInstance(int rule)
|
||||
{
|
||||
return getInstance(rule, 1);
|
||||
}
|
||||
public static AlphaComposite getInstance(int rule, float alpha)
|
||||
{
|
||||
if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1))
|
||||
throw new IllegalArgumentException();
|
||||
// This long is guaranteed unique for all valid alpha composites.
|
||||
Long l = new Long(rule + Double.doubleToLongBits(alpha));
|
||||
AlphaComposite a = (AlphaComposite) cache.get(l);
|
||||
if (a == null)
|
||||
{
|
||||
a = new AlphaComposite(rule, alpha);
|
||||
cache.put(l, a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
public CompositeContext createContext(ColorModel srcColorModel,
|
||||
ColorModel dstColorModel,
|
||||
RenderingHints hints)
|
||||
{
|
||||
// XXX Implement. Sun uses undocumented implementation class
|
||||
// sun.java2d.SunCompositeContext.
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public float getAlpha()
|
||||
{
|
||||
return alpha;
|
||||
}
|
||||
public int getRule()
|
||||
{
|
||||
return rule;
|
||||
}
|
||||
public int hashCode()
|
||||
{
|
||||
return 31 * Float.floatToIntBits(alpha) + rule;
|
||||
}
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (! (o instanceof AlphaComposite))
|
||||
return false;
|
||||
AlphaComposite a = (AlphaComposite) o;
|
||||
return rule == a.rule && alpha == a.alpha;
|
||||
}
|
||||
} // class AlphaComposite
|
98
libjava/java/awt/AttributeValue.java
Normal file
98
libjava/java/awt/AttributeValue.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
/* AttributeValue.java -- parent of type-safe enums of attributes
|
||||
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 java.awt;
|
||||
|
||||
/**
|
||||
* This class is undocumented by Sun, but it is the parent of several other
|
||||
* classes, all of which are type-safe enumerations. This takes care of
|
||||
* <code>equals</code>, <code>toString</code>, and <code>hashCode</code>, so
|
||||
* that you don't have to (although hashCode is commonly overridden).
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
*/
|
||||
class AttributeValue
|
||||
{
|
||||
/** The value of the enumeration. Package visible for speed. */
|
||||
final int value;
|
||||
|
||||
/** The list of enumeration names for the given subclass. */
|
||||
private final String[] names;
|
||||
|
||||
/**
|
||||
* Construct a type-safe enumeration element. For example,<br>
|
||||
* <pre>
|
||||
* class Foo extends AttributeValue
|
||||
* {
|
||||
* private static final String[] names = { "one", "two" }
|
||||
* public static final Foo ONE = new Foo(0);
|
||||
* public static final Foo TWO = new Foo(1);
|
||||
* private Foo(int value) { super(value, names); }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param value the position of this enumeration element, consecutive from 0
|
||||
* @param names the constant list of enumeration names for the subclass
|
||||
*/
|
||||
AttributeValue(int value, String[] names)
|
||||
{
|
||||
this.value = value;
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hashcode of this element. This is the index of the element
|
||||
* in the enumeration. Note that equals defaults to the == relation.
|
||||
*
|
||||
* @return the hashcode
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of this enumeration element.
|
||||
*
|
||||
* @return the element name
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return names[value];
|
||||
}
|
||||
} // class AttributeValue
|
144
libjava/java/awt/BasicStroke.java
Normal file
144
libjava/java/awt/BasicStroke.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
/* BasicStroke.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 java.awt;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* STUB CLASS ONLY
|
||||
*/
|
||||
public class BasicStroke implements Stroke
|
||||
{
|
||||
public static final int JOIN_MITER = 0;
|
||||
public static final int JOIN_ROUND = 1;
|
||||
public static final int JOIN_BEVEL = 2;
|
||||
public static final int CAP_BUTT = 0;
|
||||
public static final int CAP_ROUND = 1;
|
||||
public static final int CAP_SQUARE = 2;
|
||||
|
||||
private final float width;
|
||||
private final int cap;
|
||||
private final int join;
|
||||
private final float limit;
|
||||
private final float[] dash;
|
||||
private final float phase;
|
||||
|
||||
public BasicStroke(float width, int cap, int join, float miterlimit,
|
||||
float[] dash, float dashPhase)
|
||||
{
|
||||
if (width < 0 || miterlimit < 1 || cap < CAP_BUTT || cap > CAP_SQUARE
|
||||
|| join < JOIN_MITER || join > JOIN_BEVEL)
|
||||
throw new IllegalArgumentException();
|
||||
this.width = width;
|
||||
this.cap = cap;
|
||||
this.join = join;
|
||||
limit = miterlimit;
|
||||
this.dash = dash == null ? null : (float[]) dash.clone();
|
||||
phase = dashPhase;
|
||||
}
|
||||
|
||||
public BasicStroke(float width, int cap, int join, float miterlimit)
|
||||
{
|
||||
this(width, cap, join, miterlimit, null, 0);
|
||||
}
|
||||
|
||||
public BasicStroke(float width, int cap, int join)
|
||||
{
|
||||
this(width, cap, join, 10, null, 0);
|
||||
}
|
||||
|
||||
public BasicStroke(float width)
|
||||
{
|
||||
this(width, CAP_SQUARE, JOIN_MITER, 10, null, 0);
|
||||
}
|
||||
|
||||
public BasicStroke()
|
||||
{
|
||||
this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0);
|
||||
}
|
||||
|
||||
public Shape createStrokedShape(Shape s)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public float getLineWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getEndCap()
|
||||
{
|
||||
return cap;
|
||||
}
|
||||
|
||||
public int getLineJoin()
|
||||
{
|
||||
return join;
|
||||
}
|
||||
|
||||
public float getMiterLimit()
|
||||
{
|
||||
return limit;
|
||||
}
|
||||
|
||||
public float[] getDashArray()
|
||||
{
|
||||
return dash;
|
||||
}
|
||||
|
||||
public float getDashPhase()
|
||||
{
|
||||
return phase;
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (! (o instanceof BasicStroke))
|
||||
return false;
|
||||
BasicStroke s = (BasicStroke) o;
|
||||
return width == s.width && cap == s.cap && join == s.join
|
||||
&& limit == s.limit && Arrays.equals(dash, s.dash) && phase == s.phase;
|
||||
}
|
||||
} // class BasicStroke
|
|
@ -77,27 +77,107 @@ public static final String WEST = "West";
|
|||
*/
|
||||
public static final String CENTER = "Center";
|
||||
|
||||
/**
|
||||
* Constant indicating the position just after the last line of the
|
||||
* layout.
|
||||
*/
|
||||
public static final String AFTER_LAST_LINE = "Last";
|
||||
|
||||
/**
|
||||
* Constant indicating the position just after the end of the line.
|
||||
*/
|
||||
public static final String AFTER_LINE_ENDS = "After";
|
||||
/**
|
||||
* The constant indicating the position before the first line of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* top-to-bottom orientation, it is the same as {@link #NORTH}, for
|
||||
* a bottom-to-top orientation, it is the same as {@link #SOUTH}.
|
||||
*
|
||||
* <p>This constant is an older name for {@link #PAGE_START} which
|
||||
* has exactly the same value.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public static final String BEFORE_FIRST_LINE = "First";
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position after the last line of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* top-to-bottom orientation, it is the same as {@link #SOUTH}, for
|
||||
* a bottom-to-top orientation, it is the same as {@link #NORTH}.
|
||||
*
|
||||
* <p>This constant is an older name for {@link #PAGE_END} which
|
||||
* has exactly the same value.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public static final String AFTER_LAST_LINE = "Last";
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position before the first item of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* left-to-right orientation, it is the same as {@link #WEST}, for
|
||||
* a right-to-left orientation, it is the same as {@link #EAST}.
|
||||
*
|
||||
* <p>This constant is an older name for {@link #LINE_START} which
|
||||
* has exactly the same value.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public static final String BEFORE_LINE_BEGINS = "Before";
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position after the last item of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* left-to-right orientation, it is the same as {@link #EAST}, for
|
||||
* a right-to-left orientation, it is the same as {@link #WEST}.
|
||||
*
|
||||
* <p>This constant is an older name for {@link #LINE_END} which
|
||||
* has exactly the same value.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public static final String AFTER_LINE_ENDS = "After";
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position before the first line of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* top-to-bottom orientation, it is the same as {@link #NORTH}, for
|
||||
* a bottom-to-top orientation, it is the same as {@link #SOUTH}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final String PAGE_START = BEFORE_FIRST_LINE;
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position after the last line of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* top-to-bottom orientation, it is the same as {@link #SOUTH}, for
|
||||
* a bottom-to-top orientation, it is the same as {@link #NORTH}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final String PAGE_END = AFTER_LAST_LINE;
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position before the first item of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* left-to-right orientation, it is the same as {@link #WEST}, for
|
||||
* a right-to-left orientation, it is the same as {@link #EAST}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final String LINE_START = BEFORE_LINE_BEGINS;
|
||||
|
||||
|
||||
/**
|
||||
* The constant indicating the position after the last item of the
|
||||
* layout. The exact position depends on the writing system: For a
|
||||
* left-to-right orientation, it is the same as {@link #EAST}, for
|
||||
* a right-to-left orientation, it is the same as {@link #WEST}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final String LINE_END = AFTER_LINE_ENDS;
|
||||
|
||||
/**
|
||||
* Constant indicating the position just before the first line of the
|
||||
* layout.
|
||||
*/
|
||||
public static final String BEFORE_FIRST_LINE = "First";
|
||||
|
||||
/**
|
||||
* Constant indicating the position at the beginning of the line.
|
||||
*/
|
||||
public static final String BEFORE_LINE_BEGINS = "Before";
|
||||
|
||||
// Serialization constant
|
||||
private static final long serialVersionUID = -8658291919501921765L;
|
||||
|
|
121
libjava/java/awt/BufferCapabilities.java
Normal file
121
libjava/java/awt/BufferCapabilities.java
Normal file
|
@ -0,0 +1,121 @@
|
|||
/* BufferCapabilities.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 java.awt;
|
||||
|
||||
/**
|
||||
* Needs documentation...
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see BufferStrategy#getCapabilities()
|
||||
* @see GraphicsConfiguration#getCapabilities()
|
||||
* @since 1.4
|
||||
* @status updated to 1.4, lacks documentation
|
||||
*/
|
||||
public class BufferCapabilities implements Cloneable
|
||||
{
|
||||
public static final class FlipContents extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES
|
||||
= { "undefined", "background", "prior", "copied" };
|
||||
public static final FlipContents UNDEFINED = new FlipContents(0);
|
||||
public static final FlipContents BACKGROUND = new FlipContents(1);
|
||||
public static final FlipContents PRIOR = new FlipContents(2);
|
||||
public static final FlipContents COPIED = new FlipContents(3);
|
||||
private FlipContents(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class FlipContents
|
||||
|
||||
private final ImageCapabilities front;
|
||||
private final ImageCapabilities back;
|
||||
private final FlipContents flip;
|
||||
|
||||
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back,
|
||||
FlipContents flip)
|
||||
{
|
||||
this.front = front;
|
||||
this.back = back;
|
||||
this.flip = flip;
|
||||
if (front == null || back == null)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public ImageCapabilities getFrontBufferCapabilities()
|
||||
{
|
||||
return front;
|
||||
}
|
||||
|
||||
public ImageCapabilities getBackBufferCapabilities()
|
||||
{
|
||||
return back;
|
||||
}
|
||||
|
||||
public boolean isPageFlipping()
|
||||
{
|
||||
return flip != null;
|
||||
}
|
||||
|
||||
public FlipContents getFlipContents()
|
||||
{
|
||||
return flip;
|
||||
}
|
||||
|
||||
public boolean isFullScreenRequired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isMultiBufferAvailable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
return super.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
throw (Error) new InternalError().initCause(e); // Impossible
|
||||
}
|
||||
}
|
||||
} // class BufferCapabilities
|
|
@ -42,6 +42,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -200,13 +201,24 @@ removeActionListener(ActionListener listener)
|
|||
action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
|
||||
}
|
||||
|
||||
public EventListener[]
|
||||
getListeners(Class listenerType)
|
||||
{
|
||||
if (listenerType == ActionListener.class)
|
||||
return getListenersImpl(listenerType, action_listeners);
|
||||
return super.getListeners(listenerType);
|
||||
}
|
||||
public synchronized ActionListener[] getActionListeners()
|
||||
{
|
||||
return (ActionListener[])
|
||||
AWTEventMulticaster.getListeners(action_listeners,
|
||||
ActionListener.class);
|
||||
}
|
||||
|
||||
/** Returns all registered EventListers of the given listenerType.
|
||||
* listenerType must be a subclass of EventListener, or a
|
||||
* ClassClassException is thrown.
|
||||
* @since 1.3
|
||||
*/
|
||||
public EventListener[] getListeners(Class listenerType)
|
||||
{
|
||||
if (listenerType == ActionListener.class)
|
||||
return getActionListeners();
|
||||
return (EventListener[]) Array.newInstance(listenerType, 0);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ remove(String item)
|
|||
*
|
||||
* @param index The index of the item to remove.
|
||||
*
|
||||
* @exception ArrayIndexOutOfBoundException If the index is not valid.
|
||||
* @exception ArrayIndexOutOfBoundsException If the index is not valid.
|
||||
*/
|
||||
public synchronized void
|
||||
remove(int index)
|
||||
|
|
File diff suppressed because it is too large
Load diff
103
libjava/java/awt/ColorPaintContext.java
Normal file
103
libjava/java/awt/ColorPaintContext.java
Normal file
|
@ -0,0 +1,103 @@
|
|||
/* ColorPaintContext.java -- context for painting solid colors
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.Raster;
|
||||
|
||||
/**
|
||||
* This class provides a paint context which will fill a rectanglar region of
|
||||
* a raster scan with the given color. However, it is not yet completely
|
||||
* implemented.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
*/
|
||||
class ColorPaintContext implements PaintContext
|
||||
{
|
||||
/**
|
||||
* The color to fill any raster with. Package visible for use in
|
||||
* SystemColor.
|
||||
*/
|
||||
final int color;
|
||||
|
||||
/**
|
||||
* Create the context for a given color.
|
||||
*
|
||||
* @param c the solid color to use
|
||||
*/
|
||||
ColorPaintContext(int c)
|
||||
{
|
||||
color = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the resources allocated for the paint. As the color is constant,
|
||||
* there aren't any resources.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color model of this context. This ignores the model passed
|
||||
* in the request, since colors are always in sRGB.
|
||||
*
|
||||
* @return the context color model
|
||||
*/
|
||||
public ColorModel getColorModel()
|
||||
{
|
||||
return ColorModel.getRGBdefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a raster containing the colors for the graphics operation.
|
||||
*
|
||||
* @param x the x-coordinate, in device space
|
||||
* @param y the y-coordinate, in device space
|
||||
* @param w the width, in device space
|
||||
* @param h the height, in device space
|
||||
* @return a raster for the given area and color
|
||||
*/
|
||||
public Raster getRaster(int x, int y, int w, int h)
|
||||
{
|
||||
// XXX Implement. Sun uses undocumented implementation class
|
||||
// sun.awt.image.IntegerInterleavedRaster.
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class ColorPaintContext
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
||||
/* ComponentOrientation.java -- describes a component's orientation
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -34,83 +35,179 @@ 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. */
|
||||
|
||||
/**
|
||||
* @author Bryce McKinlay <bryce@albatross.co.nz>
|
||||
*/
|
||||
|
||||
/* Status: Incomplete. Needs a Locale lookup table. */
|
||||
|
||||
package java.awt;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public final class ComponentOrientation implements java.io.Serializable
|
||||
/**
|
||||
* This class is used to differentiate different orientations for text layout.
|
||||
* It controls whether text flows left-to-right or right-to-left, and whether
|
||||
* lines are horizontal or vertical, as in this table:<br>
|
||||
* <pre>
|
||||
* LT RT TL TR
|
||||
* A B C C B A A D G G D A
|
||||
* D E F F E D B E H H E B
|
||||
* G H I I H G C F I I F C
|
||||
* </pre>
|
||||
* <b>LT</b> languages are most common (left-to-right lines, top-to-bottom).
|
||||
* This includes Western European languages, and optionally includes Japanese,
|
||||
* Chinese, and Korean. <b>RT</b> languages (right-to-left lines,
|
||||
* top-to-bottom) are mainly middle eastern, such as Hebrew and Arabic.
|
||||
* <b>TR</b> languages flow top-to-bottom in a line, right-to-left, and are
|
||||
* the basis of Japanese, Chinese, and Korean. Finally, <b>TL</b> languages
|
||||
* flow top-to-bottom in a line, left-to-right, as in Mongolian.
|
||||
*
|
||||
* <p>This is a pretty poor excuse for a type-safe enum, since it is not
|
||||
* guaranteed that orientation objects are unique (thanks to serialization),
|
||||
* yet there is no equals() method. You would be wise to compare the output
|
||||
* of isHorizontal() and isLeftToRight() rather than comparing objects with
|
||||
* ==, especially since more constants may be added in the future.
|
||||
*
|
||||
* @author Bryce McKinlay <bryce@albatross.co.nz>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public final class ComponentOrientation implements Serializable
|
||||
{
|
||||
// Here is a wild guess.
|
||||
private static int HORIZONTAL_ID = 1 << 0,
|
||||
LEFT_TO_RIGHT_ID = 1 << 1;
|
||||
/**
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -4113291392143563828L;
|
||||
|
||||
/** Constant for unknown orientation. */
|
||||
private static final int UNKNOWN_ID = 1;
|
||||
|
||||
/** Constant for horizontal line orientation. */
|
||||
private static final int HORIZONTAL_ID = 2;
|
||||
|
||||
/** Constant for left-to-right orientation. */
|
||||
private static final int LEFT_TO_RIGHT_ID = 4;
|
||||
|
||||
/**
|
||||
* Items run left to right, and lines flow top to bottom. Examples: English,
|
||||
* French.
|
||||
*/
|
||||
public static final ComponentOrientation LEFT_TO_RIGHT
|
||||
= new ComponentOrientation(HORIZONTAL_ID & LEFT_TO_RIGHT_ID);
|
||||
= new ComponentOrientation(HORIZONTAL_ID | LEFT_TO_RIGHT_ID);
|
||||
|
||||
/**
|
||||
* Items run right to left, and lines flow top to bottom. Examples: Arabic,
|
||||
* Hebrew.
|
||||
*/
|
||||
public static final ComponentOrientation RIGHT_TO_LEFT
|
||||
= new ComponentOrientation(HORIZONTAL_ID);
|
||||
|
||||
/**
|
||||
* The orientation is unknown for the locale. For backwards compatibility,
|
||||
* this behaves like LEFT_TO_RIGHT in the instance methods.
|
||||
*/
|
||||
public static final ComponentOrientation UNKNOWN
|
||||
= new ComponentOrientation(0);
|
||||
= new ComponentOrientation(UNKNOWN_ID | HORIZONTAL_ID | LEFT_TO_RIGHT_ID);
|
||||
|
||||
// FIXME: This field is from the serialization spec, but what are the
|
||||
// correct values?
|
||||
int orientation;
|
||||
/**
|
||||
* The orientation of this object; bitwise-or of unknown (1), horizontal (2),
|
||||
* and left-to-right (4).
|
||||
*
|
||||
* @serial the orientation
|
||||
*/
|
||||
private final int orientation;
|
||||
|
||||
ComponentOrientation(int orientation)
|
||||
/**
|
||||
* Construct a given orientation.
|
||||
*
|
||||
* @param orientation the orientation
|
||||
*/
|
||||
private ComponentOrientation(int orientation)
|
||||
{
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the lines are horizontal, in which case lines flow
|
||||
* top-to-bottom. For example, English, Hebrew. Counterexamples: Japanese,
|
||||
* Chinese, Korean, Mongolian.
|
||||
*
|
||||
* @return true if this orientation has horizontal lines
|
||||
*/
|
||||
public boolean isHorizontal()
|
||||
{
|
||||
return ((orientation & HORIZONTAL_ID) != 0);
|
||||
return (orientation & HORIZONTAL_ID) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If isHorizontal() returns true, then this determines whether items in
|
||||
* the line flow left-to-right. If isHorizontal() returns false, items in
|
||||
* a line flow top-to-bottom, and this determines if lines flow
|
||||
* left-to-right.
|
||||
*
|
||||
* @return true if this orientation flows left-to-right
|
||||
*/
|
||||
public boolean isLeftToRight()
|
||||
{
|
||||
return ((orientation & LEFT_TO_RIGHT_ID) != 0);
|
||||
return (orientation & LEFT_TO_RIGHT_ID) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an orientation appropriate for the locale.
|
||||
*
|
||||
* @param locale the locale
|
||||
* @return the orientation for that locale
|
||||
* @throws NullPointerException if locale is null
|
||||
*/
|
||||
public static ComponentOrientation getOrientation(Locale locale)
|
||||
{
|
||||
// FIXME: Use a table to look this up.
|
||||
// Based on iterating over all languages defined in JDK 1.4, this behavior
|
||||
// matches Sun's. However, it makes me wonder if any non-horizontal
|
||||
// orientations even exist, as it sure contradicts their documentation.
|
||||
String language = locale.getLanguage();
|
||||
if ("ar".equals(language) || "fa".equals(language) || "iw".equals(language)
|
||||
|| "ur".equals(language))
|
||||
return RIGHT_TO_LEFT;
|
||||
return LEFT_TO_RIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an orientation from a resource bundle. This tries the following:<ol>
|
||||
* <li>Use the key "Orientation" to find an instance of ComponentOrientation
|
||||
* in the bundle.</li>
|
||||
* <li>Get the locale of the resource bundle, and get the orientation of
|
||||
* that locale.</li>
|
||||
* <li>Give up and get the orientation of the default locale.<li>
|
||||
* <ol>
|
||||
*
|
||||
* @param bdl the bundle to use
|
||||
* @return the orientation
|
||||
* @throws NullPointerException if bdl is null
|
||||
* @deprecated use {@link #getOrientation(Locale)} instead
|
||||
*/
|
||||
public static ComponentOrientation getOrientation(ResourceBundle bdl)
|
||||
{
|
||||
ComponentOrientation r;
|
||||
|
||||
try
|
||||
{
|
||||
Object obj = bdl.getObject("Orientation");
|
||||
r = (ComponentOrientation) obj;
|
||||
if (r != null)
|
||||
return r;
|
||||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
// Fall through
|
||||
}
|
||||
|
||||
{
|
||||
r = (ComponentOrientation) bdl.getObject("Orientation");
|
||||
if (r != null)
|
||||
return r;
|
||||
}
|
||||
catch (MissingResourceException ignored)
|
||||
{
|
||||
}
|
||||
catch (ClassCastException ignored)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
Locale l = bdl.getLocale();
|
||||
r = getOrientation(l);
|
||||
if (r != null)
|
||||
return r;
|
||||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
// Fall through
|
||||
}
|
||||
|
||||
return (getOrientation (Locale.getDefault ()));
|
||||
{
|
||||
r = getOrientation(bdl.getLocale());
|
||||
if (r != null)
|
||||
return r;
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
return getOrientation(Locale.getDefault());
|
||||
}
|
||||
}
|
||||
} // class ComponentOrientation
|
||||
|
|
73
libjava/java/awt/Composite.java
Normal file
73
libjava/java/awt/Composite.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* Composite.java -- graphics formed from composite layers
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
|
||||
/**
|
||||
* This interface is for graphics which are formed as composites of others.
|
||||
* It combines {@link Graphics2D} shapes according to defined rules to form
|
||||
* the new image. Implementations of this interface must be immutable, because
|
||||
* they are not cloned when a Graphics2D container is cloned.
|
||||
*
|
||||
* <p>Since this can expose pixels to untrusted code, there is a security
|
||||
* check on custom objects, <code>readDisplayPixels</code>, to prevent leaking
|
||||
* restricted information graphically.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see AlphaComposite
|
||||
* @see CompositeContext
|
||||
* @see Graphics2D#setComposite(Composite)
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface Composite
|
||||
{
|
||||
/**
|
||||
* Create a context state for performing the compositing operation. Several
|
||||
* contexts may exist for this object, in a multi-threaded environment.
|
||||
*
|
||||
* @param srcColorModel the color model of the source
|
||||
* @param dstColorModel the color model of the destination
|
||||
* @param hints hints for choosing between rendering alternatives
|
||||
*/
|
||||
CompositeContext createContext(ColorModel srcColorModel,
|
||||
ColorModel dstColorModel,
|
||||
RenderingHints hints);
|
||||
} // interface Composite
|
71
libjava/java/awt/CompositeContext.java
Normal file
71
libjava/java/awt/CompositeContext.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* Composite.java -- the context for compositing graphics layers
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
|
||||
/**
|
||||
* This interface provides an optimized environment for compositing graphics.
|
||||
* Several such contexts may exist for a given <code>Composite</code> object.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Composite
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface CompositeContext
|
||||
{
|
||||
/**
|
||||
* Release resources allocated for the compositing.
|
||||
*/
|
||||
void dispose();
|
||||
|
||||
/**
|
||||
* Compose the two source images into the composite image. The destination
|
||||
* can be the same as one of the two inputs, and the destination must be
|
||||
* compatible with the ColorModel chosen in {@link Composite#createContext}.
|
||||
*
|
||||
* @param src the lower image source in compositing
|
||||
* @param dstIn the upper image source in compositing
|
||||
* @param dstOut the destination for the composite
|
||||
* @see Composite
|
||||
*/
|
||||
void compose(Raster src, Raster dstIn, WritableRaster dstOut);
|
||||
} // interface CompositeContext
|
File diff suppressed because it is too large
Load diff
96
libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
Normal file
96
libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
/* ContainerOrderFocusTraversalPolicy.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 java.awt;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* STUB CLASS ONLY
|
||||
*/
|
||||
public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
|
||||
implements Serializable
|
||||
{
|
||||
private boolean downCycle = true;
|
||||
|
||||
public ContainerOrderFocusTraversalPolicy()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public Component getComponentAfter(Container root, Component current)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component getComponentBefore(Container root, Component current)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component getFirstComponent(Container root)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component getLastComponent(Container root)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component getDefaultComponent(Container root)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setImplicitDownCycleTraversal(boolean value)
|
||||
{
|
||||
downCycle = value;
|
||||
}
|
||||
|
||||
public boolean getImplicitDownCycleTraversal()
|
||||
{
|
||||
return downCycle;
|
||||
}
|
||||
|
||||
protected boolean accept(Component current)
|
||||
{
|
||||
return current.visible && current.isDisplayable() && current.enabled
|
||||
&& current.focusable;
|
||||
}
|
||||
} // class ContainerOrderFocusTraversalPolicy
|
55
libjava/java/awt/DefaultFocusTraversalPolicy.java
Normal file
55
libjava/java/awt/DefaultFocusTraversalPolicy.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* DefaultFocusTraversalPolicy.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 java.awt;
|
||||
|
||||
/**
|
||||
* STUB CLASS ONLY
|
||||
*/
|
||||
public class DefaultFocusTraversalPolicy
|
||||
extends ContainerOrderFocusTraversalPolicy
|
||||
{
|
||||
public DefaultFocusTraversalPolicy()
|
||||
{
|
||||
}
|
||||
|
||||
protected boolean accept(Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class DefaultFocusTraversalPolicy
|
96
libjava/java/awt/DefaultKeyboardFocusManager.java
Normal file
96
libjava/java/awt/DefaultKeyboardFocusManager.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
/* DefaultKeyboardFocusManager.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 java.awt;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* STUB CLASS ONLY
|
||||
*/
|
||||
public class DefaultKeyboardFocusManager extends KeyboardFocusManager
|
||||
{
|
||||
public DefaultKeyboardFocusManager()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean dispatchEvent(AWTEvent e)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public boolean dispatchKeyEvent(KeyEvent e)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public boolean postProcessKeyEvent(KeyEvent e)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public void processKeyEvent(Component comp, KeyEvent e)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
protected void enqueueKeyEvents(long after, Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
protected void dequeueKeyEvents(long after, Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
protected void discardKeyEvents(Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public void focusPreviousComponent(Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public void focusNextComponent(Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public void upFocusCycle(Component comp)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public void downFocusCycle(Container cont)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class DefaultKeyboardFocusManager
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
/* Dimension.java -- represents a 2-dimensional span
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,79 +38,168 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, plus online
|
||||
* API docs for JDK 1.2 beta from http://www.javasoft.com.
|
||||
* Status: Believed complete and correct, except that neither toString
|
||||
* has not been compared with JDK output.
|
||||
*/
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class holds a width and height value pair.
|
||||
*
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @date Fenruary 8, 1999.
|
||||
*/
|
||||
public class Dimension extends java.awt.geom.Dimension2D
|
||||
implements java.io.Serializable
|
||||
* This class holds a width and height value pair. This is used in plenty
|
||||
* of windowing classes, but also has geometric meaning.
|
||||
*
|
||||
* <p>It is valid for a dimension to have negative width or height; but it
|
||||
* is considered to have no area. Therefore, the behavior in various methods
|
||||
* is undefined in such a case.
|
||||
*
|
||||
* <p>There are some public fields; if you mess with them in an inconsistent
|
||||
* manner, it is your own fault when you get invalid results. Also, this
|
||||
* class is not threadsafe.
|
||||
*
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Component
|
||||
* @see LayoutManager
|
||||
* @since 1.0
|
||||
* @status updated to 1.14
|
||||
*/
|
||||
public class Dimension extends Dimension2D implements Serializable
|
||||
{
|
||||
/**
|
||||
* This width of this object.
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = 4723952579491349524L;
|
||||
|
||||
/**
|
||||
* The width of this object.
|
||||
*
|
||||
* @see #getSize()
|
||||
* @see #setSize(double, double)
|
||||
* @serial the width
|
||||
*/
|
||||
public int width;
|
||||
|
||||
/**
|
||||
* The height of this object.
|
||||
*
|
||||
* @see #getSize()
|
||||
* @see #setSize(double, double)
|
||||
* @serial the height
|
||||
*/
|
||||
public int height;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Dimension</code> with a width
|
||||
* and height of zero.
|
||||
* Create a new Dimension with a width and height of zero.
|
||||
*/
|
||||
public Dimension () { }
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Dimension</code> to have a width
|
||||
* and height identical to that of the specified dimension object.
|
||||
*
|
||||
* @param dim The <code>Dimension</code> to take the width and height from.
|
||||
*/
|
||||
public Dimension (Dimension dim)
|
||||
public Dimension()
|
||||
{
|
||||
this.width = dim.width;
|
||||
this.height = dim.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Dimension</code> with the
|
||||
* specified width and height.
|
||||
* Create a new Dimension with width and height identical to that of the
|
||||
* specified dimension.
|
||||
*
|
||||
* @param width The width of this object.
|
||||
* @param height The height of this object.
|
||||
* @param d the Dimension to copy
|
||||
* @throws NullPointerException if d is null
|
||||
*/
|
||||
public Dimension (int width, int height)
|
||||
public Dimension(Dimension d)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
width = d.width;
|
||||
height = d.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Dimension with the specified width and height.
|
||||
*
|
||||
* @param w the width of this object
|
||||
* @param h the height of this object
|
||||
*/
|
||||
public Dimension(int w, int h)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width of this dimension.
|
||||
*
|
||||
* @return the width, as a double
|
||||
*/
|
||||
public double getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the height of this dimension.
|
||||
*
|
||||
* @return the height, as a double
|
||||
*/
|
||||
public double getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size of this dimension. The values are rounded to int.
|
||||
*
|
||||
* @param w the new width
|
||||
* @param h the new height
|
||||
* @since 1.2
|
||||
*/
|
||||
public void setSize(double w, double h)
|
||||
{
|
||||
width = (int) w;
|
||||
height = (int) h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of this dimension. A pretty useless method, as this is
|
||||
* already a dimension.
|
||||
*
|
||||
* @return a copy of this dimension
|
||||
* @see #setSize(Dimension)
|
||||
* @since 1.1
|
||||
*/
|
||||
public Dimension getSize()
|
||||
{
|
||||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the width and height of this object to match that of the
|
||||
* specified object.
|
||||
*
|
||||
* @param d the Dimension to get the new width and height from
|
||||
* @throws NullPointerException if d is null
|
||||
* @see #getSize()
|
||||
* @since 1.1
|
||||
*/
|
||||
public void setSize(Dimension d)
|
||||
{
|
||||
width = d.width;
|
||||
height = d.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the width and height of this object to the specified values.
|
||||
*
|
||||
* @param w the new width value
|
||||
* @param h the new height value
|
||||
*/
|
||||
public void setSize(int w, int h)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests this object for equality against the specified object. This will
|
||||
* be true if and only if the specified object:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>Is not <code>null</code>.
|
||||
* <li>Is an instance of <code>Dimension</code>.
|
||||
* <li>Has width and height values identical to this object.
|
||||
* </ul>
|
||||
* be true if and only if the specified object is an instance of
|
||||
* Dimension2D, and has the same width and height.
|
||||
*
|
||||
* @param obj The object to test against.
|
||||
*
|
||||
* @return <code>true</code> if the specified object is equal to this
|
||||
* object, <code>false</code> otherwise.
|
||||
* @param obj the object to test against
|
||||
* @return true if the object is equal to this
|
||||
*/
|
||||
public boolean equals (Object obj)
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (! (obj instanceof Dimension))
|
||||
return false;
|
||||
|
@ -118,55 +208,27 @@ public class Dimension extends java.awt.geom.Dimension2D
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the size of this object. Not very useful.
|
||||
* Return the hashcode for this object. It is not documented, but appears
|
||||
* to be <code>((width + height) * (width + height + 1) / 2) + width</code>.
|
||||
*
|
||||
* @return This object.
|
||||
* @return the hashcode
|
||||
*/
|
||||
public Dimension getSize () { return new Dimension(this); }
|
||||
|
||||
/**
|
||||
* Sets the width and height of this object to match that of the
|
||||
* specified object.
|
||||
*
|
||||
* @param dim The <code>Dimension</code> object to get the new width and
|
||||
* height from.
|
||||
*/
|
||||
public void setSize (Dimension dim)
|
||||
public int hashCode()
|
||||
{
|
||||
this.width = dim.width;
|
||||
this.height = dim.height;
|
||||
// Reverse engineering this was fun!
|
||||
return (width + height) * (width + height + 1) / 2 + width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the width and height of this object to the specified values.
|
||||
* Returns a string representation of this object. The format is:
|
||||
* <code>getClass().getName() + "[width=" + width + ",height=" + height
|
||||
* + ']'</code>.
|
||||
*
|
||||
* @param width The new width value.
|
||||
* @param height The new height value.
|
||||
* @return a string representation of this object
|
||||
*/
|
||||
public void setSize (int width, int height)
|
||||
public String toString()
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
return getClass().getName()
|
||||
+ "[width=" + width + ",height=" + height + ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
*
|
||||
* @return A string representation of this object.
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
return "Dimension[w:"+width+",h:"+height+']';
|
||||
}
|
||||
|
||||
/* Note: There is no Dimension.hashCode. */
|
||||
|
||||
public double getWidth() { return width; }
|
||||
public double getHeight() { return height; }
|
||||
|
||||
public void setSize (double width, double height)
|
||||
{
|
||||
this.width = (int) width;
|
||||
this.height = (int) height;
|
||||
}
|
||||
}
|
||||
} // class Dimension
|
||||
|
|
164
libjava/java/awt/DisplayMode.java
Normal file
164
libjava/java/awt/DisplayMode.java
Normal file
|
@ -0,0 +1,164 @@
|
|||
/* DisplayMode.java -- a description of display mode configurations
|
||||
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 java.awt;
|
||||
|
||||
/**
|
||||
* This encapsulates information about the display mode for a graphics
|
||||
* device configuration. They are device dependent, and may not always be
|
||||
* available.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see GraphicsDevice
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public final class DisplayMode
|
||||
{
|
||||
/**
|
||||
* Value of the bit depth if multiple depths are supported.
|
||||
*
|
||||
* @see #getBitDepth()
|
||||
*/
|
||||
public static final int BIT_DEPTH_MULTI = -1;
|
||||
|
||||
/**
|
||||
* Value of an unknown refresh rate.
|
||||
*
|
||||
* @see #getRefreshRate()
|
||||
*/
|
||||
public static final int REFRESH_RATE_UNKNOWN = 0;
|
||||
|
||||
/** The width. */
|
||||
private final int width;
|
||||
|
||||
/** The height. */
|
||||
private final int height;
|
||||
|
||||
/** The bit depth. */
|
||||
private final int bitDepth;
|
||||
|
||||
/** The refresh rate. */
|
||||
private final int refreshRate;
|
||||
|
||||
/**
|
||||
* Create a mode with the given parameters.
|
||||
*
|
||||
* @param width the width
|
||||
* @param height the height
|
||||
* @param bitDepth the bitDepth
|
||||
* @param refreshRate the refreshRate
|
||||
* @see #BIT_DEPTH_MULTI
|
||||
* @see #REFRESH_RATE_UNKNOWN
|
||||
*/
|
||||
public DisplayMode(int width, int height, int bitDepth, int refreshRate)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.bitDepth = bitDepth;
|
||||
this.refreshRate = refreshRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height, in pixels.
|
||||
*
|
||||
* @return the height
|
||||
*/
|
||||
public int getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width, in pixels.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
public int getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bit depth, in bits per pixel. This may be BIT_DEPTH_MULTI.
|
||||
*
|
||||
* @return the bit depth
|
||||
* @see #BIT_DEPTH_MULTI
|
||||
*/
|
||||
public int getBitDepth()
|
||||
{
|
||||
return bitDepth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the refresh rate, in hertz. This may be REFRESH_RATE_UNKNOWN.
|
||||
*
|
||||
* @return the refresh rate
|
||||
* @see #REFRESH_RATE_UNKNOWN
|
||||
*/
|
||||
public int getRefreshRate()
|
||||
{
|
||||
return refreshRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for equality. This returns true for two modes with identical
|
||||
* parameters.
|
||||
*
|
||||
* @param o the object to compare to
|
||||
* @return true if it is equal
|
||||
*/
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (! (o instanceof DisplayMode))
|
||||
return false;
|
||||
DisplayMode m = (DisplayMode) o;
|
||||
return width == m.width && height == m.height && bitDepth == m.bitDepth
|
||||
&& refreshRate == m.refreshRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash code for the display mode.
|
||||
*
|
||||
* @return the hash code
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
return width + height + bitDepth + refreshRate;
|
||||
}
|
||||
} // class DisplayMode
|
|
@ -320,4 +320,27 @@ public class EventQueue
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the timestamp of the most recent event that had a timestamp, or
|
||||
* the initialization time of the event queue if no events have been fired.
|
||||
* At present, only <code>InputEvent</code>s, <code>ActionEvent</code>s,
|
||||
* <code>InputMethodEvent</code>s, and <code>InvocationEvent</code>s have
|
||||
* timestamps, but this may be added to other events in future versions.
|
||||
* If this is called by the event dispatching thread, it can be any
|
||||
* (sequential) value, but to other threads, the safest bet is to return
|
||||
* System.currentTimeMillis().
|
||||
*
|
||||
* @return the most recent timestamp
|
||||
* @see InputEvent#getWhen()
|
||||
* @see ActionEvent#getWhen()
|
||||
* @see InvocationEvent#getWhen()
|
||||
* @see InputMethodEvent#getWhen()
|
||||
* @since 1.4
|
||||
*/
|
||||
public static long getMostRecentEventTime()
|
||||
{
|
||||
// XXX For now, this ONLY does the current time.
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
} // class EventQueue
|
||||
|
|
66
libjava/java/awt/FocusTraversalPolicy.java
Normal file
66
libjava/java/awt/FocusTraversalPolicy.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* FocusTraversalPolicy.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 java.awt;
|
||||
|
||||
/**
|
||||
* STUB CLASS ONLY
|
||||
*/
|
||||
public abstract class FocusTraversalPolicy
|
||||
{
|
||||
public FocusTraversalPolicy()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract Component getComponentAfter(Container root,
|
||||
Component current);
|
||||
|
||||
public abstract Component getComponentBefore(Container root,
|
||||
Component current);
|
||||
|
||||
public abstract Component getFirstComponent(Container root);
|
||||
|
||||
public abstract Component getLastComponent(Container root);
|
||||
|
||||
public abstract Component getDefaultComponent(Container root);
|
||||
|
||||
public Component getInitialComponent(Window window)
|
||||
{
|
||||
return getDefaultComponent(window);
|
||||
}
|
||||
} // class FocusTraversalPolicy
|
|
@ -73,6 +73,66 @@ public static final int ROMAN_BASELINE = 0;
|
|||
public static final int CENTER_BASELINE = 1;
|
||||
public static final int HANGING_BASELINE = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Indicates to <code>createFont</code> that the supplied font data
|
||||
* is in TrueType format.
|
||||
*
|
||||
* <p><em>Specification Note:</em> The Sun JavaDoc for J2SE 1.4 does
|
||||
* not indicate whether this value also subsumes OpenType. OpenType
|
||||
* is essentially the same format as TrueType, but allows to define
|
||||
* glyph shapes in the same way as PostScript, using cubic bezier
|
||||
* curves.
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final int TRUETYPE_FONT = 0;
|
||||
|
||||
|
||||
/**
|
||||
* A flag for <code>layoutGlyphVector</code>, indicating that the
|
||||
* orientation of a text run is from left to right.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int LAYOUT_LEFT_TO_RIGHT = 0;
|
||||
|
||||
|
||||
/**
|
||||
* A flag for <code>layoutGlyphVector</code>, indicating that the
|
||||
* orientation of a text run is from right to left.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int LAYOUT_RIGHT_TO_LEFT = 1;
|
||||
|
||||
|
||||
/**
|
||||
* A flag for <code>layoutGlyphVector</code>, indicating that the
|
||||
* text does not contain valid characters before the
|
||||
* <code>start</code> position. If this flag is set,
|
||||
* <code>layoutGlyphVector</code> does not examine the text before
|
||||
* <code>start</code>, even if this would be necessary to select the
|
||||
* correct glyphs (e.g., for Arabic text).
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int LAYOUT_NO_START_CONTEXT = 2;
|
||||
|
||||
|
||||
/**
|
||||
* A flag for <code>layoutGlyphVector</code>, indicating that the
|
||||
* text does not contain valid characters after the
|
||||
* <code>limit</code> position. If this flag is set,
|
||||
* <code>layoutGlyphVector</code> does not examine the text after
|
||||
* <code>limit</code>, even if this would be necessary to select the
|
||||
* correct glyphs (e.g., for Arabic text).
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
|
||||
|
||||
|
||||
// Serialization constant
|
||||
private static final long serialVersionUID = -4206021311591459213L;
|
||||
|
||||
|
@ -162,7 +222,7 @@ decode(String fontspec)
|
|||
{
|
||||
tokenval = Integer.parseInt(token);
|
||||
}
|
||||
catch(Exception e) { ; }
|
||||
catch(NumberFormatException e) { ; }
|
||||
|
||||
if (tokenval != 0)
|
||||
size = tokenval;
|
||||
|
|
65
libjava/java/awt/FontFormatException.java
Normal file
65
libjava/java/awt/FontFormatException.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* FontFormatException.java -- the specified font is bad
|
||||
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 java.awt;
|
||||
|
||||
/**
|
||||
* Thrown when a specified font is bad.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Font
|
||||
* @since 1.3
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class FontFormatException extends Exception
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.4+.
|
||||
*/
|
||||
private static final long serialVersionUID = -4481290147811361272L;
|
||||
|
||||
/**
|
||||
* Create a new instance with the specified detailed error message.
|
||||
*
|
||||
* @param message the detailed error message
|
||||
*/
|
||||
public FontFormatException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class FontFormatException
|
129
libjava/java/awt/GradientPaint.java
Normal file
129
libjava/java/awt/GradientPaint.java
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* GradientPaint.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 java.awt;
|
||||
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.ColorModel;
|
||||
|
||||
/**
|
||||
* STUB CLASS ONLY
|
||||
*/
|
||||
public class GradientPaint implements Paint
|
||||
{
|
||||
private final float x1;
|
||||
private final float y1;
|
||||
private final Color c1;
|
||||
private final float x2;
|
||||
private final float y2;
|
||||
private final Color c2;
|
||||
private final boolean cyclic;
|
||||
|
||||
public GradientPaint(float x1, float y1, Color c1,
|
||||
float x2, float y2, Color c2)
|
||||
{
|
||||
this(x1, y1, c1, x2, y2, c2, false);
|
||||
}
|
||||
|
||||
public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2)
|
||||
{
|
||||
this((float) p1.getX(), (float) p1.getY(), c1,
|
||||
(float) p2.getX(), (float) p2.getY(), c2, false);
|
||||
}
|
||||
|
||||
public GradientPaint(float x1, float y1, Color c1,
|
||||
float x2, float y2, Color c2, boolean cyclic)
|
||||
{
|
||||
if (c1 == null || c2 == null)
|
||||
throw new NullPointerException();
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.c1 = c1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.c2 = c2;
|
||||
this.cyclic = cyclic;
|
||||
}
|
||||
|
||||
public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2,
|
||||
boolean cyclic)
|
||||
{
|
||||
this((float) p1.getX(), (float) p1.getY(), c1,
|
||||
(float) p2.getX(), (float) p2.getY(), c2, cyclic);
|
||||
}
|
||||
|
||||
public Point2D getPoint1()
|
||||
{
|
||||
return new Point2D.Float(x1, y1);
|
||||
}
|
||||
|
||||
public Color getColor1()
|
||||
{
|
||||
return c1;
|
||||
}
|
||||
|
||||
public Point2D getPoint2()
|
||||
{
|
||||
return new Point2D.Float(x2, y2);
|
||||
}
|
||||
|
||||
public Color getColor2()
|
||||
{
|
||||
return c2;
|
||||
}
|
||||
|
||||
public boolean isCyclic()
|
||||
{
|
||||
return cyclic;
|
||||
}
|
||||
|
||||
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
|
||||
Rectangle2D userBounds,
|
||||
AffineTransform xform,
|
||||
RenderingHints hints)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public int getTransparency()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class GradientPaint
|
106
libjava/java/awt/GraphicsConfigTemplate.java
Normal file
106
libjava/java/awt/GraphicsConfigTemplate.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* GraphicsConfigTemplate.java -- a template for selecting configurations
|
||||
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 java.awt;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This allows filtering an array of GraphicsConfigurations for the best
|
||||
* one based on various requirements. The resulting configuration has had
|
||||
* all non-default attributes set as required to meet or exceed the request.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see GraphicsConfiguration
|
||||
* @see GraphicsDevice
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class GraphicsConfigTemplate implements Serializable
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = -8061369279557787079L;
|
||||
|
||||
/** States that a feature is required to select a configuration. */
|
||||
public static final int REQUIRED = 1;
|
||||
|
||||
/**
|
||||
* States that a feature is preferred, but not required, to select a
|
||||
* configuration. In the case of multiple valid configurations, the tie
|
||||
* breaks in favor of the one with the feature.
|
||||
*/
|
||||
public static final int PREFERRED = 2;
|
||||
|
||||
/**
|
||||
* States that a feature is not necessary in the configuration. In the case
|
||||
* of multiple valid configurations, the tie breaks in favor of the one
|
||||
* without the feature, to reduce overhead.
|
||||
*/
|
||||
public static final int UNNECESSARY = 3;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*/
|
||||
public GraphicsConfigTemplate()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "best" match among the array of possible configurations, given
|
||||
* the criteria of this template.
|
||||
*
|
||||
* @param array the array to choose from
|
||||
* @return the best match
|
||||
* @throws NullPointerException if array is null
|
||||
*/
|
||||
public abstract GraphicsConfiguration getBestConfiguration
|
||||
(GraphicsConfiguration[] array);
|
||||
|
||||
/**
|
||||
* Returns true if the given configuration supports all the features required
|
||||
* by this template.
|
||||
*
|
||||
* @param config the configuration to test
|
||||
* @return true if it is a match
|
||||
* @throws NullPointerException if config is null
|
||||
*/
|
||||
public abstract boolean isGraphicsConfigSupported
|
||||
(GraphicsConfiguration config);
|
||||
} // class GraphicsConfigTemplate
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
||||
/* GraphicsConfiguration.java -- describes characteristics of graphics
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -34,35 +35,184 @@ 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. */
|
||||
|
||||
/* Status: Complete, but commented out until we have the required
|
||||
GraphicsDevice. */
|
||||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.VolatileImage;
|
||||
|
||||
/**
|
||||
* This class describes the configuration of various graphics devices, such
|
||||
* as a monitor or printer. Different configurations may exist for the same
|
||||
* device, according to the different native modes supported.
|
||||
*
|
||||
* <p>Virtual devices are supported (for example, in a multiple screen
|
||||
* environment, a virtual device covers all screens simultaneously); the
|
||||
* configuration will have a non-zero relative coordinate system in such
|
||||
* a case.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Window
|
||||
* @see Frame
|
||||
* @see GraphicsEnvironment
|
||||
* @see GraphicsDevice
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class GraphicsConfiguration
|
||||
{
|
||||
// Can't instantiate directly. Having a protected constructor seems
|
||||
// redundant, but that is what the docs specify.
|
||||
/**
|
||||
* The default constructor.
|
||||
*
|
||||
* @see GraphicsDevice#getConfigurations()
|
||||
* @see GraphicsDevice#getDefaultConfiguration()
|
||||
* @see GraphicsDevice#getBestConfiguration(GraphicsConfigTemplate)
|
||||
* @see Graphics2D#getDeviceConfiguration()
|
||||
*/
|
||||
protected GraphicsConfiguration ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Gets the associated device that this configuration describes.
|
||||
*
|
||||
* @return the device
|
||||
*/
|
||||
public abstract GraphicsDevice getDevice();
|
||||
*/
|
||||
|
||||
public abstract BufferedImage createCompatibleImage(int width, int height);
|
||||
public abstract BufferedImage createCompatibleImage(int width, int height,
|
||||
/**
|
||||
* Returns a buffered image optimized to this device, so that blitting can
|
||||
* be supported in the buffered image.
|
||||
*
|
||||
* @param w the width of the buffer
|
||||
* @param h the height of the buffer
|
||||
* @return the buffered image, or null if none is supported
|
||||
*/
|
||||
public abstract BufferedImage createCompatibleImage(int w, int h);
|
||||
|
||||
/**
|
||||
* Returns a buffered volatile image optimized to this device, so that
|
||||
* blitting can be supported in the buffered image. Because the buffer is
|
||||
* volatile, it can be optimized by native graphics accelerators.
|
||||
*
|
||||
* @param w the width of the buffer
|
||||
* @param h the height of the buffer
|
||||
* @return the buffered image, or null if none is supported
|
||||
* @see Component#createVolatileImage(int, int)
|
||||
* @since 1.4
|
||||
*/
|
||||
public abstract VolatileImage createCompatibleVolatileImage(int w, int h);
|
||||
|
||||
/**
|
||||
* Returns a buffered volatile image optimized to this device, and with the
|
||||
* given capabilities, so that blitting can be supported in the buffered
|
||||
* image. Because the buffer is volatile, it can be optimized by native
|
||||
* graphics accelerators.
|
||||
*
|
||||
* @param w the width of the buffer
|
||||
* @param h the height of the buffer
|
||||
* @param caps the desired capabilities of the image buffer
|
||||
* @return the buffered image, or null if none is supported
|
||||
* @throws AWTException if the capabilities cannot be met
|
||||
* @since 1.4
|
||||
*/
|
||||
public VolatileImage createCompatibleVolatileImage(int w, int h,
|
||||
ImageCapabilities caps)
|
||||
throws AWTException
|
||||
{
|
||||
throw new AWTException("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffered image optimized to this device, and with the specified
|
||||
* transparency, so that blitting can be supported in the buffered image.
|
||||
*
|
||||
* @param w the width of the buffer
|
||||
* @param h the height of the buffer
|
||||
* @param transparency the transparency of the buffer
|
||||
* @return the buffered image, or null if none is supported
|
||||
* @see Transparency#OPAQUE
|
||||
* @see Transparency#BITMASK
|
||||
* @see Transparency#TRANSLUCENT
|
||||
*/
|
||||
public abstract BufferedImage createCompatibleImage(int w, int h,
|
||||
int transparency);
|
||||
|
||||
/**
|
||||
* Gets the color model of the corresponding device.
|
||||
*
|
||||
* @return the color model
|
||||
*/
|
||||
public abstract ColorModel getColorModel();
|
||||
|
||||
/**
|
||||
* Gets a color model for the corresponding device which supports the desired
|
||||
* transparency level.
|
||||
*
|
||||
* @param transparency the transparency of the model
|
||||
* @return the color model, with transparency
|
||||
* @see Transparency#OPAQUE
|
||||
* @see Transparency#BITMASK
|
||||
* @see Transparency#TRANSLUCENT
|
||||
*/
|
||||
public abstract ColorModel getColorModel(int transparency);
|
||||
|
||||
/**
|
||||
* Returns a transform that maps user coordinates to device coordinates. The
|
||||
* preferred mapping is about 72 user units to 1 inch (2.54 cm) of physical
|
||||
* space. This is often the identity transform. The device coordinates have
|
||||
* the origin at the upper left, with increasing x to the right, and
|
||||
* increasing y to the bottom.
|
||||
*
|
||||
* @return the transformation from user space to device space
|
||||
* @see #getNormalizingTransform()
|
||||
*/
|
||||
public abstract AffineTransform getDefaultTransform();
|
||||
|
||||
/**
|
||||
* Returns a transform that maps user coordinates to device coordinates. The
|
||||
* exact mapping is 72 user units to 1 inch (2.54 cm) of physical space.
|
||||
* This is often the identity transform. The device coordinates have the
|
||||
* origin at the upper left, with increasing x to the right, and increasing
|
||||
* y to the bottom. Note that this is more accurate (and thus, sometimes more
|
||||
* costly) than the default transform.
|
||||
*
|
||||
* @return the normalized transformation from user space to device space
|
||||
* @see #getDefaultTransform()
|
||||
*/
|
||||
public abstract AffineTransform getNormalizingTransform();
|
||||
|
||||
/* @since 1.3 */
|
||||
/**
|
||||
* Returns the bounds of the configuration, in device coordinates. If this
|
||||
* is a virtual device (for example, encompassing several screens), the
|
||||
* bounds may have a non-zero origin.
|
||||
*
|
||||
* @return the device bounds
|
||||
* @since 1.3
|
||||
*/
|
||||
public abstract Rectangle getBounds();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the buffering capabilities of this configuration.
|
||||
*
|
||||
* @return the buffer capabilities
|
||||
* @since 1.4
|
||||
*/
|
||||
public BufferCapabilities getBufferCapabilities()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the imaging capabilities of this configuration.
|
||||
*
|
||||
* @return the image capabilities
|
||||
* @since 1.4
|
||||
*/
|
||||
public ImageCapabilities getImageCapabilities()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class GraphicsConfiguration
|
||||
|
|
271
libjava/java/awt/GraphicsDevice.java
Normal file
271
libjava/java/awt/GraphicsDevice.java
Normal file
|
@ -0,0 +1,271 @@
|
|||
/* GraphicsDevice.java -- information about a graphics device
|
||||
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 java.awt;
|
||||
|
||||
/**
|
||||
* This describes a graphics device available to the given environment. This
|
||||
* includes screen and printer devices, and the different configurations for
|
||||
* each device. Also, this allows you to create virtual devices which operate
|
||||
* over a multi-screen environment.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see GraphicsEnvironment
|
||||
* @see GraphicsConfiguration
|
||||
* @since 1.3
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class GraphicsDevice
|
||||
{
|
||||
/** Device is a raster screen. */
|
||||
public static final int TYPE_RASTER_SCREEN = 0;
|
||||
|
||||
/** Device is a printer. */
|
||||
public static final int TYPE_PRINTER = 1;
|
||||
|
||||
/** Device is an image buffer not visible to the user. */
|
||||
public static final int TYPE_IMAGE_BUFFER = 2;
|
||||
|
||||
/** The current full-screen window, or null if there is none. */
|
||||
private Window full_screen;
|
||||
|
||||
/** The current display mode, or null if unknown. */
|
||||
private DisplayMode mode;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*
|
||||
* @see GraphicsEnvironment#getScreenDevices()
|
||||
* @see GraphicsEnvironment#getDefaultScreenDevice()
|
||||
* @see GraphicsConfiguration#getDevice()
|
||||
*/
|
||||
protected GraphicsDevice()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the device.
|
||||
*
|
||||
* @return the device type
|
||||
* @see #TYPE_RASTER_SCREEN
|
||||
* @see #TYPE_PRINTER
|
||||
* @see #TYPE_IMAGE_BUFFER
|
||||
*/
|
||||
public abstract int getType();
|
||||
|
||||
/**
|
||||
* Returns an identification string for the device. This can be
|
||||
* vendor-specific, and may be useful for debugging.
|
||||
*
|
||||
* @return the identification
|
||||
*/
|
||||
public abstract String getIDstring();
|
||||
|
||||
/**
|
||||
* Return all configurations valid for this device.
|
||||
*
|
||||
* @return an array of configurations
|
||||
*/
|
||||
public abstract GraphicsConfiguration[] getConfigurations();
|
||||
|
||||
/**
|
||||
* Return the default configuration for this device.
|
||||
*
|
||||
* @return the default configuration
|
||||
*/
|
||||
public abstract GraphicsConfiguration getDefaultConfiguration();
|
||||
|
||||
/**
|
||||
* Return the best configuration, according to the criteria in the given
|
||||
* template.
|
||||
*
|
||||
* @param template the template to adjust by
|
||||
* @return the best configuration
|
||||
* @throws NullPointerException if template is null
|
||||
*/
|
||||
public GraphicsConfiguration getBestConfiguration
|
||||
(GraphicsConfigTemplate template)
|
||||
{
|
||||
return template.getBestConfiguration(getConfigurations());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the device supports full-screen exclusive mode. The
|
||||
* default implementation returns true; subclass it if this is not the case.
|
||||
*
|
||||
* @return true if full screen support is available
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isFullScreenSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the given window between full screen and normal mode. The previous
|
||||
* full-screen window, if different, is restored; if the given window is
|
||||
* null, no window will be full screen. If
|
||||
* <code>isFullScreenSupported()</code> returns true, full screen mode is
|
||||
* considered to be exclusive, which implies:<ul>
|
||||
* <li>Windows cannot overlap the full-screen window. All other application
|
||||
* windows will always appear beneath the full-screen window in the
|
||||
* Z-order.</li>
|
||||
* <li>Input method windows are disabled. It is advisable to call
|
||||
* <code>Component.enableInputMethods(false)</code> to make a component
|
||||
* a non-client of the input method framework.</li>
|
||||
* </ul><br>
|
||||
* If <code>isFullScreenSupported()</code> returns false, full-screen
|
||||
* exclusive mode is simulated by resizing the window to the size of the
|
||||
* screen and positioning it at (0,0).
|
||||
*
|
||||
* XXX Not yet implemented in Classpath.
|
||||
*
|
||||
* @param w the window to toggle
|
||||
* @see #isFullScreenSupported()
|
||||
* @see getFullScreenWindow()
|
||||
* @see setDisplayMode(DisplayMode)
|
||||
* @see Component#enableInputMethods(boolean)
|
||||
* @since 1.4
|
||||
*/
|
||||
public synchronized void setFullScreenWindow(Window w)
|
||||
{
|
||||
if (full_screen != null)
|
||||
; // XXX Restore the previous window to normal mode.
|
||||
full_screen = w;
|
||||
// XXX If w != null, make it full-screen.
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current full-screen window of the device, or null if no
|
||||
* window is full-screen.
|
||||
*
|
||||
* @return the full-screen window
|
||||
* @see #setFullScreenWindow(Window)
|
||||
* @since 1.4
|
||||
*/
|
||||
public Window getFullScreenWindow()
|
||||
{
|
||||
return full_screen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this device supports low-level display changes. This may
|
||||
* depend on whether full-screen exclusive mode is available.
|
||||
*
|
||||
* XXX The default implementation returns false for now.
|
||||
*
|
||||
* @return true if display changes are supported
|
||||
* @see #setDisplayMode(DisplayMode)
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isDisplayChangeSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display mode. This may be dependent on the availability of
|
||||
* full-screen exclusive mode.
|
||||
*
|
||||
* @param mode the new mode
|
||||
* @throws IllegalArgumentException if the new mode is not in getDisplayModes
|
||||
* @throws UnsupportedOperationException if ! isDisplayChangeSupported()
|
||||
* @see #getDisplayMode()
|
||||
* @see #getDisplayModes()
|
||||
* @see #isDisplayChangeSupported()
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setDisplayMode(DisplayMode mode)
|
||||
{
|
||||
DisplayMode[] array = getDisplayModes();
|
||||
if (! isDisplayChangeSupported())
|
||||
throw new UnsupportedOperationException();
|
||||
int i = array == null ? 0 : array.length;
|
||||
while (--i >= 0)
|
||||
if (array[i].equals(mode))
|
||||
break;
|
||||
if (i < 0)
|
||||
throw new IllegalArgumentException();
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current display mode of this device, or null if unknown.
|
||||
*
|
||||
* @return the current display mode
|
||||
* @see #setDisplayMode(DisplayMode)
|
||||
* @see #getDisplayModes()
|
||||
* @since 1.4
|
||||
*/
|
||||
public DisplayMode getDisplayMode()
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of all available display modes. This implementation
|
||||
* returns a 0-length array, so subclasses must override this.
|
||||
*
|
||||
* @return the array of available modes
|
||||
* @since 1.4
|
||||
*/
|
||||
public DisplayMode[] getDisplayModes()
|
||||
{
|
||||
return new DisplayMode[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of bytes available in accelerated memory on this
|
||||
* device. The device may support creation or caching on a first-come,
|
||||
* first-served basis, depending on the operating system and driver.
|
||||
* Memory may be a finite resource, and because of multi-threading, you
|
||||
* are not guaranteed that the result of this method ensures your image
|
||||
* will successfully be put in accelerated memory. A negative result means
|
||||
* the memory is unlimited. The default implementation assumes no special
|
||||
* memory is available, and returns 0.
|
||||
*
|
||||
* @return the size of accelerated memory available
|
||||
* @see VolatileImage#flush()
|
||||
* @see ImageCapabilities#isAccelerated()
|
||||
*/
|
||||
public int getAvailableAcceleratedMemory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} // class GraphicsDevice
|
210
libjava/java/awt/GraphicsEnvironment.java
Normal file
210
libjava/java/awt/GraphicsEnvironment.java
Normal file
|
@ -0,0 +1,210 @@
|
|||
/* GraphicsEnvironment.java -- information about the graphics environment
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This descibes the collection of GraphicsDevice and Font objects available
|
||||
* on a given platform. The resources might be local or remote, and specify
|
||||
* the valid configurations for displaying graphics.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see GraphicsDevice
|
||||
* @see GraphicsConfiguration
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class GraphicsEnvironment
|
||||
{
|
||||
/**
|
||||
* The environment must be obtained from a factory or query method, hence
|
||||
* this constructor is protected.
|
||||
*/
|
||||
protected GraphicsEnvironment()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local graphics environment.
|
||||
*
|
||||
* XXX Not implemented in Classpath yet.
|
||||
* @return the local environment
|
||||
*/
|
||||
public static GraphicsEnvironment getLocalGraphicsEnvironment()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the local environment is headless, meaning that it does not
|
||||
* support a display, keyboard, or mouse. Many methods in the Abstract
|
||||
* Windows Toolkit (java.awt) throw a {@link HeadlessException} if this
|
||||
* returns true.
|
||||
*
|
||||
* XXX For now, Classpath assumes that it is never headless.
|
||||
*
|
||||
* @return true if the environment is headless, meaning that graphics are
|
||||
* unsupported
|
||||
* @since 1.4
|
||||
*/
|
||||
public static boolean isHeadless()
|
||||
{
|
||||
// XXX Should be: getLocalGraphicsEnvironment().isHeadlessInstance();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given environment is headless, meaning that it does not
|
||||
* support a display, keyboard, or mouse. Many methods in the Abstract
|
||||
* Windows Toolkit (java.awt) throw a {@link HeadlessException} if this
|
||||
* returns true. This default implementation returns false, so subclasses
|
||||
* need only override it if they are headless.
|
||||
*
|
||||
* @return true if the environment is headless, meaning that graphics are
|
||||
* unsupported
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isHeadlessInstance()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of all the GraphicsDevice objects.
|
||||
*
|
||||
* @return the available graphics devices, may be 0 length
|
||||
* @throws HeadlessException if the environment is headless
|
||||
*/
|
||||
public abstract GraphicsDevice[] getScreenDevices();
|
||||
|
||||
/**
|
||||
* Get the default screen GraphicsDevice object.
|
||||
*
|
||||
* @return the default screen device
|
||||
* @throws HeadlessException if the environment is headless
|
||||
*/
|
||||
public abstract GraphicsDevice getDefaultScreenDevice();
|
||||
|
||||
/**
|
||||
* Return a Graphics2D object which will render into the specified image.
|
||||
*
|
||||
* @param image the image to render into
|
||||
* @return the object that renders into the image
|
||||
*/
|
||||
public abstract Graphics2D createGraphics(BufferedImage image);
|
||||
|
||||
/**
|
||||
* Returns an array of the one-point size fonts available in this
|
||||
* environment. From there, the user can select the font and derive the
|
||||
* correct one of proper size and attributes, using <code>deriveFont</code>.
|
||||
* Only one master version of each font appears in this array; if a font
|
||||
* can be derived from another, it must be created in that way.
|
||||
*
|
||||
* @return the array of available fonts
|
||||
* @see #getAvailableFontFamilyNames()
|
||||
* @see Font#deriveFont(int, float)
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract Font[] getAllFonts();
|
||||
|
||||
/**
|
||||
* Returns an array of the font family names available in this environment.
|
||||
* This allows flexibility in choosing the style of font, while still letting
|
||||
* the Font class decide its best match.
|
||||
*
|
||||
* @return the array of available font families
|
||||
* @see #getAllFonts()
|
||||
* @see Font#getFamily()
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract String[] getAvailableFontFamilyNames();
|
||||
|
||||
/**
|
||||
* Returns an array of the font family names available in this environment,
|
||||
* localized to the current Locale if l is non-null. This allows
|
||||
* flexibility in choosing the style of font, while still letting the Font
|
||||
* class decide its best match.
|
||||
*
|
||||
* @param l the locale to use
|
||||
* @return the array of available font families, localized
|
||||
* @see #getAllFonts()
|
||||
* @see Font#getFamily()
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract String[] getAvailableFontFamilyNames(Locale l);
|
||||
|
||||
/**
|
||||
* Returns the point where a window should be centered. You should probably
|
||||
* also check that the window fits within the screen bounds. The default
|
||||
* simply returns the center of the maximum window bounds; subclasses should
|
||||
* override this if native objects (like scrollbars) make that off-centered.
|
||||
*
|
||||
* @return the centering point
|
||||
* @throws HeadlessException if the environment is headless
|
||||
* @see #getMaximumWindowBounds()
|
||||
* @since 1.4
|
||||
*/
|
||||
public Point getCenterPoint()
|
||||
{
|
||||
Rectangle r = getMaximumWindowBounds();
|
||||
return new Point(r.x + r.width / 2, r.y + r.height / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum bounds for a centered window object. The default
|
||||
* implementation simply returns the bounds of the default configuration
|
||||
* of the default screen; subclasses should override this to if native
|
||||
* objects (like scrollbars) reduce what is truly available. Also,
|
||||
* subclasses should override this if the window should be centered across
|
||||
* a multi-screen display.
|
||||
*
|
||||
* @return the maximum window bounds
|
||||
* @throws HeadlessException if the environment is headless
|
||||
* @see #getCenterPoint()
|
||||
* @see GraphicsConfiguration#getBounds()
|
||||
* @see Toolkit#getScreenInsets(GraphicsConfiguration)
|
||||
* @since 1.4
|
||||
*/
|
||||
public Rectangle getMaximumWindowBounds()
|
||||
{
|
||||
return getDefaultScreenDevice().getDefaultConfiguration().getBounds();
|
||||
}
|
||||
} // class GraphicsEnvironment
|
72
libjava/java/awt/HeadlessException.java
Normal file
72
libjava/java/awt/HeadlessException.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* HeadlessException.java -- operation not possible in headless environment
|
||||
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 java.awt;
|
||||
|
||||
/**
|
||||
* This exception is thrown when code dependent on a keyboard, mouse, or
|
||||
* display is executed in a headless environment.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class HeadlessException extends UnsupportedOperationException
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.4+.
|
||||
*/
|
||||
private static final long serialVersionUID = 167183644944358563L;
|
||||
|
||||
/**
|
||||
* Create a new instance with no detailed error message.
|
||||
*/
|
||||
public HeadlessException()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance with the specified detailed error message.
|
||||
*
|
||||
* @param message the detailed error message
|
||||
*/
|
||||
public HeadlessException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class HeadlessException
|
|
@ -1,5 +1,5 @@
|
|||
/* IllegalComponentStateException.java -- Bad component state
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* IllegalComponentStateException.java -- bad component state
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,37 +39,33 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This exception is thrown when the requested operation failed because
|
||||
* a component was not in the proper state.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This exception is thrown when the requested operation failed because
|
||||
* a component was not in the proper state.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class IllegalComponentStateException extends IllegalStateException
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -1889339587208144238L;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>IllegalComponentStateException</code>
|
||||
* with the specified detailed error message.
|
||||
*
|
||||
* @param message The detailed error message.
|
||||
*/
|
||||
public
|
||||
IllegalComponentStateException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>IllegalComponentStateException</code>
|
||||
* with no detailed error message.
|
||||
*/
|
||||
public
|
||||
IllegalComponentStateException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
/**
|
||||
* Create a new instance with no detailed error message.
|
||||
*/
|
||||
public IllegalComponentStateException()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance with the specified detailed error message.
|
||||
*
|
||||
* @param message the detailed error message
|
||||
*/
|
||||
public IllegalComponentStateException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class IllegalComponentStateException
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Image.java -- Java class for images
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* Image.java -- superclass for images
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,160 +38,153 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.image.*;
|
||||
import java.awt.image.AreaAveragingScaleFilter;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.ImageProducer;
|
||||
import java.awt.image.ReplicateScaleFilter;
|
||||
|
||||
/**
|
||||
* This is the abstract superclass of all image objects in Java.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This is the abstract superclass of all image objects in Java.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class Image
|
||||
{
|
||||
/**
|
||||
* This variable is returned whenever a property that is not defined
|
||||
* is requested.
|
||||
*/
|
||||
// For debug purposes, this might as well be a unique string.
|
||||
public static final Object UndefinedProperty
|
||||
= new String("undefined property");
|
||||
|
||||
/*
|
||||
* Static Variables
|
||||
*/
|
||||
/**
|
||||
* Constant indicating that the default scaling algorithm should be used.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public static final int SCALE_DEFAULT = 1;
|
||||
|
||||
/**
|
||||
* Constant indicating that the default scaling algorithm should be used.
|
||||
*/
|
||||
public static final int SCALE_DEFAULT = 1;
|
||||
/**
|
||||
* Constant indicating that a fast scaling algorithm should be used.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public static final int SCALE_FAST = 2;
|
||||
|
||||
/**
|
||||
* Constant indicating that a fast scaling algorithm should be used.
|
||||
*/
|
||||
public static final int SCALE_FAST = 2;
|
||||
/**
|
||||
* Constant indicating that a smooth scaling algorithm should be used.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public static final int SCALE_SMOOTH = 4;
|
||||
|
||||
/**
|
||||
* Constant indicating that a smooth scaling algorithm should be used.
|
||||
*/
|
||||
public static final int SCALE_SMOOTH = 4;
|
||||
/**
|
||||
* Constant indicating that the <code>ReplicateScaleFilter</code> class
|
||||
* algorithm should be used for scaling.
|
||||
*
|
||||
* @see ReplicateScaleFilter
|
||||
* @since 1.1
|
||||
*/
|
||||
public static final int SCALE_REPLICATE = 8;
|
||||
|
||||
/**
|
||||
* Constant indicating that the <code>ReplicateScaleFilter</code> class
|
||||
* algorithm should be used for scaling.
|
||||
*/
|
||||
public static final int SCALE_REPLICATE = 8;
|
||||
/**
|
||||
* Constant indicating that the area averaging scaling algorithm should be
|
||||
* used.
|
||||
*
|
||||
* @see AreaAveragingScaleFilter
|
||||
* @since 1.1
|
||||
*/
|
||||
public static final int SCALE_AREA_AVERAGING = 16;
|
||||
|
||||
/**
|
||||
* Constant indicating that the area averaging scaling algorithm should be
|
||||
* used.
|
||||
*/
|
||||
public static final int SCALE_AREA_AVERAGING = 16;
|
||||
|
||||
/**
|
||||
* This variable is returned whenever a property that is not defined
|
||||
* is requested.
|
||||
*/
|
||||
public static final Object UndefinedProperty = Image.class;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
|
||||
/**
|
||||
* A default constructor for subclasses.
|
||||
*/
|
||||
public
|
||||
Image()
|
||||
{
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the width of the image, or -1 if it is unknown. If the
|
||||
* image width is unknown, the observer object will be notified when
|
||||
* the value is known.
|
||||
*
|
||||
* @param observer The image observer for this object.
|
||||
*/
|
||||
public abstract int
|
||||
getWidth(ImageObserver observer);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the height of the image, or -1 if it is unknown. If the
|
||||
* image height is unknown, the observer object will be notified when
|
||||
* the value is known.
|
||||
*
|
||||
* @param observer The image observer for this object.
|
||||
*/
|
||||
public abstract int
|
||||
getHeight(ImageObserver observer);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the image producer object for this object.
|
||||
*
|
||||
* @return The image producer for this object.
|
||||
*/
|
||||
public abstract ImageProducer
|
||||
getSource();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns a graphics context object for drawing an off-screen object.
|
||||
* This method is only valid for off-screen objects.
|
||||
*
|
||||
* @return A graphics context object for an off-screen object.
|
||||
*/
|
||||
public abstract Graphics
|
||||
getGraphics();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method requests a named property for an object. The value of the
|
||||
* property is returned. The value <code>UndefinedProperty</code> is
|
||||
* returned if there is no property with the specified name. The value
|
||||
* <code>null</code> is returned if the properties for the object are
|
||||
* not yet known. In this case, the specified image observer is notified
|
||||
* when the properties are known.
|
||||
*
|
||||
* @param name The requested property name.
|
||||
* @param observer The image observer for this object.
|
||||
*/
|
||||
public abstract Object
|
||||
getProperty(String name, ImageObserver observer);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Scales the image to the requested dimension.
|
||||
*
|
||||
* XXX: FIXME
|
||||
*
|
||||
* @param width The width of the scaled image.
|
||||
* @param height The height of the scaled image.
|
||||
* @param flags A value indicating the algorithm to use, which will be
|
||||
* set from contants defined in this class.
|
||||
*
|
||||
* @return The scaled <code>Image</code> object.
|
||||
*/
|
||||
public Image
|
||||
getScaledInstance(int width, int height, int flags)
|
||||
/**
|
||||
* A default constructor for subclasses.
|
||||
*/
|
||||
public Image()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the width of the image, or -1 if it is unknown. If the
|
||||
* image width is unknown, the observer object will be notified when
|
||||
* the value is known.
|
||||
*
|
||||
* @param observer the image observer for this object
|
||||
* @return the width in pixels
|
||||
* @see #getHeight(ImageObserver)
|
||||
*/
|
||||
public abstract int getWidth(ImageObserver observer);
|
||||
|
||||
/**
|
||||
* Flushes (that is, destroys) any resources used for this image. This
|
||||
* includes the actual image data.
|
||||
*/
|
||||
public abstract void
|
||||
flush();
|
||||
/**
|
||||
* Returns the height of the image, or -1 if it is unknown. If the
|
||||
* image height is unknown, the observer object will be notified when
|
||||
* the value is known.
|
||||
*
|
||||
* @param observer the image observer for this object
|
||||
* @return the height in pixels
|
||||
* @see #getWidth(ImageObserver)
|
||||
*/
|
||||
public abstract int getHeight(ImageObserver observer);
|
||||
|
||||
/**
|
||||
* Returns the image producer object for this object. The producer is the
|
||||
* object which generates pixels for this image.
|
||||
*
|
||||
* @return the image producer for this object
|
||||
*/
|
||||
public abstract ImageProducer getSource();
|
||||
|
||||
/**
|
||||
* Returns a graphics context object for drawing an off-screen object.
|
||||
* This method is only valid for off-screen objects.
|
||||
*
|
||||
* @return a graphics context object for an off-screen object
|
||||
* @see Graphics#createImage(int, int)
|
||||
*/
|
||||
public abstract Graphics getGraphics();
|
||||
|
||||
/**
|
||||
* This method requests a named property for an object. The value of the
|
||||
* property is returned. The value <code>UndefinedProperty</code> is
|
||||
* returned if there is no property with the specified name. The value
|
||||
* <code>null</code> is returned if the properties for the object are
|
||||
* not yet known. In this case, the specified image observer is notified
|
||||
* when the properties are known.
|
||||
*
|
||||
* @param name the requested property name
|
||||
* @param observer the image observer for this object
|
||||
* @return the named property, if available
|
||||
* @see #UndefinedProperty
|
||||
*/
|
||||
public abstract Object getProperty(String name, ImageObserver observer);
|
||||
|
||||
/**
|
||||
* Scales the image to the requested dimension. A new Image with asynchronous
|
||||
* loading will be produced according to the hints of the algorithm
|
||||
* requested. If either the width or height is non-positive, it is adjusted
|
||||
* to preserve the original aspect ratio.
|
||||
*
|
||||
* @param width the width of the scaled image
|
||||
* @param height the height of the scaled image
|
||||
* @param flags a value indicating the algorithm to use
|
||||
* @return the scaled <code>Image</code> object
|
||||
* @see #SCALE_DEFAULT
|
||||
* @see #SCALE_FAST
|
||||
* @see #SCALE_SMOOTH
|
||||
* @see #SCALE_REPLICATE
|
||||
* @see #SCALE_AREA_AVERAGING
|
||||
* @since 1.1
|
||||
*/
|
||||
public Image getScaledInstance(int width, int height, int flags)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Flushes (that is, destroys) any resources used for this image. This
|
||||
* includes the actual image data.
|
||||
*/
|
||||
public abstract void flush();
|
||||
} // class Image
|
||||
|
||||
|
|
70
libjava/java/awt/ImageCapabilities.java
Normal file
70
libjava/java/awt/ImageCapabilities.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
/* ImageCapabilities.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 java.awt;
|
||||
|
||||
/**
|
||||
* STUBS ONLY
|
||||
*/
|
||||
public class ImageCapabilities implements Cloneable
|
||||
{
|
||||
private final boolean accelerated;
|
||||
public ImageCapabilities(boolean accelerated)
|
||||
{
|
||||
this.accelerated = accelerated;
|
||||
}
|
||||
public boolean isAccelerated()
|
||||
{
|
||||
return accelerated;
|
||||
}
|
||||
public boolean isTrueVolatile()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public Object clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
return super.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
throw (Error) new InternalError().initCause(e); // Impossible
|
||||
}
|
||||
}
|
||||
} // class ImageCapabilities
|
|
@ -1,4 +1,4 @@
|
|||
/* Insets.java -- Information about a container border.
|
||||
/* Insets.java -- information about a container border
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
@ -38,137 +38,121 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
/**
|
||||
* This class represents the "margin" or space around a container.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
public class Insets implements Cloneable, java.io.Serializable
|
||||
{
|
||||
import java.io.Serializable;
|
||||
|
||||
/*
|
||||
* Instance Variable
|
||||
/**
|
||||
* This class represents the "margin" or space around a container.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @status
|
||||
*/
|
||||
|
||||
/**
|
||||
* @serial The top inset
|
||||
*/
|
||||
public int top;
|
||||
|
||||
/**
|
||||
* @serial This bottom inset
|
||||
*/
|
||||
public int bottom;
|
||||
|
||||
/**
|
||||
* @serial The left inset
|
||||
*/
|
||||
public int left;
|
||||
|
||||
/**
|
||||
* @serial The right inset
|
||||
*/
|
||||
public int right;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Inset</code> with the specified
|
||||
* inset values.
|
||||
*
|
||||
* @param top The top inset
|
||||
* @param left The left inset
|
||||
* @param bottom The bottom inset
|
||||
* @param right The right inset
|
||||
*/
|
||||
public
|
||||
Insets(int top, int left, int bottom, int right)
|
||||
public class Insets implements Cloneable, Serializable
|
||||
{
|
||||
this.top = top;
|
||||
this.left = left;
|
||||
this.bottom = bottom;
|
||||
this.right = right;
|
||||
}
|
||||
/**
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -2272572637695466749L;
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* The gap from the top.
|
||||
*
|
||||
* @serial the top inset
|
||||
*/
|
||||
public int top;
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
/**
|
||||
* The gap from the left.
|
||||
*
|
||||
* @serial the left inset
|
||||
*/
|
||||
public int left;
|
||||
|
||||
/**
|
||||
* Tests whether this object is equal to the specified object. This will
|
||||
* be true if and only if the specified object:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>Is not <code>null</code>.
|
||||
* <li>Is an instance of <code>Insets</code>.
|
||||
* <li>Has the same top, bottom, left, and right inset values as this object.
|
||||
* </ul>
|
||||
*
|
||||
* @param obj The object to test against.
|
||||
*
|
||||
* @return <code>true</code> if the specified object is equal to this
|
||||
* one, <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean
|
||||
equals(Object obj)
|
||||
{
|
||||
if (!(obj instanceof Insets))
|
||||
return(false);
|
||||
/**
|
||||
* The gap from the bottom.
|
||||
*
|
||||
* @serial the bottom inset
|
||||
*/
|
||||
public int bottom;
|
||||
|
||||
Insets i = (Insets)obj;
|
||||
/**
|
||||
* The gap from the right.
|
||||
*
|
||||
* @serial the right inset
|
||||
*/
|
||||
public int right;
|
||||
|
||||
if (i.top != top)
|
||||
return(false);
|
||||
if (i.bottom != bottom)
|
||||
return(false);
|
||||
if (i.left != left)
|
||||
return(false);
|
||||
if (i.right != right)
|
||||
return(false);
|
||||
/**
|
||||
* Initializes a new instance of <code>Inset</code> with the specified
|
||||
* inset values.
|
||||
*
|
||||
* @param top the top inset
|
||||
* @param left the left inset
|
||||
* @param bottom the bottom inset
|
||||
* @param right the right inset
|
||||
*/
|
||||
public Insets(int top, int left, int bottom, int right)
|
||||
{
|
||||
this.top = top;
|
||||
this.left = left;
|
||||
this.bottom = bottom;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
/**
|
||||
* Tests whether this object is equal to the specified object. The other
|
||||
* object must be an instance of Insets with identical field values.
|
||||
*
|
||||
* @param obj the object to test against
|
||||
* @return true if the specified object is equal to this one
|
||||
*/
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (! (obj instanceof Insets))
|
||||
return false;
|
||||
Insets i = (Insets) obj;
|
||||
return top == i.top && bottom == i.bottom
|
||||
&& left == i.left && right == i.right;
|
||||
}
|
||||
|
||||
public int
|
||||
hashCode()
|
||||
{
|
||||
return top + bottom + left + right;
|
||||
}
|
||||
/**
|
||||
* Returns a hashcode for this instance. The formula is unspecified, but
|
||||
* appears to be <code>XXX what is it? </code>.
|
||||
*
|
||||
* @return the hashcode
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
// This can't be right...
|
||||
return top + bottom + left + right;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns a string representation of this object, which will be non-null.
|
||||
* The format is unspecified, but appears to be <code>XXX what is it?</code>.
|
||||
*
|
||||
* @return a string representation of this object
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return getClass().getName() + "(top=" + top + ",bottom=" + bottom +
|
||||
",left=" + left + ",right=" + right + ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
*
|
||||
* @return A string representation of this object.
|
||||
*/
|
||||
public String
|
||||
toString()
|
||||
{
|
||||
return(getClass().getName() + "(top=" + top + ",bottom=" + bottom +
|
||||
",left=" + left + ",right=" + right + ")");
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns a copy of this object.
|
||||
*
|
||||
* @return A copy of this object.
|
||||
*/
|
||||
public Object
|
||||
clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
return(super.clone());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return(null);
|
||||
}
|
||||
}
|
||||
|
||||
} // class Insets
|
||||
/**
|
||||
* Returns a copy of this object.
|
||||
*
|
||||
* @return a copy of this object
|
||||
*/
|
||||
public Object clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
return super.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
throw (Error) new InternalError().initCause(e); // Impossible
|
||||
}
|
||||
}
|
||||
} // class Insets
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* ItemSelectable.java -- Items that can be selected
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* ItemSelectable.java -- items that can be selected
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -41,44 +41,35 @@ package java.awt;
|
|||
import java.awt.event.ItemListener;
|
||||
|
||||
/**
|
||||
* This interface is for objects that can have one or more items
|
||||
* selected. For example, radio buttons.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This interface is for objects that can have one or more items selected.
|
||||
* For example, radio buttons.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface ItemSelectable
|
||||
{
|
||||
/**
|
||||
* Returns the list of objects that are selected in this component.
|
||||
*
|
||||
* @return the list of selected objects, or null
|
||||
*/
|
||||
Object[] getSelectedObjects();
|
||||
|
||||
/**
|
||||
* Returns the list of objects that are selected in this component.
|
||||
*
|
||||
* @return The list of objects that are selected, or <code>null</code> if
|
||||
* no objects are selected.
|
||||
*/
|
||||
public abstract Object[]
|
||||
getSelectedObjects();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Adds an item listener to this object. It will receive
|
||||
* selection events for this object.
|
||||
*
|
||||
* @param listener The item listener to add.
|
||||
*/
|
||||
public abstract void
|
||||
addItemListener(ItemListener listener);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Removes an item listener from this object. It will no longer receive
|
||||
* selection change events.
|
||||
*
|
||||
* @param listener The item listener to remove.
|
||||
*/
|
||||
public abstract void
|
||||
removeItemListener(ItemListener listener);
|
||||
/**
|
||||
* Adds an item listener to this object. It will receive selection events
|
||||
* for this object by the user (but not programatically). If listener is
|
||||
* null, it is ignored.
|
||||
*
|
||||
* @param listener the item listener to add
|
||||
*/
|
||||
void addItemListener(ItemListener listener);
|
||||
|
||||
/**
|
||||
* Removes an item listener from this object.
|
||||
*
|
||||
* @param listener the item listener to remove
|
||||
*/
|
||||
void removeItemListener(ItemListener listener);
|
||||
} // interface ItemSelectable
|
||||
|
||||
|
|
500
libjava/java/awt/JobAttributes.java
Normal file
500
libjava/java/awt/JobAttributes.java
Normal file
|
@ -0,0 +1,500 @@
|
|||
/* JobAttributes.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 java.awt;
|
||||
|
||||
/**
|
||||
* Needs documentation...
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.3
|
||||
* @status updated to 1.4, lacks documentation
|
||||
*/
|
||||
public final class JobAttributes implements Cloneable
|
||||
{
|
||||
public static final class DefaultSelectionType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "all", "range", "selection" };
|
||||
public static final DefaultSelectionType ALL
|
||||
= new DefaultSelectionType(0);
|
||||
public static final DefaultSelectionType RANGE
|
||||
= new DefaultSelectionType(1);
|
||||
public static final DefaultSelectionType SELECTION
|
||||
= new DefaultSelectionType(2);
|
||||
private DefaultSelectionType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class DefaultSelectionType
|
||||
|
||||
public static final class DestinationType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "file", "printer" };
|
||||
public static final DestinationType FILE = new DestinationType(0);
|
||||
public static final DestinationType PRINTER = new DestinationType(1);
|
||||
private DestinationType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class DestinationType
|
||||
|
||||
public static final class DialogType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "common", "native", "none" };
|
||||
public static final DialogType COMMON = new DialogType(0);
|
||||
public static final DialogType NATIVE = new DialogType(1);
|
||||
public static final DialogType NONE = new DialogType(2);
|
||||
private DialogType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class DialogType
|
||||
|
||||
public static final class MultipleDocumentHandlingType
|
||||
extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = {
|
||||
"separate-documents-collated-copies",
|
||||
"separate-documents-uncollated-copies"
|
||||
};
|
||||
public static final MultipleDocumentHandlingType
|
||||
SEPARATE_DOCUMENTS_COLLATED_COPIES
|
||||
= new MultipleDocumentHandlingType(0);
|
||||
public static final MultipleDocumentHandlingType
|
||||
SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
|
||||
= new MultipleDocumentHandlingType(1);
|
||||
private MultipleDocumentHandlingType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class MultipleDocumentHandlingType
|
||||
|
||||
public static final class SidesType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES
|
||||
= { "one-sided", "two-sided-long-edge", "two-sided-short-edge" };
|
||||
public static final SidesType ONE_SIDED = new SidesType(0);
|
||||
public static final SidesType TWO_SIDED_LONG_EDGE = new SidesType(1);
|
||||
public static final SidesType TWO_SIDED_SHORT_EDGE = new SidesType(2);
|
||||
private SidesType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class SidesType
|
||||
|
||||
private int copies;
|
||||
private DefaultSelectionType selection;
|
||||
private DestinationType destination;
|
||||
private DialogType dialog;
|
||||
private String filename;
|
||||
private int maxPage;
|
||||
private int minPage;
|
||||
private MultipleDocumentHandlingType multiple;
|
||||
private int[][] pageRanges; // null for default value
|
||||
private int fromPage; // 0 for default value
|
||||
private int toPage; // 0 for default value
|
||||
private String printer;
|
||||
private SidesType sides;
|
||||
|
||||
public JobAttributes()
|
||||
{
|
||||
copies = 1;
|
||||
selection = DefaultSelectionType.ALL;
|
||||
destination = DestinationType.PRINTER;
|
||||
dialog = DialogType.NATIVE;
|
||||
maxPage = Integer.MAX_VALUE;
|
||||
minPage = 1;
|
||||
multiple
|
||||
= MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES;
|
||||
sides = SidesType.ONE_SIDED;
|
||||
}
|
||||
|
||||
public JobAttributes(JobAttributes attr)
|
||||
{
|
||||
set(attr);
|
||||
}
|
||||
|
||||
public JobAttributes(int copies, DefaultSelectionType selection,
|
||||
DestinationType destination, DialogType dialog,
|
||||
String filename, int max, int min,
|
||||
MultipleDocumentHandlingType multiple,
|
||||
int[][] pageRanges, String printer, SidesType sides)
|
||||
{
|
||||
if (copies <= 0 || selection == null || destination == null
|
||||
|| dialog == null || max < min || min <= 0 || multiple == null
|
||||
|| sides == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.copies = copies;
|
||||
this.selection = selection;
|
||||
this.destination = destination;
|
||||
this.dialog = dialog;
|
||||
this.filename = filename;
|
||||
maxPage = max;
|
||||
minPage = min;
|
||||
this.multiple = multiple;
|
||||
setPageRanges(pageRanges);
|
||||
this.printer = printer;
|
||||
this.sides = sides;
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
{
|
||||
return new JobAttributes(this);
|
||||
}
|
||||
|
||||
public void set(JobAttributes attr)
|
||||
{
|
||||
copies = attr.copies;
|
||||
selection = attr.selection;
|
||||
destination = attr.destination;
|
||||
dialog = attr.dialog;
|
||||
filename = attr.filename;
|
||||
maxPage = attr.maxPage;
|
||||
minPage = attr.minPage;
|
||||
multiple = attr.multiple;
|
||||
pageRanges = (int[][]) attr.pageRanges.clone();
|
||||
printer = attr.printer;
|
||||
sides = attr.sides;
|
||||
fromPage = attr.fromPage;
|
||||
toPage = attr.toPage;
|
||||
}
|
||||
|
||||
public int getCopies()
|
||||
{
|
||||
return copies;
|
||||
}
|
||||
|
||||
public void setCopies(int copies)
|
||||
{
|
||||
if (copies <= 0)
|
||||
throw new IllegalArgumentException();
|
||||
this.copies = copies;
|
||||
}
|
||||
|
||||
public void setCopiesToDefault()
|
||||
{
|
||||
copies = 1;
|
||||
}
|
||||
|
||||
public DefaultSelectionType getDefaultSelection()
|
||||
{
|
||||
return selection;
|
||||
}
|
||||
|
||||
public void setDefaultSelection(DefaultSelectionType selection)
|
||||
{
|
||||
if (selection == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.selection = selection;
|
||||
}
|
||||
|
||||
public DestinationType getDestination()
|
||||
{
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(DestinationType destination)
|
||||
{
|
||||
if (destination == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
public DialogType getDialog()
|
||||
{
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setDialog(DialogType dialog)
|
||||
{
|
||||
if (dialog == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFileName(String filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public int getFromPage()
|
||||
{
|
||||
return fromPage != 0 ? fromPage
|
||||
: pageRanges != null ? pageRanges[0][0]
|
||||
: toPage != 0 ? toPage : minPage;
|
||||
}
|
||||
|
||||
public void setFromPage(int fromPage)
|
||||
{
|
||||
if (fromPage < minPage || (fromPage > toPage && toPage != 0)
|
||||
|| fromPage > maxPage)
|
||||
throw new IllegalArgumentException();
|
||||
if (pageRanges == null)
|
||||
this.fromPage = fromPage;
|
||||
}
|
||||
|
||||
public int getMaxPage()
|
||||
{
|
||||
return maxPage;
|
||||
}
|
||||
|
||||
public void setMaxPage(int maxPage)
|
||||
{
|
||||
if (maxPage < minPage)
|
||||
throw new IllegalArgumentException();
|
||||
this.maxPage = maxPage;
|
||||
if (maxPage < fromPage)
|
||||
fromPage = maxPage;
|
||||
if (maxPage < toPage)
|
||||
toPage = maxPage;
|
||||
if (pageRanges != null)
|
||||
{
|
||||
int i = pageRanges.length - 1;
|
||||
while (i >= 0 && maxPage < pageRanges[i][1])
|
||||
i--;
|
||||
if (maxPage >= pageRanges[++i][0])
|
||||
pageRanges[i++][1] = maxPage;
|
||||
if (i == 0)
|
||||
pageRanges = null;
|
||||
else if (i < pageRanges.length)
|
||||
{
|
||||
int[][] tmp = new int[i][];
|
||||
System.arraycopy(pageRanges, 0, tmp, 0, i);
|
||||
pageRanges = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMinPage()
|
||||
{
|
||||
return minPage;
|
||||
}
|
||||
|
||||
public void setMinPage(int minPage)
|
||||
{
|
||||
if (minPage <= 0 || minPage > maxPage)
|
||||
throw new IllegalArgumentException();
|
||||
this.minPage = minPage;
|
||||
if (minPage > toPage)
|
||||
toPage = minPage;
|
||||
if (minPage > fromPage)
|
||||
fromPage = minPage;
|
||||
if (pageRanges != null)
|
||||
{
|
||||
int size = pageRanges.length;
|
||||
int i = 0;
|
||||
while (i < size && minPage > pageRanges[i][0])
|
||||
i++;
|
||||
if (minPage <= pageRanges[i - 1][1])
|
||||
pageRanges[--i][0] = minPage;
|
||||
if (i == size)
|
||||
pageRanges = null;
|
||||
else if (i > 0)
|
||||
{
|
||||
int[][] tmp = new int[size - i][];
|
||||
System.arraycopy(pageRanges, i, tmp, 0, size - i);
|
||||
pageRanges = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MultipleDocumentHandlingType getMultipleDocumentHandling()
|
||||
{
|
||||
return multiple;
|
||||
}
|
||||
|
||||
public void setMultipleDocumentHandling
|
||||
(MultipleDocumentHandlingType multiple)
|
||||
{
|
||||
if (multiple == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.multiple = multiple;
|
||||
}
|
||||
|
||||
public void setMultipleDocumentHandlingToDefault()
|
||||
{
|
||||
multiple
|
||||
= MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES;
|
||||
}
|
||||
|
||||
public int[][] getPageRanges()
|
||||
{
|
||||
if (pageRanges == null)
|
||||
return new int[][] { { getFromPage(), getToPage() } };
|
||||
// Perform a deep clone, so user code cannot affect original arrays.
|
||||
int i = pageRanges.length;
|
||||
int[][] result = new int[i][];
|
||||
while (--i >= 0)
|
||||
result[i] = (int[]) pageRanges[i].clone();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setPageRanges(int[][] pageRanges)
|
||||
{
|
||||
int size = pageRanges == null ? 0 : pageRanges.length;
|
||||
if (size == 0)
|
||||
throw new IllegalArgumentException();
|
||||
while (--size >= 0)
|
||||
{
|
||||
int[] range = pageRanges[size];
|
||||
if (range == null || range.length != 2
|
||||
|| range[0] < minPage || range[1] < range[0] || range[1] > maxPage
|
||||
|| (size != 0 && range[0] <= pageRanges[size - 1][1]))
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
size = pageRanges.length;
|
||||
if (fromPage > 0 && pageRanges[0][0] > fromPage)
|
||||
fromPage = pageRanges[0][0];
|
||||
if (toPage > 0 && pageRanges[size - 1][1] < toPage)
|
||||
toPage = pageRanges[size - 1][1];
|
||||
this.pageRanges = new int[size][];
|
||||
while (--size >= 0)
|
||||
this.pageRanges[size] = (int[]) pageRanges[size].clone();
|
||||
}
|
||||
|
||||
public String getPrinter()
|
||||
{
|
||||
return printer;
|
||||
}
|
||||
|
||||
public void setPrinter(String printer)
|
||||
{
|
||||
this.printer = printer;
|
||||
}
|
||||
|
||||
public SidesType getSides()
|
||||
{
|
||||
return sides;
|
||||
}
|
||||
|
||||
public void setSides(SidesType sides)
|
||||
{
|
||||
if (sides == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.sides = sides;
|
||||
}
|
||||
|
||||
public void setSidesToDefault()
|
||||
{
|
||||
sides = SidesType.ONE_SIDED;
|
||||
}
|
||||
|
||||
public int getToPage()
|
||||
{
|
||||
return toPage != 0 ? toPage
|
||||
: pageRanges != null ? pageRanges[pageRanges.length - 1][1]
|
||||
: fromPage != 0 ? fromPage : maxPage;
|
||||
}
|
||||
|
||||
public void setToPage(int toPage)
|
||||
{
|
||||
if (toPage < minPage || (fromPage > toPage && fromPage != 0)
|
||||
|| toPage > maxPage)
|
||||
throw new IllegalArgumentException();
|
||||
if (pageRanges == null)
|
||||
this.toPage = toPage;
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o)
|
||||
return true;
|
||||
if (! (o instanceof JobAttributes))
|
||||
return false;
|
||||
JobAttributes ja = (JobAttributes) o;
|
||||
if (copies != ja.copies || selection != ja.selection
|
||||
|| destination != ja.destination || dialog != ja.dialog
|
||||
|| ! filename.equals(ja.filename) || maxPage != ja.maxPage
|
||||
|| minPage != ja.minPage || multiple != ja.multiple
|
||||
|| fromPage != ja.fromPage || toPage != ja.toPage
|
||||
|| ! printer.equals(ja.printer) || sides != ja.sides
|
||||
|| (pageRanges == null) != (ja.pageRanges == null))
|
||||
return false;
|
||||
if (pageRanges != ja.pageRanges)
|
||||
for (int i = pageRanges.length; --i >= 0; )
|
||||
if (pageRanges[i][0] != ja.pageRanges[i][0]
|
||||
|| pageRanges[i][1] != ja.pageRanges[i][1])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = (selection.value << 6) ^ (destination.value << 5)
|
||||
^ (dialog.value << 3) ^ (multiple.value << 2) ^ sides.value
|
||||
^ (filename == null ? 0 : filename.hashCode())
|
||||
^ (printer == null ? 0 : printer.hashCode());
|
||||
// The effect of the above fields on the hashcode match the JDK. However,
|
||||
// I am unable to reverse engineer the effect of the fields listed below,
|
||||
// so I am using my own implementation. Note that this still satisfies
|
||||
// the general contract of hashcode, it just doesn't match the JDK.
|
||||
hash ^= (copies << 27) ^ (maxPage << 22) ^ (minPage << 17);
|
||||
if (pageRanges == null)
|
||||
hash ^= (getFromPage() << 13) ^ (getToPage() << 8);
|
||||
else
|
||||
for (int i = pageRanges.length; --i >= 0; )
|
||||
hash ^= (pageRanges[i][0] << 13) ^ (pageRanges[i][1] << 8);
|
||||
return hash;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer s = new StringBuffer("copies=").append(copies)
|
||||
.append(",defaultSelection=").append(selection).append(",destination=")
|
||||
.append(destination).append(",dialog=").append(dialog)
|
||||
.append(",fileName=").append(filename).append(",fromPage=")
|
||||
.append(getFromPage()).append(",maxPage=").append(maxPage)
|
||||
.append(",minPage=").append(minPage)
|
||||
.append(",multiple-document-handling=").append(multiple)
|
||||
.append(",page-ranges=[");
|
||||
if (pageRanges == null)
|
||||
s.append(minPage).append(':').append(minPage).append(']');
|
||||
else
|
||||
for (int i = 0; i < pageRanges.length; i++)
|
||||
s.append(pageRanges[i][0]).append(':').append(pageRanges[i][1])
|
||||
.append(',');
|
||||
s.setLength(s.length() - 1);
|
||||
return s.append("],printer=").append(printer).append(",sides=")
|
||||
.append(sides).append(",toPage=").append(getToPage()).toString();
|
||||
}
|
||||
} // class JobAttributes
|
82
libjava/java/awt/KeyEventDispatcher.java
Normal file
82
libjava/java/awt/KeyEventDispatcher.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
/* KeyEventDispatcher.java -- dispatches key events
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* An instance of this interface coordinates with a KeyboardFocusManager to
|
||||
* target and dispatch all key events. This allows retargeting, consuming,
|
||||
* changing, or otherwise manipulating the key event before sending it on to
|
||||
* a target.
|
||||
*
|
||||
* <p>By default, the KeyboardFocusManager is the sink for all key events not
|
||||
* dispatched by other dispatchers. Therefore, it is unnecessary for the user
|
||||
* to register the focus manager as a dispatcher.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)
|
||||
* @see KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface KeyEventDispatcher
|
||||
{
|
||||
/**
|
||||
* Called by the KeyboardFocusManager to request that a key event be
|
||||
* dispatched. The dispatcher is free to retarget the event, consume it,
|
||||
* dispatch it, or make other changes. This is usually done to allow
|
||||
* delivery of key events to objects other than the window in focus, such
|
||||
* as for navigating non-focusable components. If this dispatcher chooses
|
||||
* to dispatch the event itself, it should call <code>redispatchEvent</code>
|
||||
* to avoid infinite recursion.
|
||||
*
|
||||
* <p>If the return value is false, the KeyEvent is passed to the next
|
||||
* dispatcher in the chain, ending with the KeyboardFocusManager. If the
|
||||
* return value is true, the event has been consumed (although it might
|
||||
* have been ignored), and no further action will be taken on the event. Be
|
||||
* sure to check whether the event was consumed before dispatching it
|
||||
* further.
|
||||
*
|
||||
* @param e the key event
|
||||
* @return true if the event has been consumed
|
||||
* @see KeyboardFocusManager#redispatchEvent(Component, AWTEvent)
|
||||
*/
|
||||
boolean dispatchKeyEvent(KeyEvent e);
|
||||
} // interface KeyEventDispatcher
|
81
libjava/java/awt/KeyEventPostProcessor.java
Normal file
81
libjava/java/awt/KeyEventPostProcessor.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
/* KeyEventPostProcessor.java -- performs actions after a key event dispatch
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* An instance of this interface coordinates with a KeyboardFocusManager to
|
||||
* target and dispatch all key events that are otherwise unconsumed. This
|
||||
* allows events which take place when nothing has focus to still operate,
|
||||
* such as menu keyboard shortcuts.
|
||||
*
|
||||
* <p>By default, the KeyboardFocusManager is the sink for all key events not
|
||||
* post-processed elsewhere. Therefore, it is unnecessary for the user
|
||||
* to register the focus manager as a dispatcher.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)
|
||||
* @see KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface KeyEventPostProcessor
|
||||
{
|
||||
/**
|
||||
* Called by the KeyboardFocusManager to request that a key event be
|
||||
* post-processed. Typically, the event has already been dispatched and
|
||||
* handled, unless no object has focus. Thus, this allows global event
|
||||
* handling for things like menu shortcuts. If this post-processor chooses
|
||||
* to dispatch the event, it should call <code>redispatchEvent</code>
|
||||
* to avoid infinite recursion.
|
||||
*
|
||||
* <p>If the return value is false, the KeyEvent is passed to the next
|
||||
* dispatcher in the chain, ending with the KeyboardFocusManager. If the
|
||||
* return value is true, the event has been consumed (although it might
|
||||
* have been ignored), and no further action will be taken on the event. Be
|
||||
* sure to check whether the event was consumed before dispatching it
|
||||
* further.
|
||||
*
|
||||
* @param e the key event
|
||||
* @return true if the event has been consumed
|
||||
* @see KeyboardFocusManager#redispatchEvent(Component, AWTEvent)
|
||||
*/
|
||||
boolean postProcessKeyEvent(KeyEvent e);
|
||||
} // interface KeyEventPostProcessor
|
556
libjava/java/awt/KeyboardFocusManager.java
Normal file
556
libjava/java/awt/KeyboardFocusManager.java
Normal file
|
@ -0,0 +1,556 @@
|
|||
/* KeyboardFocusManager.java -- manage component focusing via the keyboard
|
||||
Copyright (C) 2002 Free Software Foundation
|
||||
|
||||
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 java.awt;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.beans.VetoableChangeSupport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.4
|
||||
* @status partially updated to 1.4, needs documentation.
|
||||
*/
|
||||
public abstract class KeyboardFocusManager
|
||||
implements KeyEventDispatcher, KeyEventPostProcessor
|
||||
{
|
||||
public static final int FORWARD_TRAVERSAL_KEYS = 0;
|
||||
public static final int BACKWARD_TRAVERSAL_KEYS = 1;
|
||||
public static final int UP_CYCLE_TRAVERSAL_KEYS = 2;
|
||||
public static final int DOWN_CYCLE_TRAVERSAL_KEYS = 3;
|
||||
|
||||
private static final Set DEFAULT_FORWARD_KEYS;
|
||||
private static final Set DEFAULT_BACKWARD_KEYS;
|
||||
static
|
||||
{
|
||||
Set s = new HashSet();
|
||||
s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0));
|
||||
s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
|
||||
KeyEvent.CTRL_DOWN_MASK));
|
||||
DEFAULT_FORWARD_KEYS = Collections.unmodifiableSet(s);
|
||||
s = new HashSet();
|
||||
s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
|
||||
KeyEvent.SHIFT_DOWN_MASK));
|
||||
s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
|
||||
KeyEvent.SHIFT_DOWN_MASK
|
||||
| KeyEvent.CTRL_DOWN_MASK));
|
||||
DEFAULT_BACKWARD_KEYS = Collections.unmodifiableSet(s);
|
||||
}
|
||||
|
||||
private static KeyboardFocusManager current
|
||||
= new DefaultKeyboardFocusManager();
|
||||
|
||||
// XXX Not implemented correctly. I think a good implementation here may
|
||||
// be to have permanentFocusOwner be null, and fall back to focusOwner,
|
||||
// unless a temporary focus change is in effect.
|
||||
private static Component focusOwner;
|
||||
private static Component permanentFocusOwner;
|
||||
|
||||
private static Window focusedWindow;
|
||||
private static Window activeWindow;
|
||||
private static Container focusCycleRoot;
|
||||
|
||||
private FocusTraversalPolicy defaultPolicy;
|
||||
private Set[] defaultFocusKeys = new Set[] {
|
||||
DEFAULT_FORWARD_KEYS, DEFAULT_BACKWARD_KEYS,
|
||||
Collections.EMPTY_SET, Collections.EMPTY_SET
|
||||
};
|
||||
|
||||
private final PropertyChangeSupport propertyChangeSupport
|
||||
= new PropertyChangeSupport(this);
|
||||
private final VetoableChangeSupport vetoableChangeSupport
|
||||
= new VetoableChangeSupport(this);
|
||||
private final ArrayList keyEventDispatchers = new ArrayList();
|
||||
private final ArrayList keyEventPostProcessors = new ArrayList();
|
||||
|
||||
|
||||
public KeyboardFocusManager()
|
||||
{
|
||||
}
|
||||
|
||||
public static KeyboardFocusManager getCurrentKeyboardFocusManager()
|
||||
{
|
||||
// XXX Need a way to divide this into contexts.
|
||||
return current;
|
||||
}
|
||||
|
||||
public static void setCurrentKeyboardFocusManager(KeyboardFocusManager m)
|
||||
{
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new AWTPermission("replaceKeyboardFocusManager"));
|
||||
// XXX Need a way to divide this into contexts.
|
||||
current = m == null ? new DefaultKeyboardFocusManager() : m;
|
||||
}
|
||||
|
||||
public Component getFocusOwner()
|
||||
{
|
||||
// XXX Need an easy way to test if this thread is in the context of the
|
||||
// global focus owner, to avoid creating the exception in the first place.
|
||||
try
|
||||
{
|
||||
return getGlobalFocusOwner();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Component getGlobalFocusOwner()
|
||||
{
|
||||
// XXX Need a way to test if this thread is in the context of the focus
|
||||
// owner, and throw a SecurityException if that is the case.
|
||||
// XXX Implement.
|
||||
return focusOwner;
|
||||
}
|
||||
|
||||
protected void setGlobalFocusOwner(Component owner)
|
||||
{
|
||||
// XXX Should this send focus events to the components involved?
|
||||
if (owner == null || owner.focusable)
|
||||
{
|
||||
firePropertyChange("focusOwner", focusOwner, owner);
|
||||
try
|
||||
{
|
||||
fireVetoableChange("focusOwner", focusOwner, owner);
|
||||
focusOwner = owner;
|
||||
}
|
||||
catch (PropertyVetoException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearGlobalFocusOwner()
|
||||
{
|
||||
// XXX Is this enough?
|
||||
setGlobalFocusOwner(null);
|
||||
}
|
||||
|
||||
public Component getPermanentFocusOwner()
|
||||
{
|
||||
// XXX Need an easy way to test if this thread is in the context of the
|
||||
// global focus owner, to avoid creating the exception in the first place.
|
||||
try
|
||||
{
|
||||
return getGlobalPermanentFocusOwner();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Component getGlobalPermanentFocusOwner()
|
||||
{
|
||||
// XXX Need a way to test if this thread is in the context of the focus
|
||||
// owner, and throw a SecurityException if that is the case.
|
||||
// XXX Implement.
|
||||
return permanentFocusOwner == null ? focusOwner : permanentFocusOwner;
|
||||
}
|
||||
|
||||
protected void setGlobalPermanentFocusOwner(Component focusOwner)
|
||||
{
|
||||
// XXX Should this send focus events to the components involved?
|
||||
if (focusOwner == null || focusOwner.focusable)
|
||||
{
|
||||
firePropertyChange("permanentFocusOwner", permanentFocusOwner,
|
||||
focusOwner);
|
||||
try
|
||||
{
|
||||
fireVetoableChange("permanentFocusOwner", permanentFocusOwner,
|
||||
focusOwner);
|
||||
permanentFocusOwner = focusOwner;
|
||||
}
|
||||
catch (PropertyVetoException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Window getFocusedWindow()
|
||||
{
|
||||
// XXX Need an easy way to test if this thread is in the context of the
|
||||
// global focus owner, to avoid creating the exception in the first place.
|
||||
try
|
||||
{
|
||||
return getGlobalFocusedWindow();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Window getGlobalFocusedWindow()
|
||||
{
|
||||
// XXX Need a way to test if this thread is in the context of the focus
|
||||
// owner, and throw a SecurityException if that is the case.
|
||||
// XXX Implement.
|
||||
return focusedWindow;
|
||||
}
|
||||
|
||||
protected void setGlobalFocusedWindow(Window window)
|
||||
{
|
||||
// XXX Should this send focus events to the windows involved?
|
||||
if (window == null || window.focusable)
|
||||
{
|
||||
firePropertyChange("focusedWindow", focusedWindow, window);
|
||||
try
|
||||
{
|
||||
fireVetoableChange("focusedWindow", focusedWindow, window);
|
||||
focusedWindow = window;
|
||||
}
|
||||
catch (PropertyVetoException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Window getActiveWindow()
|
||||
{
|
||||
// XXX Need an easy way to test if this thread is in the context of the
|
||||
// global focus owner, to avoid creating the exception in the first place.
|
||||
try
|
||||
{
|
||||
return getGlobalActiveWindow();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Window getGlobalActiveWindow()
|
||||
{
|
||||
// XXX Need a way to test if this thread is in the context of the focus
|
||||
// owner, and throw a SecurityException if that is the case.
|
||||
// XXX Implement.
|
||||
return activeWindow;
|
||||
}
|
||||
|
||||
protected void setGlobalActiveWindow(Window window)
|
||||
{
|
||||
// XXX Should this send focus events to the windows involved?
|
||||
firePropertyChange("activeWindow", activeWindow, window);
|
||||
try
|
||||
{
|
||||
fireVetoableChange("activeWindow", activeWindow, window);
|
||||
activeWindow = window;
|
||||
}
|
||||
catch (PropertyVetoException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
|
||||
{
|
||||
if (defaultPolicy == null)
|
||||
defaultPolicy = new DefaultFocusTraversalPolicy();
|
||||
return defaultPolicy;
|
||||
}
|
||||
|
||||
public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy policy)
|
||||
{
|
||||
if (policy == null)
|
||||
throw new IllegalArgumentException();
|
||||
firePropertyChange("defaultFocusTraversalPolicy", defaultPolicy, policy);
|
||||
defaultPolicy = policy;
|
||||
}
|
||||
|
||||
public void setDefaultFocusTraversalKeys(int id, Set keystrokes)
|
||||
{
|
||||
if (keystrokes == null)
|
||||
throw new IllegalArgumentException();
|
||||
Set sa;
|
||||
Set sb;
|
||||
Set sc;
|
||||
String type;
|
||||
switch (id)
|
||||
{
|
||||
case FORWARD_TRAVERSAL_KEYS:
|
||||
sa = defaultFocusKeys[BACKWARD_TRAVERSAL_KEYS];
|
||||
sb = defaultFocusKeys[UP_CYCLE_TRAVERSAL_KEYS];
|
||||
sc = defaultFocusKeys[DOWN_CYCLE_TRAVERSAL_KEYS];
|
||||
type = "forwardDefaultFocusTraversalKeys";
|
||||
break;
|
||||
case BACKWARD_TRAVERSAL_KEYS:
|
||||
sa = defaultFocusKeys[FORWARD_TRAVERSAL_KEYS];
|
||||
sb = defaultFocusKeys[UP_CYCLE_TRAVERSAL_KEYS];
|
||||
sc = defaultFocusKeys[DOWN_CYCLE_TRAVERSAL_KEYS];
|
||||
type = "backwardDefaultFocusTraversalKeys";
|
||||
break;
|
||||
case UP_CYCLE_TRAVERSAL_KEYS:
|
||||
sa = defaultFocusKeys[FORWARD_TRAVERSAL_KEYS];
|
||||
sb = defaultFocusKeys[BACKWARD_TRAVERSAL_KEYS];
|
||||
sc = defaultFocusKeys[DOWN_CYCLE_TRAVERSAL_KEYS];
|
||||
type = "upCycleDefaultFocusTraversalKeys";
|
||||
break;
|
||||
case DOWN_CYCLE_TRAVERSAL_KEYS:
|
||||
sa = defaultFocusKeys[FORWARD_TRAVERSAL_KEYS];
|
||||
sb = defaultFocusKeys[BACKWARD_TRAVERSAL_KEYS];
|
||||
sc = defaultFocusKeys[UP_CYCLE_TRAVERSAL_KEYS];
|
||||
type = "downCycleDefaultFocusTraversalKeys";
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
int i = keystrokes.size();
|
||||
Iterator iter = keystrokes.iterator();
|
||||
while (--i >= 0)
|
||||
{
|
||||
Object o = iter.next();
|
||||
if (! (o instanceof AWTKeyStroke)
|
||||
|| sa.contains(o) || sb.contains(o) || sc.contains(o)
|
||||
|| ((AWTKeyStroke) o).keyCode == KeyEvent.VK_UNDEFINED)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
keystrokes = Collections.unmodifiableSet(new HashSet(keystrokes));
|
||||
firePropertyChange(type, defaultFocusKeys[id], keystrokes);
|
||||
defaultFocusKeys[id] = keystrokes;
|
||||
}
|
||||
|
||||
public Set getDefaultFocusTraversalKeys(int id)
|
||||
{
|
||||
if (id < FORWARD_TRAVERSAL_KEYS || id > DOWN_CYCLE_TRAVERSAL_KEYS)
|
||||
throw new IllegalArgumentException();
|
||||
return defaultFocusKeys[id];
|
||||
}
|
||||
|
||||
public Container getCurrentFocusCycleRoot()
|
||||
{
|
||||
// XXX Need an easy way to test if this thread is in the context of the
|
||||
// global focus owner, to avoid creating the exception in the first place.
|
||||
try
|
||||
{
|
||||
return getGlobalCurrentFocusCycleRoot();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Container getGlobalCurrentFocusCycleRoot()
|
||||
{
|
||||
// XXX Need a way to test if this thread is in the context of the focus
|
||||
// owner, and throw a SecurityException if that is the case.
|
||||
// XXX Implement.
|
||||
return focusCycleRoot;
|
||||
}
|
||||
|
||||
protected void setGlobalCurrentFocusCycleRoot(Container cycleRoot)
|
||||
{
|
||||
firePropertyChange("currentFocusCycleRoot", focusCycleRoot, cycleRoot);
|
||||
focusCycleRoot = cycleRoot;
|
||||
}
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(PropertyChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
public PropertyChangeListener[] getPropertyChangeListeners()
|
||||
{
|
||||
return propertyChangeSupport.getPropertyChangeListeners();
|
||||
}
|
||||
|
||||
public void addPropertyChangeListener(String name, PropertyChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
propertyChangeSupport.addPropertyChangeListener(name, l);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(String name,
|
||||
PropertyChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
propertyChangeSupport.removePropertyChangeListener(name, l);
|
||||
}
|
||||
|
||||
public PropertyChangeListener[] getPropertyChangeListeners(String name)
|
||||
{
|
||||
return propertyChangeSupport.getPropertyChangeListeners(name);
|
||||
}
|
||||
|
||||
protected void firePropertyChange(String name, Object o, Object n)
|
||||
{
|
||||
propertyChangeSupport.firePropertyChange(name, o, n);
|
||||
}
|
||||
|
||||
public void addVetoableChangeListener(VetoableChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
vetoableChangeSupport.addVetoableChangeListener(l);
|
||||
}
|
||||
|
||||
public void removeVetoableChangeListener(VetoableChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
vetoableChangeSupport.removeVetoableChangeListener(l);
|
||||
}
|
||||
|
||||
public VetoableChangeListener[] getVetoableChangeListeners()
|
||||
{
|
||||
return vetoableChangeSupport.getVetoableChangeListeners();
|
||||
}
|
||||
|
||||
public void addVetoableChangeListener(String name, VetoableChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
vetoableChangeSupport.addVetoableChangeListener(name, l);
|
||||
}
|
||||
|
||||
public void removeVetoableChangeListener(String name,
|
||||
VetoableChangeListener l)
|
||||
{
|
||||
if (l != null)
|
||||
vetoableChangeSupport.removeVetoableChangeListener(name, l);
|
||||
}
|
||||
|
||||
public VetoableChangeListener[] getVetoableChangeListeners(String name)
|
||||
{
|
||||
return vetoableChangeSupport.getVetoableChangeListeners(name);
|
||||
}
|
||||
|
||||
protected void fireVetoableChange(String name, Object o, Object n)
|
||||
throws PropertyVetoException
|
||||
{
|
||||
vetoableChangeSupport.fireVetoableChange(name, o, n);
|
||||
}
|
||||
|
||||
public void addKeyEventDispatcher(KeyEventDispatcher dispatcher)
|
||||
{
|
||||
if (dispatcher != null)
|
||||
keyEventDispatchers.add(dispatcher);
|
||||
}
|
||||
|
||||
public void removeKeyEventDispatcher(KeyEventDispatcher dispatcher)
|
||||
{
|
||||
keyEventDispatchers.remove(dispatcher);
|
||||
}
|
||||
|
||||
protected List getKeyEventDispatchers()
|
||||
{
|
||||
return (List) keyEventDispatchers.clone();
|
||||
}
|
||||
|
||||
public void addKeyEventPostProcessor(KeyEventPostProcessor postProcessor)
|
||||
{
|
||||
if (postProcessor != null)
|
||||
keyEventPostProcessors.add(postProcessor);
|
||||
}
|
||||
|
||||
public void removeKeyEventPostProcessor(KeyEventPostProcessor postProcessor)
|
||||
{
|
||||
keyEventPostProcessors.remove(postProcessor);
|
||||
}
|
||||
|
||||
protected List getKeyEventPostProcessors()
|
||||
{
|
||||
return (List) keyEventPostProcessors.clone();
|
||||
}
|
||||
|
||||
public abstract boolean dispatchEvent(AWTEvent e);
|
||||
|
||||
public final void redispatchEvent(Component target, AWTEvent e)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public abstract boolean dispatchKeyEvent(KeyEvent e);
|
||||
|
||||
public abstract boolean postProcessKeyEvent(KeyEvent e);
|
||||
|
||||
public abstract void processKeyEvent(Component focused, KeyEvent e);
|
||||
|
||||
protected abstract void enqueueKeyEvents(long after, Component untilFocused);
|
||||
|
||||
protected abstract void dequeueKeyEvents(long after, Component untilFocused);
|
||||
|
||||
protected abstract void discardKeyEvents(Component comp);
|
||||
|
||||
public abstract void focusNextComponent(Component comp);
|
||||
|
||||
public abstract void focusPreviousComponent(Component comp);
|
||||
|
||||
public abstract void upFocusCycle(Component comp);
|
||||
|
||||
public abstract void downFocusCycle(Container cont);
|
||||
|
||||
public final void focusNextComponent()
|
||||
{
|
||||
focusNextComponent(focusOwner);
|
||||
}
|
||||
|
||||
public final void focusPreviousComponent()
|
||||
{
|
||||
focusPreviousComponent(focusOwner);
|
||||
}
|
||||
|
||||
public final void upFocusCycle()
|
||||
{
|
||||
upFocusCycle(focusOwner);
|
||||
}
|
||||
|
||||
public final void downFocusCycle()
|
||||
{
|
||||
if (focusOwner instanceof Container
|
||||
&& ((Container) focusOwner).isFocusCycleRoot())
|
||||
downFocusCycle((Container) focusOwner);
|
||||
}
|
||||
} // class KeyboardFocusManager
|
|
@ -1,5 +1,5 @@
|
|||
/* LayoutManager.java -- Layout containers in a Window
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* LayoutManager.java -- lay out elements in a Container
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,68 +39,54 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This interface is for laying out containers.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This interface is for laying out containers in a particular sequence.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see Container
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface LayoutManager
|
||||
{
|
||||
/**
|
||||
* Adds the specified component to the layout group.
|
||||
*
|
||||
* @param name the name of the component to add
|
||||
* @param component the component to add
|
||||
*/
|
||||
void addLayoutComponent(String name, Component component);
|
||||
|
||||
/**
|
||||
* Adds the specified component to the layout group.
|
||||
*
|
||||
* @param name The name of the component to add.
|
||||
* @param component The component to add.
|
||||
*/
|
||||
public abstract void
|
||||
addLayoutComponent(String name, Component component);
|
||||
/**
|
||||
* Removes the specified component from the layout group.
|
||||
*
|
||||
* @param component the component to remove
|
||||
*/
|
||||
void removeLayoutComponent(Component component);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Calculates the preferred size for this container, taking into account
|
||||
* the components it contains.
|
||||
*
|
||||
* @param parent the parent container to lay out
|
||||
* @return the preferred dimensions of this container
|
||||
* @see #minimumLayoutSize(Container)
|
||||
*/
|
||||
Dimension preferredLayoutSize(Container parent);
|
||||
|
||||
/**
|
||||
* Removes the specified component from the layout group.
|
||||
*
|
||||
* @param component The component to remove.
|
||||
*/
|
||||
public abstract void
|
||||
removeLayoutComponent(Component component);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Calculates the preferred size for this container, taking into account
|
||||
* the components in the specified parent container.
|
||||
*
|
||||
* @param parent The parent container.
|
||||
*
|
||||
* @return The preferred dimensions of this container.
|
||||
*/
|
||||
public abstract Dimension
|
||||
preferredLayoutSize(Container parent);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Calculates the minimum size for this container, taking into account
|
||||
* the components in the specified parent container.
|
||||
*
|
||||
* @param parent The parent container.
|
||||
*
|
||||
* @return The minimum dimensions of this container.
|
||||
*/
|
||||
public abstract Dimension
|
||||
minimumLayoutSize(Container parent);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Lays out the components in this container on the specified parent
|
||||
* container.
|
||||
*
|
||||
* @param parent The parent container.
|
||||
*/
|
||||
public abstract void
|
||||
layoutContainer(Container parent);
|
||||
/**
|
||||
* Calculates the minimum size for this container, taking into account
|
||||
* the components it contains.
|
||||
*
|
||||
* @param parent the parent container to lay out
|
||||
* @return the minimum dimensions of this container
|
||||
* @see #preferredLayoutSize(Container)
|
||||
*/
|
||||
Dimension minimumLayoutSize(Container parent);
|
||||
|
||||
/**
|
||||
* Lays out the components in the given container.
|
||||
*
|
||||
* @param parent the container to lay out
|
||||
*/
|
||||
void layoutContainer(Container parent);
|
||||
} // interface LayoutManager
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* LayoutManager2.java -- Enhanced layout manager.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* LayoutManager2.java -- enhanced layout manager
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,70 +39,62 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* Layout manager for laying out containers based on contraints.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* Layout manager for laying out containers based on contraints. The
|
||||
* constraints control how the layout will proceed.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see LayoutManager
|
||||
* @see Container
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface LayoutManager2 extends LayoutManager
|
||||
{
|
||||
/**
|
||||
* Adds the specified component to the layout, with the specified
|
||||
* constraint object.
|
||||
*
|
||||
* @param component the component to add
|
||||
* @param constraint the constraint to satisfy
|
||||
*/
|
||||
void addLayoutComponent(Component component, Object contraint);
|
||||
|
||||
/**
|
||||
* Adds the specified component to the layout, with the specified
|
||||
* constraint object.
|
||||
*
|
||||
* @param component The component to add.
|
||||
* @param constraint The constraint object.
|
||||
*/
|
||||
public abstract void
|
||||
addLayoutComponent(Component component, Object contraint);
|
||||
/**
|
||||
* Determines the maximum size of the specified target container.
|
||||
*
|
||||
* @param target the container to lay out
|
||||
* @return the maximum size of the container
|
||||
* @see Component#getMaximumSize()
|
||||
*/
|
||||
Dimension maximumLayoutSize(Container target);
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the preferred X axis alignment for the specified target
|
||||
* container. This value will range from 0 to 1 where 0 is alignment
|
||||
* closest to the origin, 0.5 is centered, and 1 is aligned furthest
|
||||
* from the origin.
|
||||
*
|
||||
* @param target the target container
|
||||
* @return the x-axis alignment preference
|
||||
*/
|
||||
float getLayoutAlignmentX(Container target);
|
||||
|
||||
/**
|
||||
* Determines the minimum size of the specified target container.
|
||||
*
|
||||
* @param target The target container.
|
||||
*/
|
||||
public abstract Dimension
|
||||
maximumLayoutSize(Container target);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the preferred X axis alignment for the specified target
|
||||
* container. This value will range from 0 to 1 where 0 is alignment
|
||||
* closest to the origin, 0.5 is centered, and 1 is aligned furthest
|
||||
* from the origin.
|
||||
*
|
||||
* @param target The target container.
|
||||
*/
|
||||
public abstract float
|
||||
getLayoutAlignmentX(Container target);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the preferred Y axis alignment for the specified target
|
||||
* container. This value will range from 0 to 1 where 0 is alignment
|
||||
* closest to the origin, 0.5 is centered, and 1 is aligned furthest
|
||||
* from the origin.
|
||||
*
|
||||
* @param target The target container.
|
||||
*/
|
||||
public abstract float
|
||||
getLayoutAlignmentY(Container target);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Forces the layout manager to purge any cached information about
|
||||
* the layout of the target container. This will force it to be
|
||||
* recalculated.
|
||||
*
|
||||
* @param target The target container.
|
||||
*/
|
||||
public abstract void
|
||||
invalidateLayout(Container target);
|
||||
|
||||
} // interface LayoutManager2
|
||||
/**
|
||||
* Returns the preferred Y axis alignment for the specified target
|
||||
* container. This value will range from 0 to 1 where 0 is alignment
|
||||
* closest to the origin, 0.5 is centered, and 1 is aligned furthest
|
||||
* from the origin.
|
||||
*
|
||||
* @param target the target container
|
||||
* @return the y-axis alignment preference
|
||||
*/
|
||||
float getLayoutAlignmentY(Container target);
|
||||
|
||||
/**
|
||||
* Forces the layout manager to purge any cached information about the
|
||||
* layout of the target container. This will force it to be recalculated.
|
||||
*
|
||||
* @param target the target container
|
||||
*/
|
||||
void invalidateLayout(Container target);
|
||||
} // interface LayoutManager2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* MenuContainer.java -- Container for menu items.
|
||||
/* MenuContainer.java -- container for menu items
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
@ -39,42 +39,33 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This interface is a container for menu components.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This interface is a container for menu components.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface MenuContainer
|
||||
{
|
||||
/**
|
||||
* Returns the font in use by this container.
|
||||
*
|
||||
* @return the menu font
|
||||
*/
|
||||
Font getFont();
|
||||
|
||||
/**
|
||||
* Returns the font in use by this container.
|
||||
*
|
||||
* @return The font in use by this container.
|
||||
*/
|
||||
public abstract Font
|
||||
getFont();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Removes the specified menu component from the menu.
|
||||
*
|
||||
* @param component The menu component to remove.
|
||||
*/
|
||||
public abstract void
|
||||
remove(MenuComponent component);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Posts and event to the listeners. This is replaced by
|
||||
* <code>dispatchEvent</code>.
|
||||
*
|
||||
* @param event The event to dispatch.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public abstract boolean
|
||||
postEvent(Event event);
|
||||
/**
|
||||
* Removes the specified menu component from the menu.
|
||||
*
|
||||
* @param component the menu component to remove
|
||||
*/
|
||||
void remove(MenuComponent component);
|
||||
|
||||
/**
|
||||
* Posts an event to the listeners.
|
||||
*
|
||||
* @param event the event to dispatch
|
||||
* @deprecated use {@link MenuComponent#dispatchEvent(AWTEvent)} instead
|
||||
*/
|
||||
boolean postEvent(Event event);
|
||||
} // interface MenuContainer
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.awt.peer.MenuItemPeer;
|
|||
import java.awt.peer.MenuComponentPeer;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
|
@ -385,19 +386,24 @@ removeActionListener(ActionListener l)
|
|||
action_listeners = AWTEventMulticaster.remove(action_listeners, l);
|
||||
}
|
||||
|
||||
public synchronized ActionListener[] getActionListeners()
|
||||
{
|
||||
return (ActionListener[])
|
||||
AWTEventMulticaster.getListeners(action_listeners,
|
||||
ActionListener.class);
|
||||
}
|
||||
|
||||
/** Returns all registered EventListers of the given listenerType.
|
||||
* listenerType must be a subclass of EventListener, or a
|
||||
* ClassClassException is thrown.
|
||||
* @since 1.3
|
||||
*/
|
||||
public EventListener[]
|
||||
getListeners(Class listenerType)
|
||||
{
|
||||
if (listenerType == ActionListener.class)
|
||||
return Component.getListenersImpl(listenerType, action_listeners);
|
||||
else
|
||||
return Component.getListenersImpl(listenerType, null);
|
||||
}
|
||||
public EventListener[] getListeners(Class listenerType)
|
||||
{
|
||||
if (listenerType == ActionListener.class)
|
||||
return getActionListeners();
|
||||
return (EventListener[]) Array.newInstance(listenerType, 0);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
|
482
libjava/java/awt/PageAttributes.java
Normal file
482
libjava/java/awt/PageAttributes.java
Normal file
|
@ -0,0 +1,482 @@
|
|||
/* PageAttributes.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 java.awt;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Missing Documentation
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.3
|
||||
* @status updated to 1.4, but missing documentation
|
||||
*/
|
||||
public final class PageAttributes implements Cloneable
|
||||
{
|
||||
public static final class ColorType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "color", "monochrome" };
|
||||
public static final ColorType COLOR = new ColorType(0);
|
||||
public static final ColorType MONOCHROME = new ColorType(1);
|
||||
private ColorType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class ColorType
|
||||
public static final class MediaType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES
|
||||
= { "iso-4a0", "iso-2a0", "iso-a0", "iso-a1", "iso-a2", "iso-a3",
|
||||
"iso-a4", "iso-a5", "iso-a6", "iso-a7", "iso-a8", "iso-a9",
|
||||
"iso-a10", "iso-b0", "iso-b1", "iso-b2", "iso-b3", "iso-b4",
|
||||
"iso-b5", "iso-b6", "iso-b7", "iso-b8", "iso-b9", "iso-b10",
|
||||
"jis-b0", "jis-b1", "jis-b2", "jis-b3", "jis-b4", "jis-b5",
|
||||
"jis-b6", "jis-b7", "jis-b8", "jis-b9", "jis-b10", "iso-c0",
|
||||
"iso-c1", "iso-c2", "iso-c3", "iso-c4", "iso-c5", "iso-c6",
|
||||
"iso-c7", "iso-c8", "iso-c9", "iso-c10", "iso-designated-long",
|
||||
"executive", "folio", "invoice", "ledger", "na-letter", "na-legal",
|
||||
"quarto", "a", "b", "c", "d", "e", "na-10x15-envelope",
|
||||
"na-10x14-envelope", "na-10x13-envelope", "na-9x12-envelope",
|
||||
"na-9x11-envelope", "na-7x9-envelope", "na-6x9-envelope",
|
||||
"na-number-9-envelope", "na-number-10-envelope",
|
||||
"na-number-11-envelope", "na-number-12-envelope",
|
||||
"na-number-14-envelope", "invite-envelope", "italy-envelope",
|
||||
"monarch-envelope", "personal-envelope" };
|
||||
public static final MediaType ISO_4A0 = new MediaType(0);
|
||||
public static final MediaType ISO_2A0 = new MediaType(1);
|
||||
public static final MediaType ISO_A0 = new MediaType(2);
|
||||
public static final MediaType ISO_A1 = new MediaType(3);
|
||||
public static final MediaType ISO_A2 = new MediaType(4);
|
||||
public static final MediaType ISO_A3 = new MediaType(5);
|
||||
public static final MediaType ISO_A4 = new MediaType(6);
|
||||
public static final MediaType ISO_A5 = new MediaType(7);
|
||||
public static final MediaType ISO_A6 = new MediaType(8);
|
||||
public static final MediaType ISO_A7 = new MediaType(9);
|
||||
public static final MediaType ISO_A8 = new MediaType(10);
|
||||
public static final MediaType ISO_A9 = new MediaType(11);
|
||||
public static final MediaType ISO_A10 = new MediaType(12);
|
||||
public static final MediaType ISO_B0 = new MediaType(13);
|
||||
public static final MediaType ISO_B1 = new MediaType(14);
|
||||
public static final MediaType ISO_B2 = new MediaType(15);
|
||||
public static final MediaType ISO_B3 = new MediaType(16);
|
||||
public static final MediaType ISO_B4 = new MediaType(17);
|
||||
public static final MediaType ISO_B5 = new MediaType(18);
|
||||
public static final MediaType ISO_B6 = new MediaType(19);
|
||||
public static final MediaType ISO_B7 = new MediaType(20);
|
||||
public static final MediaType ISO_B8 = new MediaType(21);
|
||||
public static final MediaType ISO_B9 = new MediaType(22);
|
||||
public static final MediaType ISO_B10 = new MediaType(23);
|
||||
public static final MediaType JIS_B0 = new MediaType(24);
|
||||
public static final MediaType JIS_B1 = new MediaType(25);
|
||||
public static final MediaType JIS_B2 = new MediaType(26);
|
||||
public static final MediaType JIS_B3 = new MediaType(27);
|
||||
public static final MediaType JIS_B4 = new MediaType(28);
|
||||
public static final MediaType JIS_B5 = new MediaType(29);
|
||||
public static final MediaType JIS_B6 = new MediaType(30);
|
||||
public static final MediaType JIS_B7 = new MediaType(31);
|
||||
public static final MediaType JIS_B8 = new MediaType(32);
|
||||
public static final MediaType JIS_B9 = new MediaType(33);
|
||||
public static final MediaType JIS_B10 = new MediaType(34);
|
||||
public static final MediaType ISO_C0 = new MediaType(35);
|
||||
public static final MediaType ISO_C1 = new MediaType(36);
|
||||
public static final MediaType ISO_C2 = new MediaType(37);
|
||||
public static final MediaType ISO_C3 = new MediaType(38);
|
||||
public static final MediaType ISO_C4 = new MediaType(39);
|
||||
public static final MediaType ISO_C5 = new MediaType(40);
|
||||
public static final MediaType ISO_C6 = new MediaType(41);
|
||||
public static final MediaType ISO_C7 = new MediaType(42);
|
||||
public static final MediaType ISO_C8 = new MediaType(43);
|
||||
public static final MediaType ISO_C9 = new MediaType(44);
|
||||
public static final MediaType ISO_C10 = new MediaType(45);
|
||||
public static final MediaType ISO_DESIGNATED_LONG = new MediaType(46);
|
||||
public static final MediaType EXECUTIVE = new MediaType(47);
|
||||
public static final MediaType FOLIO = new MediaType(48);
|
||||
public static final MediaType INVOICE = new MediaType(49);
|
||||
public static final MediaType LEDGER = new MediaType(50);
|
||||
public static final MediaType NA_LETTER = new MediaType(51);
|
||||
public static final MediaType NA_LEGAL = new MediaType(52);
|
||||
public static final MediaType QUARTO = new MediaType(53);
|
||||
public static final MediaType A = new MediaType(54);
|
||||
public static final MediaType B = new MediaType(55);
|
||||
public static final MediaType C = new MediaType(56);
|
||||
public static final MediaType D = new MediaType(57);
|
||||
public static final MediaType E = new MediaType(58);
|
||||
public static final MediaType NA_10X15_ENVELOPE = new MediaType(59);
|
||||
public static final MediaType NA_10X14_ENVELOPE = new MediaType(60);
|
||||
public static final MediaType NA_10X13_ENVELOPE = new MediaType(61);
|
||||
public static final MediaType NA_9X12_ENVELOPE = new MediaType(62);
|
||||
public static final MediaType NA_9X11_ENVELOPE = new MediaType(63);
|
||||
public static final MediaType NA_7X9_ENVELOPE = new MediaType(64);
|
||||
public static final MediaType NA_6X9_ENVELOPE = new MediaType(65);
|
||||
public static final MediaType NA_NUMBER_9_ENVELOPE = new MediaType(66);
|
||||
public static final MediaType NA_NUMBER_10_ENVELOPE = new MediaType(67);
|
||||
public static final MediaType NA_NUMBER_11_ENVELOPE = new MediaType(68);
|
||||
public static final MediaType NA_NUMBER_12_ENVELOPE = new MediaType(69);
|
||||
public static final MediaType NA_NUMBER_14_ENVELOPE = new MediaType(70);
|
||||
public static final MediaType INVITE_ENVELOPE = new MediaType(71);
|
||||
public static final MediaType ITALY_ENVELOPE = new MediaType(72);
|
||||
public static final MediaType MONARCH_ENVELOPE = new MediaType(73);
|
||||
public static final MediaType PERSONAL_ENVELOPE = new MediaType(74);
|
||||
public static final MediaType A0 = ISO_A0;
|
||||
public static final MediaType A1 = ISO_A1;
|
||||
public static final MediaType A2 = ISO_A2;
|
||||
public static final MediaType A3 = ISO_A3;
|
||||
public static final MediaType A4 = ISO_A4;
|
||||
public static final MediaType A5 = ISO_A5;
|
||||
public static final MediaType A6 = ISO_A6;
|
||||
public static final MediaType A7 = ISO_A7;
|
||||
public static final MediaType A8 = ISO_A8;
|
||||
public static final MediaType A9 = ISO_A9;
|
||||
public static final MediaType A10 = ISO_A10;
|
||||
public static final MediaType B0 = ISO_B0;
|
||||
public static final MediaType B1 = ISO_B1;
|
||||
public static final MediaType B2 = ISO_B2;
|
||||
public static final MediaType B3 = ISO_B3;
|
||||
public static final MediaType B4 = ISO_B4;
|
||||
public static final MediaType ISO_B4_ENVELOPE = ISO_B4;
|
||||
public static final MediaType B5 = ISO_B5;
|
||||
public static final MediaType ISO_B5_ENVELOPE = ISO_B4;
|
||||
public static final MediaType B6 = ISO_B6;
|
||||
public static final MediaType B7 = ISO_B7;
|
||||
public static final MediaType B8 = ISO_B8;
|
||||
public static final MediaType B9 = ISO_B9;
|
||||
public static final MediaType B10 = ISO_B10;
|
||||
public static final MediaType C0 = ISO_B0;
|
||||
public static final MediaType ISO_C0_ENVELOPE = ISO_C0;
|
||||
public static final MediaType C1 = ISO_C1;
|
||||
public static final MediaType ISO_C1_ENVELOPE = ISO_C1;
|
||||
public static final MediaType C2 = ISO_C2;
|
||||
public static final MediaType ISO_C2_ENVELOPE = ISO_C2;
|
||||
public static final MediaType C3 = ISO_C3;
|
||||
public static final MediaType ISO_C3_ENVELOPE = ISO_C3;
|
||||
public static final MediaType C4 = ISO_C4;
|
||||
public static final MediaType ISO_C4_ENVELOPE = ISO_C4;
|
||||
public static final MediaType C5 = ISO_C5;
|
||||
public static final MediaType ISO_C5_ENVELOPE = ISO_C5;
|
||||
public static final MediaType C6 = ISO_C6;
|
||||
public static final MediaType ISO_C6_ENVELOPE = ISO_C6;
|
||||
public static final MediaType C7 = ISO_C7;
|
||||
public static final MediaType ISO_C7_ENVELOPE = ISO_C7;
|
||||
public static final MediaType C8 = ISO_C8;
|
||||
public static final MediaType ISO_C8_ENVELOPE = ISO_C8;
|
||||
public static final MediaType C9 = ISO_C9;
|
||||
public static final MediaType ISO_C9_ENVELOPE = ISO_C9;
|
||||
public static final MediaType C10 = ISO_C10;
|
||||
public static final MediaType ISO_C10_ENVELOPE = ISO_C10;
|
||||
public static final MediaType ISO_DESIGNATED_LONG_ENVELOPE
|
||||
= ISO_DESIGNATED_LONG;
|
||||
public static final MediaType STATEMENT = INVOICE;
|
||||
public static final MediaType TABLOID = LEDGER;
|
||||
public static final MediaType LETTER = NA_LETTER;
|
||||
public static final MediaType NOTE = NA_LETTER;
|
||||
public static final MediaType LEGAL = NA_LEGAL;
|
||||
public static final MediaType ENV_10X15 = NA_10X15_ENVELOPE;
|
||||
public static final MediaType ENV_10X14 = NA_10X14_ENVELOPE;
|
||||
public static final MediaType ENV_10X13 = NA_10X13_ENVELOPE;
|
||||
public static final MediaType ENV_9X12 = NA_9X12_ENVELOPE;
|
||||
public static final MediaType ENV_9X11 = NA_9X11_ENVELOPE;
|
||||
public static final MediaType ENV_7X9 = NA_7X9_ENVELOPE;
|
||||
public static final MediaType ENV_6X9 = NA_6X9_ENVELOPE;
|
||||
public static final MediaType ENV_9 = NA_NUMBER_9_ENVELOPE;
|
||||
public static final MediaType ENV_10 = NA_NUMBER_10_ENVELOPE;
|
||||
public static final MediaType ENV_11 = NA_NUMBER_11_ENVELOPE;
|
||||
public static final MediaType ENV_12 = NA_NUMBER_12_ENVELOPE;
|
||||
public static final MediaType ENV_14 = NA_NUMBER_14_ENVELOPE;
|
||||
public static final MediaType ENV_INVITE = INVITE_ENVELOPE;
|
||||
public static final MediaType ENV_ITALY = ITALY_ENVELOPE;
|
||||
public static final MediaType ENV_MONARCH = MONARCH_ENVELOPE;
|
||||
public static final MediaType ENV_PERSONAL = PERSONAL_ENVELOPE;
|
||||
public static final MediaType INVITE = INVITE_ENVELOPE;
|
||||
public static final MediaType ITALY = ITALY_ENVELOPE;
|
||||
public static final MediaType MONARCH = MONARCH_ENVELOPE;
|
||||
public static final MediaType PERSONAL = PERSONAL_ENVELOPE;
|
||||
private MediaType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class MediaType
|
||||
public static final class OrientationRequestedType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "portrait", "landscape" };
|
||||
public static final OrientationRequestedType PORTRAIT
|
||||
= new OrientationRequestedType(0);
|
||||
public static final OrientationRequestedType LANDSCAPE
|
||||
= new OrientationRequestedType(1);
|
||||
private OrientationRequestedType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class OrientationRequestedType
|
||||
public static final class OriginType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "physical", "printable" };
|
||||
public static final OriginType PHYSICAL = new OriginType(0);
|
||||
public static final OriginType PRINTABLE = new OriginType(1);
|
||||
private OriginType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class OriginType
|
||||
public static final class PrintQualityType extends AttributeValue
|
||||
{
|
||||
private static final String[] NAMES = { "high", "normal", "draft" };
|
||||
public static final PrintQualityType HIGH = new PrintQualityType(0);
|
||||
public static final PrintQualityType NORMAL = new PrintQualityType(1);
|
||||
public static final PrintQualityType DRAFT = new PrintQualityType(2);
|
||||
private PrintQualityType(int value)
|
||||
{
|
||||
super(value, NAMES);
|
||||
}
|
||||
} // class PrintQualityType
|
||||
|
||||
|
||||
private ColorType color;
|
||||
private MediaType media;
|
||||
private OrientationRequestedType orientation;
|
||||
private OriginType origin;
|
||||
private PrintQualityType quality;
|
||||
private int resolutionX;
|
||||
private int resolutionY;
|
||||
private int resolutionScale;
|
||||
public PageAttributes()
|
||||
{
|
||||
color = ColorType.MONOCHROME;
|
||||
setMediaToDefault();
|
||||
orientation = OrientationRequestedType.PORTRAIT;
|
||||
origin = OriginType.PHYSICAL;
|
||||
quality = PrintQualityType.NORMAL;
|
||||
setPrinterResolutionToDefault();
|
||||
}
|
||||
|
||||
public PageAttributes(PageAttributes attr)
|
||||
{
|
||||
set(attr);
|
||||
}
|
||||
|
||||
public PageAttributes(ColorType color, MediaType media,
|
||||
OrientationRequestedType orientation,
|
||||
OriginType origin, PrintQualityType quality,
|
||||
int[] resolution)
|
||||
{
|
||||
if (color == null || media == null || orientation == null
|
||||
|| origin == null || quality == null)
|
||||
throw new IllegalArgumentException();
|
||||
setPrinterResolution(resolution);
|
||||
this.color = color;
|
||||
this.media = media;
|
||||
this.orientation = orientation;
|
||||
this.origin = origin;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
{
|
||||
return new PageAttributes(this);
|
||||
}
|
||||
|
||||
public void set(PageAttributes attr)
|
||||
{
|
||||
color = attr.color;
|
||||
media = attr.media;
|
||||
orientation = attr.orientation;
|
||||
origin = attr.origin;
|
||||
quality = attr.quality;
|
||||
resolutionX = attr.resolutionX;
|
||||
resolutionY = attr.resolutionY;
|
||||
resolutionScale = attr.resolutionScale;
|
||||
}
|
||||
|
||||
public ColorType getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(ColorType color)
|
||||
{
|
||||
if (color == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public MediaType getMedia()
|
||||
{
|
||||
return media;
|
||||
}
|
||||
|
||||
public void setMedia(MediaType media)
|
||||
{
|
||||
if (media == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.media = media;
|
||||
}
|
||||
|
||||
public void setMediaToDefault()
|
||||
{
|
||||
String country = Locale.getDefault().getCountry();
|
||||
media = ("US".equals(country) || "CA".equals(country)) ? MediaType.LETTER
|
||||
: MediaType.A4;
|
||||
}
|
||||
|
||||
public OrientationRequestedType getOrientationRequested()
|
||||
{
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientationRequested(OrientationRequestedType orientation)
|
||||
{
|
||||
if (orientation == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
public void setOrientationRequested(int orientation)
|
||||
{
|
||||
if (orientation == 3)
|
||||
this.orientation = OrientationRequestedType.PORTRAIT;
|
||||
else if (orientation == 4)
|
||||
this.orientation = OrientationRequestedType.LANDSCAPE;
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public void setOrientationRequestedToDefault()
|
||||
{
|
||||
orientation = OrientationRequestedType.PORTRAIT;
|
||||
}
|
||||
|
||||
public OriginType getOrigin()
|
||||
{
|
||||
return origin;
|
||||
}
|
||||
|
||||
public void setOrigin(OriginType origin)
|
||||
{
|
||||
if (origin == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public PrintQualityType getPrintQuality()
|
||||
{
|
||||
return quality;
|
||||
}
|
||||
|
||||
public void setPrintQuality(PrintQualityType quality)
|
||||
{
|
||||
if (quality == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
public void setPrintQuality(int quality)
|
||||
{
|
||||
if (quality == 3)
|
||||
this.quality = PrintQualityType.DRAFT;
|
||||
else if (quality == 4)
|
||||
this.quality = PrintQualityType.NORMAL;
|
||||
else if (quality == 5)
|
||||
this.quality = PrintQualityType.HIGH;
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public void setPrintQualityToDefault()
|
||||
{
|
||||
quality = PrintQualityType.NORMAL;
|
||||
}
|
||||
|
||||
public int[] getPrinterResolution()
|
||||
{
|
||||
return new int[] { resolutionX, resolutionY, resolutionScale };
|
||||
}
|
||||
|
||||
public void setPrinterResolution(int[] resolution)
|
||||
{
|
||||
if (resolution == null || resolution.length != 3 || resolution[0] <= 0
|
||||
|| resolution[1] <= 0 || resolution[2] < 3 || resolution[2] > 4)
|
||||
throw new IllegalArgumentException();
|
||||
resolutionX = resolution[0];
|
||||
resolutionY = resolution[1];
|
||||
resolutionScale = resolution[2];
|
||||
}
|
||||
|
||||
public void setPrinterResolution(int resolution)
|
||||
{
|
||||
if (resolution <= 0)
|
||||
throw new IllegalArgumentException();
|
||||
resolutionX = resolution;
|
||||
resolutionY = resolution;
|
||||
resolutionScale = 3;
|
||||
}
|
||||
|
||||
public void setPrinterResolutionToDefault()
|
||||
{
|
||||
resolutionX = 72;
|
||||
resolutionY = 72;
|
||||
resolutionScale = 3;
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o)
|
||||
return true;
|
||||
if (! (o instanceof PageAttributes))
|
||||
return false;
|
||||
PageAttributes pa = (PageAttributes) o;
|
||||
return color == pa.color && media == pa.media
|
||||
&& orientation == pa.orientation && origin == pa.origin
|
||||
&& quality == pa.quality && resolutionX == pa.resolutionX
|
||||
&& resolutionY == pa.resolutionY
|
||||
&& resolutionScale == pa.resolutionScale;
|
||||
}
|
||||
public int hashCode()
|
||||
{
|
||||
return (color.value << 31) ^ (media.value << 24)
|
||||
^ (orientation.value << 23) ^ (origin.value << 22)
|
||||
^ (quality.value << 20) ^ (resolutionScale << 19)
|
||||
^ (resolutionY << 10) ^ resolutionX;
|
||||
}
|
||||
public String toString()
|
||||
{
|
||||
return "color=" + color + ",media=" + media + ",orientation-requested="
|
||||
+ orientation + ",origin=" + origin + ",print-quality=" + quality
|
||||
+ ",printer-resolution=[" + resolutionX + ',' + resolutionY + ','
|
||||
+ resolutionScale + ']';
|
||||
}
|
||||
} // class PageAttributes
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2002 Free Software Foundation
|
||||
/* Paint.java -- generate colors for Graphics2D operations
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,23 +38,42 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.ColorModel;
|
||||
|
||||
/**
|
||||
* Defines how color patterns are generated for Graphics2D operations. This
|
||||
* is used to perform the <code>draw</code> and <code>fill</code> methods
|
||||
* of the graphics object. Instances must be immutable, because the graphics
|
||||
* object does not clone them.
|
||||
*
|
||||
* @author Warren Levy <warrenl@cygnus.com>
|
||||
* @date March 15, 2000.
|
||||
* @see PaintContext
|
||||
* @see Color
|
||||
* @see GradientPaint
|
||||
* @see TexturePaint
|
||||
* @see Graphics2D#setPaint(Paint)
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
||||
* Status: Stubbed.
|
||||
*/
|
||||
|
||||
public interface Paint extends Transparency
|
||||
{
|
||||
// FIXME
|
||||
// public PaintContext createContext(ColorModel cm,
|
||||
// Rectangle deviceBounds,
|
||||
// Rectangle2D userBounds,
|
||||
// AffineTransform xform,
|
||||
// RenderingHints hints);
|
||||
}
|
||||
/**
|
||||
* Create the context necessary for performing the color pattern generation.
|
||||
* The color model is a hint, and may be null for Classpath implementations;
|
||||
* however some legacy code may throw a NullPointerException when passed a
|
||||
* null. Leaving the color model null provides the most efficiency and leeway
|
||||
* in the generation of the color pattern.
|
||||
*
|
||||
* @param cm the color model, used as a hint
|
||||
* @param deviceBounds the device space bounding box of the painted area
|
||||
* @param userBounds the user space bounding box of the painted area
|
||||
* @param xform the transformation from user space to device space
|
||||
* @param hints any hints for choosing between rendering alternatives
|
||||
* @return the context for performing the paint
|
||||
*/
|
||||
PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
|
||||
Rectangle2D userBounds, AffineTransform xform,
|
||||
RenderingHints hints);
|
||||
} // interface Paint
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2002 Free Software Foundation
|
||||
/* PaintContext.java -- the environment for performing a paint operation
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,21 +38,39 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.Raster;
|
||||
|
||||
/**
|
||||
* @author Warren Levy <warrenl@cygnus.com>
|
||||
* @date March 16, 2000.
|
||||
* @see Paint
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
||||
* Status: Partially stubbed.
|
||||
*/
|
||||
|
||||
public interface PaintContext
|
||||
{
|
||||
public void dispose();
|
||||
// FIXME
|
||||
// public ColorModel getColorModel();
|
||||
// public Raster getRaster(int x, int y, int w, int h);
|
||||
}
|
||||
/**
|
||||
* Release the resources allocated for the paint.
|
||||
*/
|
||||
void dispose();
|
||||
|
||||
/**
|
||||
* Return the color model of this context. It may be different from the
|
||||
* hint specified during createContext, as not all contexts can generate
|
||||
* color patterns in an arbitrary model.
|
||||
*
|
||||
* @return the context color model
|
||||
*/
|
||||
ColorModel getColorModel();
|
||||
|
||||
/**
|
||||
* Return a raster containing the colors for the graphics operation.
|
||||
*
|
||||
* @param x the x-coordinate, in device space
|
||||
* @param y the y-coordinate, in device space
|
||||
* @param w the width, in device space
|
||||
* @param h the height, in device space
|
||||
* @return a raster for the given area and color
|
||||
*/
|
||||
Raster getRaster(int x, int y, int w, int h);
|
||||
} // interface PaintContext
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Panel.java -- Simple container object.
|
||||
/* Panel.java -- Simple container object
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
@ -41,59 +41,109 @@ 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;
|
||||
|
||||
/**
|
||||
* A panel is a simple container class.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
public class Panel extends Container implements java.io.Serializable
|
||||
{
|
||||
|
||||
/*
|
||||
* Constructors
|
||||
* A panel is a simple container class. It's default layout is the
|
||||
* <code>FlowLayout</code> manager.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see FlowLayout
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Panel</code> that has a default
|
||||
* layout manager of <code>FlowLayout</code>.
|
||||
*/
|
||||
public
|
||||
Panel()
|
||||
public class Panel extends Container implements Accessible
|
||||
{
|
||||
this(new FlowLayout());
|
||||
}
|
||||
/**
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -2728009084054400034L;
|
||||
|
||||
/*************************************************************************/
|
||||
/** The cached accessible context. */
|
||||
private transient AccessibleContext context;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Panel</code> with the specified
|
||||
* layout manager.
|
||||
*
|
||||
* @param layoutManager The layout manager for this object.
|
||||
*/
|
||||
public
|
||||
Panel(LayoutManager layoutManager)
|
||||
{
|
||||
setLayout(layoutManager);
|
||||
}
|
||||
/**
|
||||
* Initializes a new instance of <code>Panel</code> that has a default
|
||||
* layout manager of <code>FlowLayout</code>.
|
||||
*/
|
||||
public Panel()
|
||||
{
|
||||
this(new FlowLayout());
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Initializes a new instance of <code>Panel</code> with the specified
|
||||
* layout manager.
|
||||
*
|
||||
* @param layoutManager the layout manager for this object
|
||||
* @since 1.1
|
||||
*/
|
||||
public Panel(LayoutManager layoutManager)
|
||||
{
|
||||
setLayout(layoutManager);
|
||||
}
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
/**
|
||||
* Notifies this object to create its native peer.
|
||||
*
|
||||
* @see #isDisplayable()
|
||||
* @see #removeNotify()
|
||||
*/
|
||||
public void addNotify()
|
||||
{
|
||||
if (peer == null)
|
||||
peer = getToolkit().createPanel(this);
|
||||
super.addNotify();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies this object to create its native peer.
|
||||
*/
|
||||
public void
|
||||
addNotify()
|
||||
{
|
||||
if (peer == null)
|
||||
peer = getToolkit().createPanel(this);
|
||||
super.addNotify();
|
||||
}
|
||||
/**
|
||||
* Gets the AccessibleContext associated with this panel, creating one if
|
||||
* necessary. This always returns an instance of {@link AccessibleAWTPanel}.
|
||||
*
|
||||
* @return the accessibility context of this panel
|
||||
* @since 1.3
|
||||
*/
|
||||
public AccessibleContext getAccessibleContext()
|
||||
{
|
||||
if (context == null)
|
||||
context = new AccessibleAWTPanel();
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides accessibility support for Panels, and is the
|
||||
* runtime type returned by {@link #getAccessibleContext()}.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.3
|
||||
*/
|
||||
protected class AccessibleAWTPanel extends AccessibleAWTContainer
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.4+.
|
||||
*/
|
||||
private static final long serialVersionUID = -6409552226660031050L;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*/
|
||||
protected AccessibleAWTPanel()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the role of this accessible object, a panel.
|
||||
*
|
||||
* @return the role of the object
|
||||
* @see AccessibleRole#PANEL
|
||||
*/
|
||||
public AccessibleRole getAccessibleRole()
|
||||
{
|
||||
return AccessibleRole.PANEL;
|
||||
}
|
||||
} // class AccessibleAWTPanel
|
||||
} // class Panel
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 1999, 2002 Free Software Foundation
|
||||
/* Point.java -- represents a point in 2-D space
|
||||
Copyright (C) 1999, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -36,144 +37,209 @@ exception statement from your version. */
|
|||
|
||||
|
||||
package java.awt;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, plus online
|
||||
* API docs for JDK 1.2 beta from http://www.javasoft.com.
|
||||
* Status: Believed complete and correct, except that neither toString
|
||||
* nor hashCode have been compared with JDK output.
|
||||
*/
|
||||
import java.awt.geom.Point2D;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents a point on the screen using cartesian coordinates.
|
||||
* Remember that in screen coordinates, increasing x values go from left to
|
||||
* right, and increasing y values go from top to bottom.
|
||||
*
|
||||
* <p>There are some public fields; if you mess with them in an inconsistent
|
||||
* manner, it is your own fault when you get invalid results. Also, this
|
||||
* class is not threadsafe.
|
||||
*
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @date February 8, 1999.
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class Point extends Point2D implements java.io.Serializable
|
||||
public class Point extends Point2D implements Serializable
|
||||
{
|
||||
/**
|
||||
* @serial The X coordinate of the point.
|
||||
* Compatible with JDK 1.0+.
|
||||
*/
|
||||
private static final long serialVersionUID = -5276940640259749850L;
|
||||
|
||||
/**
|
||||
* The x coordinate.
|
||||
*
|
||||
* @see #getLocation()
|
||||
* @see #move(int, int)
|
||||
* @serial the X coordinate of the point
|
||||
*/
|
||||
public int x;
|
||||
|
||||
/**
|
||||
* @serial The Y coordinate of the point.
|
||||
* The y coordinate.
|
||||
*
|
||||
* @see #getLocation()
|
||||
* @see #move(int, int)
|
||||
* @serial The Y coordinate of the point
|
||||
*/
|
||||
public int y;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Point</code> representing the
|
||||
* coordiates (0,0).
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public Point () { }
|
||||
public Point()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Point</code> with coordinates
|
||||
* identical to the coordinates of the specified points.
|
||||
*
|
||||
* @param point The point to copy the coordinates from.
|
||||
* @param point the point to copy the coordinates from
|
||||
* @throws NullPointerException if p is null
|
||||
*/
|
||||
public Point (Point p) { this.x = p.x; this.y = p.y; }
|
||||
public Point(Point p)
|
||||
{
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Point</code> with the specified
|
||||
* coordinates.
|
||||
*
|
||||
* @param x The X coordinate of this point.
|
||||
* @param y The Y coordinate of this point.
|
||||
* @param x the X coordinate
|
||||
* @param y the Y coordinate
|
||||
*/
|
||||
public Point (int x, int y) { this.x = x; this.y = y; }
|
||||
|
||||
/**
|
||||
* Tests whether or not this object is equal to the specified object.
|
||||
* This will be true if and only if the specified objectj:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>Is not <code>null</code>.
|
||||
* <li>Is an instance of <code>Point</code>.
|
||||
* <li>Has X and Y coordinates equal to this object's.
|
||||
* </ul>
|
||||
*
|
||||
* @param obj The object to test against for equality.
|
||||
*
|
||||
* @return <code>true</code> if the specified object is equal to this
|
||||
* object, <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean equals (Object obj)
|
||||
public Point(int x, int y)
|
||||
{
|
||||
if (! (obj instanceof Point))
|
||||
return false;
|
||||
Point p = (Point) obj;
|
||||
return this.x == p.x && this.y == p.y;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash value for this point.
|
||||
* Get the x coordinate.
|
||||
*
|
||||
* @param A hash value for this point.
|
||||
* @return the value of x, as a double
|
||||
*/
|
||||
public int hashCode () { return x ^ y; }
|
||||
public double getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of this object as a point. A pretty useless
|
||||
* method. It is included to mimic the <code>getLocation</code> method
|
||||
* in component.
|
||||
* Get the y coordinate.
|
||||
*
|
||||
* @return This point.
|
||||
* @return the value of y, as a double
|
||||
*/
|
||||
public Point getLocation () { return new Point(this); }
|
||||
public double getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this object's coordinates to the specified values. This method
|
||||
* is identical to the <code>setLocation(int, int)</code> method.
|
||||
* Returns the location of this point. A pretty useless method, as this
|
||||
* is already a point.
|
||||
*
|
||||
* @param x The new X coordinate.
|
||||
* @param y The new Y coordinate.
|
||||
* @return a copy of this point
|
||||
* @see #setLocation(Point)
|
||||
* @since 1.1
|
||||
*/
|
||||
public void move (int x, int y) { this.x = x; this.y = y; }
|
||||
public Point getLocation()
|
||||
{
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this object's coordinates to match those of the specified point.
|
||||
*
|
||||
* @param p the point to copy the coordinates from
|
||||
* @throws NullPointerException if p is null
|
||||
* @since 1.1
|
||||
*/
|
||||
public void setLocation(Point p)
|
||||
{
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this object's coordinates to the specified values. This method
|
||||
* is identical to the <code>move()</code> method.
|
||||
*
|
||||
* @param x The new X coordinate.
|
||||
* @param y The new Y coordinate.
|
||||
* @param x the new X coordinate
|
||||
* @param y the new Y coordinate
|
||||
*/
|
||||
public void setLocation (int x, int y) { this.x = x; this.y = y; }
|
||||
public void setLocation(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this object's coordinates to match those of the specified point.
|
||||
* Sets this object's coordinates to the specified values. This method
|
||||
* performs normal casting from double to int, so you may lose precision.
|
||||
*
|
||||
* @param point The point to copy the coordinates from.
|
||||
* @param x the new X coordinate
|
||||
* @param y the new Y coordinate
|
||||
*/
|
||||
public void setLocation (Point pt) { this.x = pt.x; this.y = pt.y; }
|
||||
public void setLocation(double x, double y)
|
||||
{
|
||||
this.x = (int) x;
|
||||
this.y = (int) y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the coordinates of this point such that the specified
|
||||
* Sets this object's coordinates to the specified values. This method
|
||||
* is identical to the <code>setLocation(int, int)</code> method.
|
||||
*
|
||||
* @param x the new X coordinate
|
||||
* @param y the new Y coordinate
|
||||
*/
|
||||
public void move(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the coordinates of this point such that the specified
|
||||
* <code>dx</code> parameter is added to the existing X coordinate and
|
||||
* <code>dy</code> is added to the existing Y coordinate.
|
||||
*
|
||||
* @param dx The amount to add to the X coordinate.
|
||||
* @param dy The amount to add to the Y coordinate.
|
||||
* @param dx the amount to add to the X coordinate
|
||||
* @param dy the amount to add to the Y coordinate
|
||||
*/
|
||||
public void translate (int x, int y) { this.x += x; this.y += y; }
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
*
|
||||
* @return A string representation of this object.
|
||||
*/
|
||||
public String toString ()
|
||||
public void translate(int dx, int dy)
|
||||
{
|
||||
return getClass().getName() + "[x:"+x+",y:"+y+']';
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
public double getX() { return x; }
|
||||
public double getY() { return y; }
|
||||
/**
|
||||
* Tests whether or not this object is equal to the specified object.
|
||||
* This will be true if and only if the specified object is an instance
|
||||
* of Point2D and has the same X and Y coordinates.
|
||||
*
|
||||
* @param obj the object to test against for equality
|
||||
* @return true if the specified object is equal
|
||||
*/
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (! (obj instanceof Point2D))
|
||||
return false;
|
||||
Point2D p = (Point2D) obj;
|
||||
return x == p.getX() && y == p.getY();
|
||||
}
|
||||
|
||||
public void setLocation (double x, double y)
|
||||
{ this.x = (int) x; this.y = (int) y; }
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns a string representation of this object. The format is:
|
||||
* <code>getClass().getName() + "[x=" + x + ",y=" + y + ']'</code>.
|
||||
*
|
||||
* @return a string representation of this object
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return getClass().getName() + "[x=" + x + ",y=" + y + ']';
|
||||
}
|
||||
} // class Point
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/* PrintGraphics.java -- A print graphics context.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* PrintGraphics.java -- a print graphics context
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,21 +39,19 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This interface allows the originating print job to be obtained.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This interface allows the originating print job to be obtained.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface PrintGraphics
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns the <code>PrintJob</code> that this object is being
|
||||
* managed by.
|
||||
*
|
||||
* @return The print job for this object.
|
||||
*/
|
||||
public abstract PrintJob
|
||||
getPrintJob();
|
||||
|
||||
/**
|
||||
* Returns the <code>PrintJob</code> that this object is being
|
||||
* managed by.
|
||||
*
|
||||
* @return the print job for this object
|
||||
*/
|
||||
PrintJob getPrintJob();
|
||||
} // interface PrintGraphics
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* PrintJob.java -- A print job class
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,90 +39,64 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* This abstract class represents a print job.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This abstract class represents a print job.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see Toolkit#getPrintJob(Frame, String, Properties)
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class PrintJob
|
||||
{
|
||||
/**
|
||||
* Create a new PrintJob.
|
||||
*/
|
||||
public PrintJob()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
/**
|
||||
* Returns a graphics context suitable for rendering the next page. The
|
||||
* return must also implement {@link PrintGraphics}.
|
||||
*
|
||||
* @return a graphics context for printing the next page
|
||||
*/
|
||||
public abstract Graphics getGraphics();
|
||||
|
||||
/**
|
||||
* This method initializes a new instance of <code>PrintJob</code>.
|
||||
*/
|
||||
public
|
||||
PrintJob()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Returns the dimension of the page in pixels. The resolution will be
|
||||
* chosen to be similar to the on screen image.
|
||||
*
|
||||
* @return the page dimensions
|
||||
*/
|
||||
public abstract Dimension getPageDimension();
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Returns the resolution of the page in pixels per inch. Note that this is
|
||||
* not necessarily the printer's resolution.
|
||||
*
|
||||
* @return the resolution of the page in pixels per inch
|
||||
*/
|
||||
public abstract int getPageResolution();
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
/**
|
||||
* Tests whether or not the last page will be printed first.
|
||||
*
|
||||
* @return true if the last page prints first
|
||||
*/
|
||||
public abstract boolean lastPageFirst();
|
||||
|
||||
/**
|
||||
* Returns a graphics context suitable for rendering the next page.
|
||||
*
|
||||
* @return A graphics context for printing the next page.
|
||||
*/
|
||||
public abstract Graphics
|
||||
getGraphics();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the dimension of the page in pixels. The resolution will be
|
||||
* chosen to be similar to the on screen image.
|
||||
*
|
||||
* @return The page dimensions.
|
||||
*/
|
||||
public abstract Dimension
|
||||
getPageDimension();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the resolution of the page in pixels per inch.
|
||||
*
|
||||
* @return The resolution of the page in pixels per inch.
|
||||
*/
|
||||
public abstract int
|
||||
getPageResolution();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Tests whether or not the last page will be printed first.
|
||||
*
|
||||
* @return <code>true</code> if the last page prints first, <code>false</code>
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean
|
||||
lastPageFirst();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Informs the print job that printing is complete.
|
||||
*/
|
||||
public abstract void
|
||||
end();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method explicitly ends the print job in the event the job
|
||||
* becomes un-referenced without the application having done so.
|
||||
*/
|
||||
public void
|
||||
finalize()
|
||||
{
|
||||
end();
|
||||
}
|
||||
/**
|
||||
* Informs the print job that printing is complete or should be aborted.
|
||||
*/
|
||||
public abstract void end();
|
||||
|
||||
/**
|
||||
* This method explicitly ends the print job in the event the job
|
||||
* becomes un-referenced without the application having done so.
|
||||
*/
|
||||
public void finalize()
|
||||
{
|
||||
end();
|
||||
}
|
||||
} // class PrintJob
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
||||
/* RenderingHints.java --
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -34,50 +35,59 @@ 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;
|
||||
|
||||
/**
|
||||
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
|
||||
*/
|
||||
public class RenderingHints implements
|
||||
//java.util.Map,
|
||||
Cloneable
|
||||
{
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* NEEDS DOCUMENTATION
|
||||
*
|
||||
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
*/
|
||||
public class RenderingHints implements Map, Cloneable
|
||||
{
|
||||
public abstract static class Key
|
||||
{
|
||||
private int intKey;
|
||||
private final int key;
|
||||
|
||||
protected Key(int privateKey)
|
||||
{
|
||||
intKey = privateKey;
|
||||
key = privateKey;
|
||||
}
|
||||
|
||||
public abstract boolean isCompatibleValue(Object value);
|
||||
|
||||
protected final int intKey()
|
||||
{
|
||||
return intKey;
|
||||
}
|
||||
|
||||
public final int hashCode()
|
||||
protected final int intKey()
|
||||
{
|
||||
return key;
|
||||
}
|
||||
|
||||
public final int hashCode()
|
||||
{
|
||||
return System.identityHashCode(this);
|
||||
}
|
||||
|
||||
public final boolean equals(Object other)
|
||||
{
|
||||
return (this == other);
|
||||
}
|
||||
}
|
||||
|
||||
private static class KeyImpl extends Key
|
||||
public final boolean equals(Object other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
} // class Key
|
||||
|
||||
private static final class KeyImpl extends Key
|
||||
{
|
||||
String description;
|
||||
Object v1, v2, v3;
|
||||
final String description;
|
||||
final Object v1;
|
||||
final Object v2;
|
||||
final Object v3;
|
||||
|
||||
KeyImpl(int privateKey, String description,
|
||||
Object v1, Object v2, Object v3)
|
||||
Object v1, Object v2, Object v3)
|
||||
{
|
||||
super(privateKey);
|
||||
this.description = description;
|
||||
|
@ -85,243 +95,268 @@ public class RenderingHints implements
|
|||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
}
|
||||
|
||||
public boolean isCompatibleValue(Object value)
|
||||
|
||||
public boolean isCompatibleValue(Object value)
|
||||
{
|
||||
return (value == v1) || (value == v2) || (value == v3);
|
||||
return value == v1 || value == v2 || value == v3;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
public String toString()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
}
|
||||
} // class KeyImpl
|
||||
|
||||
|
||||
//java.util.HashMap hintMap;
|
||||
private HashMap hintMap = new HashMap();
|
||||
|
||||
public static final Key KEY_ANTIALIASING;
|
||||
public static final Object
|
||||
VALUE_ANTIALIAS_ON = "Antialiased rendering mode",
|
||||
VALUE_ANTIALIAS_DEFAULT = "Default antialiasing rendering mode";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_ANTIALIASING = new KeyImpl(1, "Global antialiasing enable key",
|
||||
VALUE_ANTIALIAS_ON,
|
||||
VALUE_ANTIALIAS_DEFAULT,
|
||||
VALUE_ANTIALIAS_DEFAULT);
|
||||
}
|
||||
public static final Object VALUE_ANTIALIAS_ON
|
||||
= "Antialiased rendering mode";
|
||||
|
||||
public static final Object VALUE_ANTIALIAS_OFF
|
||||
= "Nonantialiased rendering mode";
|
||||
|
||||
public static final Object VALUE_ANTIALIAS_DEFAULT
|
||||
= "Default antialiasing rendering mode";
|
||||
|
||||
public static final Key KEY_RENDERING;
|
||||
public static final Object
|
||||
VALUE_RENDER_SPEED = "Fastest rendering methods",
|
||||
VALUE_RENDER_QUALITY = "Highest quality rendering methods",
|
||||
VALUE_RENDER_DEFAULT = "Default rendering methods";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_RENDERING = new KeyImpl(2, "Global rendering quality key",
|
||||
VALUE_RENDER_SPEED,
|
||||
VALUE_RENDER_QUALITY,
|
||||
VALUE_RENDER_DEFAULT);
|
||||
}
|
||||
|
||||
public static final Object VALUE_RENDER_SPEED
|
||||
= "Fastest rendering methods";
|
||||
|
||||
public static final Object VALUE_RENDER_QUALITY
|
||||
= "Highest quality rendering methods";
|
||||
|
||||
public static final Object VALUE_RENDER_DEFAULT
|
||||
= "Default rendering methods";
|
||||
|
||||
public static final Key KEY_DITHERING;
|
||||
public static final Object
|
||||
VALUE_DITHER_DISABLE = "Nondithered rendering mode",
|
||||
VALUE_DITHER_ENABLE = "Dithered rendering mode",
|
||||
VALUE_DITHER_DEFAULT = "Default dithering mode";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_DITHERING = new KeyImpl(3, "Dithering quality key",
|
||||
VALUE_DITHER_DISABLE,
|
||||
VALUE_DITHER_ENABLE,
|
||||
VALUE_DITHER_DEFAULT);
|
||||
}
|
||||
|
||||
public static final Object VALUE_DITHER_DISABLE
|
||||
= "Nondithered rendering mode";
|
||||
|
||||
public static final Object VALUE_DITHER_ENABLE
|
||||
= "Dithered rendering mode";
|
||||
|
||||
public static final Object VALUE_DITHER_DEFAULT
|
||||
= "Default dithering mode";
|
||||
|
||||
public static final Key KEY_TEXT_ANTIALIASING;
|
||||
public static final Object
|
||||
VALUE_TEXT_ANTIALIAS_ON = "Antialiased text mode",
|
||||
VALUE_TEXT_ANTIALIAS_OFF = "Nonantialiased text mode",
|
||||
VALUE_TEXT_ANTIALIAS_DEFAULT = "Default antialiasing text mode";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_TEXT_ANTIALIASING = new KeyImpl(4, "Text-specific antialiasing enable key",
|
||||
VALUE_TEXT_ANTIALIAS_ON,
|
||||
VALUE_TEXT_ANTIALIAS_OFF,
|
||||
VALUE_TEXT_ANTIALIAS_DEFAULT);
|
||||
}
|
||||
|
||||
public static final Object VALUE_TEXT_ANTIALIAS_ON
|
||||
= "Antialiased text mode";
|
||||
|
||||
public static final Object VALUE_TEXT_ANTIALIAS_OFF
|
||||
= "Nonantialiased text mode";
|
||||
|
||||
public static final Object VALUE_TEXT_ANTIALIAS_DEFAULT
|
||||
= "Default antialiasing text mode";
|
||||
|
||||
public static final Key KEY_FRACTIONALMETRICS;
|
||||
public static final Object
|
||||
VALUE_FRACTIONALMETRICS_OFF = "Integer text metrics mode",
|
||||
VALUE_FRACTIONALMETRICS_ON = "Fractional text metrics mode",
|
||||
VALUE_FRACTIONALMETRICS_DEFAULT = "Default fractional text metrics mode";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_FRACTIONALMETRICS = new KeyImpl(5, "Fractional metrics enable key",
|
||||
VALUE_FRACTIONALMETRICS_OFF,
|
||||
VALUE_FRACTIONALMETRICS_ON,
|
||||
VALUE_FRACTIONALMETRICS_DEFAULT);
|
||||
}
|
||||
|
||||
public static final Object VALUE_FRACTIONALMETRICS_OFF
|
||||
= "Integer text metrics mode";
|
||||
|
||||
public static final Object VALUE_FRACTIONALMETRICS_ON
|
||||
= "Fractional text metrics mode";
|
||||
|
||||
public static final Object VALUE_FRACTIONALMETRICS_DEFAULT
|
||||
= "Default fractional text metrics mode";
|
||||
|
||||
public static final Key KEY_INTERPOLATION;
|
||||
public static final Object
|
||||
VALUE_INTERPOLATION_NEAREST_NEIGHBOR = "Nearest Neighbor image interpolation mode",
|
||||
VALUE_INTERPOLATION_BILINEAR = "Bilinear image interpolation mode",
|
||||
VALUE_INTERPOLATION_BICUBIC = "Bicubic image interpolation mode";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_INTERPOLATION = new KeyImpl(6, "Image interpolation method key",
|
||||
VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
|
||||
VALUE_INTERPOLATION_BILINEAR,
|
||||
VALUE_INTERPOLATION_BICUBIC);
|
||||
}
|
||||
|
||||
public static final Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR
|
||||
= "Nearest Neighbor image interpolation mode";
|
||||
|
||||
public static final Object VALUE_INTERPOLATION_BILINEAR
|
||||
= "Bilinear image interpolation mode";
|
||||
|
||||
public static final Object VALUE_INTERPOLATION_BICUBIC
|
||||
= "Bicubic image interpolation mode";
|
||||
|
||||
public static final Key KEY_ALPHA_INTERPOLATION;
|
||||
public static final Object
|
||||
VALUE_ALPHA_INTERPOLATION_SPEED = "Fastest alpha blending methods",
|
||||
VALUE_ALPHA_INTERPOLATION_QUALITY = "Highest quality alpha blending methods",
|
||||
VALUE_ALPHA_INTERPOLATION_DEFAULT = "Default alpha blending methods";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_ALPHA_INTERPOLATION = new KeyImpl(7, "Alpha blending interpolation method key",
|
||||
VALUE_ALPHA_INTERPOLATION_SPEED,
|
||||
VALUE_ALPHA_INTERPOLATION_QUALITY,
|
||||
VALUE_ALPHA_INTERPOLATION_DEFAULT);
|
||||
}
|
||||
|
||||
public static final Object VALUE_ALPHA_INTERPOLATION_SPEED
|
||||
= "Fastest alpha blending methods";
|
||||
|
||||
public static final Object VALUE_ALPHA_INTERPOLATION_QUALITY
|
||||
= "Highest quality alpha blending methods";
|
||||
|
||||
public static final Object VALUE_ALPHA_INTERPOLATION_DEFAULT
|
||||
= "Default alpha blending methods";
|
||||
|
||||
public static final Key KEY_COLOR_RENDERING;
|
||||
public static final Object
|
||||
VALUE_COLOR_RENDER_SPEED = "Fastest color rendering mode",
|
||||
VALUE_COLOR_RENDER_QUALITY = "Highest quality color rendering mode",
|
||||
VALUE_COLOR_RENDER_DEFAULT = "Default color rendering mode";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_COLOR_RENDERING = new KeyImpl(8, "Color rendering quality key",
|
||||
VALUE_COLOR_RENDER_SPEED,
|
||||
VALUE_COLOR_RENDER_QUALITY,
|
||||
VALUE_COLOR_RENDER_DEFAULT);
|
||||
}
|
||||
public static final Object VALUE_COLOR_RENDER_SPEED
|
||||
= "Fastest color rendering mode";
|
||||
|
||||
public static final Object VALUE_COLOR_RENDER_QUALITY
|
||||
= "Highest quality color rendering mode";
|
||||
|
||||
public static final Object VALUE_COLOR_RENDER_DEFAULT
|
||||
= "Default color rendering mode";
|
||||
|
||||
public static final Key KEY_STROKE_CONTROL;
|
||||
public static final Object
|
||||
VALUE_STROKE_DEFAULT = "Default stroke control mode",
|
||||
VALUE_STROKE_NORMALIZE = "Normalize stroke control mode",
|
||||
VALUE_STROKE_PURE = "Pure stroke control mode";
|
||||
|
||||
static
|
||||
public static final Object VALUE_STROKE_DEFAULT
|
||||
= "Default stroke normalization";
|
||||
|
||||
public static final Object VALUE_STROKE_NORMALIZE
|
||||
= "Normalize strokes for consistent rendering";
|
||||
|
||||
public static final Object VALUE_STROKE_PURE
|
||||
= "Pure stroke conversion for accurate paths";
|
||||
|
||||
static
|
||||
{
|
||||
KEY_ANTIALIASING = new KeyImpl(1, "Global antialiasing enable key",
|
||||
VALUE_ANTIALIAS_ON,
|
||||
VALUE_ANTIALIAS_OFF,
|
||||
VALUE_ANTIALIAS_DEFAULT);
|
||||
KEY_RENDERING = new KeyImpl(2, "Global rendering quality key",
|
||||
VALUE_RENDER_SPEED,
|
||||
VALUE_RENDER_QUALITY,
|
||||
VALUE_RENDER_DEFAULT);
|
||||
KEY_DITHERING = new KeyImpl(3, "Dithering quality key",
|
||||
VALUE_DITHER_DISABLE,
|
||||
VALUE_DITHER_ENABLE,
|
||||
VALUE_DITHER_DEFAULT);
|
||||
KEY_TEXT_ANTIALIASING
|
||||
= new KeyImpl(4, "Text-specific antialiasing enable key",
|
||||
VALUE_TEXT_ANTIALIAS_ON,
|
||||
VALUE_TEXT_ANTIALIAS_OFF,
|
||||
VALUE_TEXT_ANTIALIAS_DEFAULT);
|
||||
KEY_FRACTIONALMETRICS = new KeyImpl(5, "Fractional metrics enable key",
|
||||
VALUE_FRACTIONALMETRICS_OFF,
|
||||
VALUE_FRACTIONALMETRICS_ON,
|
||||
VALUE_FRACTIONALMETRICS_DEFAULT);
|
||||
KEY_INTERPOLATION = new KeyImpl(6, "Image interpolation method key",
|
||||
VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
|
||||
VALUE_INTERPOLATION_BILINEAR,
|
||||
VALUE_INTERPOLATION_BICUBIC);
|
||||
KEY_ALPHA_INTERPOLATION
|
||||
= new KeyImpl(7, "Alpha blending interpolation method key",
|
||||
VALUE_ALPHA_INTERPOLATION_SPEED,
|
||||
VALUE_ALPHA_INTERPOLATION_QUALITY,
|
||||
VALUE_ALPHA_INTERPOLATION_DEFAULT);
|
||||
KEY_COLOR_RENDERING = new KeyImpl(8, "Color rendering quality key",
|
||||
VALUE_COLOR_RENDER_SPEED,
|
||||
VALUE_COLOR_RENDER_QUALITY,
|
||||
VALUE_COLOR_RENDER_DEFAULT);
|
||||
KEY_STROKE_CONTROL = new KeyImpl(9, "Stroke normalization control key",
|
||||
VALUE_STROKE_DEFAULT,
|
||||
VALUE_STROKE_NORMALIZE,
|
||||
VALUE_STROKE_PURE);
|
||||
VALUE_STROKE_DEFAULT,
|
||||
VALUE_STROKE_NORMALIZE,
|
||||
VALUE_STROKE_PURE);
|
||||
}
|
||||
|
||||
public RenderingHints(Map init)
|
||||
{
|
||||
putAll(init);
|
||||
}
|
||||
|
||||
//public RenderingHints(Map init);
|
||||
|
||||
public RenderingHints(Key key, Object value)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
put(key, value);
|
||||
}
|
||||
|
||||
public int size()
|
||||
public int size()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.size();
|
||||
}
|
||||
|
||||
public boolean containsKey(Object key)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
}
|
||||
|
||||
public boolean containsValue(Object value)
|
||||
public boolean isEmpty()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public boolean containsKey(Object key)
|
||||
{
|
||||
if (key == null)
|
||||
throw new NullPointerException();
|
||||
return hintMap.containsKey((Key) key);
|
||||
}
|
||||
|
||||
public boolean containsValue(Object value)
|
||||
{
|
||||
return hintMap.containsValue(value);
|
||||
}
|
||||
|
||||
public Object get(Object key)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
}
|
||||
|
||||
public Object put(Object key, Object value)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
}
|
||||
|
||||
public void add(RenderingHints hints)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.get((Key) key);
|
||||
}
|
||||
|
||||
public void clear()
|
||||
public Object put(Object key, Object value)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
if (key == null || value == null)
|
||||
throw new NullPointerException();
|
||||
if (! ((Key) key).isCompatibleValue(value))
|
||||
throw new IllegalArgumentException();
|
||||
return hintMap.put(key, value);
|
||||
}
|
||||
|
||||
public Object remove(Object key)
|
||||
|
||||
public void add(RenderingHints hints)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
hintMap.putAll(hints);
|
||||
}
|
||||
|
||||
/*
|
||||
public void putAll(Map m)
|
||||
|
||||
public void clear()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
hintMap.clear();
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public Set keySet()
|
||||
|
||||
public Object remove(Object key)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return remove((Key) key);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public Collection values()
|
||||
|
||||
public void putAll(Map m)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
hintMap.putAll(m);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public Set entrySet()
|
||||
|
||||
public Set keySet()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.keySet();
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean equals(Object o)
|
||||
|
||||
public Collection values()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.values();
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
|
||||
public Set entrySet()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return Collections.unmodifiableSet(hintMap.entrySet());
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.equals(o);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
throw new UnsupportedOperationException("FIXME, not implemented yet");
|
||||
return hintMap.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public Object clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
RenderingHints copy = (RenderingHints) super.clone();
|
||||
copy.hintMap = (HashMap) hintMap.clone();
|
||||
return copy;
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
throw (Error) new InternalError().initCause(e); // Impossible
|
||||
}
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return hintMap.toString();
|
||||
}
|
||||
} // class RenderingHints
|
||||
|
|
112
libjava/java/awt/Robot.java
Normal file
112
libjava/java/awt/Robot.java
Normal file
|
@ -0,0 +1,112 @@
|
|||
/* Robot.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 java.awt;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/** STUB CLASS ONLY */
|
||||
public class Robot
|
||||
{
|
||||
private boolean waitForIdle;
|
||||
private int autoDelay;
|
||||
public Robot() throws AWTException
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public Robot(GraphicsDevice screen) throws AWTException
|
||||
{
|
||||
this();
|
||||
}
|
||||
public void mouseMove(int x, int y)
|
||||
{
|
||||
}
|
||||
public void mousePress(int buttons)
|
||||
{
|
||||
}
|
||||
public void mouseRelease(int buttons)
|
||||
{
|
||||
}
|
||||
public void mouseWheel(int wheelAmt)
|
||||
{
|
||||
}
|
||||
public void keyPress(int keycode)
|
||||
{
|
||||
}
|
||||
public void keyRelease(int keycode)
|
||||
{
|
||||
}
|
||||
public Color getPixelColor(int x, int y)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public BufferedImage createScreenCapture(Rectangle screen)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public boolean isAutoWaitForIdle()
|
||||
{
|
||||
return waitForIdle;
|
||||
}
|
||||
public void setAutoWaitForIdle(boolean value)
|
||||
{
|
||||
waitForIdle = value;
|
||||
}
|
||||
public int getAutoDelay()
|
||||
{
|
||||
return autoDelay;
|
||||
}
|
||||
public void setAutoDelay(int ms)
|
||||
{
|
||||
if (ms < 0 || ms > 60000)
|
||||
throw new IllegalArgumentException();
|
||||
autoDelay = ms;
|
||||
}
|
||||
public void delay(int ms)
|
||||
{
|
||||
if (ms < 0 || ms > 60000)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
public void waitForIdle()
|
||||
{
|
||||
}
|
||||
public String toString()
|
||||
{
|
||||
return "unimplemented";
|
||||
}
|
||||
} // class Robot
|
|
@ -1,340 +1,466 @@
|
|||
/* Copyright (C) 2000 Free Software Foundation
|
||||
/* ScrollPane.java -- Scrolling window
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of libgcj.
|
||||
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. */
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.event.AdjustmentListener;
|
||||
import java.awt.peer.ScrollPanePeer;
|
||||
import java.awt.peer.ContainerPeer;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
|
||||
/** A ScrollPane is a component that has vertical and horizontal
|
||||
* scrollbars as well as a single child which is scrolled by them.
|
||||
* @author Tom Tromey <tromey@redhat.com>
|
||||
* @date December 31, 2000
|
||||
*/
|
||||
public class ScrollPane extends Container
|
||||
/**
|
||||
* This widget provides a scrollable region that allows a single
|
||||
* subcomponent to be viewed through a smaller window.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
public class ScrollPane extends Container implements java.io.Serializable
|
||||
{
|
||||
/** This indicates that scrollbars should only be displayed when
|
||||
* needed. */
|
||||
public static final int SCROLLBARS_AS_NEEDED = 0;
|
||||
/** This indicates that scrollbars should always be displayed. */
|
||||
public static final int SCROLLBARS_ALWAYS = 1;
|
||||
/** This indicates that scrollbars should never be displayed. */
|
||||
public static final int SCROLLBARS_NEVER = 2;
|
||||
|
||||
/** Create a new ScrollPane object using the indicated scrollbar
|
||||
* display policy. If the policy is not specified it defaults to
|
||||
* SCROLLBARS_AS_NEEDED. The default size of this component is
|
||||
* 100x100.
|
||||
* @param policy The scrollbar display policy
|
||||
*/
|
||||
public ScrollPane ()
|
||||
{
|
||||
this (SCROLLBARS_AS_NEEDED);
|
||||
}
|
||||
/*
|
||||
* Static Variables
|
||||
*/
|
||||
|
||||
public ScrollPane (int policy)
|
||||
{
|
||||
if (policy != SCROLLBARS_AS_NEEDED
|
||||
&& policy != SCROLLBARS_ALWAYS
|
||||
&& policy != SCROLLBARS_NEVER)
|
||||
throw new IllegalArgumentException ("invalid value for policy");
|
||||
/**
|
||||
* Constant indicating that scrollbars are created as needed in this
|
||||
* windows.
|
||||
*/
|
||||
public static final int SCROLLBARS_AS_NEEDED = 0;
|
||||
|
||||
this.policy = policy;
|
||||
setSize (100, 100);
|
||||
}
|
||||
/**
|
||||
* Constant indicating that scrollbars are always displayed in this
|
||||
* window.
|
||||
*/
|
||||
public static final int SCROLLBARS_ALWAYS = 1;
|
||||
|
||||
/** Add a component to this ScrollPane.
|
||||
* @param comp The component to add
|
||||
* @param constraints Constraints. This is ignored.
|
||||
* @param pos Position. This must be <= 0, but is otherwise ignored.
|
||||
*/
|
||||
protected final void addImpl (Component comp, Object constraints,
|
||||
int pos)
|
||||
{
|
||||
if (pos > 0)
|
||||
throw new IllegalArgumentException ("pos must be <= 0");
|
||||
/**
|
||||
* Constant indicating that scrollbars are never displayed in this window.
|
||||
*/
|
||||
public static final int SCROLLBARS_NEVER = 2;
|
||||
|
||||
if (ncomponents > 0)
|
||||
remove (component[0]);
|
||||
// Serialization constant
|
||||
private static final long serialVersionUID = 7956609840827222915L;
|
||||
|
||||
if (comp.isLightweight ())
|
||||
{
|
||||
Panel p = new Panel ();
|
||||
p.add (comp);
|
||||
comp = p;
|
||||
}
|
||||
/*************************************************************************/
|
||||
|
||||
super.addImpl (comp, constraints, pos);
|
||||
}
|
||||
/*
|
||||
* Instance Variables
|
||||
*/
|
||||
|
||||
/** This creates the component's peer. */
|
||||
public void addNotify ()
|
||||
{
|
||||
if (peer == null)
|
||||
peer = getToolkit ().createScrollPane (this);
|
||||
super.addNotify ();
|
||||
}
|
||||
/**
|
||||
* @serial The horizontal scrollbar for this window. The methods
|
||||
* <code>setMinimum()</code>, <code>setMaximum</code>, and
|
||||
* <code>setVisibleAmount</code> must not be called on this scrollbar.
|
||||
*/
|
||||
private ScrollPaneAdjustable hAdjustable;
|
||||
|
||||
/** Lays out the components in this container. */
|
||||
public void doLayout ()
|
||||
{
|
||||
ScrollPanePeer spp = (ScrollPanePeer) peer;
|
||||
Dimension c = component[0].getPreferredSize ();
|
||||
component[0].setSize (c.width, c.height);
|
||||
spp.childResized (c.width, c.height);
|
||||
// Update the scrollbar position to the closest valid value.
|
||||
setScrollPosition (hscroll.getValue (), vscroll.getValue ());
|
||||
}
|
||||
/**
|
||||
* @serial The vertical scrollbar for this window. The methods
|
||||
* <code>setMinimum()</code>, <code>setMaximum</code>, and
|
||||
* <code>setVisibleAmount</code> must not be called on this scrollbar.
|
||||
*/
|
||||
private ScrollPaneAdjustable vAdjustable;
|
||||
|
||||
/** Returns an Adjustable representing the horizontal scrollbar.
|
||||
* The methods setMaximum, setMinimum, and setVisibleAmount should
|
||||
* not be called on this Adjustable. They will throw AWTError if
|
||||
* called.
|
||||
*/
|
||||
public Adjustable getHAdjustable ()
|
||||
{
|
||||
return hscroll;
|
||||
}
|
||||
/**
|
||||
* @serial Indicates when scrollbars are displayed in this window, will
|
||||
* be one of the constants from this class.
|
||||
*/
|
||||
private int scrollbarDisplayPolicy;
|
||||
|
||||
/** Returns the height of the horizontal scrollbar. */
|
||||
public int getHScrollbarHeight ()
|
||||
{
|
||||
if (peer == null)
|
||||
return 0;
|
||||
ScrollPanePeer spp = (ScrollPanePeer) peer;
|
||||
return spp.getHScrollbarHeight ();
|
||||
}
|
||||
// Current scroll position
|
||||
private Point scrollPosition = new Point(0, 0);
|
||||
|
||||
/** Returns the scrollbar display policy. */
|
||||
public int getScrollbarDisplayPolicy ()
|
||||
{
|
||||
return policy;
|
||||
}
|
||||
/*************************************************************************/
|
||||
|
||||
/** Returns the viewport's scroll position. */
|
||||
public Point getScrollPosition ()
|
||||
{
|
||||
return new Point (hscroll.getValue (), vscroll.getValue ());
|
||||
}
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
|
||||
/** Returns an Adjustable representing the vertical scrollbar.
|
||||
* The methods setMaximum, setMinimum, and setVisibleAmount should
|
||||
* not be called on this Adjustable. They will throw AWTError if
|
||||
* called.
|
||||
*/
|
||||
public Adjustable getVAdjustable ()
|
||||
{
|
||||
return vscroll;
|
||||
}
|
||||
|
||||
/** Returns the size of the viewport. */
|
||||
public Dimension getViewportSize ()
|
||||
{
|
||||
// Note: according to the online docs, the Insets are
|
||||
// automatically updated by the peer to include the scrollbar
|
||||
// sizes.
|
||||
Insets ins = getInsets ();
|
||||
int myw = width - ins.left - ins.right;
|
||||
int myh = height - ins.top - ins.bottom;
|
||||
|
||||
Dimension cs;
|
||||
if (ncomponents > 0)
|
||||
cs = component[0].getPreferredSize ();
|
||||
else
|
||||
cs = new Dimension (myw, myh);
|
||||
|
||||
// A little optimization -- reuse the Dimension.
|
||||
cs.setSize (myw, myh);
|
||||
return cs;
|
||||
}
|
||||
|
||||
/** Returns the width of the vertical scrollbar. */
|
||||
public int getVScrollbarWidth ()
|
||||
{
|
||||
if (peer == null)
|
||||
return 0;
|
||||
ScrollPanePeer spp = (ScrollPanePeer) peer;
|
||||
return spp.getVScrollbarWidth ();
|
||||
}
|
||||
|
||||
/** Generates a String representation of this ScrollPane's state. */
|
||||
public String paramString ()
|
||||
{
|
||||
return ("[" + getClass ().getName ()
|
||||
+ ": " + ((ncomponents > 0) ? component[0].paramString () : "")
|
||||
+ "]");
|
||||
}
|
||||
|
||||
/** Set the layout manager for this component. ScrollPane has its
|
||||
* own layout manager and overrides this method so that the layout
|
||||
* manager cannot be changed.
|
||||
* @param m The new layout manager (ignored)
|
||||
*/
|
||||
public final void setLayout (LayoutManager m)
|
||||
{
|
||||
// Nothing.
|
||||
}
|
||||
|
||||
/** Sets the scroll position for this ScrollPane. If the point if
|
||||
* out of range it is silently moved within range.
|
||||
* @param x The x coordinate
|
||||
* @param y The y coordinate
|
||||
*/
|
||||
public void setScrollPosition (int x, int y)
|
||||
{
|
||||
// According to the JCL we throw a NullPointerException if there
|
||||
// is no child.
|
||||
if (ncomponents == 0)
|
||||
throw new NullPointerException ("no child in ScrollPane");
|
||||
|
||||
Dimension child_d = component[0].getPreferredSize ();
|
||||
Dimension our_d = getViewportSize ();
|
||||
|
||||
int xmax = Math.max (0, child_d.width - our_d.width);
|
||||
int ymax = Math.max (0, child_d.height - our_d.height);
|
||||
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
else if (x > xmax)
|
||||
x = xmax;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
else if (y > ymax)
|
||||
y = ymax;
|
||||
|
||||
ScrollPanePeer spp = (ScrollPanePeer) peer;
|
||||
spp.setScrollPosition (x, y);
|
||||
}
|
||||
|
||||
/** Sets the scroll position for this ScrollPane. If the point if
|
||||
* out of range it is silently moved within range.
|
||||
* @param p The new point
|
||||
*/
|
||||
public void setScrollPosition (Point p)
|
||||
{
|
||||
setScrollPosition (p.x, p.y);
|
||||
}
|
||||
|
||||
// This implements the Adjustable for each scrollbar. The
|
||||
// expectation is that the peer will look at these objects directly
|
||||
// and modify the values in them when the user manipulates the
|
||||
// scrollbars. This has to be done from CNI to bypass Java
|
||||
// protection rules. The peer should also take care of calling the
|
||||
// adjustment listeners.
|
||||
class ScrollPaneAdjustable implements Adjustable
|
||||
{
|
||||
AdjustmentListener listeners;
|
||||
int orient;
|
||||
int unit;
|
||||
int block;
|
||||
int value;
|
||||
|
||||
public ScrollPaneAdjustable (int orient)
|
||||
{
|
||||
this.orient = orient;
|
||||
}
|
||||
|
||||
public void addAdjustmentListener (AdjustmentListener l)
|
||||
{
|
||||
listeners = AWTEventMulticaster.add (listeners, l);
|
||||
}
|
||||
|
||||
public int getBlockIncrement ()
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMaximum ()
|
||||
{
|
||||
Dimension child_d = component[0].getPreferredSize ();
|
||||
Dimension our_d = getViewportSize ();
|
||||
|
||||
int xmax = Math.max (0, child_d.width - our_d.width);
|
||||
int ymax = Math.max (0, child_d.height - our_d.height);
|
||||
|
||||
return (orient == Adjustable.HORIZONTAL) ? xmax : ymax;
|
||||
}
|
||||
|
||||
public int getMinimum ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getOrientation ()
|
||||
{
|
||||
return orient;
|
||||
}
|
||||
|
||||
public int getUnitIncrement ()
|
||||
{
|
||||
return unit;
|
||||
}
|
||||
|
||||
public int getValue ()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getVisibleAmount ()
|
||||
{
|
||||
Dimension d = getViewportSize ();
|
||||
return (orient == Adjustable.HORIZONTAL) ? d.width : d.height;
|
||||
}
|
||||
|
||||
public void removeAdjustmentListener (AdjustmentListener l)
|
||||
{
|
||||
listeners = AWTEventMulticaster.remove (listeners, l);
|
||||
}
|
||||
|
||||
public void setBlockIncrement (int b)
|
||||
{
|
||||
throw new AWTError ("can't use setBlockIncrement on this Adjustable");
|
||||
}
|
||||
|
||||
public void setMaximum (int max)
|
||||
{
|
||||
throw new AWTError ("can't use setMaximum on this Adjustable");
|
||||
}
|
||||
|
||||
public void setMinimum (int min)
|
||||
{
|
||||
throw new AWTError ("can't use setMinimum on this Adjustable");
|
||||
}
|
||||
|
||||
public void setUnitIncrement (int u)
|
||||
{
|
||||
unit = u;
|
||||
if (peer != null)
|
||||
{
|
||||
ScrollPanePeer spp = (ScrollPanePeer) peer;
|
||||
spp.setUnitIncrement (this, u);
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue (int v)
|
||||
{
|
||||
value = v;
|
||||
if (peer != null)
|
||||
{
|
||||
ScrollPanePeer spp = (ScrollPanePeer) peer;
|
||||
spp.setValue (this, v);
|
||||
}
|
||||
}
|
||||
|
||||
public void setVisibleAmount (int v)
|
||||
{
|
||||
throw new AWTError ("can't use setVisibleAmount on this Adjustable");
|
||||
}
|
||||
}
|
||||
|
||||
ScrollPaneAdjustable hscroll
|
||||
= new ScrollPaneAdjustable (Adjustable.HORIZONTAL);
|
||||
ScrollPaneAdjustable vscroll
|
||||
= new ScrollPaneAdjustable (Adjustable.VERTICAL);
|
||||
int policy;
|
||||
/**
|
||||
* Initializes a new instance of <code>ScrollPane</code> with a default
|
||||
* scrollbar policy of <code>SCROLLBARS_AS_NEEDED</code>.
|
||||
*/
|
||||
public
|
||||
ScrollPane()
|
||||
{
|
||||
this(SCROLLBARS_AS_NEEDED);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ScrollPane</code> with the
|
||||
* specified scrollbar policy.
|
||||
*
|
||||
* @param scrollbarDisplayPolicy When to display scrollbars, which must
|
||||
* be one of the constants defined in this class.
|
||||
*/
|
||||
public
|
||||
ScrollPane(int scrollbarDisplayPolicy)
|
||||
{
|
||||
this.scrollbarDisplayPolicy = scrollbarDisplayPolicy;
|
||||
|
||||
if ((scrollbarDisplayPolicy != SCROLLBARS_ALWAYS) ||
|
||||
(scrollbarDisplayPolicy != SCROLLBARS_AS_NEEDED) ||
|
||||
(scrollbarDisplayPolicy != SCROLLBARS_NEVER))
|
||||
throw new IllegalArgumentException("Bad scrollbarDisplayPolicy: " +
|
||||
scrollbarDisplayPolicy);
|
||||
|
||||
if (scrollbarDisplayPolicy != SCROLLBARS_NEVER)
|
||||
{
|
||||
hAdjustable = new ScrollPaneAdjustable(Scrollbar.HORIZONTAL);
|
||||
vAdjustable = new ScrollPaneAdjustable(Scrollbar.VERTICAL);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Instance Variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the current scrollbar display policy.
|
||||
*
|
||||
* @return The current scrollbar display policy.
|
||||
*/
|
||||
public int
|
||||
getScrollbarDisplayPolicy()
|
||||
{
|
||||
return(scrollbarDisplayPolicy);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the horizontal scrollbar for this object. If the scrollbar
|
||||
* display policy is set to <code>SCROLLBARS_NEVER</code> then this
|
||||
* will be <code>null</code>.
|
||||
*
|
||||
* @return The horizontal scrollbar for this window.
|
||||
*/
|
||||
public Adjustable
|
||||
getHAdjustable()
|
||||
{
|
||||
return(hAdjustable);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the vertical scrollbar for this object. If the scrollbar
|
||||
* display policy is set to <code>SCROLLBARS_NEVER</code> then this
|
||||
* will be <code>null</code>.
|
||||
*
|
||||
* @return The horizontal scrollbar for this window.
|
||||
*/
|
||||
public Adjustable
|
||||
getVAdjustable()
|
||||
{
|
||||
return(vAdjustable);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the current viewport size. The viewport is the region of
|
||||
* this object's window where the child is actually displayed.
|
||||
*
|
||||
* @return The viewport size.
|
||||
*/
|
||||
public Dimension
|
||||
getViewportSize()
|
||||
{
|
||||
Dimension viewsize = getSize();
|
||||
Insets insets = getInsets();
|
||||
viewsize.width = viewsize.width - (insets.left + insets.right);
|
||||
viewsize.height = viewsize.height - (insets.top + insets.bottom);
|
||||
|
||||
ScrollPaneAdjustable v = (ScrollPaneAdjustable)getVAdjustable();
|
||||
ScrollPaneAdjustable h = (ScrollPaneAdjustable)getHAdjustable();
|
||||
|
||||
if ((v != null) && v.isVisible())
|
||||
viewsize.width = viewsize.width - v.getSize().width;
|
||||
if ((h != null) && h.isVisible())
|
||||
viewsize.height = viewsize.height - v.getSize().height;
|
||||
|
||||
return(viewsize);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the height of a horizontal scrollbar.
|
||||
*
|
||||
* @return The height of a horizontal scrollbar.
|
||||
*/
|
||||
public int
|
||||
getHScrollbarHeight()
|
||||
{
|
||||
ScrollPanePeer spp = (ScrollPanePeer)getPeer();
|
||||
if (spp != null)
|
||||
return(spp.getHScrollbarHeight());
|
||||
else
|
||||
return(0); // FIXME: What to do here?
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the width of a vertical scrollbar.
|
||||
*
|
||||
* @return The width of a vertical scrollbar.
|
||||
*/
|
||||
public int
|
||||
getVScrollbarWidth()
|
||||
{
|
||||
ScrollPanePeer spp = (ScrollPanePeer)getPeer();
|
||||
if (spp != null)
|
||||
return(spp.getVScrollbarWidth());
|
||||
else
|
||||
return(0); // FIXME: What to do here?
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the current scroll position of the viewport.
|
||||
*
|
||||
* @return The current scroll position of the viewport.
|
||||
*/
|
||||
public Point
|
||||
getScrollPosition()
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
Adjustable v = getVAdjustable();
|
||||
Adjustable h = getHAdjustable();
|
||||
|
||||
if (v != null)
|
||||
y = v.getValue();
|
||||
if (h != null)
|
||||
x = h.getValue();
|
||||
|
||||
return(new Point(x, y));
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the scroll position to the specified value.
|
||||
*
|
||||
* @param scrollPosition The new scrollPosition.
|
||||
*
|
||||
* @exception IllegalArgumentException If the specified value is outside
|
||||
* the legal scrolling range.
|
||||
*/
|
||||
public void
|
||||
setScrollPosition(Point scrollPosition) throws IllegalArgumentException
|
||||
{
|
||||
setScrollPosition(scrollPosition.x, scrollPosition.y);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the scroll position to the specified value.
|
||||
*
|
||||
* @param x The new X coordinate of the scroll position.
|
||||
* @param y The new Y coordinate of the scroll position.
|
||||
*
|
||||
* @exception IllegalArgumentException If the specified value is outside
|
||||
* the legal scrolling range.
|
||||
*/
|
||||
public void
|
||||
setScrollPosition(int x, int y)
|
||||
{
|
||||
Adjustable h = getHAdjustable();
|
||||
Adjustable v = getVAdjustable();
|
||||
|
||||
if (h != null)
|
||||
h.setValue(x);
|
||||
if (v != null)
|
||||
v.setValue(y);
|
||||
|
||||
ScrollPanePeer spp = (ScrollPanePeer)getPeer();
|
||||
if (spp != null)
|
||||
spp.setScrollPosition(x, y);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Notifies this object that it should create its native peer.
|
||||
*/
|
||||
public void
|
||||
addNotify()
|
||||
{
|
||||
if (getPeer() == null)
|
||||
return;
|
||||
|
||||
setPeer((ComponentPeer)getToolkit().createScrollPane(this));
|
||||
|
||||
if (hAdjustable != null)
|
||||
hAdjustable.addNotify();
|
||||
if (vAdjustable != null)
|
||||
vAdjustable.removeNotify();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Notifies this object that it should destroy its native peers.
|
||||
*/
|
||||
public void
|
||||
removeNotify()
|
||||
{
|
||||
if (hAdjustable != null)
|
||||
hAdjustable.removeNotify();
|
||||
if (vAdjustable != null)
|
||||
vAdjustable.removeNotify();
|
||||
|
||||
super.removeNotify();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Adds the specified child component to this container. A
|
||||
* <code>ScrollPane</code> can have at most one child, so if a second
|
||||
* one is added, then first one is removed.
|
||||
*
|
||||
* @param component The component to add to this container.
|
||||
* @param constraints A list of layout constraints for this object.
|
||||
* @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)
|
||||
{
|
||||
Component[] list = getComponents();
|
||||
if ((list != null) && (list.length > 0))
|
||||
remove(list[0]);
|
||||
|
||||
super.addImpl(component, constraints, -1);
|
||||
|
||||
doLayout();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Lays out this component. This consists of resizing the sole child
|
||||
* component to its perferred size.
|
||||
*/
|
||||
public void
|
||||
doLayout()
|
||||
{
|
||||
Component[] list = getComponents();
|
||||
if ((list != null) && (list.length > 0))
|
||||
{
|
||||
Dimension dim = list[0].getPreferredSize();
|
||||
list[0].resize(dim);
|
||||
|
||||
Point p = getScrollPosition();
|
||||
if (p.x > dim.width)
|
||||
p.x = dim.width;
|
||||
if (p.y > dim.height)
|
||||
p.y = dim.height;
|
||||
|
||||
setScrollPosition(p);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Lays out this component. This consists of resizing the sole child
|
||||
* component to its perferred size.
|
||||
*
|
||||
* @deprecated This method is deprecated in favor of
|
||||
* <code>doLayout()</code>.
|
||||
*/
|
||||
public void
|
||||
layout()
|
||||
{
|
||||
doLayout();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method overrides its superclass method to ensure no layout
|
||||
* manager is set for this container. <code>ScrollPane</code>'s do
|
||||
* not have layout managers.
|
||||
*
|
||||
* @param layoutManager Ignored
|
||||
*/
|
||||
public final void
|
||||
setLayout(LayoutManager layoutManager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Prints all of the components in this container.
|
||||
*
|
||||
* @param graphics The desired graphics context for printing.
|
||||
*/
|
||||
public void
|
||||
printComponents(Graphics graphics)
|
||||
{
|
||||
super.printComponents(graphics);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns a debug string for this object.
|
||||
*
|
||||
* @return A debug string for this object.
|
||||
*/
|
||||
public String
|
||||
paramString()
|
||||
{
|
||||
return(getClass().getName());
|
||||
}
|
||||
|
||||
} // class ScrollPane
|
||||
|
||||
|
|
72
libjava/java/awt/ScrollPaneAdjustable.java
Normal file
72
libjava/java/awt/ScrollPaneAdjustable.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* ScrollPaneAdjustable.java -- Scrollbars for a ScrollPane
|
||||
Copyright (C) 1999 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 java.awt;
|
||||
|
||||
/**
|
||||
* Need this class since the serialization spec for ScrollPane
|
||||
* uses it.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
class ScrollPaneAdjustable extends Scrollbar
|
||||
{
|
||||
|
||||
public
|
||||
ScrollPaneAdjustable(int orientation)
|
||||
{
|
||||
super(orientation);
|
||||
}
|
||||
|
||||
public void
|
||||
setMaximum(int maximum)
|
||||
{
|
||||
}
|
||||
|
||||
public void
|
||||
setMinimum(int minimum)
|
||||
{
|
||||
}
|
||||
|
||||
public void
|
||||
setVisibleAmount(int visibleAmount)
|
||||
{
|
||||
}
|
||||
|
||||
} // class ScrollPaneAdjustable
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/* Shape.java -- Interface for shape abstractions.
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
/* Shape.java -- the classic Object-Oriented shape interface
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,38 +38,166 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.geom.*;
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition.
|
||||
* Status: Believed complete and correct to JDK 1.2.
|
||||
*/
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
/**
|
||||
* This interface represents an abstract shape.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
*/
|
||||
* This interface represents an abstract shape. The shape is described by
|
||||
* a {@link PathIterator}, and has callbacks for determining bounding box,
|
||||
* where points and rectangles lie in relation to the shape, and tracing
|
||||
* the trajectory.
|
||||
*
|
||||
* <p>A point is inside if it is completely inside, or on the boundary and
|
||||
* adjacent points in the increasing x or y direction are completely inside.
|
||||
* Unclosed shapes are considered as implicitly closed when performing
|
||||
* <code>contains</code> or <code>intersects</code>.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see PathIterator
|
||||
* @see AffineTransform
|
||||
* @see FlatteningPathIterator
|
||||
* @see GeneralPath
|
||||
* @since 1.0
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface Shape
|
||||
{
|
||||
/**
|
||||
* Returns a <code>Rectange</code> that bounds the shape. There is no
|
||||
* guarantee that this is the minimum bounding box, particularly if
|
||||
* the shape overflows the finite integer range of a bound. Generally,
|
||||
* <code>getBounds2D</code> returns a tighter bound.
|
||||
*
|
||||
* @return the shape's bounding box
|
||||
* @see #getBounds2D()
|
||||
*/
|
||||
Rectangle getBounds();
|
||||
|
||||
/**
|
||||
* Returns a <code>Rectange</code> that bounds the shape.
|
||||
*
|
||||
* @return A <code>Rectange</code> that bounds the shape.
|
||||
*/
|
||||
public abstract Rectangle
|
||||
getBounds();
|
||||
/**
|
||||
* Returns a high precision bounding box of the shape. There is no guarantee
|
||||
* that this is the minimum bounding box, but at least it never overflows.
|
||||
*
|
||||
* @return the shape's bounding box
|
||||
* @see #getBounds()
|
||||
* @since 1.2
|
||||
*/
|
||||
Rectangle2D getBounds2D();
|
||||
|
||||
public boolean contains (double x, double y);
|
||||
public boolean contains (double x, double y, double w, double h);
|
||||
public boolean contains (Point2D p);
|
||||
public boolean contains (Rectangle2D r);
|
||||
public Rectangle2D getBounds2D ();
|
||||
public PathIterator getPathIterator (AffineTransform at);
|
||||
public PathIterator getPathIterator (AffineTransform at, double flatness);
|
||||
public boolean intersects (double x, double y, double w, double h);
|
||||
public boolean intersects (Rectangle2D r);
|
||||
/**
|
||||
* Test if the coordinates lie in the shape.
|
||||
*
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @return true if (x,y) lies inside the shape
|
||||
* @since 1.2
|
||||
*/
|
||||
boolean contains(double x, double y);
|
||||
|
||||
/**
|
||||
* Test if the point lie in the shape.
|
||||
*
|
||||
* @param p the high-precision point
|
||||
* @return true if p lies inside the shape
|
||||
* @throws NullPointerException if p is null
|
||||
* @since 1.2
|
||||
*/
|
||||
boolean contains(Point2D p);
|
||||
|
||||
/**
|
||||
* Test if a high-precision rectangle intersects the shape. This is true
|
||||
* if any point in the rectangle is in the shape, with the caveat that the
|
||||
* operation may include high probability estimates when the actual
|
||||
* calculation is prohibitively expensive. The {@link Area} class can
|
||||
* be used for more precise answers.
|
||||
*
|
||||
* @param x the x coordinate of the rectangle
|
||||
* @param y the y coordinate of the rectangle
|
||||
* @param w the width of the rectangle, undefined results if negative
|
||||
* @param h the height of the rectangle, undefined results if negative
|
||||
* @return true if the rectangle intersects this shape
|
||||
* @see Area
|
||||
* @since 1.2
|
||||
*/
|
||||
boolean intersects(double x, double y, double w, double h);
|
||||
|
||||
/**
|
||||
* Test if a high-precision rectangle intersects the shape. This is true
|
||||
* if any point in the rectangle is in the shape, with the caveat that the
|
||||
* operation may include high probability estimates when the actual
|
||||
* calculation is prohibitively expensive. The {@link Area} class can
|
||||
* be used for more precise answers.
|
||||
*
|
||||
* @param r the rectangle
|
||||
* @return true if the rectangle intersects this shape
|
||||
* @throws NullPointerException if r is null
|
||||
* @see #intersects(double, double, double, double)
|
||||
* @since 1.2
|
||||
*/
|
||||
boolean intersects(Rectangle2D r);
|
||||
|
||||
/**
|
||||
* Test if a high-precision rectangle lies completely in the shape. This is
|
||||
* true if all points in the rectangle are in the shape, with the caveat
|
||||
* that the operation may include high probability estimates when the actual
|
||||
* calculation is prohibitively expensive. The {@link Area} class can
|
||||
* be used for more precise answers.
|
||||
*
|
||||
* @param x the x coordinate of the rectangle
|
||||
* @param y the y coordinate of the rectangle
|
||||
* @param w the width of the rectangle, undefined results if negative
|
||||
* @param h the height of the rectangle, undefined results if negative
|
||||
* @return true if the rectangle is contained in this shape
|
||||
* @see Area
|
||||
* @since 1.2
|
||||
*/
|
||||
boolean contains(double x, double y, double w, double h);
|
||||
|
||||
/**
|
||||
* Test if a high-precision rectangle lies completely in the shape. This is
|
||||
* true if all points in the rectangle are in the shape, with the caveat
|
||||
* that the operation may include high probability estimates when the actual
|
||||
* calculation is prohibitively expensive. The {@link Area} class can
|
||||
* be used for more precise answers.
|
||||
*
|
||||
* @param r the rectangle
|
||||
* @return true if the rectangle is contained in this shape
|
||||
* @throws NullPointerException if r is null
|
||||
* @see #contains(double, double, double, double)
|
||||
* @since 1.2
|
||||
*/
|
||||
boolean contains(Rectangle2D r);
|
||||
|
||||
/**
|
||||
* Return an iterator along the shape boundary. If the optional transform
|
||||
* is provided, the iterator is transformed accordingly. Each call returns
|
||||
* a new object, independent from others in use. It is recommended, but
|
||||
* not required, that the Shape isolate iterations from future changes to
|
||||
* the boundary, and document this fact.
|
||||
*
|
||||
* @param transform an optional transform to apply to the iterator
|
||||
* @return a new iterator over the boundary
|
||||
* @since 1.2
|
||||
*/
|
||||
PathIterator getPathIterator(AffineTransform transform);
|
||||
|
||||
/**
|
||||
* Return an iterator along the flattened version of the shape boundary.
|
||||
* Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE points are returned in the
|
||||
* iterator. The flatness paramter controls how far points are allowed to
|
||||
* differ from the real curve; although a limit on accuracy may cause this
|
||||
* parameter to be enlarged if needed.
|
||||
*
|
||||
* <p>If the optional transform is provided, the iterator is transformed
|
||||
* accordingly. Each call returns a new object, independent from others in
|
||||
* use. It is recommended, but not required, that the Shape isolate
|
||||
* iterations from future changes to the boundary, and document this fact.
|
||||
*
|
||||
* @param transform an optional transform to apply to the iterator
|
||||
* @param double the maximum distance for deviation from the real boundary
|
||||
* @return a new iterator over the boundary
|
||||
* @since 1.2
|
||||
*/
|
||||
PathIterator getPathIterator(AffineTransform transform, double flatness);
|
||||
} // interface Shape
|
||||
|
||||
|
|
65
libjava/java/awt/Stroke.java
Normal file
65
libjava/java/awt/Stroke.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* Stroke.java -- a stroked outline of a shape
|
||||
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 java.awt;
|
||||
|
||||
/**
|
||||
* This interface allows a Graphics2D to grab the outline of a shape, as if
|
||||
* stroked by a marking pen of appropriate size and shape. The area inked
|
||||
* by the pen is the area of this stroke. Anything in the graphic which
|
||||
* traces an outline will use this stroke, such as <code>drawLine</code>.
|
||||
* Strokes must be immutable, because the graphics object does not clone
|
||||
* them.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see BasicStroke
|
||||
* @see Graphics2D#setStroke(Stroke)
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface Stroke
|
||||
{
|
||||
/**
|
||||
* Returns a shape which outlines the boundary of the given shape, in
|
||||
* effect converting the infinitely thin line into a new shape.
|
||||
*
|
||||
* @param s the shape to stroke
|
||||
* @return the stroked outline shape
|
||||
*/
|
||||
Shape createStrokedShape(Shape s);
|
||||
} // interface Stroke
|
|
@ -1,5 +1,5 @@
|
|||
/* SystemColor.java -- Class to access system color values.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* SystemColor.java -- access dynamic system color values
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,393 +38,425 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
/**
|
||||
* This class contains the various "system colors" in use by the
|
||||
* native windowing system.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
public final class SystemColor extends Color implements java.io.Serializable
|
||||
{
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.io.Serializable;
|
||||
|
||||
/*
|
||||
* Static Variables
|
||||
/**
|
||||
* This class contains the various "system colors" in use by the native
|
||||
* windowing system. The <code>getRGB()</code> method is dynamic on systems
|
||||
* which support dynamic system color changes, and most methods in the
|
||||
* superclass are written to use this dynamic value when reporting colors.
|
||||
* However, the <code>equals()</code> method is not dynamic, and does not
|
||||
* track the actual color of instances in this class. This means that equals
|
||||
* may give surprising results; you are better off relying on getRGB.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* Array index of the desktop color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int DESKTOP = 0;
|
||||
|
||||
/**
|
||||
* Array index of the active caption color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int ACTIVE_CAPTION = 1;
|
||||
|
||||
/**
|
||||
* Array index of the active caption text color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int ACTIVE_CAPTION_TEXT = 2;
|
||||
|
||||
/**
|
||||
* Array index of the active caption border color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int ACTIVE_CAPTION_BORDER = 3;
|
||||
|
||||
/**
|
||||
* Array index of the inactive caption color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int INACTIVE_CAPTION = 4;
|
||||
|
||||
/**
|
||||
* Array index of the inactive caption text color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int INACTIVE_CAPTION_TEXT = 5;
|
||||
|
||||
/**
|
||||
* Array index of the inactive caption border color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int INACTIVE_CAPTION_BORDER = 6;
|
||||
|
||||
/**
|
||||
* Array index of the window background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int WINDOW = 7;
|
||||
|
||||
/**
|
||||
* Array index of the window border color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int WINDOW_BORDER = 8;
|
||||
|
||||
/**
|
||||
* Array index of the window text color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int WINDOW_TEXT = 9;
|
||||
|
||||
/**
|
||||
* Array index of the menu background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int MENU = 10;
|
||||
|
||||
/**
|
||||
* Array index of the menu text color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int MENU_TEXT = 11;
|
||||
|
||||
/**
|
||||
* Array index of the text background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int TEXT = 12;
|
||||
|
||||
/**
|
||||
* Array index of the text foreground color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int TEXT_TEXT = 13;
|
||||
|
||||
/**
|
||||
* Array index of the highlighted text background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int TEXT_HIGHLIGHT = 14;
|
||||
|
||||
/**
|
||||
* Array index of the highlighted text foreground color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int TEXT_HIGHLIGHT_TEXT = 15;
|
||||
|
||||
/**
|
||||
* Array index of the inactive text foreground color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int TEXT_INACTIVE_TEXT = 16;
|
||||
|
||||
/**
|
||||
* Array index of the control background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int CONTROL = 17;
|
||||
|
||||
/**
|
||||
* Array index of the control text color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int CONTROL_TEXT = 18;
|
||||
|
||||
/**
|
||||
* Array index of the highlighted control background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int CONTROL_HIGHLIGHT = 19;
|
||||
|
||||
/**
|
||||
* Array index of the lightly highlighted control background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int CONTROL_LT_HIGHLIGHT = 20;
|
||||
|
||||
/**
|
||||
* Array index of the shadowed control background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int CONTROL_SHADOW = 21;
|
||||
|
||||
/**
|
||||
* Array index of the darkly shadowed control background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int CONTROL_DK_SHADOW = 22;
|
||||
|
||||
/**
|
||||
* Array index of the scrollbar background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int SCROLLBAR = 23;
|
||||
|
||||
/**
|
||||
* Array index of the info background color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int INFO = 24;
|
||||
|
||||
/**
|
||||
* Array index of the info text color. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int INFO_TEXT = 25;
|
||||
|
||||
/**
|
||||
* The number of system colors. Used by
|
||||
* <code>Toolkit.loadSystemColors()</code>.
|
||||
*/
|
||||
public static final int NUM_COLORS = 26;
|
||||
|
||||
/**
|
||||
* The desktop color.
|
||||
*/
|
||||
public static final SystemColor desktop;
|
||||
|
||||
/**
|
||||
* The active caption background color.
|
||||
*/
|
||||
public static final SystemColor activeCaption;
|
||||
|
||||
/**
|
||||
* The active caption text color.
|
||||
*/
|
||||
public static final SystemColor activeCaptionText;
|
||||
|
||||
/**
|
||||
* The active caption border color.
|
||||
*/
|
||||
public static final SystemColor activeCaptionBorder;
|
||||
|
||||
/**
|
||||
* The inactive caption background color.
|
||||
*/
|
||||
public static final SystemColor inactiveCaption;
|
||||
|
||||
/**
|
||||
* The inactive caption text color.
|
||||
*/
|
||||
public static final SystemColor inactiveCaptionText;
|
||||
|
||||
/**
|
||||
* The inactive caption border color.
|
||||
*/
|
||||
public static final SystemColor inactiveCaptionBorder;
|
||||
|
||||
/**
|
||||
* The window background color.
|
||||
*/
|
||||
public static final SystemColor window;
|
||||
|
||||
/**
|
||||
* The window border color.
|
||||
*/
|
||||
public static final SystemColor windowBorder;
|
||||
|
||||
/**
|
||||
* The window text color.
|
||||
*/
|
||||
public static final SystemColor windowText;
|
||||
|
||||
/**
|
||||
* The menu background color.
|
||||
*/
|
||||
public static final SystemColor menu;
|
||||
|
||||
/**
|
||||
* The menu text color.
|
||||
*/
|
||||
public static final SystemColor menuText;
|
||||
|
||||
/**
|
||||
* The text background color.
|
||||
*/
|
||||
public static final SystemColor text;
|
||||
|
||||
/**
|
||||
* The text foreground color.
|
||||
*/
|
||||
public static final SystemColor textText;
|
||||
|
||||
/**
|
||||
* The highlighted text background color.
|
||||
*/
|
||||
public static final SystemColor textHighlight;
|
||||
|
||||
/**
|
||||
* The highlighted text foreground color.
|
||||
*/
|
||||
public static final SystemColor textHighlightText;
|
||||
|
||||
/**
|
||||
* The inactive text color.
|
||||
*/
|
||||
public static final SystemColor textInactiveText;
|
||||
|
||||
/**
|
||||
* The control background color.
|
||||
*/
|
||||
public static final SystemColor control;
|
||||
|
||||
/**
|
||||
* The control text color.
|
||||
*/
|
||||
public static final SystemColor controlText;
|
||||
|
||||
/**
|
||||
* The control highlight color.
|
||||
*/
|
||||
public static final SystemColor controlHighlight;
|
||||
|
||||
/**
|
||||
* The control light highlight color.
|
||||
*/
|
||||
public static final SystemColor controlLtHighlight;
|
||||
|
||||
/**
|
||||
* The control shadow color.
|
||||
*/
|
||||
public static final SystemColor controlShadow;
|
||||
|
||||
/**
|
||||
* The control dark shadow color.
|
||||
*/
|
||||
public static final SystemColor controlDkShadow;
|
||||
|
||||
/**
|
||||
* The scrollbar color.
|
||||
*/
|
||||
public static final SystemColor scrollbar;
|
||||
|
||||
/**
|
||||
* The info text background color.
|
||||
*/
|
||||
public static final SystemColor info;
|
||||
|
||||
/**
|
||||
* The info text foreground color.
|
||||
*/
|
||||
public static final SystemColor infoText;
|
||||
|
||||
// Serialization version constant
|
||||
private static final long serialVersionUID = 4503142729533789064L;
|
||||
|
||||
static
|
||||
public final class SystemColor extends Color implements Serializable
|
||||
{
|
||||
int[] sys_color_rgbs = new int[NUM_COLORS];
|
||||
Toolkit.getDefaultToolkit().loadSystemColors(sys_color_rgbs);
|
||||
// Implementation note: To be serial compatible with JDK, this class must
|
||||
// violate the semantic meaning of super.value to be one of the
|
||||
// NUM_COLORS constants instead of the actual RGB value. Hence there are
|
||||
// a lot of ugly workarounds in Color and in this class. I would have
|
||||
// designed it MUCH differently, making a separate id field in this class.
|
||||
|
||||
desktop = new SystemColor(sys_color_rgbs[DESKTOP]);
|
||||
activeCaption= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION]);
|
||||
activeCaptionText= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_TEXT]);
|
||||
activeCaptionBorder = new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_BORDER]);
|
||||
inactiveCaption = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION]);
|
||||
inactiveCaptionText = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_TEXT]);
|
||||
inactiveCaptionBorder =
|
||||
new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_BORDER]);
|
||||
window = new SystemColor(sys_color_rgbs[WINDOW]);
|
||||
windowBorder = new SystemColor(sys_color_rgbs[WINDOW_BORDER]);
|
||||
windowText = new SystemColor(sys_color_rgbs[WINDOW_TEXT]);
|
||||
menu = new SystemColor(sys_color_rgbs[MENU]);
|
||||
menuText = new SystemColor(sys_color_rgbs[MENU_TEXT]);
|
||||
text = new SystemColor(sys_color_rgbs[TEXT]);
|
||||
textText = new SystemColor(sys_color_rgbs[TEXT_TEXT]);
|
||||
textHighlight = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT]);
|
||||
textHighlightText = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT_TEXT]);
|
||||
textInactiveText = new SystemColor(sys_color_rgbs[TEXT_INACTIVE_TEXT]);
|
||||
control = new SystemColor(sys_color_rgbs[CONTROL]);
|
||||
controlText = new SystemColor(sys_color_rgbs[CONTROL_TEXT]);
|
||||
controlHighlight = new SystemColor(sys_color_rgbs[CONTROL_HIGHLIGHT]);
|
||||
controlLtHighlight = new SystemColor(sys_color_rgbs[CONTROL_LT_HIGHLIGHT]);
|
||||
controlShadow = new SystemColor(sys_color_rgbs[CONTROL_SHADOW]);
|
||||
controlDkShadow = new SystemColor(sys_color_rgbs[CONTROL_DK_SHADOW]);
|
||||
scrollbar = new SystemColor(sys_color_rgbs[SCROLLBAR]);
|
||||
info = new SystemColor(sys_color_rgbs[INFO]);
|
||||
infoText = new SystemColor(sys_color_rgbs[INFO_TEXT]);
|
||||
}
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 4503142729533789064L;
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Array index of the desktop color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #desktop
|
||||
*/
|
||||
public static final int DESKTOP = 0;
|
||||
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
/**
|
||||
* Array index of the active caption color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #activeCaption
|
||||
*/
|
||||
public static final int ACTIVE_CAPTION = 1;
|
||||
|
||||
private
|
||||
SystemColor(int rgb)
|
||||
{
|
||||
super(rgb);
|
||||
}
|
||||
/**
|
||||
* Array index of the active caption text color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #activeCaptionText
|
||||
*/
|
||||
public static final int ACTIVE_CAPTION_TEXT = 2;
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Array index of the active caption border color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #activeCaptionBorder
|
||||
*/
|
||||
public static final int ACTIVE_CAPTION_BORDER = 3;
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
/**
|
||||
* Array index of the inactive caption color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #inactiveCaption
|
||||
*/
|
||||
public static final int INACTIVE_CAPTION = 4;
|
||||
|
||||
/**
|
||||
* Returns the RGB value for this color as an <code>int</code>. The first
|
||||
* byte is the blue value, the second the green value, the third the
|
||||
* red value and the fourth is set to 0xFF.
|
||||
*
|
||||
* @return The RGB value.
|
||||
/**
|
||||
* Array index of the inactive caption text color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #inactiveCaptionText
|
||||
*/
|
||||
public static final int INACTIVE_CAPTION_TEXT = 5;
|
||||
|
||||
/**
|
||||
* Array index of the inactive caption border color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #inactiveCaptionBorder
|
||||
*/
|
||||
public static final int INACTIVE_CAPTION_BORDER = 6;
|
||||
|
||||
/**
|
||||
* Array index of the window background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #window
|
||||
*/
|
||||
public static final int WINDOW = 7;
|
||||
|
||||
/**
|
||||
* Array index of the window border color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #windowBorder
|
||||
*/
|
||||
public static final int WINDOW_BORDER = 8;
|
||||
|
||||
/**
|
||||
* Array index of the window text color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #windowText
|
||||
*/
|
||||
public static final int WINDOW_TEXT = 9;
|
||||
|
||||
/**
|
||||
* Array index of the menu background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #menu
|
||||
*/
|
||||
public static final int MENU = 10;
|
||||
|
||||
/**
|
||||
* Array index of the menu text color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #menuText
|
||||
*/
|
||||
public static final int MENU_TEXT = 11;
|
||||
|
||||
/**
|
||||
* Array index of the text background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #text
|
||||
*/
|
||||
public static final int TEXT = 12;
|
||||
|
||||
/**
|
||||
* Array index of the text foreground color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #textText
|
||||
*/
|
||||
public int
|
||||
getRGB()
|
||||
{
|
||||
// Override only to be spec consistent.
|
||||
return(super.getRGB());
|
||||
}
|
||||
public static final int TEXT_TEXT = 13;
|
||||
|
||||
/*************************************************************************/
|
||||
/**
|
||||
* Array index of the highlighted text background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #textHighlight
|
||||
*/
|
||||
public static final int TEXT_HIGHLIGHT = 14;
|
||||
|
||||
/**
|
||||
* Returns a string describing this color.
|
||||
*
|
||||
* @return A string describing this color.
|
||||
*/
|
||||
public String
|
||||
toString()
|
||||
{
|
||||
return("SystemColor(R=" + getRed() + ",G=" + getGreen() + ",B=" +
|
||||
getBlue() + ")");
|
||||
}
|
||||
/**
|
||||
* Array index of the highlighted text foreground color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #textHighlightText
|
||||
*/
|
||||
public static final int TEXT_HIGHLIGHT_TEXT = 15;
|
||||
|
||||
} // class SystemColor
|
||||
/**
|
||||
* Array index of the inactive text foreground color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #textInactiveText
|
||||
*/
|
||||
public static final int TEXT_INACTIVE_TEXT = 16;
|
||||
|
||||
/**
|
||||
* Array index of the control background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #control
|
||||
*/
|
||||
public static final int CONTROL = 17;
|
||||
|
||||
/**
|
||||
* Array index of the control text color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #controlText
|
||||
*/
|
||||
public static final int CONTROL_TEXT = 18;
|
||||
|
||||
/**
|
||||
* Array index of the highlighted control background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #controlHighlight
|
||||
*/
|
||||
public static final int CONTROL_HIGHLIGHT = 19;
|
||||
|
||||
/**
|
||||
* Array index of the lightly highlighted control background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #controlLtHighlight
|
||||
*/
|
||||
public static final int CONTROL_LT_HIGHLIGHT = 20;
|
||||
|
||||
/**
|
||||
* Array index of the shadowed control background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #controlShadow
|
||||
*/
|
||||
public static final int CONTROL_SHADOW = 21;
|
||||
|
||||
/**
|
||||
* Array index of the darkly shadowed control background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #controlDkShadow
|
||||
*/
|
||||
public static final int CONTROL_DK_SHADOW = 22;
|
||||
|
||||
/**
|
||||
* Array index of the scrollbar background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #scrollbar
|
||||
*/
|
||||
public static final int SCROLLBAR = 23;
|
||||
|
||||
/**
|
||||
* Array index of the info background color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #info
|
||||
*/
|
||||
public static final int INFO = 24;
|
||||
|
||||
/**
|
||||
* Array index of the info text color. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*
|
||||
* @see #infoText
|
||||
*/
|
||||
public static final int INFO_TEXT = 25;
|
||||
|
||||
/**
|
||||
* The number of system colors. Used by
|
||||
* {@link Toolkit#loadSystemColors()}.
|
||||
*/
|
||||
public static final int NUM_COLORS = 26;
|
||||
|
||||
/**
|
||||
* The internal array used to dynamically update <code>getRGB()</code>.
|
||||
*/
|
||||
private static final int[] colors = new int[NUM_COLORS];
|
||||
|
||||
/** The desktop color. */
|
||||
public static final SystemColor desktop
|
||||
= new SystemColor(DESKTOP);
|
||||
|
||||
/** The active caption background color. */
|
||||
public static final SystemColor activeCaption
|
||||
= new SystemColor(ACTIVE_CAPTION);
|
||||
|
||||
/** The active caption text color. */
|
||||
public static final SystemColor activeCaptionText
|
||||
= new SystemColor(ACTIVE_CAPTION_TEXT);
|
||||
|
||||
/** The active caption border color. */
|
||||
public static final SystemColor activeCaptionBorder
|
||||
= new SystemColor(ACTIVE_CAPTION_BORDER);
|
||||
|
||||
/** The inactive caption background color. */
|
||||
public static final SystemColor inactiveCaption
|
||||
= new SystemColor(INACTIVE_CAPTION);
|
||||
|
||||
/** The inactive caption text color. */
|
||||
public static final SystemColor inactiveCaptionText
|
||||
= new SystemColor(INACTIVE_CAPTION_TEXT);
|
||||
|
||||
/** The inactive caption border color. */
|
||||
public static final SystemColor inactiveCaptionBorder
|
||||
= new SystemColor(INACTIVE_CAPTION_BORDER);
|
||||
|
||||
/** The window background color. */
|
||||
public static final SystemColor window
|
||||
= new SystemColor(WINDOW);
|
||||
|
||||
/** The window border color. */
|
||||
public static final SystemColor windowBorder
|
||||
= new SystemColor(WINDOW_BORDER);
|
||||
|
||||
/** The window text color. */
|
||||
public static final SystemColor windowText
|
||||
= new SystemColor(WINDOW_TEXT);
|
||||
|
||||
/** The menu background color. */
|
||||
public static final SystemColor menu
|
||||
= new SystemColor(MENU);
|
||||
|
||||
/** The menu text color. */
|
||||
public static final SystemColor menuText
|
||||
= new SystemColor(MENU_TEXT);
|
||||
|
||||
/** The text background color. */
|
||||
public static final SystemColor text
|
||||
= new SystemColor(TEXT);
|
||||
|
||||
/** The text foreground color. */
|
||||
public static final SystemColor textText
|
||||
= new SystemColor(TEXT_TEXT);
|
||||
|
||||
/** The highlighted text background color. */
|
||||
public static final SystemColor textHighlight
|
||||
= new SystemColor(TEXT_HIGHLIGHT);
|
||||
|
||||
/** The highlighted text foreground color. */
|
||||
public static final SystemColor textHighlightText
|
||||
= new SystemColor(TEXT_HIGHLIGHT_TEXT);
|
||||
|
||||
/** The inactive text color. */
|
||||
public static final SystemColor textInactiveText
|
||||
= new SystemColor(TEXT_INACTIVE_TEXT);
|
||||
|
||||
/** The control background color. */
|
||||
public static final SystemColor control
|
||||
= new SystemColor(CONTROL);
|
||||
|
||||
/** The control text color. */
|
||||
public static final SystemColor controlText
|
||||
= new SystemColor(CONTROL_TEXT);
|
||||
|
||||
/** The control highlight color. */
|
||||
public static final SystemColor controlHighlight
|
||||
= new SystemColor(CONTROL_HIGHLIGHT);
|
||||
|
||||
/** The control light highlight color. */
|
||||
public static final SystemColor controlLtHighlight
|
||||
= new SystemColor(CONTROL_LT_HIGHLIGHT);
|
||||
|
||||
/** The control shadow color. */
|
||||
public static final SystemColor controlShadow
|
||||
= new SystemColor(CONTROL_SHADOW);
|
||||
|
||||
/** The control dark shadow color. */
|
||||
public static final SystemColor controlDkShadow
|
||||
= new SystemColor(CONTROL_DK_SHADOW);
|
||||
|
||||
/** The scrollbar color. */
|
||||
public static final SystemColor scrollbar
|
||||
= new SystemColor(SCROLLBAR);
|
||||
|
||||
/** The info text background color. */
|
||||
public static final SystemColor info
|
||||
= new SystemColor(INFO);
|
||||
|
||||
/** The info text foreground color. */
|
||||
public static final SystemColor infoText
|
||||
= new SystemColor(INFO_TEXT);
|
||||
|
||||
/**
|
||||
* Construct a system color which is dynamically updated.
|
||||
*
|
||||
* @param id the color id
|
||||
*/
|
||||
private SystemColor(int id)
|
||||
{
|
||||
// Note: See Color#Color(int, boolean) to explain why we use this
|
||||
// particular constructor.
|
||||
super(id, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the RGB value for this color, in the sRGB color space. The blue
|
||||
* value will be in bits 0-7, green in 8-15, red in 6-23, and the alpha
|
||||
* value (bits 24-31) is 0xff. This is dynamically updated, so it may not
|
||||
* match the results of <code>getRed()</code>, <code>getGreen()</code>, or
|
||||
* <code>getBlue()</code>.
|
||||
*
|
||||
* @return the current RGB value
|
||||
*/
|
||||
public int getRGB()
|
||||
{
|
||||
Toolkit.getDefaultToolkit().loadSystemColors(colors);
|
||||
return colors[value] | ALPHA_MASK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paint context, used for filling areas of a raster scan with
|
||||
* the current value of this system color. Since the system colors may be
|
||||
* dynamically updated, the returned value may not always be the same; but
|
||||
* as the system color is solid, the context does not need any of the
|
||||
* passed parameters to do its job.
|
||||
*
|
||||
* @param cm the requested color model, ignored
|
||||
* @param deviceBounds the bounding box in device coordinates, ignored
|
||||
* @param userBounds the bounding box in user coordinates, ignored
|
||||
* @param xform the bounds transformation, ignored
|
||||
* @param hints any rendering hints, ignored
|
||||
* @return a context for painting this solid color
|
||||
*/
|
||||
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
|
||||
Rectangle2D userBounds,
|
||||
AffineTransform xform,
|
||||
RenderingHints hints)
|
||||
{
|
||||
Toolkit.getDefaultToolkit().loadSystemColors(colors);
|
||||
int color = colors[value] | ALPHA_MASK;
|
||||
if (context == null || color != context.color)
|
||||
context = new ColorPaintContext(color);
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this color. This is in the format
|
||||
* "java.awt.SystemColor[i=" + index + ']', where index is one of the
|
||||
* integer constants of this class. Unfortunately, this description
|
||||
* does not describe the current value of the color; for that you should
|
||||
* use <code>new Color(syscolor.getRGB()).toString()</code>.
|
||||
*
|
||||
* @return a string describing this color
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return "java.awt.SystemColor[i=" + value + ']';
|
||||
}
|
||||
} // class SystemColor
|
||||
|
|
75
libjava/java/awt/TexturePaint.java
Normal file
75
libjava/java/awt/TexturePaint.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
/* TexturePaint.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 java.awt;
|
||||
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
|
||||
/** STUB CLASS ONLY */
|
||||
public class TexturePaint implements Paint
|
||||
{
|
||||
private final BufferedImage texture;
|
||||
private final Rectangle2D anchor;
|
||||
public TexturePaint(BufferedImage texture, Rectangle2D anchor)
|
||||
{
|
||||
this.texture = texture;
|
||||
this.anchor = anchor;
|
||||
}
|
||||
public BufferedImage getImage()
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
public Rectangle2D getAnchorRect()
|
||||
{
|
||||
return anchor;
|
||||
}
|
||||
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
|
||||
Rectangle2D userBounds,
|
||||
AffineTransform xform,
|
||||
RenderingHints hints)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
public int getTransparency()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class TexturePaint
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 2000, 2002 Free Software Foundation
|
||||
/* Transparency.java -- common transparency modes in graphics
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -37,21 +38,30 @@ exception statement from your version. */
|
|||
package java.awt;
|
||||
|
||||
/**
|
||||
* A common transparency mode for layering graphics.
|
||||
*
|
||||
* @author Warren Levy <warrenl@cygnus.com>
|
||||
* @date March 15, 2000.
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
public interface Transparency
|
||||
{
|
||||
public static final int OPAQUE = 1;
|
||||
public static final int BITMASK = 2;
|
||||
public static final int TRANSLUCENT = 3;
|
||||
/** Image data which is completely opaque, for an alpha value of 1.0. */
|
||||
int OPAQUE = 1;
|
||||
|
||||
public int getTransparency();
|
||||
}
|
||||
/**
|
||||
* Image data which is either completely opaque or transparent, for an
|
||||
* exact integer alpha value.
|
||||
*/
|
||||
int BITMASK = 2;
|
||||
|
||||
/** Image data which is translucent, for a non-integer alpha value. */
|
||||
int TRANSLUCENT = 3;
|
||||
|
||||
/**
|
||||
* Return the transparency type.
|
||||
*
|
||||
* @return One of {@see #OPAQUE}, {@see #BITMASK}, or {@see #TRANSLUCENT}.
|
||||
*/
|
||||
int getTransparency();
|
||||
} // interface Transparency
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* Window.java --
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -36,7 +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 java.awt;
|
||||
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.awt.peer.WindowPeer;
|
||||
|
@ -145,8 +146,8 @@ public class Window extends Container
|
|||
public void addNotify()
|
||||
{
|
||||
if (peer == null)
|
||||
peer = getToolkit ().createWindow (this);
|
||||
super.addNotify ();
|
||||
peer = getToolkit().createWindow(this);
|
||||
super.addNotify();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +172,7 @@ public class Window extends Container
|
|||
/**
|
||||
* Makes this window visible and brings it to the front.
|
||||
*/
|
||||
public void show ()
|
||||
public void show()
|
||||
{
|
||||
if (peer == null)
|
||||
addNotify();
|
||||
|
@ -206,12 +207,12 @@ public class Window extends Container
|
|||
* Sends this window to the back so that all other windows display in
|
||||
* front of it.
|
||||
*/
|
||||
public void toBack ()
|
||||
public void toBack()
|
||||
{
|
||||
if (peer != null)
|
||||
{
|
||||
WindowPeer wp = (WindowPeer) peer;
|
||||
wp.toBack ();
|
||||
wp.toBack();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,12 +220,12 @@ public class Window extends Container
|
|||
* Brings this window to the front so that it displays in front of
|
||||
* any other windows.
|
||||
*/
|
||||
public void toFront ()
|
||||
public void toFront()
|
||||
{
|
||||
if (peer != null)
|
||||
{
|
||||
WindowPeer wp = (WindowPeer) peer;
|
||||
wp.toFront ();
|
||||
wp.toFront();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,7 +239,7 @@ public class Window extends Container
|
|||
*/
|
||||
public Toolkit getToolkit()
|
||||
{
|
||||
return Toolkit.getDefaultToolkit ();
|
||||
return Toolkit.getDefaultToolkit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,9 +271,9 @@ public class Window extends Container
|
|||
*
|
||||
* @return The locale this window is configured for.
|
||||
*/
|
||||
public Locale getLocale ()
|
||||
public Locale getLocale()
|
||||
{
|
||||
return locale == null ? Locale.getDefault () : locale;
|
||||
return locale == null ? Locale.getDefault() : locale;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -312,9 +313,9 @@ public class Window extends Container
|
|||
*
|
||||
* @param listener The <code>WindowListener</code> to add.
|
||||
*/
|
||||
public synchronized void addWindowListener (WindowListener listener)
|
||||
public synchronized void addWindowListener(WindowListener listener)
|
||||
{
|
||||
windowListener = AWTEventMulticaster.add (windowListener, listener);
|
||||
windowListener = AWTEventMulticaster.add(windowListener, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -323,17 +324,24 @@ public class Window extends Container
|
|||
*
|
||||
* @param listener The <code>WindowListener</code> to remove.
|
||||
*/
|
||||
public synchronized void removeWindowListener (WindowListener listener)
|
||||
public synchronized void removeWindowListener(WindowListener listener)
|
||||
{
|
||||
windowListener = AWTEventMulticaster.remove (windowListener, listener);
|
||||
windowListener = AWTEventMulticaster.remove(windowListener, listener);
|
||||
}
|
||||
|
||||
public synchronized WindowListener[] getWindowListeners()
|
||||
{
|
||||
return (WindowListener[])
|
||||
AWTEventMulticaster.getListeners(windowListener,
|
||||
WindowListener.class);
|
||||
}
|
||||
|
||||
/** @since 1.3 */
|
||||
public EventListener[] getListeners(Class listenerType)
|
||||
{
|
||||
if (listenerType == WindowListener.class)
|
||||
return getListenersImpl(listenerType, windowListener);
|
||||
else return super.getListeners(listenerType);
|
||||
return getWindowListeners();
|
||||
return super.getListeners(listenerType);
|
||||
}
|
||||
|
||||
void dispatchEventImpl(AWTEvent e)
|
||||
|
@ -356,12 +364,12 @@ public class Window extends Container
|
|||
*
|
||||
* @param event The event to process.
|
||||
*/
|
||||
protected void processEvent (AWTEvent evt)
|
||||
protected void processEvent(AWTEvent evt)
|
||||
{
|
||||
if (evt instanceof WindowEvent)
|
||||
processWindowEvent ((WindowEvent) evt);
|
||||
processWindowEvent((WindowEvent) evt);
|
||||
else
|
||||
super.processEvent (evt);
|
||||
super.processEvent(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -372,32 +380,32 @@ public class Window extends Container
|
|||
*
|
||||
* @param event The event to process.
|
||||
*/
|
||||
protected void processWindowEvent (WindowEvent evt)
|
||||
protected void processWindowEvent(WindowEvent evt)
|
||||
{
|
||||
if (windowListener != null)
|
||||
{
|
||||
switch (evt.getID ())
|
||||
switch (evt.getID())
|
||||
{
|
||||
case WindowEvent.WINDOW_ACTIVATED:
|
||||
windowListener.windowActivated (evt);
|
||||
windowListener.windowActivated(evt);
|
||||
break;
|
||||
case WindowEvent.WINDOW_CLOSED:
|
||||
windowListener.windowClosed (evt);
|
||||
windowListener.windowClosed(evt);
|
||||
break;
|
||||
case WindowEvent.WINDOW_CLOSING:
|
||||
windowListener.windowClosing (evt);
|
||||
windowListener.windowClosing(evt);
|
||||
break;
|
||||
case WindowEvent.WINDOW_DEACTIVATED:
|
||||
windowListener.windowDeactivated (evt);
|
||||
windowListener.windowDeactivated(evt);
|
||||
break;
|
||||
case WindowEvent.WINDOW_DEICONIFIED:
|
||||
windowListener.windowDeiconified (evt);
|
||||
windowListener.windowDeiconified(evt);
|
||||
break;
|
||||
case WindowEvent.WINDOW_ICONIFIED:
|
||||
windowListener.windowIconified (evt);
|
||||
windowListener.windowIconified(evt);
|
||||
break;
|
||||
case WindowEvent.WINDOW_OPENED:
|
||||
windowListener.windowOpened (evt);
|
||||
windowListener.windowOpened(evt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
63
libjava/java/awt/color/CMMException.java
Normal file
63
libjava/java/awt/color/CMMException.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* CMMException.java -- error in the native CMM
|
||||
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 java.awt.color;
|
||||
|
||||
/**
|
||||
* Thrown when there is an error in the native CMM.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class CMMException extends Exception
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 5775558044142994965L;
|
||||
|
||||
/**
|
||||
* Create a new instance with a specified detailed error message.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public CMMException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class CMMException
|
64
libjava/java/awt/color/ProfileDataException.java
Normal file
64
libjava/java/awt/color/ProfileDataException.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* ProfileDataException.java -- error in processing an ICC_Profile
|
||||
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 java.awt.color;
|
||||
|
||||
/**
|
||||
* Thrown when there is an error accessing or processing an
|
||||
* <code>ICC_Profile</code>.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class ProfileDataException extends Exception
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 7286140888240322498L;
|
||||
|
||||
/**
|
||||
* Create a new instance with a specified detailed error message.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public ProfileDataException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class ProfileDataException
|
73
libjava/java/awt/datatransfer/FlavorTable.java
Normal file
73
libjava/java/awt/datatransfer/FlavorTable.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* FlavorTable.java -- A relaxed mapping between flavors
|
||||
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 java.awt.datatransfer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A FlavorMap which no longer requires a 1-to-1 mapping between flavors. Any
|
||||
* native can map to multiple flavors, and any flavor can map to multiple
|
||||
* natives; although the mappings are usually symmetric.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface FlavorTable extends FlavorMap
|
||||
{
|
||||
/**
|
||||
* Returns a list of String natives corresponding to the given flavor. The
|
||||
* list should be sorted from best to worst. The list must be modifiable
|
||||
* without affecting this table.
|
||||
*
|
||||
* @param flavor the flavor to look up, or null to return all natives
|
||||
* @return the sorted list of natives
|
||||
*/
|
||||
List getNativesForFlavor(DataFlavor flavor);
|
||||
|
||||
/**
|
||||
* Returns a list of flavors corresponding to the given String native. The
|
||||
* list should be sorted from best to worst. The list must be modifiable
|
||||
* without affecting this table.
|
||||
*
|
||||
* @param native the native to look up, or null to return all flavors
|
||||
* @return the sorted list of flavors
|
||||
*/
|
||||
List getFlavorsForNative(String name);
|
||||
} // interface FlavorTable
|
|
@ -1,5 +1,5 @@
|
|||
/* MimeTypeParseException.java -- Thrown when MIME string couldn't be parsed.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
/* MimeTypeParseException.java -- thrown when MIME string couldn't be parsed
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -41,30 +41,30 @@ package java.awt.datatransfer;
|
|||
/**
|
||||
* MIME string couldn't be parsed correctly.
|
||||
*
|
||||
* @author Mark Wielaard (mark@klomp.org)
|
||||
* @author Mark Wielaard <mark@klomp.org>
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class MimeTypeParseException extends Exception
|
||||
public class MimeTypeParseException extends Exception
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -5604407764691570741L;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>MimeTypeParseException</code>
|
||||
* without any message.
|
||||
*/
|
||||
public
|
||||
MimeTypeParseException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>MimeTypeParseException</code>
|
||||
* with a specified detailed error message.
|
||||
*/
|
||||
public
|
||||
MimeTypeParseException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
/**
|
||||
* Create a new instance without any message.
|
||||
*/
|
||||
public MimeTypeParseException()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance with a specified detailed error message.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public MimeTypeParseException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
} // class MimeTypeParseException
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Transferable.java -- Data transfer source
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -41,52 +41,41 @@ package java.awt.datatransfer;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This interface is implemented by classes that can transfer data.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
* This interface is implemented by classes that can transfer data.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface Transferable
|
||||
{
|
||||
/**
|
||||
* This method returns a list of available data flavors for the data being
|
||||
* transferred. The array returned will be sorted from most preferred
|
||||
* flavor at the beginning to least preferred at the end.
|
||||
*
|
||||
* @return adA list of data flavors for this data
|
||||
*/
|
||||
public abstract DataFlavor[] getTransferDataFlavors();
|
||||
|
||||
/**
|
||||
* Returns the data in the specified <code>DataFlavor</code>
|
||||
*
|
||||
* @param flavor The data flavor to return.
|
||||
*
|
||||
* @return The data in the appropriate flavor.
|
||||
*
|
||||
* @exception UnsupportedFlavorException If the flavor is not supported.
|
||||
* @exception IOException If the data is not available.
|
||||
*/
|
||||
public abstract Object
|
||||
getTransferData(DataFlavor flavor) throws UnsupportedFlavorException,
|
||||
IOException;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method returns a list of available data flavors for the
|
||||
* data being transferred. The array returned will be sorted from most
|
||||
* preferred flavor at the beginning to least preferred at the end.
|
||||
*
|
||||
* @return A list of data flavors for this data.
|
||||
*/
|
||||
public abstract DataFlavor[]
|
||||
getTransferDataFlavors();
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Tests whether or not this data can be delivered in the specified
|
||||
* data flavor.
|
||||
*
|
||||
* @param flavor The data flavor to test.
|
||||
*
|
||||
* @return <code>true</code> if the data flavor is supported,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
public abstract boolean
|
||||
isDataFlavorSupported(DataFlavor flavor);
|
||||
/**
|
||||
* Tests whether or not this data can be delivered in the specified data
|
||||
* flavor.
|
||||
*
|
||||
* @param flavor the data flavor to test
|
||||
* @return true if the data flavor is supported
|
||||
*/
|
||||
public abstract boolean isDataFlavorSupported(DataFlavor flavor);
|
||||
|
||||
/**
|
||||
* Returns the data in the specified <code>DataFlavor</code>.
|
||||
*
|
||||
* @param flavor the data flavor to return
|
||||
* @return the data in the appropriate flavor
|
||||
* @throws UnsupportedFlavorException if the flavor is not supported
|
||||
* @throws IOException if the data is not available
|
||||
* @see DataFlavor#getRepresentationClass
|
||||
*/
|
||||
public abstract Object getTransferData(DataFlavor flavor)
|
||||
throws UnsupportedFlavorException, IOException;
|
||||
} // interface Transferable
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* UnsupportedFlavorException.java -- Data flavor is not valid.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
/* UnsupportedFlavorException.java -- ata flavor is not valid
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -39,24 +39,27 @@ exception statement from your version. */
|
|||
package java.awt.datatransfer;
|
||||
|
||||
/**
|
||||
* The data flavor requested is not supported for the transfer data.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
*/
|
||||
public class UnsupportedFlavorException extends Exception
|
||||
* The data flavor requested is not supported for the transfer data.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see Transferable#getTransferData(DataFlavor)
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class UnsupportedFlavorException extends Exception
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 5383814944251665601L;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>UnsupportedDataFlavor</code>
|
||||
* for the specified data flavor.
|
||||
*
|
||||
* @param flavor The data flavor that is not supported.
|
||||
*/
|
||||
public
|
||||
UnsupportedFlavorException(DataFlavor flavor)
|
||||
{
|
||||
super(flavor.getHumanPresentableName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>UnsupportedDataFlavor</code>
|
||||
* for the specified data flavor.
|
||||
*
|
||||
* @param flavor the data flavor that is not supported
|
||||
*/
|
||||
public UnsupportedFlavorException(DataFlavor flavor)
|
||||
{
|
||||
super(flavor == null ? null : flavor.getHumanPresentableName());
|
||||
}
|
||||
} // class UnsupportedFlavorException
|
||||
|
||||
|
|
72
libjava/java/awt/dnd/DnDConstants.java
Normal file
72
libjava/java/awt/dnd/DnDConstants.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* DnDConstants.java -- constants for drag-and-drop operations
|
||||
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 java.awt.dnd;
|
||||
|
||||
/**
|
||||
* This class contains various constants used in drag-and-drop operations.
|
||||
* Why it is not an interface is beyond me.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public final class DnDConstants
|
||||
{
|
||||
/** No action takes place. */
|
||||
public static final int ACTION_NONE = 0;
|
||||
|
||||
/** The copy action. */
|
||||
public static final int ACTION_COPY = 1;
|
||||
|
||||
/** The move action. */
|
||||
public static final int ACTION_MOVE = 2;
|
||||
|
||||
/** Either a copy or a move. */
|
||||
public static final int ACTION_COPY_OR_MOVE = 3;
|
||||
|
||||
/**
|
||||
* A link action. This does not copy or move, but creates a reference back
|
||||
* to the original. However, since platforms differ on how a reference should
|
||||
* behave, this action is not recommended for common use.
|
||||
*/
|
||||
public static final int ACTION_LINK = 1073741824;
|
||||
|
||||
/** A synonym for {@link #ACTION_LINK}. */
|
||||
public static final int ACTION_REFERENCE = ACTION_LINK;
|
||||
} // class DnDConstants
|
129
libjava/java/awt/dnd/DragGestureEvent.java
Normal file
129
libjava/java/awt/dnd/DragGestureEvent.java
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* DragGestureEvent.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 java.awt.dnd;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.util.EventObject;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* STUBBED
|
||||
* @see DragGestureRecognizer
|
||||
* @see DragGestureListener
|
||||
* @see DragSource
|
||||
* @since 1.2
|
||||
*/
|
||||
public class DragGestureEvent extends EventObject
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 9080172649166731306L;
|
||||
|
||||
private DragSource dragSource;
|
||||
private Component component;
|
||||
private final Point origin;
|
||||
private final int action;
|
||||
|
||||
public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin,
|
||||
List events)
|
||||
{
|
||||
super(dgr);
|
||||
if (origin == null || events == null)
|
||||
throw new IllegalArgumentException();
|
||||
this.origin = origin;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public DragGestureRecognizer getSourceAsDragGestureRecognizer()
|
||||
{
|
||||
return (DragGestureRecognizer) source;
|
||||
}
|
||||
public Component getComponent()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public DragSource getDragSource()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public Point getDragOrigin()
|
||||
{
|
||||
return origin;
|
||||
}
|
||||
public Iterator iterator()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public Object[] toArray()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public Object[] toArray(Object[] array)
|
||||
{
|
||||
return array;
|
||||
}
|
||||
public int getDragAction()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public InputEvent getTriggerEvent()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public void startDrag(Cursor dragCursor, Transferable trans)
|
||||
{
|
||||
startDrag(dragCursor, null, null, trans, null);
|
||||
}
|
||||
public void startDrag(Cursor dragCursor, Transferable trans,
|
||||
DragSourceListener l)
|
||||
{
|
||||
startDrag(dragCursor, null, null, trans, l);
|
||||
}
|
||||
public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset,
|
||||
Transferable trans, DragSourceListener l)
|
||||
{
|
||||
}
|
||||
} // class DragGestureEvent
|
63
libjava/java/awt/dnd/DragGestureListener.java
Normal file
63
libjava/java/awt/dnd/DragGestureListener.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* DragGestureListener.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 java.awt.dnd;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This is a listener for starting a drag-and-drop gesture. Upon receiving
|
||||
* notification, the implementor then starts the drag operation.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see DragGestureRecognizer
|
||||
* @see DragGestureEvent
|
||||
* @see DragSource
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface DragGestureListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called when the native platform notifies the virtual machine that a
|
||||
* drag-and-drop has been initiated.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
void dragGestureRecognized(DragGestureEvent e);
|
||||
} // interface DragGestureListener
|
173
libjava/java/awt/dnd/DragGestureRecognizer.java
Normal file
173
libjava/java/awt/dnd/DragGestureRecognizer.java
Normal file
|
@ -0,0 +1,173 @@
|
|||
/* DragGestureRecognizer.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 java.awt.dnd;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
/**
|
||||
* STUBBED
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract class DragGestureRecognizer implements Serializable
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 8996673345831063337L;
|
||||
|
||||
protected DragSource dragSource;
|
||||
protected Component component;
|
||||
protected transient DragGestureListener dragGestureListener;
|
||||
protected int sourceActions;
|
||||
protected ArrayList events = new ArrayList();
|
||||
|
||||
protected DragGestureRecognizer(DragSource ds, Component c, int sa,
|
||||
DragGestureListener dgl)
|
||||
{
|
||||
if (ds == null)
|
||||
throw new IllegalArgumentException();
|
||||
dragSource = ds;
|
||||
component = c;
|
||||
sourceActions = sa;
|
||||
dragGestureListener = dgl;
|
||||
}
|
||||
|
||||
protected DragGestureRecognizer(DragSource ds, Component c, int sa)
|
||||
{
|
||||
this(ds, c, sa, null);
|
||||
}
|
||||
|
||||
protected DragGestureRecognizer(DragSource ds, Component c)
|
||||
{
|
||||
this(ds, c, 0, null);
|
||||
}
|
||||
|
||||
protected DragGestureRecognizer(DragSource ds)
|
||||
{
|
||||
this(ds, null, 0, null);
|
||||
}
|
||||
|
||||
protected abstract void registerListeners();
|
||||
|
||||
protected abstract void unregisterListeners();
|
||||
|
||||
public DragSource getDragSource()
|
||||
{
|
||||
return dragSource;
|
||||
}
|
||||
|
||||
public Component getComponent()
|
||||
{
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(Component c)
|
||||
{
|
||||
component = c;
|
||||
}
|
||||
|
||||
public int getSourceActions()
|
||||
{
|
||||
return sourceActions;
|
||||
}
|
||||
|
||||
public void setSourceActions(int sa)
|
||||
{
|
||||
sourceActions = sa;
|
||||
}
|
||||
|
||||
public InputEvent getTriggerEvent()
|
||||
{
|
||||
return events.size() > 0 ? (InputEvent) events.get(0) : null;
|
||||
}
|
||||
|
||||
public void resetRecognizer()
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public void addDragGestureListener(DragGestureListener dgl)
|
||||
throws TooManyListenersException
|
||||
{
|
||||
if (dragGestureListener != null)
|
||||
throw new TooManyListenersException();
|
||||
dragGestureListener = dgl;
|
||||
}
|
||||
|
||||
public void removeDragGestureListener(DragGestureListener dgl)
|
||||
{
|
||||
if (dragGestureListener != dgl)
|
||||
throw new IllegalArgumentException();
|
||||
dragGestureListener = null;
|
||||
}
|
||||
|
||||
protected void fireDragGestureRecognized(int dragAction, Point p)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
protected void appendEvent(InputEvent e)
|
||||
{
|
||||
if (e == null)
|
||||
return;
|
||||
events.add(e);
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream s)
|
||||
throws ClassNotFoundException, IOException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
dragGestureListener = (DragGestureListener) s.readObject();
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream s) throws IOException
|
||||
{
|
||||
s.defaultWriteObject();
|
||||
s.writeObject(dragGestureListener instanceof Serializable
|
||||
? dragGestureListener : null);
|
||||
}
|
||||
} // class DragGestureRecognizer
|
163
libjava/java/awt/dnd/DragSource.java
Normal file
163
libjava/java/awt/dnd/DragSource.java
Normal file
|
@ -0,0 +1,163 @@
|
|||
/* DragSource.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 java.awt.dnd;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.FlavorMap;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.dnd.peer.DragSourceContextPeer;
|
||||
import java.io.Serializable;
|
||||
import java.util.EventListener;
|
||||
|
||||
public class DragSource implements Serializable
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 6236096958971414066L;
|
||||
|
||||
public static final Cursor DefaultCopyDrop = null;
|
||||
public static final Cursor DefaultMoveDrop = null;
|
||||
public static final Cursor DefaultLinkDrop = null;
|
||||
public static final Cursor DefaultCopyNoDrop = null;
|
||||
public static final Cursor DefaultMoveNoDrop = null;
|
||||
public static final Cursor DefaultLinkNoDrop = null;
|
||||
|
||||
public DragSource()
|
||||
{
|
||||
}
|
||||
|
||||
public static DragSource getDefaultDragSource()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isDragImageSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
|
||||
Image dragImage, Point imageOffset,
|
||||
Transferable trans, DragSourceListener dsl,
|
||||
FlavorMap map)
|
||||
{
|
||||
}
|
||||
|
||||
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
|
||||
Transferable trans, DragSourceListener dsl,
|
||||
FlavorMap map)
|
||||
{
|
||||
startDrag(trigger, dragCursor, null, null, trans, dsl, map);
|
||||
}
|
||||
|
||||
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
|
||||
Image dragImage, Point imageOffset,
|
||||
Transferable trans, DragSourceListener dsl)
|
||||
{
|
||||
startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null);
|
||||
}
|
||||
|
||||
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
|
||||
Transferable trans, DragSourceListener dsl)
|
||||
{
|
||||
startDrag(trigger, dragCursor, null, null, trans, dsl, null);
|
||||
}
|
||||
|
||||
protected DragSourceContext
|
||||
createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
|
||||
Cursor cursor, Image image, Point offset,
|
||||
Transferable t, DragSourceListener dsl)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public FlavorMap getFlavorMap()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public DragGestureRecognizer
|
||||
createDragGestureRecognizer(Class recognizer, Component c, int actions,
|
||||
DragGestureListener dgl)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public DragGestureRecognizer
|
||||
createDefaultDragGestureRecognizer(Component c, int actions,
|
||||
DragGestureListener dgl)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addDragSourceListener(DragSourceListener l)
|
||||
{
|
||||
}
|
||||
|
||||
public void removeDragSourceListener(DragSourceListener l)
|
||||
{
|
||||
}
|
||||
|
||||
public DragSourceListener[] getDragSourceListeners()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addDragSourceMotionListener(DragSourceMotionListener l)
|
||||
{
|
||||
}
|
||||
|
||||
public void removeDragSourceMotionListener(DragSourceMotionListener l)
|
||||
{
|
||||
}
|
||||
|
||||
public DragSourceMotionListener[] getDragSourceMotionListeners()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public EventListener[] getListeners(Class type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
} // class DragSource
|
126
libjava/java/awt/dnd/DragSourceAdapter.java
Normal file
126
libjava/java/awt/dnd/DragSourceAdapter.java
Normal file
|
@ -0,0 +1,126 @@
|
|||
/* DragSourceAdapter.java -- drag-and-drop listener adapter
|
||||
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 java.awt.dnd;
|
||||
|
||||
/**
|
||||
* This class implements <code>DragSourceListener</code> and
|
||||
* <code>DragSourceMotionListener</code>, and implements all methods
|
||||
* with empty bodies. This allows a listener interested in implementing only
|
||||
* a subset of these interfaces to extend this class and override only the
|
||||
* desired methods.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see DragSourceEvent
|
||||
* @see DragSourceListener
|
||||
* @see DragSourceMotionListener
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class DragSourceAdapter
|
||||
implements DragSourceListener, DragSourceMotionListener
|
||||
{
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DragSourceAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the cursor hotspot enters a drop site which will accept the
|
||||
* drag.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
public void dragEnter(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the cursor hotspot moves inside of a drop site which will
|
||||
* accept the drag.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
public void dragOver(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever the mouse is moved during a drag-and-drop operation.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
public void dragMouseMoved(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user modifies the drop gesture. This is often the case
|
||||
* when additional mouse or key events are received during the drag.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
public void dropActionChanged(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the cursor hotspot moves outside of a drop site which will
|
||||
* accept the drag. This could also happen if the drop site is no longer
|
||||
* active, or no longer accepts the drag.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
public void dragExit(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the drag and drop operation is complete. After this event,
|
||||
* <code>getDropSuccess</code> of the event is valid, and
|
||||
* <code>getDropAction</code> holds the action requested by the drop site.
|
||||
* Furthermore, the <code>DragSourceContext</code> is invalidated.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
public void dragDropEnd(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
} // class DragSourceAdapter
|
138
libjava/java/awt/dnd/DragSourceContext.java
Normal file
138
libjava/java/awt/dnd/DragSourceContext.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
/* DragSourceContext.java --
|
||||
Copyright (C) 2002 Free Software Foundation
|
||||
|
||||
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 java.awt.dnd;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.dnd.peer.DragSourceContextPeer;
|
||||
import java.io.Serializable;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
public class DragSourceContext
|
||||
implements DragSourceListener, DragSourceMotionListener, Serializable
|
||||
{
|
||||
protected static final int DEFAULT = 0;
|
||||
protected static final int ENTER = 1;
|
||||
protected static final int OVER = 2;
|
||||
protected static final int CHANGED = 3;
|
||||
|
||||
public DragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
|
||||
Cursor cursor, Image image, Point offset,
|
||||
Transferable trans, DragSourceListener dsl)
|
||||
{
|
||||
}
|
||||
|
||||
public DragSource getDragSource()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component getComponent()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public DragGestureEvent getTrigger()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getSourceActions()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setCursor(Cursor c)
|
||||
{
|
||||
}
|
||||
|
||||
public Cursor getCursor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addDragSourceListener(DragSourceListener l)
|
||||
throws TooManyListenersException
|
||||
{
|
||||
}
|
||||
|
||||
public void removeDragSourceListener(DragSourceListener l)
|
||||
{
|
||||
}
|
||||
|
||||
public void transferablesFlavorsChanged()
|
||||
{
|
||||
}
|
||||
|
||||
public void dragEnter(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void dragOver(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void dragExit(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void dropActionChanged(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void dragDropEnd(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public void dragMouseMoved(DragSourceDragEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
public Transferable getTransferable()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void updateCurrentCursor(int dropOp, int targetAct, int status)
|
||||
{
|
||||
}
|
||||
} // class DragSourceContext
|
95
libjava/java/awt/dnd/DragSourceDragEvent.java
Normal file
95
libjava/java/awt/dnd/DragSourceDragEvent.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
/* DragSourceDragEvent.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 java.awt.dnd;
|
||||
|
||||
import gnu.java.awt.EventModifier;
|
||||
|
||||
/**
|
||||
* STUBBED
|
||||
*/
|
||||
public class DragSourceDragEvent extends DragSourceEvent
|
||||
{
|
||||
private final int dropAction;
|
||||
private final int targetActions;
|
||||
private final int gestureModifiers;
|
||||
|
||||
public DragSourceDragEvent(DragSourceContext context, int dropAction,
|
||||
int actions, int modifiers)
|
||||
{
|
||||
super(context);
|
||||
this.dropAction = dropAction;
|
||||
targetActions = actions;
|
||||
gestureModifiers = EventModifier.extend(modifiers);
|
||||
}
|
||||
|
||||
public DragSourceDragEvent(DragSourceContext context, int dropAction,
|
||||
int actions, int modifiers, int x, int y)
|
||||
{
|
||||
super(context, x, y);
|
||||
this.dropAction = dropAction;
|
||||
targetActions = actions;
|
||||
gestureModifiers = EventModifier.extend(modifiers);
|
||||
}
|
||||
|
||||
public int getTargetActions()
|
||||
{
|
||||
return targetActions;
|
||||
}
|
||||
|
||||
public int getGestureModifiers()
|
||||
{
|
||||
return EventModifier.revert(gestureModifiers);
|
||||
}
|
||||
|
||||
public int getGestureModifiersEx()
|
||||
{
|
||||
return gestureModifiers;
|
||||
}
|
||||
|
||||
public int getUserAction()
|
||||
{
|
||||
return dropAction;
|
||||
}
|
||||
|
||||
public int getDropAction()
|
||||
{
|
||||
return dropAction & targetActions
|
||||
& ((DragSourceContext) source).getSourceActions();
|
||||
}
|
||||
} // class DragSourceDragEvent
|
85
libjava/java/awt/dnd/DragSourceEvent.java
Normal file
85
libjava/java/awt/dnd/DragSourceEvent.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* DragSourceEvent.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 java.awt.dnd;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.EventObject;
|
||||
|
||||
public class DragSourceEvent extends EventObject
|
||||
{
|
||||
private final boolean locationSpecified;
|
||||
private final int x;
|
||||
private final int y;
|
||||
|
||||
public DragSourceEvent(DragSourceContext context)
|
||||
{
|
||||
super(context);
|
||||
locationSpecified = false;
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
public DragSourceEvent(DragSourceContext context, int x, int y)
|
||||
{
|
||||
super(context);
|
||||
locationSpecified = true;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public DragSourceContext getDragSourceContext()
|
||||
{
|
||||
return (DragSourceContext) source;
|
||||
}
|
||||
|
||||
public Point getLocation()
|
||||
{
|
||||
return locationSpecified ? new Point(x, y) : null;
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
} // class DragSourceEvent
|
97
libjava/java/awt/dnd/DragSourceListener.java
Normal file
97
libjava/java/awt/dnd/DragSourceListener.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* DragSourceListener.java -- listen to events during the drag
|
||||
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 java.awt.dnd;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This class allows an object to listen for drag and drop events. It can
|
||||
* be used to provide appropriate feedback for "drag over" actions. You can
|
||||
* also use a <code>DragSourceAdapter</code> to filter the events you are
|
||||
* interested in.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface DragSourceListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called when the cursor hotspot enters a drop site which will accept the
|
||||
* drag.
|
||||
*
|
||||
* @param e the drag source drag event
|
||||
*/
|
||||
void dragEnter(DragSourceDragEvent e);
|
||||
|
||||
/**
|
||||
* Called when the cursor hotspot moves inside of a drop site which will
|
||||
* accept the drag.
|
||||
*
|
||||
* @param e the drag source drag event
|
||||
*/
|
||||
void dragOver(DragSourceDragEvent e);
|
||||
|
||||
/**
|
||||
* Called when the user modifies the drop gesture. This is often the case
|
||||
* when additional mouse or key events are received during the drag.
|
||||
*
|
||||
* @param e the drag source drag event
|
||||
*/
|
||||
void dropActionChanged(DragSourceDragEvent e);
|
||||
|
||||
/**
|
||||
* Called when the cursor hotspot moves outside of a drop site which will
|
||||
* accept the drag. This could also happen if the drop site is no longer
|
||||
* active, or no longer accepts the drag.
|
||||
*
|
||||
* @param e the drag source drag event
|
||||
*/
|
||||
void dragExit(DragSourceDragEvent e);
|
||||
|
||||
/**
|
||||
* Called when the drag and drop operation is complete. After this event,
|
||||
* <code>getDropSuccess</code> of the event is valid, and
|
||||
* <code>getDropAction</code> holds the action requested by the drop site.
|
||||
* Furthermore, the <code>DragSourceContext</code> is invalidated.
|
||||
*
|
||||
* @param e the drag source drag event
|
||||
*/
|
||||
void dragDropEnd(DragSourceDragEvent e);
|
||||
} // interface DragSourceListener
|
64
libjava/java/awt/dnd/DragSourceMotionListener.java
Normal file
64
libjava/java/awt/dnd/DragSourceMotionListener.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* DragSourceMotionListener.java -- tracks motion in the drag source
|
||||
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 java.awt.dnd;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This is a listener for mouse motion in the drag source before the drop
|
||||
* event occurs. You can also use a <code>DragSourceAdapter</code> to filter
|
||||
* the events you are interested in.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see DragSourceDragEvent
|
||||
* @see DragSource
|
||||
* @see DragSourceListener
|
||||
* @see DragSourceAdapter
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface DragSourceMotionListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called whenever the mouse is moved during a drag-and-drop operation.
|
||||
*
|
||||
* @param e the event
|
||||
*/
|
||||
void dragMouseMoved(DragSourceDragEvent e);
|
||||
} // interface DragSourceMotionListener
|
40
libjava/java/awt/dnd/DropTarget.java
Normal file
40
libjava/java/awt/dnd/DropTarget.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* DropTarget.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 java.awt.dnd;
|
||||
/** STUB CLASS ONLY */
|
||||
public class DropTarget {}
|
73
libjava/java/awt/dnd/InvalidDnDOperationException.java
Normal file
73
libjava/java/awt/dnd/InvalidDnDOperationException.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* InvalidDnDOperationException.java -- thrown when drag-and-drop fails
|
||||
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 java.awt.dnd;
|
||||
|
||||
/**
|
||||
* Thrown when a method in the java.awt.dnd package is unable to perform a
|
||||
* requested operation, usually because the underlying DnD system is in the
|
||||
* wrong state.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class InvalidDnDOperationException extends IllegalStateException
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = -6062568741193956678L;
|
||||
|
||||
/**
|
||||
* Create an exception without a message.
|
||||
*/
|
||||
public InvalidDnDOperationException()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an exception with a message.
|
||||
*
|
||||
* @param s the message
|
||||
*/
|
||||
public InvalidDnDOperationException(String s)
|
||||
{
|
||||
super(s);
|
||||
}
|
||||
} // class InvalidDnDOperationException
|
55
libjava/java/awt/dnd/peer/DragSourceContextPeer.java
Normal file
55
libjava/java/awt/dnd/peer/DragSourceContextPeer.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* DragSourceContextPeer.java -- interface for drag-and-drop peers
|
||||
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 java.awt.dnd.peer;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.dnd.DragSourceContext;
|
||||
|
||||
/**
|
||||
* STUBBED
|
||||
*/
|
||||
public interface DragSourceContextPeer
|
||||
{
|
||||
void startDrag(DragSourceContext context, Cursor c, Image i, Point p);
|
||||
Cursor getCursor();
|
||||
void setCursor(Cursor c);
|
||||
void transferablesFlavorsChanged();
|
||||
} // interface DragSourceContextPeer
|
|
@ -1,22 +1,64 @@
|
|||
/* Copyright (C) 2000 Free Software Foundation
|
||||
/* AWTEventListener.java -- listen for all events in the AWT system
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of libjava.
|
||||
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. */
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.event;
|
||||
import java.awt.*;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 8, 2000
|
||||
* This listener is for classes that need to listen to all events in the AWT
|
||||
* system. In general, this should not be used except for classes like
|
||||
* javax.accessibility or by event recorders.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see AWTEvent
|
||||
* @see Toolkit#addAWTEventListener(AWTEventListener, long)
|
||||
* @see Toolkit#removeAWTEventListener(AWTEventListener)
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/* Status: Believed complete and correct to JDK 1.2. */
|
||||
|
||||
public interface AWTEventListener extends java.util.EventListener
|
||||
public interface AWTEventListener extends EventListener
|
||||
{
|
||||
public void eventDispatched (AWTEvent e);
|
||||
}
|
||||
/**
|
||||
* This method is called when any event in the AWT system is dispatched.
|
||||
*
|
||||
* @param event the AWTEvent that was dispatched
|
||||
*/
|
||||
void eventDispatched(AWTEvent event);
|
||||
} // interface AWTEventListener
|
||||
|
|
154
libjava/java/awt/event/AWTEventListenerProxy.java
Normal file
154
libjava/java/awt/event/AWTEventListenerProxy.java
Normal file
|
@ -0,0 +1,154 @@
|
|||
/* AWTEventListenerProxy.java -- wrapper/filter for AWTEventListener
|
||||
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 java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.util.EventListenerProxy;
|
||||
|
||||
/**
|
||||
* This class allows adding an AWTEventListener which only pays attention to
|
||||
* a specific event mask.
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Toolkit
|
||||
* @see EventListenerProxy
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class AWTEventListenerProxy extends EventListenerProxy
|
||||
implements AWTEventListener
|
||||
{
|
||||
/** The event mask. */
|
||||
private final long mask;
|
||||
|
||||
/**
|
||||
* Construct an AWT Event Listener which only listens to events in the given
|
||||
* mask, passing the work on to the real listener.
|
||||
*
|
||||
* @param eventMask the mask of events to listen to
|
||||
* @param listener the wrapped listener
|
||||
*/
|
||||
public AWTEventListenerProxy(long eventMask, AWTEventListener listener)
|
||||
{
|
||||
super(listener);
|
||||
mask = eventMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards events on to the delegate if they meet the event mask.
|
||||
*
|
||||
* @param event the property change event to filter
|
||||
* @throws NullPointerException if the delegate this was created with is null
|
||||
*/
|
||||
public void eventDispatched(AWTEvent event)
|
||||
{
|
||||
int id = event == null ? 0 : event.getID();
|
||||
if (((mask & AWTEvent.ACTION_EVENT_MASK) != 0
|
||||
&& event instanceof ActionEvent)
|
||||
|| ((mask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0
|
||||
&& event instanceof AdjustmentEvent)
|
||||
|| ((mask & AWTEvent.COMPONENT_EVENT_MASK) != 0
|
||||
&& event instanceof ComponentEvent
|
||||
&& (id >= ComponentEvent.COMPONENT_FIRST
|
||||
&& id <= ComponentEvent.COMPONENT_LAST))
|
||||
|| ((mask & AWTEvent.CONTAINER_EVENT_MASK) != 0
|
||||
&& event instanceof ContainerEvent)
|
||||
|| ((mask & AWTEvent.FOCUS_EVENT_MASK) != 0
|
||||
&& event instanceof FocusEvent)
|
||||
|| ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0
|
||||
&& event instanceof HierarchyEvent
|
||||
&& (id == HierarchyEvent.ANCESTOR_MOVED
|
||||
|| id == HierarchyEvent.ANCESTOR_RESIZED))
|
||||
|| ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0
|
||||
&& event instanceof HierarchyEvent
|
||||
&& id == HierarchyEvent.HIERARCHY_CHANGED)
|
||||
|| ((mask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0
|
||||
&& event instanceof InputMethodEvent)
|
||||
|| ((mask & AWTEvent.INVOCATION_EVENT_MASK) != 0
|
||||
&& event instanceof InvocationEvent)
|
||||
|| ((mask & AWTEvent.ITEM_EVENT_MASK) != 0
|
||||
&& event instanceof ItemEvent)
|
||||
|| ((mask & AWTEvent.KEY_EVENT_MASK) != 0
|
||||
&& event instanceof KeyEvent)
|
||||
|| ((mask & AWTEvent.MOUSE_EVENT_MASK) != 0
|
||||
&& event instanceof MouseEvent
|
||||
&& (id == MouseEvent.MOUSE_PRESSED
|
||||
|| id == MouseEvent.MOUSE_RELEASED
|
||||
|| id == MouseEvent.MOUSE_CLICKED
|
||||
|| id == MouseEvent.MOUSE_ENTERED
|
||||
|| id == MouseEvent.MOUSE_EXITED))
|
||||
|| ((mask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0
|
||||
&& event instanceof MouseEvent
|
||||
&& (id == MouseEvent.MOUSE_MOVED
|
||||
|| id == MouseEvent.MOUSE_DRAGGED))
|
||||
|| ((mask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0
|
||||
&& event instanceof MouseWheelEvent)
|
||||
|| ((mask & AWTEvent.PAINT_EVENT_MASK) != 0
|
||||
&& event instanceof PaintEvent)
|
||||
|| ((mask & AWTEvent.TEXT_EVENT_MASK) != 0
|
||||
&& event instanceof TextEvent)
|
||||
|| ((mask & AWTEvent.WINDOW_EVENT_MASK) != 0
|
||||
&& event instanceof WindowEvent
|
||||
&& (id == WindowEvent.WINDOW_OPENED
|
||||
|| id == WindowEvent.WINDOW_CLOSING
|
||||
|| id == WindowEvent.WINDOW_CLOSED
|
||||
|| id == WindowEvent.WINDOW_ICONIFIED
|
||||
|| id == WindowEvent.WINDOW_DEICONIFIED
|
||||
|| id == WindowEvent.WINDOW_ACTIVATED
|
||||
|| id == WindowEvent.WINDOW_DEACTIVATED))
|
||||
|| ((mask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0
|
||||
&& event instanceof WindowEvent
|
||||
&& (id == WindowEvent.WINDOW_GAINED_FOCUS
|
||||
|| id == WindowEvent.WINDOW_LOST_FOCUS))
|
||||
|| ((mask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0
|
||||
&& event instanceof WindowEvent
|
||||
&& id == WindowEvent.WINDOW_STATE_CHANGED))
|
||||
((AWTEventListener) getListener()).eventDispatched(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the event mask associated with this listener.
|
||||
*
|
||||
* @return the event mask
|
||||
*/
|
||||
public long getEventMask()
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
} // class AWTEventListenerProxy
|
|
@ -1,66 +1,226 @@
|
|||
/* Copyright (C) 1999, 2000 Free Software Foundation
|
||||
/* ActionEvent.java -- an action has been triggered
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of libjava.
|
||||
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. */
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.event;
|
||||
import java.awt.*;
|
||||
|
||||
/* Status: Believed complete and correct to JDK 1.2. */
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
/**
|
||||
* This event is generated when an action on a component (such as a
|
||||
* button press) occurs.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see ActionListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class ActionEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -7671078796273832149L;
|
||||
|
||||
/** Bit mask indicating the shift key was pressed. */
|
||||
public static final int SHIFT_MASK = InputEvent.SHIFT_MASK;
|
||||
|
||||
/** Bit mask indicating the control key was pressed. */
|
||||
public static final int CTRL_MASK = InputEvent.CTRL_MASK;
|
||||
|
||||
/** Bit mask indicating the that meta key was pressed. */
|
||||
public static final int META_MASK = InputEvent.META_MASK;
|
||||
|
||||
/** Bit mask indicating that the alt key was pressed. */
|
||||
public static final int ALT_MASK = InputEvent.ALT_MASK;
|
||||
|
||||
/** The first id number in the range of action id's. */
|
||||
public static final int ACTION_FIRST = 1001;
|
||||
|
||||
/** The last id number in the range of action id's. */
|
||||
public static final int ACTION_LAST = 1001;
|
||||
|
||||
/** An event id indicating that an action has occurred. */
|
||||
public static final int ACTION_PERFORMED = 1001;
|
||||
public static final int ALT_MASK = 8;
|
||||
public static final int CTRL_MASK = 2;
|
||||
public static final int META_MASK = 4;
|
||||
public static final int SHIFT_MASK = 1;
|
||||
|
||||
String cmd;
|
||||
int modifiers;
|
||||
/**
|
||||
* A nonlocalized string that gives more specific details of the event cause.
|
||||
*
|
||||
* @see #getActionCommand()
|
||||
* @serial the command for this event
|
||||
*/
|
||||
private final String actionCommand;
|
||||
|
||||
public ActionEvent (Object source, int id, String command)
|
||||
/**
|
||||
* The bitmask of the modifiers that were pressed during the action.
|
||||
*
|
||||
* @see #getModifiers()
|
||||
* @serial modifiers for this event
|
||||
*/
|
||||
private final int modifiers;
|
||||
|
||||
/**
|
||||
* The timestamp of this event; usually the same as the underlying input
|
||||
* event.
|
||||
*
|
||||
* @see #getWhen()
|
||||
* @serial the timestamp of the event
|
||||
* @since 1.4
|
||||
*/
|
||||
private final long when;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ActionEvent</code> with the
|
||||
* specified source, id, and command. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param command the command string for this action
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public ActionEvent(Object source, int id, String command)
|
||||
{
|
||||
super(source, id);
|
||||
cmd = command;
|
||||
this(source, id, command, EventQueue.getMostRecentEventTime(), 0);
|
||||
}
|
||||
|
||||
public ActionEvent (Object source, int id, String command, int modifiers)
|
||||
/**
|
||||
* Initializes a new instance of <code>ActionEvent</code> with the
|
||||
* specified source, id, command, and modifiers. Note that an invalid id
|
||||
* leads to unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param command the command string for this action
|
||||
* @param modifiers the bitwise or of modifier keys down during the action
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public ActionEvent(Object source, int id, String command, int modifiers)
|
||||
{
|
||||
this(source, id, command, EventQueue.getMostRecentEventTime(), modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ActionEvent</code> with the
|
||||
* specified source, id, command, and modifiers, and timestamp. Note that
|
||||
* an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param command the command string for this action
|
||||
* @param when the timestamp of the event
|
||||
* @param modifiers the bitwise or of modifier keys down during the action
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public ActionEvent(Object source, int id, String command, long when,
|
||||
int modifiers)
|
||||
{
|
||||
super(source, id);
|
||||
cmd = command;
|
||||
actionCommand = command;
|
||||
this.when = when;
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public String getActionCommand ()
|
||||
/**
|
||||
* Returns the command string associated with this action.
|
||||
*
|
||||
* @return the command string associated with this action
|
||||
*/
|
||||
public String getActionCommand()
|
||||
{
|
||||
return cmd;
|
||||
return actionCommand;
|
||||
}
|
||||
|
||||
public int getModifiers ()
|
||||
/**
|
||||
* Gets the timestamp of when this action took place. Usually, this
|
||||
* corresponds to the timestamp of the underlying InputEvent.
|
||||
*
|
||||
* @return the timestamp of this action
|
||||
* @since 1.4
|
||||
*/
|
||||
public long getWhen()
|
||||
{
|
||||
return when;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the keys held down during the action. This value will be a
|
||||
* combination of the bit mask constants defined in this class, or 0 if no
|
||||
* modifiers were pressed.
|
||||
*
|
||||
* @return the modifier bits
|
||||
*/
|
||||
public int getModifiers()
|
||||
{
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public String paramString ()
|
||||
/**
|
||||
* Returns a string that identifies the action event. This is in the format
|
||||
* <code>"ACTION_PERFORMED,cmd=" + getActionCommand() + ",when=" + getWhen()
|
||||
* + ",modifiers=" + <modifier string></code>, where the modifier
|
||||
* string is in the order "Meta", "Ctrl", "Alt", "Shift", "Alt Graph", and
|
||||
* "Button1", separated by '+', according to the bits set in getModifiers().
|
||||
*
|
||||
* @return a string identifying the event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
String r;
|
||||
switch (id)
|
||||
{
|
||||
case ACTION_PERFORMED:
|
||||
r = "ACTION_PERFORMED";
|
||||
break;
|
||||
default:
|
||||
r = "unknown type";
|
||||
break;
|
||||
}
|
||||
|
||||
r += ",cmd=" + cmd;
|
||||
return r;
|
||||
StringBuffer s = new StringBuffer(id == ACTION_PERFORMED
|
||||
? "ACTION_PERFORMED,cmd="
|
||||
: "unknown type,cmd=");
|
||||
s.append(actionCommand).append(",when=").append(when).append("modifiers");
|
||||
int len = s.length();
|
||||
s.setLength(len + 1);
|
||||
if ((modifiers & META_MASK) != 0)
|
||||
s.append("+Meta");
|
||||
if ((modifiers & CTRL_MASK) != 0)
|
||||
s.append("+Ctrl");
|
||||
if ((modifiers & ALT_MASK) != 0)
|
||||
s.append("+Alt");
|
||||
if ((modifiers & SHIFT_MASK) != 0)
|
||||
s.append("+Shift");
|
||||
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0)
|
||||
s.append("+Alt Graph");
|
||||
if ((modifiers & InputEvent.BUTTON1_MASK) != 0)
|
||||
s.append("+Button1");
|
||||
s.setCharAt(len, '=');
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
} // class ActionEvent
|
||||
|
|
|
@ -1,21 +1,59 @@
|
|||
/* Copyright (C) 1999 Free Software Foundation
|
||||
/* ActionListener.java -- listens for action events
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of libjava.
|
||||
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. */
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
* @date Fenruary, 1999.
|
||||
* This interface is for classes that listen for action events.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see ActionEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/* Status: Believed complete and correct. */
|
||||
|
||||
public interface ActionListener extends java.util.EventListener
|
||||
public interface ActionListener extends EventListener
|
||||
{
|
||||
public void actionPerformed (ActionEvent e);
|
||||
}
|
||||
/**
|
||||
* This method is invoked when an action occurs.
|
||||
*
|
||||
* @param event the <code>ActionEvent</code> that occurred
|
||||
*/
|
||||
void actionPerformed(ActionEvent e);
|
||||
} // interface ActionListener
|
||||
|
|
|
@ -1,95 +1,222 @@
|
|||
/* Copyright (C) 2000 Free Software Foundation
|
||||
/* AdjustmentEvent.java -- an adjustable value was changed
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of libjava.
|
||||
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. */
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
||||
details. */
|
||||
|
||||
package java.awt.event;
|
||||
import java.awt.*;
|
||||
|
||||
import java.awt.Adjustable;
|
||||
import java.awt.AWTEvent;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date April 8, 2000
|
||||
* This class represents an event that is generated when an adjustable
|
||||
* value is changed.
|
||||
*
|
||||
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||
* @see Adjustable
|
||||
* @see AdjustmentListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
/* Status: Believed complete and correct to JDK 1.2. */
|
||||
|
||||
public class AdjustmentEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 5700290645205279921L;
|
||||
|
||||
/** This is the first id in the range of ids used by adjustment events. */
|
||||
public static final int ADJUSTMENT_FIRST = 601;
|
||||
|
||||
/** This is the last id in the range of ids used by adjustment events. */
|
||||
public static final int ADJUSTMENT_LAST = 601;
|
||||
|
||||
/** This is the id indicating an adjustment value changed. */
|
||||
public static final int ADJUSTMENT_VALUE_CHANGED = 601;
|
||||
public static final int BLOCK_DECREMENT = 3;
|
||||
public static final int BLOCK_INCREMENT = 4;
|
||||
public static final int TRACK = 5;
|
||||
public static final int UNIT_DECREMENT = 2;
|
||||
|
||||
/** Adjustment type for unit increments. */
|
||||
public static final int UNIT_INCREMENT = 1;
|
||||
|
||||
public AdjustmentEvent (Adjustable source, int id, int type, int value)
|
||||
/** Adjustment type for unit decrements. */
|
||||
public static final int UNIT_DECREMENT = 2;
|
||||
|
||||
/** Adjustment type for block decrements. */
|
||||
public static final int BLOCK_DECREMENT = 3;
|
||||
|
||||
/** Adjustment type for block increments. */
|
||||
public static final int BLOCK_INCREMENT = 4;
|
||||
|
||||
/** Adjustment type for tracking adjustments. */
|
||||
public static final int TRACK = 5;
|
||||
|
||||
/**
|
||||
* The adjustable object that caused the event.
|
||||
*
|
||||
* @see #getAdjustable()
|
||||
* @serial the cause
|
||||
*/
|
||||
private final Adjustable adjustable;
|
||||
|
||||
/**
|
||||
* The type of adjustment, one of {@link #UNIT_INCREMENT},
|
||||
* {@link #UNIT_DECREMENT}, {@link #BLOCK_INCREMENT},
|
||||
* {@link #BLOCK_DECREMENT}, or {@link #TRACK}.
|
||||
*
|
||||
* @see #getAdjustmentType()
|
||||
* @serial the adjustment type
|
||||
*/
|
||||
private final int adjustmentType;
|
||||
|
||||
/**
|
||||
* The new value of the adjustable; it should be in the range of the
|
||||
* adjustable cause.
|
||||
*
|
||||
* @see #getValue()
|
||||
* @serial the adjustment value
|
||||
*/
|
||||
private final int value;
|
||||
|
||||
/**
|
||||
* True if this is in a series of multiple adjustment events.
|
||||
*
|
||||
* @see #getValueIsAdjusting()
|
||||
* @serial true if this is not the last adjustment
|
||||
* @since 1.4
|
||||
*/
|
||||
private final boolean isAdjusting;
|
||||
|
||||
/**
|
||||
* Initializes an instance of <code>AdjustmentEvent</code> with the
|
||||
* specified source, id, type, and value. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param type the event type, one of the constants of this class
|
||||
* @param value the value of the adjustment
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public AdjustmentEvent(Adjustable source, int id, int type, int value)
|
||||
{
|
||||
super (source, id);
|
||||
this.adjType = type;
|
||||
this(source, id, type, value, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an instance of <code>AdjustmentEvent</code> with the
|
||||
* specified source, id, type, and value. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param type the event type, one of the constants of this class
|
||||
* @param value the value of the adjustment
|
||||
* @param isAdjusting if this event is in a chain of adjustments
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public AdjustmentEvent(Adjustable source, int id, int type, int value,
|
||||
boolean isAdjusting)
|
||||
{
|
||||
super(source, id);
|
||||
this.adjustmentType = type;
|
||||
this.value = value;
|
||||
adjustable = source;
|
||||
this.isAdjusting = isAdjusting;
|
||||
}
|
||||
|
||||
public Adjustable getAdjustable ()
|
||||
/**
|
||||
* This method returns the source of the event as an <code>Adjustable</code>.
|
||||
*
|
||||
* @return the <code>Adjustable</code> source of the event
|
||||
*/
|
||||
public Adjustable getAdjustable()
|
||||
{
|
||||
return (Adjustable) source;
|
||||
return adjustable;
|
||||
}
|
||||
|
||||
public int getAdjustmentType ()
|
||||
{
|
||||
return adjType;
|
||||
}
|
||||
|
||||
public int getValue ()
|
||||
/**
|
||||
* Returns the new value of the adjustable object.
|
||||
*
|
||||
* @return the value of the event
|
||||
*/
|
||||
public int getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public String paramString ()
|
||||
/**
|
||||
* Returns the type of the event, which will be one of
|
||||
* {@link #UNIT_INCREMENT}, {@link #UNIT_DECREMENT},
|
||||
* {@link #BLOCK_INCREMENT}, {@link #BLOCK_DECREMENT}, or {@link #TRACK}.
|
||||
*
|
||||
* @return the type of the event
|
||||
*/
|
||||
public int getAdjustmentType()
|
||||
{
|
||||
String r;
|
||||
switch (id)
|
||||
{
|
||||
case ADJUSTMENT_VALUE_CHANGED:
|
||||
r = "ADJUSTMENT_VALUE_CHANGED";
|
||||
break;
|
||||
default:
|
||||
r = "unknown id";
|
||||
break;
|
||||
}
|
||||
|
||||
r += ",adjType=";
|
||||
|
||||
switch (adjType)
|
||||
{
|
||||
case BLOCK_DECREMENT:
|
||||
r += "BLOCK_DECREMENT";
|
||||
break;
|
||||
case BLOCK_INCREMENT:
|
||||
r += "BLOCK_INCREMENT";
|
||||
break;
|
||||
case TRACK:
|
||||
r += "TRACK";
|
||||
break;
|
||||
case UNIT_DECREMENT:
|
||||
r += "UNIT_DECREMENT";
|
||||
break;
|
||||
case UNIT_INCREMENT:
|
||||
r += "UNIT_INCREMENT";
|
||||
break;
|
||||
default:
|
||||
r += "unknown type";
|
||||
break;
|
||||
}
|
||||
|
||||
r += ",value=" + value;
|
||||
return r;
|
||||
return adjustmentType;
|
||||
}
|
||||
|
||||
private int adjType;
|
||||
private int value;
|
||||
}
|
||||
/**
|
||||
* Test if this event is part of a sequence of multiple adjustements.
|
||||
*
|
||||
* @return true if this is not the last adjustment
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean getValueIsAdjusting()
|
||||
{
|
||||
return isAdjusting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string that describes the event. This is in the format
|
||||
* <code>"ADJUSTMENT_VALUE_CHANGED,adjType=" + <type> + ",value="
|
||||
* + getValue() + ",isAdjusting=" + getValueIsAdjusting()</code>, where
|
||||
* type is the name of the constant returned by getAdjustmentType().
|
||||
*
|
||||
* @return a string that describes the event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return (id == ADJUSTMENT_VALUE_CHANGED
|
||||
? "ADJUSTMENT_VALUE_CHANGED,adjType=" : "unknown type,adjType=")
|
||||
+ (adjustmentType == UNIT_INCREMENT ? "UNIT_INCREMENT,value="
|
||||
: adjustmentType == UNIT_DECREMENT ? "UNIT_DECREMENT,value="
|
||||
: adjustmentType == BLOCK_INCREMENT ? "BLOCK_INCREMENT,value="
|
||||
: adjustmentType == BLOCK_DECREMENT ? "BLOCK_DECREMENT,value="
|
||||
: adjustmentType == TRACK ? "TRACK,value=" : "unknown type,value=")
|
||||
+ value + ",isAdjusting=" + isAdjusting;
|
||||
}
|
||||
} // class AdjustmentEvent
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue