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.
javax.swing.plaf.nimbus

Class State<T extends JComponent>


  • public abstract class State<T extends JComponent>
    extends Object

    Represents a built in, or custom, state in Nimbus.

    Synth provides several built in states, which are:

    • Enabled
    • Mouse Over
    • Pressed
    • Disabled
    • Focused
    • Selected
    • Default

    However, there are many more states that could be described in a LookAndFeel, and it would be nice to style components differently based on these different states. For example, a progress bar could be "indeterminate". It would be very convenient to allow this to be defined as a "state".

    This class, State, is intended to be used for such situations. Simply implement the abstract #isInState method. It returns true if the given JComponent is "in this state", false otherwise. This method will be called many times in performance sensitive loops. It must execute very quickly.

    For example, the following might be an implementation of a custom "Indeterminate" state for JProgressBars:

    
         public final class IndeterminateState extends State<JProgressBar> {
             public IndeterminateState() {
                 super("Indeterminate");
             }
    
             @Override
             protected boolean isInState(JProgressBar c) {
                 return c.isIndeterminate();
             }
         }
     
    • Constructor Detail

      • State

        protected State(String name)

        Create a new custom State. Specify the name for the state. The name should be unique within the states set for any one particular component. The name of the state should coincide with the name used in UIDefaults.

        For example, the following would be correct:

        
             defaults.put("Button.States", "Enabled, Foo, Disabled");
             defaults.put("Button.Foo", new FooState("Foo"));
         
        Parameters:
        name - a simple user friendly name for the state, such as "Indeterminate" or "EmbeddedPanel" or "Blurred". It is customary to use camel case, with the first letter capitalized.
    • Method Detail

      • toString

        public String toString()
        Description copied from class: Object
        Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

        The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

         getClass().getName() + '@' + Integer.toHexString(hashCode())
         
        Overrides:
        toString in class Object
        Returns:
        a string representation of the object.
      • isInState

        protected abstract boolean isInState(T c)

        Gets whether the specified JComponent is in the custom state represented by this class. This is an extremely performance sensitive loop. Please take proper precautions to ensure that it executes quickly.

        Nimbus uses this method to help determine what state a JComponent is in. For example, a custom State could exist for JProgressBar such that it would return true when the progress bar is indeterminate. Such an implementation of this method would simply be:

         return c.isIndeterminate();
        Parameters:
        c - the JComponent to test. This will never be null.
        Returns:
        true if c is in the custom state represented by this State instance

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-javax/swing/plaf/nimbus/State.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