Appending The Scroll Bar to the Text Area

Hey, im having some serious problems setting the scroll panel to my text area, here is what i have done so far, could anyone offer me a hand please
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class MyPanel extends JPanel implements ActionListener
    private JButton forloopbtn;
    private JButton doloopbtn;
    private JButton whileloopbtn;
    private JTextField inserttxtfield;
    private JLabel insertlbl;
    private JTextArea countingtxtarea;
    private JScrollPane myscrollpane;
    public MyPanel()
        //construct components
        forloopbtn = new JButton ("For Loop");
        doloopbtn = new JButton ("Do Loop");
        whileloopbtn = new JButton ("While Loop");
        inserttxtfield = new JTextField (5);
        insertlbl = new JLabel ("Insert Number To Count To Here");
        countingtxtarea = new JTextArea (5, 5);
        myscrollpane = new JScrollPane();
        //adjust size and set layout
        setPreferredSize (new Dimension (485, 351));
        setLayout (null);
        //add components
        add (forloopbtn);
        add (doloopbtn);
        add (whileloopbtn);
        add (inserttxtfield);
        add (insertlbl);
        add (countingtxtarea);
        add (myscrollpane);
        //add actionlistener
        forloopbtn.addActionListener(this);
        doloopbtn.addActionListener(this);
        whileloopbtn.addActionListener(this);
        //set component bounds (only needed by Absolute Positioning)
        forloopbtn.setBounds (90, 50, 100, 20);
        doloopbtn.setBounds (200, 50, 100, 20);
        whileloopbtn.setBounds (310, 50, 100, 20);
        inserttxtfield.setBounds (320, 20, 30, 20);
        insertlbl.setBounds (135, 15, 185, 25);
        countingtxtarea.setBounds (165, 90, 145, 205);
     

ive tried to do it again and this is what my code now looks like, still no scroll bar tho
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class MyPanel extends JPanel implements ActionListener
    private JButton forloopbtn;
    private JButton doloopbtn;
    private JButton whileloopbtn;
    private JTextField inserttxtfield;
    private JLabel insertlbl;
    private JTextArea countingtxtarea;
    private JScrollPane scrollpane;
    public MyPanel()
        //construct components
        forloopbtn = new JButton ("For Loop");
        doloopbtn = new JButton ("Do Loop");
        whileloopbtn = new JButton ("While Loop");
        inserttxtfield = new JTextField (5);
        insertlbl = new JLabel ("Insert Number To Count To Here");
        countingtxtarea = new JTextArea (5, 5);
        scrollpane = new javax.swing.JScrollPane(countingtxtarea);
        scrollpane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        //adjust size and set layout
        setPreferredSize (new Dimension (485, 351));
        setLayout (null);
        //add components
        add (forloopbtn);
        add (doloopbtn);
        add (whileloopbtn);
        add (inserttxtfield);
        add (insertlbl);
        add (countingtxtarea);
        add(scrollpane);
        //add actionlistener
        forloopbtn.addActionListener(this);
        doloopbtn.addActionListener(this);
        whileloopbtn.addActionListener(this);
        //set component bounds (only needed by Absolute Positioning)
        forloopbtn.setBounds (90, 50, 100, 20);
        doloopbtn.setBounds (200, 50, 100, 20);
        whileloopbtn.setBounds (310, 50, 100, 20);
        inserttxtfield.setBounds (320, 20, 30, 20);
        insertlbl.setBounds (135, 15, 185, 25);
        countingtxtarea.setBounds (165, 90, 145, 205);

