Hello, How many items at a time can scrolling in Java handle?? For example if I have a JList or a JTable, what is the maximum number of rows that JTable or JList scroll list? Will it keep scrolling for infinity.
How many items at a time can scrolling in Java handle?? For example if I have a JList or a JTable, what is the maximum number of rows that JTable or JList scroll list? This depends on the JComponent view. You can get and set the unit and block increments on either/both of the horizontal and vertical scrollBars of a JScrollPane. See the JScrollPane class api comments section which contains a link to the tutorial page "How to Use Scroll Panes" where you can get the details. Will it keep scrolling for infinity I'm not sure what you mean by this. It should scroll to the end of the content/view; to the bottom of the child JComponent.
The JList component uses the ListModel interface. This interface has method getSize() that has a return type of int,which means at most (2 to the power 32) of elements can the JList view. What I am looking for is that I want to be able to do is make the JLast be able to view more than that (2 to the power 64).
It's not 2^32, but 2^31 - 1 which is the largest possible value of an int. DefaultListModel has a private Vector member, and Vector has a protected Object member. I can't find anywhere in the API for Vector where it says there is a maximum size, nor does the JLS Arrays chapter mention a maximum size.
Hello, The DefaultListModel implements the ListModel interface. This interface represents the functionality of a list model. This interface has a getSize method, and this method returns an int data type.Which means any list can have at maximum (2 ^ 32 -1) of elements.What I am looking for is that I want a value greater than that, for example (2 ^ 64).
Which means any list can have at maximum (2 ^ 32 -1) of elements.
Does it? I have already told you there is no mention of a maximum size. Look at a related class, ArrayList. It says
Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list. It is always at least as large as the list size.
It doesn't say anything about maximum size. But have you bought your new big screen? Have you tried to add > 2^31 elements? Can you do it without an OutOfMemoryError? What do your friends say about somebody who tries that?
Look at the following code sample written by Hans Muller, the author of the JList class.
In the list model, the maximum number of elements it can have is about (2 ^ 32) / 2.Why is it that number. Because the get size method is int. The JList can deal with at maximum 2 ^ 32 /2. Why /2 because int is a signed data type, and half of those 2^32 will go for negative numbers.
What I want is I do want the ListModel to be able to handle elements more than that. For example 2 ^ 64.
Why I do want that??
Because I have been discussing with someone with in Java we can modify the JList that can handle more that this limit. For example 2 ^ 64.
Did you get my idea [ April 13, 2007: Message edited by: Khaled Mahmoud ]