I am using freeze, hide and showall on NatTable. When I perform freeze on any row, lets suppose 3rd row and hide that row, then the freeze indicator gets shifted to the previous row i.e 2nd row. And when I do showAll rows then the freeze indicator remains below the 2nd row. If I repeat the hiding of the freezed row and perform show all, at a point the freeze indicator will be above 1st row and then it disappears after repeating it once more.
Freeze performed on 3rd row
Hiding the 3rd row
Performing show all rows
Is it expected behaviour or an issue?
If it is an issue, how to resolve it?
The freeze state is based on positions. If you hide a row on the freeze border it is not possible to identify if the row that gets visible again was part of the frozen area or the non-frozen area. Currently the implementation interpretes that case as the new visible column belongs to the non-frozen area. This decision was made IIRC because typically the frozen area is non modifiable, means a user should not hide rows or columns interactively in a frozen area. At least for projects I worked in. That is of course discussable, but that is how it is right now. So if you need to support a fixed freeze border and allow hiding in the frozen area, you probably need to ensure via an event listener that on structural changes the freeze border stays at its fixed position.
Related
aPanel.getTable().setRowSelectionAllowed(true);
aPanel.getTable().requestFocusInWindow();
Still the focus gets lost and we had to regain it using mouse click.
jtable focus is lost on scrolling using up and down arrow keys and focus gets shifted to other component say button. How to regain focus to continue scrolling on rows the problem occurs for java 8.
tableName.requestFocus();
Solution: Your table doesn't know when to lose or gain focus, we have to mention explicitly this into our Table in ListSelectionListener event. requestFocus() will ensure this functionality.
will work in this case as it will prevent losing focus from the table. Please Note: no changes required in fireDataTableChanged(); method
I've created a Table that is basically a JPanel with other panels as rows containing JTextArea components to display data. I didn't want to use a JTable to have full control by myself.
When a row is clicked on I want it to be highlighted through changing its border. I implemented a Mouselistener that does the job for every text area on mouse pressed. It works. It works with 1000 entries, but when I reach more, i.e. 5000 it takes ages for the listener to do his work. Obviously it gets worse the more entries I have. But this doesn't make sense to me, as I only change one rows border, no matter whether there is 1 or 10000 others.
Can anyone point me to the reason for this? Even if I put a System.out right after "mouse pressed" it takes ages for the output. So I guess its not the executed methods (that are not time consuming at all) themselves.
everyone, excuse my language I speak Spanish and I use google translator
I have a question I can appear and disappear as one scroll lacelda depending on size or table for example when the cell arrives at a height of "300" scrolling appears visible, if not reach 300 not appear
How I can do that?
regards
There is a Swing class called JScrollPane. There are two functions called:
scrollBar.getHorizontalScrollBar().getValue();
scrollBar.getVerticalScrollBar().getValue();
You'll either need an event listener or a loop in a separate thread to check if the scroll bar is past a certain point.
The code to make it disappear is just:
scrollBar.setVisible(false)
The code to make it reappear:
scrollBar.setVisible(true);
scrollBar.validate();
scrollBar.repaint();
I am having a strange problem, where using a jComboBox is causing screen repaint issues on the portion of the panel below the panel.
Specifically:
I have a panel with a table that is located below a combo box.
(The table has a colored header row)
Opening and closing the combo box (without selecting anything) causes the table header to get colored differently (changes to white).
The region that gets mis-colored is the table cell exactly below the combo box's handle. (starts at the left side of the cell and stops exactly where the combobox handle stops.)
Resizing the window makes the panel become colored properly. (which indicates to me that this is a paint problem, as described in: http://www.oracle.com/technetwork/java/javase/swing-135905.html)
Interestingly, it seems to happen only on Solaris (not Linux, have not tried windows).
Apologies in advance for not providing a working example, just looking for ideas at the moment for things to check.
In my code, the UI has the following components:
JSplitPane:
pane1: JTable
pane2: JPanel with some texutal information.
I am listening to the row selection events on the table and then setting the divider location of the splitpane appropriately so that the textual information is visible for some row and is hidden for some other rows.
However, one problem with this approach is the switching to the divider location is very abrupt which gives very less time to the user to understand what happened.
Could you please let me know how to add in some animation so that the divider location switching happens slowly and gives user an idea that textual information is shown for a particular row selection and hidden for some other row selection.
I tried changing the divider location slowly from one value to the next on the AWT thread, but then the UI seemed to not respond properly.
Use a javax.swing.Timer to control the animation, as shown in this example. Note that the animation remains smooth as the frame is resized.