Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
java.awt

Enum Component. BaselineResizeBehavior

  • All Implemented Interfaces:
    Serializable, Comparable<Component.BaselineResizeBehavior>
    Enclosing class:
    Component

    public static enum Component.BaselineResizeBehavior
    extends Enum<Component.BaselineResizeBehavior>
    Enumeration of the common ways the baseline of a component can change as the size changes. The baseline resize behavior is primarily for layout managers that need to know how the position of the baseline changes as the component size changes. In general the baseline resize behavior will be valid for sizes greater than or equal to the minimum size (the actual minimum size; not a developer specified minimum size). For sizes smaller than the minimum size the baseline may change in a way other than the baseline resize behavior indicates. Similarly, as the size approaches Integer.MAX_VALUE and/or Short.MAX_VALUE the baseline may change in a way other than the baseline resize behavior indicates.
    Since:
    1.6
    See Also:
    Component.getBaselineResizeBehavior(), Component.getBaseline(int,int)
    • Enum Constant Detail

      • CONSTANT_ASCENT

        public static final Component.BaselineResizeBehavior CONSTANT_ASCENT
        Indicates the baseline remains fixed relative to the y-origin. That is, getBaseline returns the same value regardless of the height or width. For example, a JLabel containing non-empty text with a vertical alignment of TOP should have a baseline type of CONSTANT_ASCENT.
      • CONSTANT_DESCENT

        public static final Component.BaselineResizeBehavior CONSTANT_DESCENT
        Indicates the baseline remains fixed relative to the height and does not change as the width is varied. That is, for any height H the difference between H and getBaseline(w, H) is the same. For example, a JLabel containing non-empty text with a vertical alignment of BOTTOM should have a baseline type of CONSTANT_DESCENT.
      • CENTER_OFFSET

        public static final Component.BaselineResizeBehavior CENTER_OFFSET
        Indicates the baseline remains a fixed distance from the center of the component. That is, for any height H the difference between getBaseline(w, H) and H / 2 is the same (plus or minus one depending upon rounding error).

        Because of possible rounding errors it is recommended you ask for the baseline with two consecutive heights and use the return value to determine if you need to pad calculations by 1. The following shows how to calculate the baseline for any height:

           Dimension preferredSize = component.getPreferredSize();
           int baseline = getBaseline(preferredSize.width,
                                      preferredSize.height);
           int nextBaseline = getBaseline(preferredSize.width,
                                          preferredSize.height + 1);
           // Amount to add to height when calculating where baseline
           // lands for a particular height:
           int padding = 0;
           // Where the baseline is relative to the mid point
           int baselineOffset = baseline - height / 2;
           if (preferredSize.height % 2 == 0 &&
               baseline != nextBaseline) {
               padding = 1;
           }
           else if (preferredSize.height % 2 == 1 &&
                    baseline == nextBaseline) {
               baselineOffset--;
               padding = 1;
           }
           // The following calculates where the baseline lands for
           // the height z:
           int calculatedBaseline = (z + padding) / 2 + baselineOffset;
         
      • OTHER

        public static final Component.BaselineResizeBehavior OTHER
        Indicates the baseline resize behavior can not be expressed using any of the other constants. This may also indicate the baseline varies with the width of the component. This is also returned by components that do not have a baseline.
    • Method Detail

      • values

        public static Component.BaselineResizeBehavior[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Component.BaselineResizeBehavior c : Component.BaselineResizeBehavior.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Component.BaselineResizeBehavior valueOf(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/awt/Component.BaselineResizeBehavior.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut