ScrollPanes & TextAreas - Repositioning in 1.5 with .scrollRectToVisible()

So I've an uneditable text area with the words wrapping around sitting inside a scroll pane.
My user clicks a button and the program fetches some text from an XML document and displays it on the screen.
The trouble is that the window automatically scrolls to the bottom of the text field, while ideally I'd like my user to be able to read from top down without having to start by manually repositioning every page.
So after I set my text, I've been trying to pull off a .scrollRectToVisible(Rectangle) method, which as best as I can tell is the only way to reposition scroll bars in Java 1.5.
I've tried applying the method to the textArea object itself, which from what I can tell is that way it should be done, with rectangles of all shapes and sizes, most notably
h = textArea.getSize().height;
w = textArea.getSize().width;
(0,0,0,0)(0,0,1,1) (0,0,w,h) (w,h,0,0)(w,h,-1,-1)
and so forth with all the permutations of those variables you can imagine.
But, alas, no cigar. I can't get my text window to begin it's short life visible from the top.
Am getting something simple and basic wrong? The only thing I've found so far that might be relevent is that the API specifies a seperate .scrollRectToVisible(Rectangle) method for JtextFields, over and above that which exists for other components. Which:
"Scrolls the field left or right."
Since I'm wrapping my words I only need up and down scroll, but gotta admit I'm stuck for how to accomplish this.
Here's the relevent code in my document, in case it helps:
//declare
     JTextArea letterSurface;
     JScrollPane scrollPane;
