Problem: scrollbar textarea

Hi! I have the following problem: I want to add text to JTextArea box and I had created a scrollpane with vertical scroll bar. Also, I have a combobox. When I select one option of combo, it adds a brief explication about this option. When it adds this explication to Textarea, the scrollbar down and I want that the scrollbar up.
El codigo es este:
jTextAreaInfo.setLineWrap(true);
jTextAreaInfo.setWrapStyleWord(true);
jTextAreaInfo.setBounds(new Rectangle(10, 135, 335, 200));
jTextAreaInfo.setEditable(false);
scrollPaneInfo.setBounds(new Rectangle(10, 135, 355, 195));
scrollPaneInfo.getViewport().add(jTextAreaInfo, null);
scrollPaneInfo.setVerticalScrollBarPolicy(scrollPaneInfo.
VERTICAL_SCROLLBAR_ALWAYS);
//scrollPaneInfo.getVerticalScrollBar().scrollRectToVisible(new Rectangle(10, 135, 355, 195));
//scrollPaneInfo.scrollRectToVisible(new Rectangle(0, 0, 0, 0));
scrollPaneInfo.getVerticalScrollBar().scrollRectToVisible(new Rectangle(0, 0, 0, 0));
scrollPaneInfo.getVerticalScrollBar().setAlignmentY(0);
scrollPaneInfo.getVerticalScrollBar().setAlignmentX(0);
scrollPaneInfo.getVerticalScrollBar().updateUI();
Do I have to try to use the function scrollRectToVisible ???? What are the dimensions of the rectangle????? (0,0,0,0) ???
Thanks!!

May be you have to create a resizable text area.
http://idletogether.com/automatically-resize-texttextarea-based-on-content-autosize-in-fle x/
http://www.flexer.info/2009/02/06/auto-resizable-text-area-component/

