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

Add fullRowSelect property to JTable, JList, JTree

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE REQUEST :
      Add 'fullRowSelect' property for JTable, JList, JTree. It should be boolean property. This property should describe how selection in those components are made.

      When fullRowSelect is true, clicking anywhere in row in these components should select row and selection should be visually made whole row wide. This is current default implementation in JTable and JList.

      Setting fullRowSelect on false should force this behavior - cell (row) is made selected only when user click inside visual presentation of table/list/tree element (usually text and icon). For JTable only clicking on first column should count. This basically how it looks in JTree.

      JUSTIFICATION :
      Both described above selection behaviors are common in various GUI applications.

      Behavior similar to fullRowSelect = false can be achieved using "List.isFileList" and "Table.isFileTable" client properties, but is has 2 drawbacks:
      - it is L&F dependent (works on Windows L&F but not on Metal)
      - these properties are hard to find - single, well described method would be better solution.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JTree/JTable/JList should allow changing selection behaviors via pair of method (example):

      public void setFullRowSelectionEnabled(boolean fullRowSelect)
      public boolean isFullRowSelelectionEnabled()
      ACTUAL -
      JTree/JTable/JList don't allow simple and clear setting selection behaviors.

      CUSTOMER SUBMITTED WORKAROUND :
      Warkaround can be made with custom editors for JTable/JTree - one can dig into WindowsFileChooserUI and BasicListUI/BasicTableUI (search for 'List.isFileList' and 'Table.isFileList' properties in source).

      Haven't tried to achieve full row selection in JTree, anyway...

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: