Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: How are you supposed to set JTable height? Date: Sat, 20 May 2017 07:59:15 -0400 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <5749752d-bc83-4fb5-9abc-1a255e213a29@googlegroups.com> <92a3c52c-8ac7-49f5-9b46-794224e13642@googlegroups.com> <266d8f3d-b922-42d4-b3c1-f00e8a95574d@googlegroups.com> <80c877a7-0ea7-4869-ace6-54bb6fb04c16@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 20 May 2017 11:55:56 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="dfe475f008bec95b088ccfffd278dee4"; logging-data="28594"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mxZPOxbIRAyswXZA0HBum" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 In-Reply-To: <80c877a7-0ea7-4869-ace6-54bb6fb04c16@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:zLA0+4tzhGM5iZ5pKCHZTRghlhA= Xref: csiph.com comp.lang.java.programmer:36648 On 5/19/2017 4:06 PM, Eric Douglas wrote: > On Friday, May 19, 2017 at 2:43:03 PM UTC-4, Eric Douglas wrote: >>> >> I'm testing these more specific methods and this is tedious. I call fireTableCellUpdated and it crashes saying default row sorter reports row out of range. So I have to nail that down or go back to an update all. > > Now that I got that worked out I'm back to the hard part. > I'm trying to make accessible rows disappear. From what I could find searching the internet for this they just say use the RowFilter, but that makes them inaccessible. I don't want the user to be able to see them or edit them, but I want the program to call get and set methods as if they're showing normally. I'm not sure what's going on, because it seems straightforward and should work as advertised (has worked as advertised, for me). You can modify the contents of your TableModel without regard to whether the cells are or aren't visible; "as if they're showing normally." The JTable listens to its model, and when it receives a change event it first determines whether the change is to a visible part of the table. If the changed cells are not visible -- hidden by a RowFilter, or just scrolled out of sight -- nothing gets repainted. > I hacked the UI to not show them which is the easy part since I already implemented an extension of BasicTableUI for another custom view [...] I can't help you with this part, since I've never tried to mess with the plaf layers. On the other hand, I've never needed to: For filtering, sorting, and custom-painting rows and cells, I've just used RowFilter, TableRowSorter, and sometimes a customized TableCellRenderer or TableCellEditor. These have met my needs without recourse to mucking about in the lower levels. -- esosman@comcast-dot-net.invalid Thirteen hundred forty-two days to go.