javax.swing.border

Class TitledBorder

  • All Implemented Interfaces:
    Serializable, Border
    Direct Known Subclasses:
    BorderUIResource.TitledBorderUIResource

    public class TitledBorder
    extends AbstractBorder
    A class which implements an arbitrary border with the addition of a String title in a specified position and justification.

    If the border, font, or color property values are not specified in the constuctor or by invoking the appropriate set methods, the property values will be defined by the current look and feel, using the following property names in the Defaults Table:

    • "TitledBorder.border"
    • "TitledBorder.font"
    • "TitledBorder.titleColor"

    Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

    • Field Detail

      • title

        protected String title
      • border

        protected Border border
      • titlePosition

        protected int titlePosition
      • titleJustification

        protected int titleJustification
      • titleFont

        protected Font titleFont
      • titleColor

        protected Color titleColor
      • DEFAULT_POSITION

        public static final int DEFAULT_POSITION
        Use the default vertical orientation for the title text.
        See Also:
        Constant Field Values
      • ABOVE_TOP

        public static final int ABOVE_TOP
        Position the title above the border's top line.
        See Also:
        Constant Field Values
      • TOP

        public static final int TOP
        Position the title in the middle of the border's top line.
        See Also:
        Constant Field Values
      • BELOW_TOP

        public static final int BELOW_TOP
        Position the title below the border's top line.
        See Also:
        Constant Field Values
      • ABOVE_BOTTOM

        public static final int ABOVE_BOTTOM
        Position the title above the border's bottom line.
        See Also:
        Constant Field Values
      • BOTTOM

        public static final int BOTTOM
        Position the title in the middle of the border's bottom line.
        See Also:
        Constant Field Values
      • BELOW_BOTTOM

        public static final int BELOW_BOTTOM
        Position the title below the border's bottom line.
        See Also:
        Constant Field Values
      • DEFAULT_JUSTIFICATION

        public static final int DEFAULT_JUSTIFICATION
        Use the default justification for the title text.
        See Also:
        Constant Field Values
      • LEFT

        public static final int LEFT
        Position title text at the left side of the border line.
        See Also:
        Constant Field Values
      • CENTER

        public static final int CENTER
        Position title text in the center of the border line.
        See Also:
        Constant Field Values
      • RIGHT

        public static final int RIGHT
        Position title text at the right side of the border line.
        See Also:
        Constant Field Values
      • LEADING

        public static final int LEADING
        Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.
        See Also:
        Constant Field Values
      • TRAILING

        public static final int TRAILING
        Position title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TitledBorder

        public TitledBorder(String title)
        Creates a TitledBorder instance.
        Parameters:
        title - the title the border should display
      • TitledBorder

        public TitledBorder(Border border)
        Creates a TitledBorder instance with the specified border and an empty title.
        Parameters:
        border - the border
      • TitledBorder

        public TitledBorder(Border border,
                    String title)
        Creates a TitledBorder instance with the specified border and title.
        Parameters:
        border - the border
        title - the title the border should display
      • TitledBorder

        public TitledBorder(Border border,
                    String title,
                    int titleJustification,
                    int titlePosition)
        Creates a TitledBorder instance with the specified border, title, title-justification, and title-position.
        Parameters:
        border - the border
        title - the title the border should display
        titleJustification - the justification for the title
        titlePosition - the position for the title
      • TitledBorder

        public TitledBorder(Border border,
                    String title,
                    int titleJustification,
                    int titlePosition,
                    Font titleFont)
        Creates a TitledBorder instance with the specified border, title, title-justification, title-position, and title-font.
        Parameters:
        border - the border
        title - the title the border should display
        titleJustification - the justification for the title
        titlePosition - the position for the title
        titleFont - the font for rendering the title
      • TitledBorder

        @ConstructorProperties(value={"border","title","titleJustification","titlePosition","titleFont","titleColor"})
        public TitledBorder(Border border,
                                               String title,
                                               int titleJustification,
                                               int titlePosition,
                                               Font titleFont,
                                               Color titleColor)
        Creates a TitledBorder instance with the specified border, title, title-justification, title-position, title-font, and title-color.
        Parameters:
        border - the border
        title - the title the border should display
        titleJustification - the justification for the title
        titlePosition - the position for the title
        titleFont - the font of the title
        titleColor - the color of the title
    • Method Detail

      • paintBorder

        public void paintBorder(Component c,
                       Graphics g,
                       int x,
                       int y,
                       int width,
                       int height)
        Paints the border for the specified component with the specified position and size.
        Specified by:
        paintBorder in interface Border
        Overrides:
        paintBorder in class AbstractBorder
        Parameters:
        c - the component for which this border is being painted
        g - the paint graphics
        x - the x position of the painted border
        y - the y position of the painted border
        width - the width of the painted border
        height - the height of the painted border
      • getBorderInsets

        public Insets getBorderInsets(Component c,
                             Insets insets)
        Reinitialize the insets parameter with this Border's current Insets.
        Overrides:
        getBorderInsets in class AbstractBorder
        Parameters:
        c - the component for which this border insets value applies
        insets - the object to be reinitialized
        Returns:
        the insets object
      • getTitle

        public String getTitle()
        Returns the title of the titled border.
        Returns:
        the title of the titled border
      • getBorder

        public Border getBorder()
        Returns the border of the titled border.
        Returns:
        the border of the titled border
      • getTitlePosition

        public int getTitlePosition()
        Returns the title-position of the titled border.
        Returns:
        the title-position of the titled border
      • getTitleJustification

        public int getTitleJustification()
        Returns the title-justification of the titled border.
        Returns:
        the title-justification of the titled border
      • getTitleFont

        public Font getTitleFont()
        Returns the title-font of the titled border.
        Returns:
        the title-font of the titled border
      • getTitleColor

        public Color getTitleColor()
        Returns the title-color of the titled border.
        Returns:
        the title-color of the titled border
      • setTitle

        public void setTitle(String title)
        Sets the title of the titled border.
        Parameters:
        title - the title for the border
      • setBorder

        public void setBorder(Border border)
        Sets the border of the titled border.
        Parameters:
        border - the border
      • setTitlePosition

        public void setTitlePosition(int titlePosition)
        Sets the title-position of the titled border.
        Parameters:
        titlePosition - the position for the border
      • setTitleJustification

        public void setTitleJustification(int titleJustification)
        Sets the title-justification of the titled border.
        Parameters:
        titleJustification - the justification for the border
      • setTitleFont

        public void setTitleFont(Font titleFont)
        Sets the title-font of the titled border.
        Parameters:
        titleFont - the font for the border title
      • setTitleColor

        public void setTitleColor(Color titleColor)
        Sets the title-color of the titled border.
        Parameters:
        titleColor - the color for the border title
      • getMinimumSize

        public Dimension getMinimumSize(Component c)
        Returns the minimum dimensions this border requires in order to fully display the border and title.
        Parameters:
        c - the component where this border will be drawn
        Returns:
        the Dimension object

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/border/TitledBorder.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut