JavaFX ComboBox shows scrollbars on first click - java

I'm doing a program in JavaFX with ComboBoxes, and loading a FXML for the layout.
When I click for the first time in a ComboBox with few items (only two, for example), the scrollbar is shown at the right side. After I open it again, the scrollbar doesn't appear anymore.
I tried some solutions. One that worked is to apply a CSS directly in the FXML, which sets the cell size to a fixed value. But a solution inside the code (for example, in the initialize function in the controller) would be better for my case.
Thanks for any help.

This problem seems to be fixed in recent JDK versions, see https://bugs.openjdk.java.net/browse/JDK-8095019

If the options would stay fixed I would suggest using ChoiceBox instead of ComboBox. It is basically the same, but without the scrollable option. If you insist using ComboBox you can try combobox.setVisibleRowCount()

Related

Remove Scrollbar from ComboBox JavaFX

I want to remove the scrollbar from the combobox and hence increase the height of the combobox when it is open. Meaning, i want to see all the items without scrolling.
Thanks!
If you don't want scrolling and the list options will remain few in number and relatively constant, you might actually want the ChoiceBox UI element. It has relatively the same function as the ComboBox without the scrolling capability.
...
choice boxes, the UI controls that provide support for quickly selecting between a few options.
Check out the Oracle docs on how to use them -- it's very similar to the ComboBox.

JavaFX 2.2 Remove Pagination's selected page label

I want to remove the Selected page label (see image below) of the Pagination control.
After digging into caspian.css I wasn't able to find any clue about how to do that. By code I also didn't find any method to remove (or eventually hide) this label.
Is there a way to do that in JavaFX without re-implementing the whole control ?
Use -fx-page-information-visible
It's described within these links:
http://docs.oracle.com/javafx/2/ui_controls/pagination.htm
https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/pagination.htm#JFXUI459
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#pagination
I couldn't find a way either to hide just the label, but would it help to hide the whole button?
.number-button:selected{
-fx-opacity: 0;
}
That would hide the current selected button.
It's not what you actually wanted but maybe it can help you.

float checkboxes on expand in Swing

I've made a simple GUI with 2 lines of checkboxes. The checkboxes are all the same size. When I maximize the application, they are anchored on the left so it looks a bit out of place.
I would like to have the checkboxes slowly move to the first line if there is space. Similar to the way 'float' works in CSS (on websites).
Does Swing have this type of functionality?
Check out Wrap Layout which works in many cases.
Similar to the way 'float' works in CSS (on websites).
Look to FlowLayout for that effect.

Ext Gwt setVisible results in disappearing fields

I'm having an issue where I have 4 form fields in a fieldset. If certain conditions are met, I use setVisible(true/false) to hide or show the fieldset.
I'm running into a problem where I originally hide a fieldset, but when I make it appear, it doesn't display the labels and textfield boxes.
If I do it in reverse, where I show the fieldset, then hide it later, I have no problem switching between the views and having it show up properly.
I use an HBoxLayout for the fieldset. I'm wondering if it's the layout that could potentially be causing the problem or maybe it's the rendering order?
Does anyone have a workaround or solution?
Thanks.
The workaround I found was removing and adding the fields again. It's still not identical, the fields seem to be pushed over a bit from the left side, but it at least shows up again.

Set number of options shown in JComboBox when used as JTable RowFilter

I'm trying to set the number of options shown in the JComboBox drop down list when it is used as a JTable RowFilter. Specifically, the filter on occasion can have many options and I'd like to show twice as many as the default (which appears to be 8). See this image:
Combox Box Example http://aalto.tv/test/combobox-image.png
As you can hopefully see, this ComboBox only shows 8 items and I would like to show more if there are more to be seen.
Having searched around the popular solution is to call "setMaximumRowCount" on the JComboBox, however this is having no effect.
Can any one point me in the right direction?
Many thanks for any and all help!
Cheers,
Alex
try the revalidate() (or repaint()) method after setting the rowcount;
if a setXX method does not generate an event to the component, then you have to manually reset it.
failing that, look at the source code of the setMaximumRowCount() method
JComboBox#setMaximumRowCount works for JTable / TableHeader and AutoComplete JComboBox in the JTable too

Categories

Resources