Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6525461

Preferred gaps from LayoutStyle don't match guidelines in many cases

XMLWordPrintable

      Real spaces between components laid out using preferred gaps provided by LayoutStyle don't match the UI guidelines in various cases. See the links below for several documented examples. The differences are mostly due to the fact that component bounds are often bigger than the visible area of the component painted on the screen - and LayoutStyle does not take this into account.

      Specifically, textual components without visible borders like JLabel or JCheckBox may include some extra empty pixels around the text thus making the perceived distance from other componentes bigger. Ideally LayoutStyle should consider the appropriate perceived bounds of the text and subtract the empty pixels. This would also mean to use the text baseline as the bottom boundary.

      Components with borders like JButton or JTextField may have various shadows, 3D effect, or just empty space reserved for "focus ring", etc. These all are perceived as free space, so should be taken into account when computing the preferred gaps.

      So in current situation it is practically impossible to do precise platform independent layout matching guidelines.

      One possible solution is for known cases to compensate in LayoutStyle implementations for various look and feels. This could fix cases for gaps between consecutive individual components. However, it can never fix situations when several different components are aligned in parallel on the same position (e.g. left aligned) don't match. The only general solution seems to be to make the layout management work with "perceived" visual bounds rather than the "technical" bounds of components as used now. That would be quite complex change, but seems as only correct long term solution for precise layout.

      Several examples of incorrect spacing we've got reported:
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29254/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73614)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29259/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73630)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29263/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73645)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29266/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73651)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29271/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73665)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29268/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73656)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29269/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73662)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29375/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73916)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29380/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73919)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29381/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=73920)
      http://www.netbeans.org/nonav/issues/showattachment.cgi/29554/spacing.png
        (http://www.netbeans.org/issues/show_bug.cgi?id=74310)

            Unassigned Unassigned
            tpavek Tomáš Pávek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: