Scrollbar in html component in lwuit java - 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)

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.

How to display content in a JTextArea or ScrollPane

I input into a text field "C". What should be displayed should be the next 10 letters that come after C. What I could do is convert all these letters into strings and then set the strings text to a JLabels text, but instead I want to be able to show them on a textArea with a scroll pane so that it doesn't run off the page and instead stays within a window I can scroll down from.
Is there any way to accomplish this? I have a TextArea fitted with a scroll pane setup, but I don't know how to output any data here.

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

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.

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).

Categories

Resources