I have a textarea inside a tabsheet, that is inside a splitepanel. My problem is that the textarea not fills the hole space in tabsheet. I have set all component with a height of 100%...but it doesn't work :(
Here is a screenshot of the tab
Thanks for help!
I can't see your HTML/CSS from here, but usually Vaadin adds some divs around elements - in this case, the text area - Try to inspect that parent(s) element of the text area and there has to be one of them that needs a 100%
Related
I got a Accordion embedded into a normal Panel. The Accordion size is half the current screen size.
Now if I add content (tab) to the Accordion, the Accordion itself contains a caption followed by the content and I can see the content clearly.
If I add more than, say about 30 tabs, I can only see the caption, cause it takes also space from the Accordion.
Now my question is, how can I set the tabs content size, that I always can see the content or is it possible to show the scrollbar of the underlying Panel, cause it is not showing up.
EDIT
Here is a screenshot of many tabs added to the accordion:
I can not scroll an if I click onto an item, it won't expand.
I solved it by using a TabSheet. It is not the best solution, but okay for me. Here is the reported bug link: https://dev.vaadin.com/ticket/18219
I'm trying to make a marquee like effect in my program, the text is determined by the content of a file which will result a dynamic lenght/width for JLabel, and the problems are:
I use drag n drop and GroupLayout since it will auto resize the component, but it doesn't allow me to use setBounds nor the setLocation method.
I tried to change it to null layout, yes I can use the setBounds or the setLocation, and now the problem is that the JLabel cannot auto resize its width to fit the text length.
My marquee text would goes from right to the left screen, and will do the run 2 times.
Any suggestion here? Thanks :)
On my page I have a panel which is hidden by default. I can show it via myPanel.setVisible(true) when necessary. After this the height of the window is increased and the window scrollbar appears.
The problem is that the window is not scrolled to the bottom automatically, which is a desired behaviour. How can I fix it? I just want to scroll my page to the bottom.
I know Window.scrollTo (LEFT, TOP) can help me. But the problem is that I dont know how can I calculate the height of the page relative to the top - the second parameter I need to provide to this method. I really tried numerous ways:
Window.getClientHeight();
Document.get().getScrollHeight();
Document.get().getBody().getOffsetHeight();
Document.get().getBody().getAbsoluteBottom();
First two of them do not change their value after the hidden panel becomes visible. The second pair gives me 0 and 8 (???) values.
So how can I solve my issue?
ps
If the situation is a bit different and I have a div with a scrollbars, not the window scrollbars, is it possible to scroll it to the bottom programmatically?
You can use setVerticalScrollPostion API and set the position of the scroll
Is it simple Panel or some subclass of it.
In any case, try first with:
int top = myPanel.getAbsoluteTop();
and then scroll to some value aggregated with top.
From API:
public int getAbsoluteTop()
Gets the object's absolute top position in pixels, as measured from the browser window's client area.
For scrolling down the document, you should use the scrollTo method in Window object, i.e.:
Window.scrollTo(0, Window.getScrollTop() + Window.getClientHeight());
You actually do not need to know the size of the page to scroll to it's bottom. Just use
Window.scrollTo(0, Integer.MAX_VALUE);
At least this always worked for me.
If you want , you can create a widget handle with an id.
For example : widget.getElement().setId("scrollPanel");
Then you can scroll the view on the widget with Document.get().getElementById("scrollPanelFooter").scrollIntoView();
It's simpler!
I used textarea in javafx 2.0 but i need to add it scrolpane.how can i do that?
Scrolllpane s = new Scrollpane();
s.setnode(textarea);
but when i click on scroll pnane it has doesn't move.
what is problem?
setNode() is the right method to call to set the node that the ScrollPane will scroll over. I've used ScrollPane extensively in my 2.0 app, but I have not tried it on Text Area. Based on the API documentation for TextArea (http://download.oracle.com/javafx/2.0/api/com/javafx/preview/control/TextArea.html) it sounds like it has its own built in scroll bars? I would try setting the width/height of the TextArea, and also set the max width/height, and see if you can trigger scrollbars to appear automatically when the lines in the text area exceed the available space.
If you still want to put it in a ScrollPane, perhaps with some other nodes, you should use a container node such as VBox or something to wrap the TextArea, then set the VBox to be your scroll node on ScrollPane.
Also, bear in mind that TextArea is not a committed control for FX 2.0 yet and is therefore less hardened than the other FX controls.
When we create a text area, scroll bar automatically appears when it goes beyond t
I have TextArea in my Java app and I append lot off text rows. I need to ScrollPane to scroll to last appended ( to bottom of TextArea ). How I can do that ?
You could do that by moving the caret position to the bottom, this would automatically scroll the TextArea:
textArea.setCaretPosition(textArea.getDocument().getLength());
Text Area Scrolling explains how scrolling works in a little more detail and provides an alternative solution which may be easier.
If you scroll to the middle of the page where it talks about the policy, you should find what your trying to achieve: http://download.oracle.com/javase/tutorial/uiswing/components/scrollpane.html
As Amjad Masad already said, you need to set the caret position to the last position of the document after inserting your text.
I want to add following note: if you use the JTextArea as some kind of output log (AKA a working thread fills it continually), I only would set the caret position at the end of the document, if the current caret position is already at the end (before the insertion). This allows the user to click somewhere inside the text and read it without having the application automatically scroll down. If the user wants to see the latest and greatest, well, then (s)he has to press Ctrl+Down to put the caret at the end of the document.
You should check, if you are on the EDT, when you call the append. If you are outside of the EDT when calling append, the JTextArea does not scroll to the last appended line (see my post with a runnable example at: JScrollPane scroll at last added line).