Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1523

Re: How to create expandi

From "Josh Falter" <josh.falter@THRWHITE.remove-dii-this>
Subject Re: How to create expandi
Message-ID <1177422497.768143.219910@t38g2000prd.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <1177328316.680723.92600@e65g2000hsc.googlegroups.com>
Date 2011-04-27 15:33 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
I have never attempted this, so I don't know if it would work, but
here is what I would try....
Start with a JTable that you have created a custom TableModel for (so
that you can control the data organization).  Add a
MouseMotionListener to the JTable.  When a MouseEvent event is
received, create a Point Object from the coordinates of the event
(using MouseEvent.getPoint) and use the JTable functions
columnAtPoint() and rowAtPoint() to determine if having the mouse over
this location in the JTable should cause the data to change.  If new
data should then be shown, I would call some custom function in the
TableModel that would insert a new row and set some flags that would
be used in the getValueAt() function to inject the new data into the
next row and move all the other data down a row.  Then call
fireTableDataChanged() to get the GUI to update the data displayed.
You would also then have to listen for when the Mouse has moved to a
new location so that you can delete that extra row and reset the data,
which would probably involve the MouseMotionListener as well as a
MouseListener to determine if the mouse has left the component all
together.

HTH - Josh

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to create expanding T "jfelde" <jfelde@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
  Re: How to create expandi "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
    Re: How to create expandi "jfelde" <jfelde@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
      Re: How to create expandi "Josh Falter" <josh.falter@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
        Re: How to create expandi "jfelde" <jfelde@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
  Re: How to create expandi "RC" <rc@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000

csiph-web