Documentation of 'htmllayout.HtmlLayout' Java class
HtmlLayout
htmllayout

Class HtmlLayout

  • All Implemented Interfaces:
    java.awt.LayoutManager


    public class HtmlLayout
    extends java.lang.Object
    implements java.awt.LayoutManager
    HtmlLayout uses a string containing HTML like table tags to layout components.
    Ex:
     <table rows=2 cols=2>
      <tr>
       <td> A label
       <td component=someName>
      <tr>
       <td component=anotherName vert=max>
       <td component="some other name" horz=max>
     

    Tags and their options

    Table

    • Contains TR

    • horz= LEFT | RIGHT | CENTER | FIT | (MAX)
      Specifies how the table fills the available width
    • vert= TOP | BOTTOM | CENTER | FIT | (MAX)
      Specifies how the table fills the available height
    • rows=y ; y = rowCount (req)
    • cols=y ; y = colCount (req)
    • hgap=y ; y = horizontal gap between components
    • vgap=y ; y = vertical gap between components
    • hpad=y ; y = horizontal padding (components made wider)
    • vpad=y ; y = vertical padding (components made taller)

    TR

    • Contains TD

    • vgap=y ; y = gap between this row and the row above

    TD

    • Contains text (creates a label) or TABLE but only if no component is specified. Nested tables inherit the gaps and pads of their enclosing table.

    • colspan=y
    • rowspan=y
    • horz= (LEFT) | RIGHT | CENTER | FIT | MAX
      Specifies how the component fills the available cell width
    • vert= TOP | BOTTOM | (CENTER) | FIT | MAX
      Specifies how the component fills the available cell height
    • hgap=y ; y = horizontal gap between components
    • vgap=y ; y = vertical gap between components
    • hpad=y ; y = horizontal padding
    • vpad=y ; y = vertical padding (components made larger)
    • component="componentName" ; this is the name that must be used when add is called, as in add(comp, "componentName")
    • Constructor Summary

      Constructors 
      Constructor and Description
      HtmlLayout(java.lang.String html)
      Creates an HtmlLayout with the specified "HTML" string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addLabels(java.awt.Container parent)
      If this layout includes any automatic lables (text within a TD) this will add them to container parent.
      void addLayoutComponent(java.lang.String name, java.awt.Component comp) 
      void layoutContainer(java.awt.Container parent) 
      java.awt.Dimension minimumLayoutSize(java.awt.Container parent) 
      java.awt.Dimension preferredLayoutSize(java.awt.Container parent) 
      void removeLayoutComponent(java.awt.Component comp) 
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HtmlLayout

        public HtmlLayout(java.lang.String html)
        Creates an HtmlLayout with the specified "HTML" string.
        Parameters:
        html - The "HTML" which specifies the layout, if this is not valid table-html a BadTableHtmlException will be thrown. Html can be tested ahead of time using HtmlLayoutTest.
        See Also:
        BadTableHtmlException, HtmlLayoutTest
    • Method Detail

      • addLabels

        public void addLabels(java.awt.Container parent)
        If this layout includes any automatic lables (text within a TD) this will add them to container parent. It is not always necessary to call this, if you don't it will automatically be called when the container is first sized or layed out. Ordinarily this is ok but not always, such as when using CardLayout. Calling addLabels manually at the same time as the other components are added will never be a problem.
      • addLayoutComponent

        public void addLayoutComponent(java.lang.String name,
                                       java.awt.Component comp)
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager
        See Also:
        LayoutManager.addLayoutComponent(java.lang.String, java.awt.Component)
      • removeLayoutComponent

        public void removeLayoutComponent(java.awt.Component comp)
        Specified by:
        removeLayoutComponent in interface java.awt.LayoutManager
        See Also:
        LayoutManager.removeLayoutComponent(java.awt.Component)
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
        Specified by:
        preferredLayoutSize in interface java.awt.LayoutManager
        See Also:
        LayoutManager.preferredLayoutSize(java.awt.Container)
      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
        Specified by:
        minimumLayoutSize in interface java.awt.LayoutManager
        See Also:
        LayoutManager.minimumLayoutSize(java.awt.Container)
      • layoutContainer

        public void layoutContainer(java.awt.Container parent)
        Specified by:
        layoutContainer in interface java.awt.LayoutManager
        See Also:
        LayoutManager.layoutContainer(java.awt.Container)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.