Similar Messages

  • I upgraded to OSX mountain lion and now the scroll bars on every screen are not there unless I stretch the screen - help

    can anyone tell me why I can no longer see the scroll bar to the right of the screen unless I stretch the screen but it fades in and out instead of always being there to scroll down

    Open General preferences. Select the desired scrollbar behavior/appearance:

  • I have had elements 10 for a long time but recently the scroll bar for the fonts has disappeared. any ideas?

    I have had elements 10 for a long time but recently the scroll bar for the fonts has disappeared. any ideas?

    First try resetting the tool by clicking the tiny arrow at the far left end of the options bar and choosing reset tool.
    But you should be able to use the arrow keys to navigate through the fonts, too.

  • HT1338 How do you consistently get the scroll bar on the right side of the page

    How do you consistently get the scroll bar on the right side of the page.

    Go into System Preferences, select General and set "Show scroll bars" to "Always".

  • Can i put the scroll bar on the left hand side of the page

    i am left handed and using a touchscreen asus and would like to get the scroll bar on the left

    Hi!
    Yes, you can!
    # Type "about:config" (without quotations) in the urlbar and hit Enter
    # Search for "layout.scrollbar.side" (without quotations) variable
    # Double click on that
    # Modify the value to "3" (without quotations)
    # Click Ok
    # Restart Firefox

  • Why is the scroll bar on the left?

    I had to do a systems restore (using Vista) and now the scroll bar is on the left; it used to be on the right. If I use IE9 the scroll bar is on the right. What happened.

    Set the pref layout.scrollbar.side to '2' to place the scroll bar at the right side.
    See http://kb.mozillazine.org/layout.scrollbar.side (default is 0: user interface)

  • The scroll bar on the right is gone. the only way i can move the screen up or down is by using the arrow keys.  happened after i updated software is there something i missing

    The scroll bar on the right is gone  the only way I can move the screen up or down is with the arrow keys  Why how do i get it  back and have it stay there

    Yep. For all us spreadsheet geeks, this is a real sinker. Anyway, here's my workaround. Not free, unfortunately. I have a macro program called QuicKeys installed on my Mac that I've used for countless years, and  which I highly recommend for other reasons. Anyway, one of QuicKeys' many features is simulating a scroll wheel using the keyboard. I have it simulating a cell-by-cell scroll using cmd-arrow keys. The only drawback is that I have to release the cmd key each time I want to move another cell.

  • Why do the scroll bars on the lower right disappear in Motion 5?

    After upgrading to Mavericks I noticed that the scroll bars on the right hand side disappear after using them once. See pictures.
    How do I solve this? Very inconvenient to say the least. I've tried restarting and repair permissions so far.
    Restarting Motion brings them back, but as soon as I scroll for the first time: they're gone again!
    Please help! So I can finish my project…
    Message was edited by: ejpeg

    I was able to bring them back without restarting motion by opening opening and closing the timeline.  Either click the button at the bottom right of the Motion window that looks like a film strip, or use the keyboard shortcut (Command+7).  A couple of other options that may help, use the scroll wheel of your mouse or change the height of your layers to show more.  You chan change the height by going to the layer list to the right of the timeline and moving your cursor between two layers.  It will change to a double arrow.  You can click and drag to grow or shrink your layer height.

  • Apple, please restore the scroll bar all the time.

    This is just a note to Apple asking them to return the scroll bar all the time, or at least make it an option that it's always there for all the programs in the next update of Mountain Lion. This is really a nuisance in iPhoto, but also in other programs where it disappears. What's the point anyway? It's a pain when it vanishes, and I'm not sure if the window should scroll or if I'm seeing all the content. Getting the scroll bar to show up is tough, too. BRING BACK THE SCROLL BAR, PLEASE!

    http://www.apple.com/feedback will provide much more fruitful results.

  • Enabling the scroll bars of the  iView

    Hello all,
    I am creating one portal application which consists of 5 iView and my aim to have all the iViews completely visible on the screen at all the times and make use of the vertical and horizontal scrollbars to allow the user to see the additional data.
    So my question is How to enable the vertical and horizontal scroll bars of the iViews. I have tried this by setting <b>Isolation Method</b> of the iView to <b>"URL"</b> but doing the same i was not able to pass the events from one iView to another.
    Can you suggest me another way of enabling the scroll bars to iView.
    Thanks in advance,
    Prashant

    Hi Prashant,
    There are some other ways for achieveing the same:
    1. Define new Page Layout with 8 blocks of same size as per your requirement, and then place all the iviews in that, one per block. These changes need to be done in PAR file of framework page. (A bit time consuming)
    2. Add iViews to pages such that one page contain one iview. Add all these pages to one page and then set page properties to display every apge completely like page height as full page.
    3. iView height can be kept fixed and then all scroll bars will start appearing.
    This might help you.
    Regards
    -Kedar Kulkarni
    reward if useful

  • The scroll bar on the top pane of my email (I use AT&T Yahoo) suddenly disappeared. How do I make it come back?

    The top pane of my email window lists my emails. It always had a scroll bar on the right side, allowing me to scroll down the list of emails. Yesterday, it just disappeared. I still have a scroll bar in the bottom pane, where I read a specific email, but none in the top pane. Had tech support from AT&T, but found that since scroll bar is there in Internet Explorer, it's not my email program that's the problem, but FireFox.

    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: Command+Shift+F).
    *https://support.mozilla.org/kb/how-to-use-full-screen
    If you are in full screen mode then hover the mouse to the top of the screen to make the Navigation Toolbar and Tab bar appear.<br />
    Click the Maximize button (top right corner of the Navigation Toolbar) to leave full screen mode or right-click empty space on a toolbar and choose "Exit Full Screen Mode" or press the F11 key.

  • How can we remove the scroll bars from the table?

    Hi,
    I have a dynamic table. Currently the table appears with the scroll bars. But there is a requirement that the scroll bar should not appear and the table should stretch in the entire page. How can this be achieved.
    Thanks in advance
    Nita

    Thanks Mohammad for the reply.
    Was able to remove the scroll bars by using only the styleClass as AFStretchWidth. But there is a default partition in middle of the page still? Can i remove that too by any way.

  • I would like to know it it's possible to change the scroll bar from the right part of the firefox browser, to the left part and, if it's possible, how can it be done. Thank you!

    The scroll bar (the one used to scroll up and down any kind of website), that is normally in the right part of the firefox browser, would be of much help to me if it could sometimes be moved to the left part of the browser. Is this possible? How can it be done? Can anybody tell me the exact steps to take in order to do this (if it is possible of course)? This would be helpfull to me, since I think that the firefox scroll bar is overlaping the scroll part of the facebook chat sidebar, since I just can see a few people on this facebook chat sidebar and I can´t scroll along it, as I could a while ago. So my guess is that the firefox scroll bar is covering the other. In order to solve it in a simpler way, I guessed that if the firefox scroll bar could be moved to the left side of the browser, this problem could be solved. So, can anybody help me?

    http://kb.mozillazine.org/layout.scrollbar.side
    Type '''about:config''' in Location (address) bar
    filter for '''layout.scrollbar.side'''
    Right-click the Preference and Modify it to '''3'''
    You may need to reload any pages open to have scrollbar move to left after Preference change.

  • How to add the scroll bar in the vertical photo gallery?

    like this, how to add the scroll bar? http://www.flashvault.net/tutorial.asp?ID=288 Thanks,

    I want to know how to add a vertical scroll bar in the photo gallery which I copied from the tutorial. And add the event to catch MouseEvent.CLICK for each photo. Please advise. Thanks,

  • Firefox crashed yesterday and today it opened with the scroll bar on the left side, not the right. How do I fix this?

    Firefox crashed last night as I was closing it down. Today, when I started up my laptop and opened firefox, the scroll bar was on the left. I'm not sure how to move it back to the right side of the page.

    RichTQ wrote:
    just yesterday i have lost connection with the Vodafone network.
    Have you contacted Vodafone ?

Maybe you are looking for