customizing jlist's internal logic for selecting cells

Discussion in 'Java' started by B Young, Jan 20, 2004.

  1. B Young

    B Young Guest

    I've written a highly customized JList that lays cells out
    horizontally, wrapping, and is editable. This is presenting a problem
    with one piece of default JList behaviour that I need to change or
    remove and install my own functionality.

    My JList can have a lot of white space potentially at the right and
    bottom depending on the number of items and preferred sizes, etc.
    Well, There is no such thing as a click inside a JList that doesn't
    register and select *something*. You can click into what appears to be
    never-never-land and guess what, it selects the nearest cell. I have
    better logic I'd like to install for when something gets selected, but
    how do I get at the default behaviour? What do I remove, override,
    etc?

    P.S. I've tried overriding "int locationToIndex(Point p)" and making
    it work "properly", returning -1 if the mouse click was nowhere near
    an actual cell. No good though- doesn't look like its being called by
    JList to determine what to select.

    Sincerely
    Thanks.
     
    B Young, Jan 20, 2004
    #1
    1. Advertising

  2. B Young

    hiwa Guest

    (B Young) wrote in message news:<>...
    > I've written a highly customized JList that lays cells out
    > horizontally, wrapping, and is editable. This is presenting a problem
    > with one piece of default JList behaviour that I need to change or
    > remove and install my own functionality.
    >
    > My JList can have a lot of white space potentially at the right and
    > bottom depending on the number of items and preferred sizes, etc.
    > Well, There is no such thing as a click inside a JList that doesn't
    > register and select *something*. You can click into what appears to be
    > never-never-land and guess what, it selects the nearest cell. I have
    > better logic I'd like to install for when something gets selected, but
    > how do I get at the default behaviour? What do I remove, override,
    > etc?
    >
    > P.S. I've tried overriding "int locationToIndex(Point p)" and making
    > it work "properly", returning -1 if the mouse click was nowhere near
    > an actual cell. No good though- doesn't look like its being called by
    > JList to determine what to select.
    >
    > Sincerely
    > Thanks.


    I believe your event listeners for your JList can control
    the issue described here.
     
    hiwa, Jan 20, 2004
    #2
    1. Advertising

  3. B Young

    B Young Guest

    After some further research, the problem appears to be in BasicListUI.
    The code is way too happy to go and find the closest cell even if the
    mouse click was far outside of a legitimate cell boundry.

    I don't see a way around this though since customizing BasicListUI is
    more than I want to get involved with. I can just about as easily
    crank out a custom component of some type that mimics the
    functionality I want.

    Thanks
    Brian


    (hiwa) wrote in message news:<>...

    > I believe your event listeners for your JList can control
    > the issue described here.
     
    B Young, Jan 20, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    532
  2. Replies:
    0
    Views:
    379
  3. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    313
    Joel Finkel
    Sep 1, 2003
  4. computerzworld
    Replies:
    2
    Views:
    97
Loading...

Share This Page