JavaFX - Set the number of rows displayed - java

I use ComboBox, once put into a list (FXCollections.observableArrayList) with 2 short lines, then a list with a large number of rows.
After I change from the list with 2 to list with 15 (or more) - I see only 2 line each time inside ComboBox.
How do I change this setting? How display 4 or more?
Relevance code:
cbQueriesOptions.getItems().clear();
cbQueriesOptions.getItems().addAll(itemsQueriesOptionsString);
cbQueriesOptions.setVisible(true);
cbQueriesOptions.setDisable(true);
cbQueriesOptions.getItems().clear();
cbQueriesOptions.getItems().addAll(itemsQueriesOptionsAll);

Related

How to print multiple JTables to a single page when space is available

I have a java application with 2 JTable. The first table is made up of 2 columns and 5 rows always. The second JTable is made up of 4 columns and many columns.
I want to print JTable 1 above JTable 2, then continue to print the rest of JTable. How would I do this?
From a printable page perspective it would look as follows:
Page 1: Has the first table plus as much of the second table that can fit on it.
Page 2 to N: Has the rest of the second table.
I have an application that uses the Book Class to put together the 2 JTables and use a single print Job to print it. But each table starts on a new page. Which is not what I am looking for.
After reading the comments and a bit of research on my own it appears the best route is using Jasper Reports

Android java, take all values from list Between position N and N

I have an object list which can go up to a couple hundred, or even thousand items long. This list is displayed on the screen but I only would like to display the first 50 and when going to the next page it takes the next 50 from the list.. and so on.
Is there a way to take values from list Between startpoint N and endpoint N?
Sure- either use List.sublist() to get a subset of the list and pass that to the adapter, or use a custom adapter that only returns a subset of the main list via getView, getCount, etc. The first way is easier, but will take a bit more memory.

JList odd listing

I have a JList that gets filled up with values with a DefaultListModel.
By entering a name and pressing on a button it gets listed in the JLlist (vertical wrap).
But the odd thing is they get placed underneath each other properly (8 items).
But starting from 8 items suddenly al the items get listed right of it again (like shown below).
The JList itself is more then big enough, so what could be causing this most odd behaviour?
All the items below get stored in a list and are being added to the default list model.
1 9
2 10
3
4
5
6
7
8
But the proper output should be everything listed underneath each other.
Read the JList API and follow the link to the Swing tutorial on "How to Use Lists". There it will explain about the "setLayoutOrientation" method which supports 3 values:
Vertical
Vertical Wrap
Horizontal Wrap
You must have set this property somewhere in your code.

Better <h:selectManyCheckbox> layout?

I have a JSF page. At one point, I have a <h:selectManyCheckbox> that is displaying a number of items. The tag provides 2 attributes you can set to define whether the contents should be displayed horizontally or vertically. However, with more than a few items both choices look bad. Go with horizontal, and everything ends up bunched up. Go with vertical, and you can make your page unnecessarily long. Is there any way to get the best of both worlds? Specify that there should be x number of columns, for example? Say I have 20 items and I'd like 4 columns. If that number grew to 100, I'd still want only 4 columns. The list would then grow vertically.
Is this possible?
Use Tomahawk's t:selectManyCheckbox instead. It has a layoutWidth attribute exactly for this purpose.
There is no such tag rich:selectManyCheckbox only h:selectManyCheckbox

How to set JtextArea to keep fixed no of rows?

How can i keep no of rows constant in text area.
I need to create a console window for my application.
If rows exceeds predefined no of rows first rows must get disposed.
As if first written row will be destroyed first when i append anything which exceeds no of rows set.
One more thing , i need to keep vertical scroll bar. That means no of rows must not be the whatever rows are visible when text area it opened.
For example : - no of visible rows on view port are 30.
It should keep 120 rows information, which will can be seen with the help of scroll bar.
Sounds like what you want to do is create your own Document implementation. See Document.
The Message Console shows one way.

Categories

Resources