Vaadin horizontal layout - layout

I have horizontal layout with 4 components : combobox, textField1 , textField2 and checkbox. Based on checkbox textField2 is displayed or not. When checkbox is set to false then textField2 is not visible. How to prevent textField1 from expanding? I would like to have fixed position for components.. if checkbox or textField2 is not displayed others remaining in page would still look the same.So prevent from expanding to remaining space for component with horizontal layout.

The simplest way would be to put the field you want to hide inside another layout that has a fixed size and remains visible. Something like this:
VerticalLayout textField2Layout = new VerticalLayout(textField2);
textField2Layout.setWidth("200px");
VerticalLayout verticalLayout = new VerticalLayout(combobox,textField1,textField2Layout,checkbox);

Related

How to make recyclerview width larger than the layout width?

I want to make the width of a recyclerView wider than the width of the layout itself so that only a part of the items of the recyclerView could be seen until the user scroll to the left.
I think an image can explain it better:
Each item of the recyclerView have 5 textViews like this:
And I want to see only 4 of them until the user scrolls to the left like this:
After scrolling, the first textView shouldn't be seen until the user scrolls to the right.
How can I accomplish that? Should I change the item layout to be larger than the screen or the recyclerView?
You must be looking for something like this.
Embed the RecyclerView (nestedScrollingEnabled=false) inside a Horizontal Scrollview
List item for Recyclerview should have the width set to wrap_content
You can checkout this project on Github

Menus with multiple item-columns javaFX 8

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.

How to animate TextView

I have a custom class extending TextView (I used this trick to set my custom font).
I've a ListView and its elements are represented with my custom TextView.
Sometimes happens that the text is too long to fit and it starts a new line. I want to avoid this, so i set android:singleLine=true in the XML of my element layout.
I want to know if it's possible to animate the TextView of an element of the list, so that if such element is selected, it first scrolls its text to the left, till it reaches the end of the text, then scroll back to the right till the beginning.
I tried with marquee but it looks like it can only move in one direction and it's not what i want.

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.

Adding a scroll bar to a label

I have a label on a userForm and the data within it is in list form. The data is longer than the label. Without expanding the label, is there a way to add a scroll bar to it? Or is there another option? Basically I want a box that does not have a scroll bar unless the list is longer than the box, then there's a scroll bar.
Using Excel vba userForm
You can used a textbox styled to look like a label. Set it to multiline with scrollbars set to vertical. Scrollbars will only show up if the content exceeds the size.
You can't have scroll bar for label, instead a textbox can be used.
Set textbox with "Enabled" and "Locked" properties as"true". User will then have a scrollable and noneditable view
For vertical scrolling, set "WordWrap" and "MultiLine" to True
Now you could view the scroll bar on tapping the textbox. If you want the scroll bar to be visible by default, on the form load event we need to set the focus of textbox as below:
Private Sub UserForm_Initialize()
errorText.SetFocus
End Sub

Resources