< prev index next >

src/java.desktop/share/classes/java/awt/peer/ComponentPeer.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.peer;
  27 
  28 import java.awt.*;
  29 import java.awt.event.PaintEvent;

  30 import java.awt.image.ColorModel;
  31 import java.awt.image.ImageObserver;
  32 import java.awt.image.ImageProducer;
  33 import java.awt.image.VolatileImage;
  34 
  35 import sun.awt.CausedFocusEvent;
  36 import sun.java2d.pipe.Region;
  37 
  38 
  39 /**
  40  * The peer interface for {@link Component}. This is the top level peer
  41  * interface for widgets and defines the bulk of methods for AWT component
  42  * peers. Most component peers have to implement this interface (via one
  43  * of the subinterfaces), except menu components, which implement
  44  * {@link MenuComponentPeer}.
  45  *
  46  * The peer interfaces are intended only for use in porting
  47  * the AWT. They are not intended for use by application
  48  * developers, and developers should not implement peers
  49  * nor invoke any of the peer methods directly on the peer
  50  * instances.
  51  */
  52 public interface ComponentPeer {
  53 
  54     /**
  55      * Operation for {@link #setBounds(int, int, int, int, int)}, indicating


 326      */
 327     void updateCursorImmediately();
 328 
 329     /**
 330      * Requests focus on this component.
 331      *
 332      * @param lightweightChild the actual lightweight child that requests the
 333      *        focus
 334      * @param temporary {@code true} if the focus change is temporary,
 335      *        {@code false} otherwise
 336      * @param focusedWindowChangeAllowed {@code true} if changing the
 337      *        focus of the containing window is allowed or not
 338      * @param time the time of the focus change request
 339      * @param cause the cause of the focus change request
 340      *
 341      * @return {@code true} if the focus change is guaranteed to be
 342      *         granted, {@code false} otherwise
 343      */
 344     boolean requestFocus(Component lightweightChild, boolean temporary,
 345                          boolean focusedWindowChangeAllowed, long time,
 346                          CausedFocusEvent.Cause cause);
 347 
 348     /**
 349      * Returns {@code true} when the component takes part in the focus
 350      * traversal, {@code false} otherwise.
 351      *
 352      * @return {@code true} when the component takes part in the focus
 353      *         traversal, {@code false} otherwise
 354      */
 355     boolean isFocusable();
 356 
 357     /**
 358      * Creates an image using the specified image producer.
 359      *
 360      * @param producer the image producer from which the image pixels will be
 361      *        produced
 362      *
 363      * @return the created image
 364      *
 365      * @see Component#createImage(ImageProducer)
 366      */


   1 /*
   2  * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.peer;
  27 
  28 import java.awt.*;
  29 import java.awt.event.PaintEvent;
  30 import java.awt.event.FocusEvent.Cause;
  31 import java.awt.image.ColorModel;
  32 import java.awt.image.ImageObserver;
  33 import java.awt.image.ImageProducer;
  34 import java.awt.image.VolatileImage;
  35 

  36 import sun.java2d.pipe.Region;
  37 
  38 
  39 /**
  40  * The peer interface for {@link Component}. This is the top level peer
  41  * interface for widgets and defines the bulk of methods for AWT component
  42  * peers. Most component peers have to implement this interface (via one
  43  * of the subinterfaces), except menu components, which implement
  44  * {@link MenuComponentPeer}.
  45  *
  46  * The peer interfaces are intended only for use in porting
  47  * the AWT. They are not intended for use by application
  48  * developers, and developers should not implement peers
  49  * nor invoke any of the peer methods directly on the peer
  50  * instances.
  51  */
  52 public interface ComponentPeer {
  53 
  54     /**
  55      * Operation for {@link #setBounds(int, int, int, int, int)}, indicating


 326      */
 327     void updateCursorImmediately();
 328 
 329     /**
 330      * Requests focus on this component.
 331      *
 332      * @param lightweightChild the actual lightweight child that requests the
 333      *        focus
 334      * @param temporary {@code true} if the focus change is temporary,
 335      *        {@code false} otherwise
 336      * @param focusedWindowChangeAllowed {@code true} if changing the
 337      *        focus of the containing window is allowed or not
 338      * @param time the time of the focus change request
 339      * @param cause the cause of the focus change request
 340      *
 341      * @return {@code true} if the focus change is guaranteed to be
 342      *         granted, {@code false} otherwise
 343      */
 344     boolean requestFocus(Component lightweightChild, boolean temporary,
 345                          boolean focusedWindowChangeAllowed, long time,
 346                          Cause cause);
 347 
 348     /**
 349      * Returns {@code true} when the component takes part in the focus
 350      * traversal, {@code false} otherwise.
 351      *
 352      * @return {@code true} when the component takes part in the focus
 353      *         traversal, {@code false} otherwise
 354      */
 355     boolean isFocusable();
 356 
 357     /**
 358      * Creates an image using the specified image producer.
 359      *
 360      * @param producer the image producer from which the image pixels will be
 361      *        produced
 362      *
 363      * @return the created image
 364      *
 365      * @see Component#createImage(ImageProducer)
 366      */


< prev index next >