Menus with multiple item-columns javaFX 8 - menu

My goals is to create a menu with multiple columns. I went about this by using GridPane, to which I added Labels. Then I inserted the GridPane in a PopOver. I also added action listeners to Labels So when the users click on a cell, I can do a certain action. My current implementation is based on a button. Once clicked, the PopOver will show up.
As an example, font names:
Is there a way to have this in a menu?
I tried making the MyGridPane class that extends MenuItem. It allows me to add the GridPane to the menu, but it only comes in as an ObjectID. If I want it visually, the only way I found was to
menuItem.setGraphic()
But this make the whole GridPane one item. The cells and their action listeners get ignored.
Is there a way to add a grid pane as a menu item?

Is there a way to add a grid pane as a menu item?
Yes, you can try as
CustomMenuItem menuItem = new CustomMenuItem(gridPane);
menuItem.setHideOnClick(false);
To visually disable the highlight color for that menu/menuitem, customize the related CSS selectors of menu/menuitem.

Related

How to display several photos in another layout by clicking on one layout?

When I'm in layout 5 and I click on a button, I want to make some images visible in layout 4. I also used the general boolean method but it didn't work, do you have a solution?

Is it possible to include ListActivity with own layout in another layout?

Here at "6. Exercise: ListActivity with own layout" is the custom list that I want to include in another layout. Is it possible?
The reason why I need this is to make layout that has header, (this) custom list and button. If I make textview or button in that rowlayout.xml, they got repeated in every list item.
Any suggestions?

Add fixed positioned Combobox inside FlowPane

I have a FlowPane which will hold many panels which are based on BorderPane.
I want to create ComboBox which will be used to filter the Panels by type. And the panels will be scrolled by ScrollPanewhen they exceed the visible area.
I want the combo box to scroll along with the FlowPane inside the ScrollPane. I want to get the result which is displayed into the picture. Can you tell me how I can get the desired result. I can very easy create BorderPanes and insert them into the FlowPane and the challenge is how to position the Combo Box and keep it always at this position.
Why don't you simply use another border pane?
Add your combobox to the top ( or additional flow pane with combobox on
it)
Add your Flowpane to the Center
Then scroll the whole border pane using the scrollpane?
What could be simpler?
Here's how you'd do it:
StackPane with 2 layers:
layer1: your ComboBox panel.
layer2: your ScrollPane with your FlowPane inside*.
*The trick is: just make your combobox panel background opaque, and some initial top inset on the flowpane so that it starts at the right place.

Bring a programmatically selected Item to the visible area in a JSF selectOneListbox

I want to programmatically select an item in JSF selectOneListbox. As there are large number of items and the height is restricted, most of the items are hidden. If I move the slider up and down, I can see the selection, but not other vice. Is there any way to bring the selection to the visible area, like in a Top in VB Listbox?
I used h:selectOneMenu so that selected one is always visible.

LWUIT: tabs - how to mark the currently selected tab

I have 4 tabs. Each tab is represented by a button. Those buttons are used to select the currently displayed tab. Each button has an icon and text.
I'd like to highlight the currently selected tab by changing background color and text label color of the corresponding button. I'd like to do it using Theme and Resource Editor.
I created theme and specified unselected, selected and pressed styles for UIID "Tab". My tabs look great in Sun WTK! Fine! But I found that on a real phone the tabs always look like unselected. I tried on Nokia 5800 XPressMusic and C7. Why the difference?
After some experiments I found out the reason - the buttons may be only in 2 states: unselected and pressed. They never be in the selected state. On the emulator when I move to a button using navi keys, it becomes selected.
So, what should I do to mark the current tab?
You can use a few different approaches especially in 1.5.
LWUIT 1.5 has a Tabs component which pretty much does everything for you and is remarkably flexible.
It uses radio buttons on which the method setToggleButton(true) is invoked. Toggle buttons act like radio buttons so when you press a button in the group it stays pressed and is rendered using the ToggleButton style (you can set the UIID to whatever you want). See a sample of using toggle buttons in the font demo portion of LWUIT demo.
An option that will work for older versions of LWUIT is to just set the UIID of the button to a different value when it is pressed (and restore the UIID of the previously selected button to the original value).
I implemented what I needed. Thanks to Shai and his example.
I didn't use theme properties and made all customizations in the code. I did so because I didn't catch how setting unique UIID can help me, since the problem is not in the identifying the UIID for which the props have to be changed, but in identifying the button's style to be changed.
Below some important notes of my solution.
Call addActionListener for the buttons AFTER they have added to the tabs.
When any tab button is pressed, update UNSELECTED styles of the tab buttons. Also you can change their icons.
Call form's repaint() after step 2.

Resources