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

JSlider labels should respect the horizontalAlignment of the JLabels

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • None
    • generic
    • solaris_2.6


      If textual labels (rather than numeric) are desired on a JSlider, it should
      be possible to control the horizontalAlignment of those labels. Look at
      a piece of electronic equipment with sliders. The sliders are labeled as:

      ==========V======================
      | | | | |
      LOW MID HIGH

      Not as:

      ==========V======================
      | | | | |
             LOW MID HIGH

      A significantly more inportant attribute of this type of labeling is that
      it makes it reasonably easy to keep multiple sliders with text labels the
      same size (where the length of the slider band *and* the bounding box are
      the things desired to be kept equal). For example, if two instances of
      the "label centered" slider above are placed in a grid layout (with the
      names lenghted in one make it obvious), the following appears:


      ==========V======================
      | | | | |
             LOW MID HIGH

      ==========V=================
      | | | | |
             LOW_BAND MID HIGH_BAND

      This isn't (probably) what the UI designer wanted. Probably, the following
      would be prefered:

      ==========V======================
      | | | | |
      LOW MID HIGH

      ==========V======================
      | | | | |
      LOW_BAN MID HIGH_BAND

      At least this UI designer want to be able to do this. 8^)

      A simple way to do this is to respect the horizontalAlignment associated
      with the JLabels in the labelTable.

      It would have be nice if the original swing specification was done this
      way. If the specification can be simply changed, please do so, but this
      is a incompatable change and I suspect unacceptable from that standpoint.
      Its an incompatable change because the default JLable horizontalAlignment
      is LEFT and any non-default labelTables generated to date, probably have
      this horizontalAlignment because it didn't matter. THIS CAN BE ADDRESSED
      IN A COMPATIBLE WAY. SEE SUGGUSTED FIX.

            joutwatesunw Joshua Outwater (Inactive)
            jkowalsksunw Joseph Kowalski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: