FormLayout caption TextField on top? - java

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

Related

Vaadin Component Alignent

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.

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

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

NetBeans: How to select JLabel that resides inside JFrame?

I developed a small desktop application in Java. At some position in my UI I drag and drop a JLabel from Palette to JFrame. Later-on i remove its text by right click -> Edit Text. I did this because i am populating this label dynamically using setText() method. Now i need to reposition this Label, for this i first have to select that label and then drag n drop it to new location. But i am unable to do so because there is no text in that label and hence its not visible :(
Is there any way through which i select this label?
The easiest way is add a few spaces to a label instead of an empty string. You may also put a label inside a panel with layout like Flow or Grid (where you can set margin) and drag the panel instead. If you're using layout like Free Design, Absolute or Null, you may also manually rescale the label (selecting it through Inspector view).

Toggle JToggleButton without clicking it, and unsetting styles

I have a few toggle buttons to add styling to text in the form of:
JToggleButton boldButton = new JToggleButton("Bold");
boldButton.addActionListener(new StyledEditorKit.BoldAction());
boldButton.setFocusable(false);
and I also have various styling functions (color, left/right/center align, etc.). What I'm wanting to do is when I call a function (in this case, I'm wanting to basically make a new document) the toggle button is toggled to the off state, and all styling returns to default.
Currently I just set the frame name to untitled (previously the name of the document I was working with), and set the pane text to "", but this keeps all of the styling I had set in the previous document. Is there a better way to do it?
Thanks
boldButton.setSelected(false)
should be all you need.

Categories

Resources