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


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

Re: Forcing cell edits in a JTable?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.gui
Subject Re: Forcing cell edits in a JTable?
Date Fri, 06 Jan 2012 07:01:17 -0500
Organization A noiseless patient Spider
Lines 44
Message-ID <je6ne9$mlf$1@dont-email.me> (permalink)
References <Xns9FD1EF35A670Djpnasty@94.75.214.39> <je6mi4$j66$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 6 Jan 2012 11:54:49 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="qwFw1g9RsQ6TkML5yezG9A"; logging-data="23215"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TGOEiTxTuSilnp2idOEL49y1jXNCvHZI="
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11
In-Reply-To <je6mi4$j66$1@dont-email.me>
Cancel-Lock sha1:uUKcOuZS9TrMacsl3QKSmtUPjtk=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:4907

Show key headers only | View raw


On 01/06/2012 06:46 AM, Jeff Higgins wrote:
> On 01/05/2012 11:30 PM, Novice wrote:
>> I'm looking for some advice on the best way to handle a situation in a
>> program.
>>
>> I am displaying a JTable and giving the user the option to add new
>> rows to
>> the table. When the user chooses to insert a row, I create a new empty
>> row
>> in the table at the desired place via a custom-written insertRow() method
>> in the table model. Then I execute fireTableRowsInserted() and the empty
>> row appears. All that works fine.
>>
>> But I don't want to leave the new row empty, I want to force the user to
>> populate each cell in the new row. Almost anything goes for these
>> cells but
>> each value will have to pass at least one check in that column's cell
>> renderer, namely that it is not blank.

Ouch!

>>
>> What's the best way to ensure that the new row gets populated before the
>> user moves on to edit, delete, or insert another row?
>
> I'm really not trying to be obnoxious here, but can you just pop up a
> dialog that states, "If you'll fill out these values correctly, I will
> add them to the Table for you".
>
>>
>> I'm trying to use editCellAt() to force the edit. That method invokes the
>> editor for the desired cell but lets me hit escape even though the data
>> doesn't yet meet my requirements. I am very surprised that it doesn't
>> stay
>> in edit mode for that cell until the edits are passed and can't think of
>> why that is.
>>
>> If I edit an existing row, the cell editor will not let me leave the cell
>> until there is a satisfactory value (or I can hit escape and restore the
>> value to what it was before editing). But a new row doesn't seem to be
>> subject to the same rules. Why?
>>
>

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


Thread

Forcing cell edits in a JTable? Novice <novice@example..com> - 2012-01-06 04:30 +0000
  Re: Forcing cell edits in a JTable? Jeff Higgins <jeff@invalid.invalid> - 2012-01-06 06:46 -0500
    Re: Forcing cell edits in a JTable? Jeff Higgins <jeff@invalid.invalid> - 2012-01-06 07:01 -0500
      Re: Forcing cell edits in a JTable? Novice <novice@example..com> - 2012-01-06 14:17 +0000
    Re: Forcing cell edits in a JTable? Novice <novice@example..com> - 2012-01-06 14:16 +0000
      Re: Forcing cell edits in a JTable? Jeff Higgins <jeff@invalid.invalid> - 2012-01-06 11:48 -0500
        Re: Forcing cell edits in a JTable? Jeff Higgins <jeff@invalid.invalid> - 2012-01-06 15:13 -0500
  Re: Forcing cell edits in a JTable? Jeff Higgins <jeff@invalid.invalid> - 2012-01-06 07:22 -0500
    Re: Forcing cell edits in a JTable? Novice <novice@example..com> - 2012-01-06 14:19 +0000

csiph-web