Vaadin Component Alignent - java

I have 3 text fields in vertical layout and
I want to place a button at the right of the 3rd text field in HorizontalLayout,
but what happens is the button is placed in alignment with a caption of the text field.
How I solved this issue in Vaadin 8?

Assuming you want the button to align with the box of the TextField (rather than the caption of the field), and the two components are in the same Horizontal Layout, you can use the following:
buttonName.getElement().getStyle().set("margin-top", "auto");

You can use com.vaadin.ui.Alignment for basic alignment needs within ordered layouts. For example:
horizontalLayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT);
The default alignment is TOP_LEFT.

Related

GWT vertical align labels and textboxes in java code

I am trying to vertically align a label and 2 text boxes. I tried to use a horizontal panel, a grid and a flex table, but none of them seems to perfectly align the text. Do you have any suggestions?
You can use .setVerticalAlignment(HasVerticalAlignment.TOP); in HorizontalPanel, but according to the documentation this property affects only widgets that have been added after this property has been set.
If you only support modern browsers, a better solution is to use Flexbox layout model.
You can simply try it with Vertical panel to add widgets like label and textBox.
this can be useful to you, http://www.tutorialspoint.com/gwt/gwt_verticalpanel_widget.htm

FormLayout caption TextField on top?

There's some way to set captions on the top of TextField using FormLayout on vaadin7 ?
I think that default caption is only the left but I need change that.
Any idea ?
thanks
FormLayout always puts captions left of the field. Moreover it has also a column for the error indicator. Other layouts such as VerticalLayout or HorizontalLayout put the caption above the field.
If you want to control the position of your caption you could
deal with labels
use a CustomLayout

Insert ICON/PNG inside TextArea

Without resorting to wrapping a GWT TextArea in a separate DIV, how to add a search icon/magnifier icon inside the text area?
No, Not possible.Text area is not a normal Widget.
GWT's TextArea maps directly to a HTML TextArea thats why you can only set text to it. The only thing you can do ist create a Grid/VerticalPanel/HorizontalPanel and put in each cell a separate TextArea.
Google Groups
Similar Question
Use a Composite wrapping a FlowPanel, put a text area and an image inside, then in CSS position the icon absolutely so it's over the text field.

Display text over the icon in JXLabel

I'm using SwingX label for a image select/preview.
I need to show both text and icon together but when I set icon the text disappear!
How can I show text over the icon on a JXLabel?
Thanks
there no issue with that, there are two ways
1.correct way (implemented in the API, good habits, blablabla)
JLabel.setHorizontalTextPosition(JLabel.CENTER);
// search for equivalent in SwingX
2.crazy way to set proper LayoutManager for JXLabel and put there another JXLabel to the desired coordinates Location

Scrollbar in html component in lwuit java

I want to create chat window with textarea and textbox in lwuit. Textarea must capable to show smiley and coloring text. I have used HtmlComponent of lwuit and facing problem in scrollbar. As text content grows in size, whole screen scroll including textbox. I want only content of textarea to be scrolled.
How to solve it?
well, you can forbid scrolling for the whole form using
Form.setScrollable(false).
Then you just set your HTMLcomponent scrollable "true" with the same method and finally put these two components (TextArea and HTMLComponent) to a different cosntraints (e.g. TextArea in BorderLayout.NORTH and HTMLComponent in BorderLayout.CENTER)

Categories

Resources