Similar Messages

  • Hello, I got a problem with TextArea() used in iPAQ

    I'm developing a Java application in iPAQ by using JDK 1.1.8 in desktop PC and Java personal runtime 1.x in iPAQ. The TextArea() cannot work in iPAQ, just a narrow box and I can't change the width. Please help, thanks!

    import java.awt.*;
    import java.awt.event.*;
    public class TutorFrame extends Frame implements ActionListener
         TextArea tutorDisplay;
         Panel tutorPanel;
         createTutArea();
         add(tutorPanel);
         setVisible(true);
         validate();
         public void createTutArea()
              tutorPanel=new Panel();
              tutorPanel.setLayout(new FlowLayout());
         /* Create a text area with 10 rows and 25 columns */
              tutorDisplay = new TextArea(10, 25);
         /* Make it impossible to edit the text area */
              tutorDisplay.setEditable(false);
              tutorPanel.add(tutorDisplay);

  • Html5 animation problem, scrollbar

    Hi everyone!
    I need help in something, i made a webpage, and insert a animation made in flash but transformed into a html5, then i put it in some of the pages like "nosotros" "comtacto" of the webpage inserting a html, when I export it to the web the vertical scrollbars dissapear, but if I delete the animation, the scrollbar appears....
    I dont know how can i fix please helpme, here is the page http://hydro04.businesscatalyst.com/contacto.html
    Please I hope you will hellps me,

    Hi
    I checked the link and I don't see vertical scroll bar on page with animation.
    This can happen if html inserted stretches the page length due to which on view in browser will add a scroll to page as the length is increased.
    You can try to size the html content in code itself which you are inserting and then check.
    Thanks,
    Sanjit

  • ScrollPane problem - scrollbars not updated after child rescaling

    Hi.
    Here is a simple application using a ScrollPane to display a large circle. Initially everything looks fine but when you use zoom in and zoom out buttons ScrollPane doesn't update the scrollbars. Scrollbars are only updated after you try to scroll. Even worse - if you zoom out a couple of times, scrollbars dissapear. If you then zoom in again scrollbars will only reappear if you resize the stage main window.
    Is there something else I should do in addition to rescaling the circle node?
    Thanks for your help.
    package test2;
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ScrollPane;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.HBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Circle;
    import javafx.scene.transform.Scale;
    import javafx.stage.Stage;
    public class App2 extends Application {
         @Override
         public void start(Stage stage) throws Exception {
              final Scale scale = new Scale(1,1);
              final Circle circle = new Circle(100,100,500, Color.BLUEVIOLET);
              BorderPane border = new BorderPane();
              ScrollPane scroll = new ScrollPane();
              circle.getTransforms().add(scale);
              scroll.setNode(circle);
              Button zoomin = new Button("+");
              Button zoomout = new Button("-");
              zoomin.onActionProperty().set(new EventHandler<ActionEvent>() {
                   @Override
                   public void handle(ActionEvent arg0) {
                        scale.setX(scale.getX()*2);
                        scale.setY(scale.getY()*2);
              zoomout.onActionProperty().set(new EventHandler<ActionEvent>() {
                   @Override
                   public void handle(ActionEvent arg0) {
                        scale.setX(scale.getX()/2);
                        scale.setY(scale.getY()/2);
              HBox top = new HBox(5);          
              top.getChildren().addAll(zoomin, zoomout);
              border.setTop(top);
              border.setCenter(scroll);
              Scene s = new Scene(border,500,500);
              stage.setScene(s);
              stage.setVisible(true);
        public static void main(String[] args) {
            Application.launch(args);
    }

    Hi,
    see this thread maybe you find something helpful.
    javafx.scene.Group "auto-size" doesn't work in my case

  • Cfdocument problem with textarea linebreaks

    Hi,
    I am using cfdocument to generate pdf. There are some
    <textarea> input type fields as well, and if the data of
    those textarea fields contains any linebreaks, then the generated
    pdf shows empty boxes.
    Any help is appriciated. I am using CF 8.1.31

    before you use the textarea's value in cfdocument, replace
    all CR & LF
    characters with <br />.
    there are couple of cf functions you can use to do it:
    replace(somestring, chr(10) & chr(13), "<br />",
    "all")
    rereplace(somestring, "\r\n", "<br />", "all")
    listchangedelims(somestring, "<br />", chr(10) &
    chr(13))
    [cf representation of CR and LF chars is chr(10) and chr(13);
    \r and \n
    are regexp character classes for CR and LF]
    hth
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Problem with TextArea - AWT

    Hello,
    I'm working with JRE1.5, and I have an applet with a TextArea component and some buttons. Each button has to insert a specific tag in the TextArea. Well, when I write some lines in the TextArea and push a button, the insertion doesn't work fine, it is done in an incorrect position.
    I know that this was a bug reported, but I've read that it was already fixed in version 1.4.2.
    Does someone know if Sun has fixed the bug in version 1.5?
    Regards.

    Could you show a snippet of code so we can see how it's being inserted?

  • Font Problem in Textarea

    hello
    Pl tell me hw to set Tamil Fonts in AWT TextArea comp.
    thanx
    rafik

    Have a look at this tut...
    http://www.xencraft.com/training/webstandards.html

  • Textarea problem with jsp

    How can i set the value of a textarea retrieved from a MySQL database?
    I tried using this but didn't work:
    <textarea rows="5" cols="40" name="description" value="<%=ei_res1.getString("description")%>"></textarea>
    After this code is run, the value is seen in the source but not seen in the textarea itself.
    Thanks
    Anzel

    Realize esta JSP y la probe funciona, la soluci�n a tu problema es similar a esto...
    <html>
    <BODY>
    <%@ page language="java" buffer="16k"%>
    <%! String test=new String("5"); %>
    <textarea rows="5" cols="40" name="description" value="<%=test %>">
    </textarea>
    </BODY>
    </html>
    ------tu problema, solucionado -----
    <textarea rows="5" cols="40" name="description" value="<%=ei_res1.getString("description")%>">
    </textarea>

  • TextArea and CSS error

    Hello!
    I have a problem with TextArea and CSS. When i'm trying to
    attach css to TextArea instance flash returns error:
    Error: Error #2009: This method cannot be used on a text
    field with a style sheet.
    at flash.text::TextField/setTextFormat()
    at
    fl.controls::TextArea/fl.controls:TextArea::drawTextFormat()
    at fl.controls::TextArea/fl.controls:TextArea::draw()
    at fl.core::UIComponent/::callLaterDispatcher()
    full code of package:

    I've been searching all over the web. This almost has to be a
    bug. But I found a workaround that isn't terrible.
    label.textField.styleSheet = sheet;
    label.textField.htmlText = "<body><p><span
    class='heading'>Hello </span><a
    href='event:'>World...</a></p><p>1</p><p>2</p></body>";
    label.verticalScrollPolicy = ScrollPolicy.AUTO;
    Basically you load the text and the css into the textField. I
    haven't gotten it to work in any other combination. Then you have
    to basically reset the scrollbar to check the content again. It's
    only one line of code and I spent about a day figuring this out so
    I hope it helps someone. And if anyone knows why this is the way it
    is I'd love to hear it.
    Eric Snowden
    http://www.ericpaulsnowden.com

  • How can I hide the scroll bar in TextArea?

    How can I hide the scroll bar in TextArea?

    Hi. To remove the horizontal scrollbar you can do this:
    textArea.setWrapText(true);
    To remove the vertical scrollbar you can do this:
    ScrollBar scrollBarv = (ScrollBar)ta.lookup(".scroll-bar:vertical");
    scrollBarv.setDisable(true);  and set the opacity to 0 in the css file:
    //css file
    .text-area .scroll-bar:vertical:disabled {
        -fx-opacity: 0;
    }Here is an example:
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ContextMenu;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.ScrollBar;
    import javafx.scene.control.TextArea;
    import javafx.scene.input.ContextMenuEvent;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class TextAreaSample extends Application {
        @Override
        public void start(Stage primaryStage) {
        final TextArea textArea = new TextArea();
            textArea.setWrapText(true);
            StackPane root = new StackPane();
            root.getChildren().add(textArea);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setScene(scene);
            primaryStage.show();
            scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
            ScrollBar scrollBarv = (ScrollBar)textArea.lookup(".scroll-bar:vertical");
            scrollBarv.setDisable(true);
        public static void main(String[] args) {
            launch(args);
    }

  • Not getting right string format from textarea

    hello
    i am asking this question again sorry but i am facing another issue?
    actually i am not getting right text from textarea
    when i type in textarea in language other than english and run it prints text of text area it prints ? marks so i think its problem with textarea?
    my code is like below
    try {
                //  System.out.println(FacesContext.getCurrentInstance().getExternalContext().getResponseCharacterEncoding());
                  FacesContext.getCurrentInstance().getExternalContext().setResponseCharacterEncoding("UTF-8");
                  FacesContext.getCurrentInstance().getExternalContext().setRequestCharacterEncoding("UTF-8");
                  System.out.println(FacesContext.getCurrentInstance().getExternalContext().getResponseCharacterEncoding());
                String txt = (String) textArea1.getText();
                System.out.println(txt);
                            String suffix = ".txt";
                String prefix = "textfile";
                File ff = new File("d:/newsevents" );
                File tmpFile = File.createTempFile(prefix, suffix, ff);
                //tmpFile.
                Textfilename = tmpFile.getName();
                FileOutputStream fout = new FileOutputStream(tmpFile);
                if (textArea1.getText() != null) {
                    String s = (String) textArea1.getText();
                    fout.write(s.getBytes());
                fout.close();
            } catch (Exception ex) {
                System.out.println(ex);
            }any solution for that?

    Please read on about charset encodings carefully.
    This article is very helpful in this: [http://www.joelonsoftware.com/articles/Unicode.html].
    There are at least 2 points where your code fails:
    1) You used FileOutputStream rather than FileWriter to write characters into a text file.
    2) You assumed the characters being encoded in the platform's default charset and used [String#getBytes()|http://java.sun.com/javase/6/docs/api/java/lang/String.html#getBytes()] rather than specifying the right charset name or Charset.
    This specific problem has completely nothing to do with JSF.

  • Help printing textarea

    Hello,
    I have problem printing textarea when sending it to print job and here my code:
    <mx:TextArea id="mainTextField" styleName="letterTextArea" wordWrap="true" x="46" y="38" width="666" height="389" horizontalScrollPolicy="off"/>
    private function printLetter():void
                    var printJob:PrintJob = new PrintJob();
                    printJob.copies = 1;
                    printJob.orientation = PrintJobOrientation.PORTRAIT;
                    //var rect:Rectangle = new Rectangle(0,0,800,600);
                    printJob.start();
                    try
                        printJob.addPage(mainTextField);
                        printJob.send();
                    catch(err:Error)
                        //Alert.show("Error printing letter: "+err);
    ...the only printed in the printer is the visible part of textarea. How can I print the entire text? any idea?
    thanks a lot.
    cheers.

    I finally got it to work like this:
    var tmpBox:Text = new Text();
                    tmpBox.setStyle("paddingTop",50);
                    tmpBox.setStyle("paddingLeft",50);
                    tmpBox.setStyle("paddingRight",50);
                    addChild(tmpBox);
                    tmpBox.width = printJob.pageWidth;
                    tmpBox.height = printJob.pageHeight;
                    tmpBox.text = mainTextField.text;
    the problem is there is always a blue/light blue backgrounnd. how can remove that background? i already use css but no luck at all...any idea on how to do this?
    thanks a lot.
    cheers.

  • Skinning TextArea

    I'm trying to make a scrollable text area, and it needs to
    look exactly like the Java equivalent (don't ask...). One method
    I'm looking at is taking screenshots of the Java version and using
    the images to make a skin. I've figured out how to skin a button,
    so I could make my own TextArea from scratch and make my own
    scrollbar with it's own buttons, etc...
    But it would be much easier if I could just extend TextArea
    and manually override the images used for the arrow buttons, and
    the slider, etc... Is this possible? I can't seem to find the names
    of said objects in the API (i.e. if I extended TextArea, could I
    refer specifically to the down-arrow button? And would it be an
    object of type button?)

    You can use TextArea's "verticalScrollBarStyleName" to
    control the look of its scrollbar:
    .textArea{
    vertical-scroll-bar-style-name:'textAreaVerticalScrollBar';
    .textAreaVerticalScrollBar{
    downArrowSkin:SomeSkin.png;
    upArrowSkin:ClassReference("path.to.your.programmaticSkin");
    thumbSkin:some other skin...
    etc...

  • How can I hide the java script status bar?

    I'm trying to hide the status bar using the feature in the advanced section of enable java script. I did a search in the help window of Firefox 5.0 and it shows the area in options to do this. I followed the instructions but the feature in my advanced area does not offer this selection. I'm trying to accomplish this in order to follow the recommendations of Pogo to enhance game playing experience.

    Hi. To remove the horizontal scrollbar you can do this:
    textArea.setWrapText(true);
    To remove the vertical scrollbar you can do this:
    ScrollBar scrollBarv = (ScrollBar)ta.lookup(".scroll-bar:vertical");
    scrollBarv.setDisable(true);  and set the opacity to 0 in the css file:
    //css file
    .text-area .scroll-bar:vertical:disabled {
        -fx-opacity: 0;
    }Here is an example:
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ContextMenu;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.ScrollBar;
    import javafx.scene.control.TextArea;
    import javafx.scene.input.ContextMenuEvent;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class TextAreaSample extends Application {
        @Override
        public void start(Stage primaryStage) {
        final TextArea textArea = new TextArea();
            textArea.setWrapText(true);
            StackPane root = new StackPane();
            root.getChildren().add(textArea);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setScene(scene);
            primaryStage.show();
            scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
            ScrollBar scrollBarv = (ScrollBar)textArea.lookup(".scroll-bar:vertical");
            scrollBarv.setDisable(true);
        public static void main(String[] args) {
            launch(args);
    }

  • HtmlText & XML.prettyPrinting/ignoreWhitespace issue

    i have a module that has a tree component, a advanceddatagrid and a textarea.
    you select an item from the tree to populate the advanceddatagrid and then you select an item from the advanceddatagrid to populate the textarea.
    problem:
    the textarea uses htmlText (which is stored in a table on the DB), but for it to display correctly, I need to set XML.prettyPrinting = false and XML.ignoreWhitespace = false.  But then, the tree and advanceddatagrid look at weird with empty nodes (that didnt exist before).
    so im stuck with either having my text look correctly in my textarea or having the tree and advanceddatagrid look correct...there must be something im doing wrong.
    any help would be awesome!
    thanks

    I'd run a trace on your first node to make sure you're
    getting your XML pull correct first. Also, I generally keep my
    .ignoreWhiteSpace = "true" because that helps solve some problems.
    Last, I really try to shy away from defining text fields
    using a field variable. Rather I assign it using
    textFieldName.text = "something something something"
    That way, the variable field can be used if I need to play
    with those values later on. Run the trace() stuff and tell me what
    you get.

Maybe you are looking for