public void init() {
//initialise
     letterSurface = new JTextArea("initial bullshit") ;
     scrollPane = new JScrollPane(letterSurface);
//The text area properties
     letterSurface.setEditable(false);
     letterSurface.setLineWrap(true);
     letterSurface.setWrapStyleWord(true);
     letterSurface.setBackground(Color.white);
     letterSurface.setForeground(Color.black);
     letterSurface.setForeground(Color.black);
     letterSurface.setFont(font);
//place
     getContentPane().add(scrollPane, BorderLayout.CENTER);
//then in a differnt text fetching method
     letterSurface.setText(lettertext);
     letterSurface.repaint();
//and finally
     letterSurface.scrollRectToVisible(r);
//where r is a rectangle of all sorts of wonderful shapes and sizes as mentioned above
I've tried applying the .scrollRectToVisible() method to the scrollPane itself but that give me no joy either.
I'd be grateful for any insight anyone has.
Thankyou kindly.
M.

Dear Walker, thanks for the tip about .invokeLater(), it's a very useful little method and did exactly the trick. Would have taken me weeks to find it one my own.
I'll likely put this to lots of good use in the future too.
Thanky you very much.
da.futt - not setting the scrollBar value directly from the begining was just plain dumbness on my part. Thanks for pointing it out.
M.

Similar Messages

  • Help with scrollRectToVisible

    Hey,
    I am having a problem using the scrollRectToVisible method on a JScrollPane. I have an application where the layout is like so:
    JSplitPane (splitPane)
    ->JPanel on the right side (rightPanel) (and ignoring the left for now)
    -->rightPanel contains a JScrollPane (rightScrollPane)
    --->rightScrollPane contains a dynamically sizable JPanel (contentPanel). Dynamically changes size via a JSlider (scaleSlider) When the user interacts with the scaleSlider it changes the width of the contentPanel and will introduce a scrollBar in the rightScrollPane if the contentPanel grow larger than the viewport area. In the viewport of the rightScrollPane I would like to always display an area of the contentPanel that dynamically changes in respect to the size of the contentPanel. I am having problems with this: here is my code:
    private void scaleSliderStateChanged(ChangeEvent e) {
        JSlider source = (JSlider)e.getSource();
        int scale = source.getValue();
        contentPanel.setSize(new Dimension(scale, contentPanel.getHeight()));
        contentPanel.setPreferredSize(new Dimension(scale, contentPanel.getHeight()));
        //for brevity lets say the area of the contentPanel i want to display is
        //always in the center (width/2).
        Rectangle tempRect = contentPanel.getBounds();
        tempRect.setBounds(tempRect.width/2, 20, 200, 200);
        rightScrollPane.getViewport().scrollRectToVisible(tempRect);
        So i think that the this should produce a rectangle which is has an inital x location that is half the width, an inital y = 20, whose width and height is 200. All that really matters to me here is that the inital x location is in the viewport all the time. I would think that this should allow the user to manipulate the scaleSlider and in effect change the width of the contentPanel furthermore always retaining the same horizontally centered location of the contentPanel in the rightScrollPane.
    However upon execution and manipulation of the scaleSlider the width of the contentPanels width is changed as desired, however the horizontal scroll bar immediately moves to the far right and stays there. Can anyone tell me what i am doing wrong here?
    thanks in advance for your help.

    scrollRectToVisible() is really meant to be used on the component added to the scrollPane. So in your case the panel you just resized.
    If that doesn't work then add the code to a SwingUtilities.invokeLater(...) to make sure it gets executed after all currently queued events get processed.
    Finally if that doesn't work, the try using the setViewPostion() method of the JViewport.

  • Report with TextArea field v PopUp Form with TextArea Item CRLF Question

    I have a report which has a column in it which contains lines terminted with CRLF i.e chr(10||chr(13).
    When this column is displayed as a textarea type it presents the data correctly i.e
    Signal received to CONTINUE command section SLT_PRT.xml sequence 1
    Signal received to CONTINUE command section SLT_PRT.xml sequence 2
    Signal received to CONTINUE command section SLT_PRT.xml sequence 3
    Signal received to CONTINUE command section SLT_PRT.xml sequence 4
    When i take the same data and pass it into a html area with a textarea field in it - it displays it incorrectly ie
    Signal received to CONTINUE command section SLT_PRT.xml sequence 1Signal received to CONTINUE command section SLT_PRT.xml sequence 2Signal received to CONTINUE command section SLT_PRT.xml sequence 3Signal received to CONTINUE command section LT_PRT.xml sequence 4
    Also % signs dont show up correctly.
    What might be the problem is it encoding?
    Simon
    Edited by: SimonT2 on Nov 11, 2009 2:48 PM
    Edited by: SimonT2 on Nov 11, 2009 3:43 PM

    No that didnt work now i get:-
    <BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 1<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 2<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 3<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 4<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 5<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 6<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 7<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 8<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 9<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 10<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 11<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 12<BR><BR>Signal received to CONTINUE command section ALL_TNB_PRT.xml sequence 13<BR><BR>100Edited by: SimonT2 on Nov 11, 2009 8:51 PM
    Edited by: SimonT2 on Nov 11, 2009 8:51 PM

  • TextArea text not displayed correctly with ImageSnapshot

    I am having an issue with the ImageSnapshot.captureImage command capturing the text in a TextArea. Attached are two files illustrating the issue. The "screenshot.jpg" pic shows how the TextArea controls are displayed on the screen. The "created jpg.jpg" pic shows how the text is displayed in the jpg that is created. Below is the code that creates the snapshot, everything is pretty standard there as far as I can tell. The text is obviously not sized the same from one to the other. Any ideas whats going on here or what I can do to correct it?
    var myencoder:JPEGEncoder = new JPEGEncoder(50);
    var imgss:ImageSnapshot = ImageSnapshot.captureImage(viewstack.selectedChild, 100, myencoder);
    var fs:FileStream = new FileStream();
    var ssfile:File = File.applicationStorageDirectory.resolvePath("ProjectImages/snapshot.jpg");
    fs.open(ssfile, FileMode.WRITE);
    fs.writeBytes(imgss.data, 0, imgss.data.length);
    fs.close();
    Thanks,
    Scott

    Scott,
    Can you file a bug? http://bugs.adobe.com/flex
    Thanks,
    Jason

  • AS fails to identify an image placed in html text via an img tag in a TextArea, while doing so correctly with textField.

    A best-efforts session with identifying, in ActionScript, an
    image placed in a TextArea and identified with id, leads me to
    wonder whether the id attribute is supported.
    I have on disk a jpeg file of the amazom.com logo, a small
    image.
    In a scene, I have a TextArea with instance name
    TextAreaPane, and a Dynamic textField with instance name
    DynamicPane. Both of the html attributes in their properties panes
    are set to true. There is a button onstage with instance name
    "ShowIt".
    If my script reads:
    copyToShow = 'This is one place to see it: <img
    src="D:/Imgs/amazon.jpg" id="nineties"><br>'
    TextAreaPane.text = copyToShow;
    DynamicPane.htmlText = copyToShow;
    ShowIt.onPress = function( )
    trace ("Via TextArea, I can identify: " +
    TextAreaPane.nineties);
    trace ("Via the textField, I can identify: " +
    DynamicPane.nineties);
    After the movie loads both in the Player and in the Windows
    Projector, the image and text show correctly in both text panes.
    When I hit the button, I get:
    Via TextArea, I can identify: undefined
    Via the textField, I can identify:
    _level0.DynamicPane.nineties
    Hitting the button after the scene starts playing allows the
    very short asynchronous access time to elapse, so this isn't a case
    of loading a textfield in one line of script, and then in the next
    line expecting for ActionScript to have access to it.
    Of course for the Projector I send these statements to a
    textField on stage to see what trace gives me, and they're the
    same.
    I tried placing the two fields inside a movie clip (and
    adding that movie clip instance name to the head of their dot
    addresses), wondering if being a sub-object of a movie clip would
    help, but the same results -- the textField handles it, while
    TextArea doesn't.
    ... Does anyone have a means of getting better results?

    Tim,
    Many thanks for the clue and the amendments -- once I had
    finished a late night of it, a cleanup chore unearthed a magazine
    that's had me engrossed for a day and a half and produced the
    appearance of ignoring your replies; actually the computers have
    been off.
    I won't be back to it for another few hours at least, but
    wanted to acknowledge the support; the hints in your message look
    like they'll be the beginning of another day at it; I'll send word
    when there's some kind of results.
    I sent the same message to Adobe in their LiveDocs section, a
    forum where they variously now tolerate people saying 'How d'ya do
    this', 'How d'ya do
    that', then now reply that that isn't the right forum for
    how-to's, but rather for documentation problems. Well, since the
    intro to TextArea says that it supports all the html that Flash
    does, I added in the message that the inability to do the
    dot-addressing-image-access that they explain under id is a
    discrepancy, so qualifies to post even if they're in their
    rule-adhering mood, but it hasn't appeared yet -- either under
    review or discarded.
    The reason I'd chosen TextArea was that the text column will
    sometimes be long, and it would be nice to get the overage out of
    sight by having a window that shows only the window's worth, hiding
    what's above and below. (As you probably know, since attempting to
    cover text in a dynamic field with a mask causes all of it to
    disappear, that isn't an option.) The other night I felt I'd hit an
    impassable wall with Flash; in resigning myself to use the Dynamic
    Text field, I decided to cover the text overage with a translucent
    screen of color, and be it due to having no choice that it may, the
    desaturated stretches of text above and below would add ornament
    and atmosphere to the screen, a faintly techno note. Since there
    will often two to four of these scrolling fields going, an
    intricate, happenstance pattern would develop that might turn out
    to be nice.
    But if the avenue you've opened starts working, I'll have my
    choice between the two objects.
    Quantainne

  • How do I get marked text (text marked in a textarea with mouse)

    Hi.
    I want to implement a method that saves marked text in a textarea in a string. With marked text I mean text that the user marked with its mouse. Is there a method already in the JAVA library?
    Yours
    RB

    Sorry, my fault. Just had a glance in the JAVA API Specification ;)
    Didn't know that DefaultEditorKit is part of the JAVA library.
    RB

  • Reposition a movieclip on stage with coordinates from an xml

    Hello i am new to this forum, and kinda a beginner with actionscript. what i'm trying to do is reposition a movieclip already with the coordinates that will be in an XML file on my server. But so far no luck.
    This is what i have for AS3
    var my_x:Number;
    var my_y:Number;
    var myCoord:XML;
    sample_mc.x = my_x;
    sample_mc.y = my_y;
    var myXMLLoader:URLLoader = new URLLoader();
    myXMLLoader.load(new URLRequest("coords.xml"));
    myXMLLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML (e:Event):void{
    var myXML:XML = new XML(e.target.data);
    myCoord = myXML.position.pos1;
    my_x = myCoord.@XPOSITION;
    my_y = myCoord.@YPOSITION;
    And the XML file
    < position>
    < pos1 XPOSITION="100" YPOSITION="55">
    < /pos1>
    < /position>
    let me know if anyone can correct what i'm doing wrong, please.

    still no prevail, this is now what i got so far
    AS3
    var my_x:Number;
    var my_y:Number;
    var myCoord:XML;
    var myXMLLoader:URLLoader = new URLLoader();
    myXMLLoader.load(new URLRequest("coords.xml"));
    myXMLLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML (e:Event):void{
        var myXML:XML = new XML(e.target.data);
        myCoord = myXML.pos1;
        sample_mc.x = my_x = Number(myCoord.@XPOSITION);
        sample_mc.y = my_y = Number(myCoord.@YPOSITION);
    and the XML
    < position>
    < pos1 XPOSITION="100" YPOSITION="55">< /pos1>
    < /position>
    i know i'm just a beginner with AS but i really thought this was something simple. do i have obvious errors.

  • Problem with Jpanel repaintingl

    Hi!
    I have a problem with Jpanel.
    First , I add a Jscrollpane to the panel and I don't
    see it.
    Second, I have a paint method in the Jpanel and I do there some painting but when I exe the application I can see the panel painting only when I put the mouse cursor
    on the place where the panel need to be.
    It is very strange.
    Help me.
    Yair.

    Example code??
    Can't tell what's wrong otherwise.
    First , I add a Jscrollpane to the panel and I don't
    see it.Have you added anything to this JScrollPane? Unless you set the scroll bar policies to always on you won't see anything if you haven't added anything to the scrollpane.
    Also, if you're only adding this scrollPane to your JPanel initilise it with
    JPanel whippet = new JPanel(new BorderLayout())
    .. then when you add your scrollPanel to your JPanel do this to make sure its added slap in the in middle of it:
    whippet.add(yourScrollPanel, BorderLayout.CENTER);
    Bit more info please - duuuuuuuuuuuuuuuude (man, "Finding Nemo" was well funny didn't you think.. anyways, that's besides the point.... could just be my 8 year old mental age though.. who knows.)?

  • How to restrict the maximum size of a java.awt.ScrollPane

    Dear all,
    I would like to implement a scroll pane which is resizable, but not to a size exceeding the maximum size of the java.awt.Canvas that it contains.
    I've sort of managed to do this by writing a subclass of java.awt.ScrollPane which implements java.awt.event.ComponentListener and has a componentResized method that checks whether the ScrollPane's viewport width (height) exceeds the content's preferred size, and if so, resizes the pane appropriately (see code below).
    It seems to me, however, that there ought to be a simpler way to achieve this.
    One slightly weird thing is that when the downsizing of the pane happens, the content can once be moved to the left by sliding the horizontal scrollbar, but not by clicking on the arrows. This causes one column of gray pixels to disappear and the rightmost column of the content to appear; subsequent actions on the scrollbar does not have any further effect. Likewise, the vertical scrollbar can also be moved up once.
    Also, I would like a java.awt.Frame containing such a restrictedly resizable scrollpane, such that the Frame cannot be resized by the user such that its inside is larger than the maximum size of the scrollpane. The difficulty I encountered with that is that setSize on a Frame appears to set the size of the window including the decorations provided by the window manager (fvwm2, if that matters), and I haven't been able to find anything similar to getViewportSize, which would let me find out the size of the area inside the Frame which is available for the scrollpane which the frame contains.
    Thanks in advance for hints and advice.
    Here's the code of the componentResized method:
      public void componentResized(java.awt.event.ComponentEvent e)
        java.awt.Dimension contentSize = this.content.getPreferredSize();
        this.content.setSize(contentSize);
        java.awt.Dimension viewportSize = getViewportSize();
        System.err.println("MaxSizeScrollPane: contentSize = " + contentSize);
        System.err.println("MaxSizeScrollPane: viewportSize = " + viewportSize);
        int dx = Math.max(0, (int) (viewportSize.getWidth() - contentSize.getWidth()));
        int dy = Math.max(0, (int) (viewportSize.getHeight() - contentSize.getHeight()));
        System.err.println("MaxSizeScrollPane: dx = " + dx + ", dy = " + dy);
        if ((dx > 0) || (dy > 0))
          java.awt.Dimension currentSize = getSize();
          System.err.println("MaxSizeScrollPane: currentSize = " + currentSize);
          setSize(new java.awt.Dimension(((int) currentSize.getWidth()) - dx, ((int) currentSize.getHeight()) - dy));
        System.err.println();
      }Best regards, Jan

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    public class ScrollPaneTest
        GraphicCanvas canvas;
        CustomScrollPane scrollPane;
        private Panel getScrollPanel()
            canvas = new GraphicCanvas();
            scrollPane = new CustomScrollPane();
            scrollPane.add(canvas);
            // GridBagLayout allows scrollPane to remain at
            // its preferred size during resizing activity
            Panel panel = new Panel(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            panel.add(scrollPane, gbc);
            return panel;
        private WindowListener closer = new WindowAdapter()
            public void windowClosing(WindowEvent e)
                System.exit(0);
        private Panel getUIPanel()
            int w = canvas.width;
            int h = canvas.height;
            int visible = 100;
            int minimum = 200;
            int maximum = 500;
            final Scrollbar
                width  = new Scrollbar(Scrollbar.HORIZONTAL, w,
                                       visible, minimum, maximum),
                height = new Scrollbar(Scrollbar.HORIZONTAL, h,
                                       visible, minimum, maximum);
            AdjustmentListener l = new AdjustmentListener()
                public void adjustmentValueChanged(AdjustmentEvent e)
                    Scrollbar scrollbar = (Scrollbar)e.getSource();
                    int value = scrollbar.getValue();
                    if(scrollbar == width)
                        canvas.setWidth(value);
                    if(scrollbar == height)
                        canvas.setHeight(value);
                    canvas.invalidate();
                    scrollPane.validate();
            width.addAdjustmentListener(l);
            height.addAdjustmentListener(l);
            Panel panel = new Panel(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(2,2,2,2);
            gbc.weightx = 1.0;
            addComponents(new Label("width"),  width,  panel, gbc);
            addComponents(new Label("height"), height, panel, gbc);
            gbc.anchor = GridBagConstraints.CENTER;
            return panel;
        private void addComponents(Component c1, Component c2, Container c,
                                   GridBagConstraints gbc)
            gbc.anchor = GridBagConstraints.EAST;
            c.add(c1, gbc);
            gbc.anchor = GridBagConstraints.WEST;
            c.add(c2, gbc);
        public static void main(String[] args)
            ScrollPaneTest test = new ScrollPaneTest();
            Frame f = new Frame();
            f.addWindowListener(test.closer);
            f.add(test.getScrollPanel());
            f.add(test.getUIPanel(), "South");
            f.pack();
            f.setLocation(200,200);
            f.setVisible(true);
            f.addComponentListener(new FrameSizer(f));
    class GraphicCanvas extends Canvas
        int width, height;
        public GraphicCanvas()
            width = 300;
            height = 300;
        public void paint(Graphics g)
            super.paint(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int dia = Math.min(width, height)*7/8;
            g2.setPaint(Color.blue);
            g2.draw(new Rectangle2D.Double(width/16, height/16, width*7/8, height*7/8));
            g2.setPaint(Color.green.darker());
            g2.draw(new Ellipse2D.Double(width/2 - dia/2, height/2 - dia/2, dia-1, dia-1));
            g2.setPaint(Color.red);
            g2.draw(new Line2D.Double(width/16, height*15/16-1, width*15/16-1, height/16));
        public Dimension getPreferredSize()
            return new Dimension(width, height);
        public Dimension getMaximumSize()
            return getPreferredSize();
        public void setWidth(int w)
            width = w;
            repaint();
        public void setHeight(int h)
            height = h;
            repaint();
    class CustomScrollPane extends ScrollPane
        Dimension minimumSize;
        public Dimension getPreferredSize()
            Component child = getComponent(0);
            if(child != null)
                Dimension d = child.getPreferredSize();
                if(minimumSize == null)
                    minimumSize = (Dimension)d.clone();
                Insets insets = getInsets();
                d.width  += insets.left + insets.right;
                d.height += insets.top + insets.bottom;
                return d;
            return null;
        public Dimension getMinimumSize()
            return minimumSize;
        public Dimension getMaximumSize()
            Component child = getComponent(0);
            if(child != null)
                return child.getMaximumSize();
            return null;
    class FrameSizer extends ComponentAdapter
        Frame f;
        public FrameSizer(Frame f)
            this.f = f;
        public void componentResized(ComponentEvent e)
            Dimension needed = getSizeForViewport();
            Dimension size = f.getSize();
            if(size.width > needed.width || size.height > needed.height)
                f.setSize(needed);
                f.pack();
         * returns the minimum required frame size that will allow
         * the scrollPane to be displayed at its preferred size
        private Dimension getSizeForViewport()
            ScrollPane scrollPane = getScrollPane(f);
            Insets insets = f.getInsets();
            int w = scrollPane.getWidth() + insets.left + insets.right;
            int h = getHeightOfChildren() + insets.top + insets.bottom;
            return new Dimension(w, h);
        private ScrollPane getScrollPane(Container cont)
            Component[] c = cont.getComponents();
            for(int j = 0; j < c.length; j++)
                if(c[j] instanceof ScrollPane)
                    return (ScrollPane)c[j];
                if(((Container)c[j]).getComponentCount() > 0)
                    return getScrollPane((Container)c[j]);
            return null;
        private int getHeightOfChildren()
            Component[] c = f.getComponents();
            int extraHeight = 0;
            for(int j = 0; j < c.length; j++)
                int height;
                if(((Container)c[j]).getComponent(0) instanceof ScrollPane)
                    height = ((Container)c[j]).getComponent(0).getHeight();
                else
                    height = c[j].getHeight();
                extraHeight += height;
            return extraHeight;
    }

  • Problem with Vcard and non-English character

    VCard feature is what I would like to use, but I have quite a few contacts with Non-English name (Korean).
    I know Ipod can display in Korean, but when I create a v-card with Korean character and copy the vcard file over into /contacts folder, I can see the filename as the person's name (From windows explorer), but I can ONLY see first character of the file when I display contacts in iPod.
    Does anyone have tips/tricks on displaying all the filename in IPod contacts?
    Thanks.
      Windows XP Pro  

    Because i use the string nota into a jsp page and i print the string nota into a textarea and the text is with no newline, example:
    <textarea name="nota" rows="4" cols="60"><%= nota %></textarea>
    the text into textarea is:
    first linesecond linethird line
    but i want that the text displayed into textarea is equal the text into the CDATA section:
    first line
    second line
    third line

  • Event handling in scrollpane and graphics programming concept

    I am still unclear about what to do to refresh a canvas inside a scrollpane?
    what should i do with "repaint()" method of scrollpane??
    clearly i have to update the drawing on the graphics g of the canvas, according to the viewport of the scrollpane so that a min. area is painted only.
    will the "repaint()" method of canvas automatically get called when scrollbar is scrolled?? i tested but seems not.
    do i have to consume adjustmentevent?? seems it's not a low level event
    i saw in the console that the "update()" of the canvas sometimes get called twice when i scroll the scrollbar.
    the problem i am having is : i got different effect when i clicked on different part of the scrollbar
    clicked on the "bubble" will scroll the canvas, but once stopped the canvas that becomes visible(blank be4) is not updated
    only clicking on the area next to the "bubble" will lead to a "great leap" and the screen get updated
    i dont know how to override the adjustmentvaluechanged() actually

    i clearrect() and drawline(), filloval() in the update() of canvas and call update() inside the paint() of the canvas, i dont know if i should make it this way
    should i call repaint() of the scrollpane or repaint() of the canvas inside the adjustmentvaluechanged() of the scrollpane??

  • Problem with CDATA and new line character

    I parse a xml document with org.w3c.dom, the document contain a CDATA section in which there are more lines of text, each line is terminated with the new line character (\n).
    Example:
    <nota>
    <[CDATA[
    first line
    second line
    third line
    ]]>
    </nota>
    When a parse this node:
    Text txt_nota=(Text)elm_nota.getFirstChild();
    String nota=txt_nota.getData();
    the value returned is one string with no new line characters, example:
    "first linesecond linethird line"
    what's wrong?

    Because i use the string nota into a jsp page and i print the string nota into a textarea and the text is with no newline, example:
    <textarea name="nota" rows="4" cols="60"><%= nota %></textarea>
    the text into textarea is:
    first linesecond linethird line
    but i want that the text displayed into textarea is equal the text into the CDATA section:
    first line
    second line
    third line

  • ScrollPane behavior

    When I try the sample provided in the help doc (Flash 8,
    Windows XP):
    Live
    Docs Sample
    The behavior of the scrollpane isn't working correctly for
    me.
    It sort of works, in that if you don't play close attention
    and arrow up and down, the image scrolls up and down, but pay close
    attention to the scrolling. When the sample starts, the scrolling
    "view" should be the top left of the image. If you click the "down"
    arrow once, it should move the image "up" in the scroll pane. On my
    system, nothing happens on the first click. On the second click, it
    starts to behave "correctly" in that it will scroll the image up
    slightly.
    If I click the "down" arrow several times, then the the "up"
    arrow an equal number of times to try to get back to the top of the
    image, it won't scroll all the way. If you drag the scroll thumb,
    you can make it go all the way to the top.
    I get similar behavior with the horizonal scroll as well.
    Anyone else see this?

    Hello,
    You've probably found a fix for this by now but I thought I'd
    pass on my workaround anyway. I emailed macromedia (well adobe now)
    and they said this is a known bug that they have no patch for.
    Anyway after a lot of swearing, forum searches, breaking things and
    sticking pins in scrollpane voodoo dolls I came up with this:
    function scrollBugFix(targetPane)
    var spListener:Object = new Object();
    spListener.scroll = function(eventObject:Object):Void
    var maxVPos:Number = eventObject.target.maxVPosition;
    if (targetPane.vPosition == 0)
    trace ("scroll - fixing top");
    targetPane.vPosition = 0;
    else if(targetPane.vPosition == maxVPos)
    trace ("scroll - fixing bottom");
    targetPane.vPosition = maxVPos;
    // Add listener.
    targetPane.addEventListener("scroll", spListener);
    I've not done much coding and I don't really know why this
    works - seems a bit bizarre finding out if something is zero and if
    it is setting it to zero, but hey it worked for me so it might work
    for you.
    cheers
    chris

  • How to Increase textarea size in HTML code in WM05

    Hi All,
    I am working on a project where we used JSP & HTML language for User Interfaces.
    My application running on WM2005. In one of the page is having text area with cols=30 and rows=15.
    Here I increased the number of cols to 50, and checked in PDA(WM2005). There was no change in width of the textarea. It was similar with as it was with cols=30.
    But I can see this effect in my LAPTOP.
    Can any body please tell me how to increase the textarea in Pocket PC.
    Regards,
    Babu.

    Hi Babu,
    perhaps you have used a CSS style and this causes your problems? Anyway, the following line works on my PDA without issues:
    <textarea cols="20" rows="5" style="width:30px;">test</textarea>
    Hope this helps!
    Regards,
    Oliver

  • HTML input textarea causes problems

    Hi,
    I have a textarea on my form where the user will have the opportunity to enter a paragraph of text, where he can use HTML tags and whatever. But as soon as I enter html tags into this area, the formfileds coming after this textarea cannot sent their parameters to the next procedure. No html tags, everything works fine.
    Any idea?

    Hi Nilay,
    I don't think the textarea has anything to do with your problem. I just tried out and it works fine for me (at least with the italic and strong tags). Could you provide some more information on your case? (HTML source, the way you process the parameters, etc.)
    Peter

Maybe you are looking for

  • Viewing extra hours in day/week view

    Hi all, When I view calendars in day or week view, it shows me the whole day, from midnight to midnight. Which is sort of a pain because I don't generally schedule anything for myself at 1 o'clock in the morning so I have to scroll down to where my d

  • How to remove rootkits and malware?

    I have downloaded and ran the programme Rootkit Hunter and the results are worrying. I don't know much about malware other than a malicious individual has persistently been installing it onto my machines via malicious emails - this time targeting my

  • Save physical channel information in a configuration file and reuse it in another VI

    Dear all, I would like to do a pair of VIs. The first VI configures all psychical channels and store the task information (or physical channel name information) in a file and the second VIs can access this file and use the saved information. Can anyb

  • Applying a rating to multiple images

    Hi all, this would be a rather embarassing question had I not looked for an answer for so long. I can't stand the way Julieanne Kost edits picks and rejects. I don't know any pros who edit that way personally, and it seems so ineficient; except maybe

  • Open external application in pdf!

    I want to made a button when click it, it will open a program in desktop. Can I do that thru Adobe liveCycle Designer 7.0 ? I tried to use : app.lunchURL("program path",this); but with no luck thanks in advance.