I have had trouble with scrollbars using netbeans 5.5.1

I have had trouble getting a vertical and horizontal scrollbar working in my GUI. I am new to programming but I have books but I find them difficult to follow because they follow the old netbeans GUI models that requires all of the code to be written for example the scrollbar has to be created and then the parameters have to be set. However with the 5.5.1 the scrollbar has already been created and the parameters of the maximum the minimum and the event have already been set.
Therefore when you follow the books they explain the whole process rather than the last part which is all that is needed. I have selected the scrollbar and then pressed the right mouse button to get the menu up where I selected Events and then Adjustments, which then displayed the following script,
" private void jScrollBar1AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
// TODO add your handling code here:"
I know that I have to delete the //TODO add your handling code here and then insert the event handling code. I have tried to put in a lot of different event handler codes to try to get it to work but I have had no luck. Can anybody help. I have asked a few people but they have had trouble with it too.

Please can somebody provide me with a scirpt example.
I would really appreciate it.This was not made in Netbeans but it shows you how to use scrollpanes with a viewportview and listeners.
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.WindowConstants;
public class SwingExample {
     public static void main(String[] args) {
          JFrame frame = new JFrame("Test");
          //Create scrollpane
          JScrollPane scrollpane = new JScrollPane();
          //Create textpane to embed in Scrollpane
          JTextPane textPane = new JTextPane();
          //Add listener to textpane to listen for a KeyEvent
          textPane.addKeyListener(new KeyListener() {
               //unimplemented methods, not reuqired for example
               public void keyPressed(KeyEvent arg0) {}
               public void keyReleased(KeyEvent arg0) {}
               //Implemented method - prints current key typed.
               public void keyTyped(KeyEvent arg0) {
                    char myChar = arg0.getKeyChar();
                    System.out.println("You Typed: "+myChar);
          //Add textpane to scrollpane
          scrollpane.setViewportView(textPane);
          //add scrollpane to frame
          frame.add(scrollpane);
          frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          frame.setVisible(true);
          frame.setSize(new Dimension(400,400));
}

Similar Messages

  • I am having trouble with scrollbars in netbeans 5.5.1

    I have had trouble getting a scrollbar working in netbeans 5.5.1 because the code is not all self written the new 5.5.1 platform takes away the need to write as much code. As a result the books that I am using as a reference does not work.
    Can anybody provide me with a an example of scrollbar script that will work in netbeans 5.5.1. I have put a scrolbar onto my GUI and right mouse clicked and then I have selected Event then Adjustment and then AdjustmentValueChanged. The script was then displayed and stated this,
    "private void jScrollBar1AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
    // TODO add your handling code here:"
    I know that I have to delete // TODO add your handling code here. But what handling code should I put. If anybody could provide me with some script examples it would help. I have asked some other programmers but they wrote all of their code and were not familiar with the netbeans code requiresments.

    Hi sorry I didn't realise that I shouldn't post the same question on two different forums I have never done this before (for reference I have made another post of the same question in the new to java forum).
    Anyway I have figured it out so I don't need any more assistance however I am very greatful to everybody who has helped me espcially petes1234 and helloworld who made a lot of helpful comments, who I would like to thank a lot.
    P.S. if either petes1234 or hellowolrd see this can they pass on my thanks to the other I will try to do it may self by posting a thank you post on the new to java forum.

  • I have had trouble with my iphone 4 since latest update. It will not turn on after charging.

    I am having trouble with my iPhone 4 since latest upgrade.  It will turn off during charge and can only be turned back on by restoring it with itunes.  Is there anything I can do to fix this problem?

    sadly most likely u have to buy a new battery unless u didint update ur ios cause people on ios 4 are having problems like that

  • Following an update of Friefox to version 5.0 I have had trouble with a file which was deemed malicious by AVG antivirus software, the file is ASC.EXE - is this file part of my update, or do I have a virus which needs deleting?

    Firefox does not seem to have fully updated, so I suspect that this file which has been blocked by AVG anti-virus is an element of the update (it was created around 10 minutes after the update began).
    Most of my programmes fail to launch while this file is in the virus vault, e.g. Microsoft Word and iTunes, I have an error message which says the files are
    Is such an ASC.EXE file part of the update?
    I have done some online research into this file type and do not wish to remove it from the virus vault until I am sure it is not a trojan, which seems possible from the sites I have visited.

    '''Whenever you get a message / popup that'''
    '''software / files need to be updated;'''
    <u>'''DO NOT USE ANY OF'''</u>
    <u>'''THE PROVIDED LINKS'''</u>
    While this may be a legitimate message, it could also be <u>'''''Malware or a Virus'''''</u>.
    Any time you want or need to check for upgrades,
    go to the web site of the <u>'''''True Owner'''''</u> of the program in question.
    For example, to check out Firefox, go to '''''[https://www.mozilla.org Mozilla.org]'''''. {web link}
    You can sent a report to '''The FBI''' via their web site
    '''''[http://www.ic3.gov/complaint/default.aspx Internet Crime Complaint Center (IC3)]''''' {web link}
    You can also report such a site at;
    '''''[http://www.google.com/safebrowsing/report_phish/ Google Report Phishing Page]''''' {web link}
    which is the same when done while on site by going to
    '''''Help > Report Web Forgery'''''
    '''''[http://www.mozilla.org/en-US/legal/fraud-report/ Help us safeguard Mozilla’s trademarks by reporting misuse]''''' {web link}

  • I have had trouble with Firefox all week. When I click on your update this am, my free AVG 10.0.1204 disconnected and Firefox tells me it doesn't have any program to connect to it! What's going on???????? This is the 2nd problem I've had this week!!!!!

    I don't know any other details.

    Should read 'When I '''clicked''' on your update this a.m......

  • I am trying to publish my site so a client can view it. In the past I have not had trouble with this

    I am trying to publish my site so a client can view it. In the past I have not had trouble with this

    Adobe really does have the worst customer service/tech support of any product I have ever experienced. It is so unfortunate.
    Date: Tue, 13 Aug 2013 08:26:34 -0700
    From: [email protected]
    To: [email protected]
    Subject: I am trying to publish my site so a client can view it. In the past I have not had trouble with this
        Re: I am trying to publish my site so a client can view it. In the past I have not had trouble with this
        created by Brad Lawryk in Help with using Adobe Muse CC - View the full discussion
    We need a little more info ..
    Where are you publishing to and what is happening when you try and publish?
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5590683#5590683
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5590683#5590683
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5590683#5590683. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Help with using Adobe Muse CC by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • HELP. 3 years ago I purchased cs3. I had troubles with registering the serial number and used my university's suite instead, and (stupidly) did not sort it out. I am now wanting to subscribe to the online creative cloud with my cs3 discount. Is there any

    HELP. 3 years ago I purchased cs3. I had troubles with registering the serial number and used my university's suite instead, and (stupidly) did not sort it out. I am now wanting to subscribe to the online creative cloud with my cs3 discount. Is there any way to find / prove that I had purchased cs3 and locate a serial number? On my Adobe account it does not show my purchase of cs3 (I am guessing because of the trouble with registering my serial number). I have moved house 3 times since the purchase and am unable to locate the packaging or disk. Is there any way to prove my purchase without any serial number or showing under my Adobe account? Please help! Thanks

    The CS3 discount offer is only for retail online product, it does not include education or volume license purchases. Refer to Terms and Conditions | Adobe
    To check whether you had retail CS3 purchase, we need proof of purchase as well as serial number, without which the issue can not be resolved.
    Regards
    Rajshree

  • TS1591 i just got an ihome system and had trouble with it connecting to my iPhone.  I finally got it to work and now my itunes doesn't recognize my phone.  My software is up to date on both my Mac and my iPhone and I have shut everything down and restarte

    i just got an ihome system and had trouble with it connecting to my iPhone.  I finally got it to work and now my itunes doesn't recognize my phone.  My software is up to date on both my Mac and my iPhone and I have shut everything down and restarted.  Does anyone have any other suggestions?

    Let's try a standalone Apple Mobile Device Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of why it's not installing under normal conditions.
    Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
    http://www.apple.com/itunes/download/
    Download and install the free trial version of WinRAR:
    http://www.rarlab.com/
    Right-click the iTunesSetup.exe (or iTunes64setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
    Go into the folder and doubleclick the AppleMobileDeviceSupport.msi (or AppleMobileDeviceSupport64.msi) to do a standalone AMDS install.
    (If it offers you the choice to remove or repair, choose "Remove", and if the uninstall goes through successfully, see if you can reinstall by doubleclicking the AppleMobileDeviceSupport.msi again.)
    Does it install (or uninstall and then reinstall) properly for you? If so, can you get a normal iTunes install to go through properly now?
    If instead you get an error message during the install (or uninstall), let us know what it says. (Precise text, please.)

  • I had firefox 3.6 which i had trouble with now i have installed 4.0....should i unstall the 3.6

    i had trouble with the 3.6 and now installed 4.0....should i unstall the 3.6 now that i have 4.0........thx's

    There is a correct way of doing it i.e. click Help | Check For Updates in 3.6.16
    If on the other hand, you downloaded 4.0.1 from Mozilla.com and it's working, then you don't have to uninstall anything. The installation will have overwritten the necessary files, so there's nothing to uninstall.

  • HT4889 After using migration assistant I have had problems with some apps that were brought down from App store, as well as IntelliJ that just doesnt want to start at all. Does it have anything to do with the UID being changed?

    After using migration assistant I have had problems with some apps that were brought down from App store, as well as IntelliJ that just doesnt want to start at all. Does it have anything to do with the UID being changed?
    13-07-03 6:24:12.447 PM com.apple.launchd.peruser.502[1632]: ([0x0-0x5be5be].com.jetbrains.intellij[5805]) Job failed to exec(3) for weird reason: 13

    What is the exact name of the application you're trying to launch? Is it in the Applications folder?

  • We use dial up and upon updating to Firefox 10 we have had issues with facebook/ playing games...please help!

    We use dial up and upon updating to Firefox 10 we have had issues with facebook/playing games...please help!

    Hi nancybrendel,
    Have you looked at the Knowledge Base article [[Problems using Facebook in Firefox]]? There is a lot of good troubleshooting information in there. Please be sure to try all of the suggested steps. Each one is valuable and may be the answer to your issue.
    Hopefully this helps!

  • Hi! I have some troubles with my iphone 4...

    Hi! I have some troubles with my iphone 4 since a few months. Sometimes, suddenly, it pretends to discharge very fast, but when it comes to 1% I can still use it for hours. Also, when I recharge it, nothing would change at the 1%-note but the battery seems to be fully charged. The first and second time this happened, I made the mistake to turn the phone off because I thought a restart would solve the problem. But it made it worse: The Iphone wouldn't turn on again. I tried all the tricks with home + power button and also tried to connect it to itunes on my macbook, but nothing happend. When I connect the charger it shows me that the battery is empty (which isn't the case - I also tried different wires). After a few hours a little miracle occured and the **** thing turned on all by itself and pretended as if nothing happened.
    The third time this happend I didn't turn the phone off and just used it normally. I took care that the battery is always full and after a few days it was normal again.
    Now it happened again but I had no wire with me at work and the battery ran low and the phone turned off. Now I'm trying to "reanimate" it for 2 days now...nothing. The last times it took 3hours to 12 hours until it would awake but now...
    Does anyone know this problem and knows how to solve it? As I said, I already tried the "press the home button and powerbutton and both and whatever" tricks for a few times but it doesn't change anything....
    Cheers,
    Diana

    Buzz! Thank you for playing!
    You're out of luck. At least here. Discussing jailbroken devices is forbidden by the terms of service.
    It's likely the jailbreak has permanently hosed it.

  • Has anyone had trouble with the LG 3 Cosmos when a call comes in; I am not able to hear from the caller, but, they can hear me?  The volumn is turned up but I can't seem to resolve the issue?  Thanks

    Has anyone had trouble with the LG 3 Cosmos when a call comes in; I am not able to hear from the caller, but, they can hear me?  The volumn is turned up but I can't seem to resolve the issue?  Thanks

    Oh no, Robinbird18! This is not what we like to hear about your cell phone. It makes it pretty hard to have a conversation with someone when you can't hear them. If you make a phone call out are you able to have a conversation with someone without any issues? How long has this been going on? Have you tried to use the phone on speaker phone to see if that works at all? Please keep us posted.   KevinR_VZW Follow us on Twitter @VZWSupport If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • My ipod touch is about 3.5 years old and just recently I have had trouble charging it. No matter what I plug it into it c

    Mu Ipod touch is about 3.5 years old and just recently I have had trouble charging it it just says charging not suported thats with USB into a PC, on a docing station and in the car. I can get a bit of charge into it via the docking station before it displays the not suported message. Any idea?

    Not Charge
    - See:     
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable. The cable for 5G iPod (lightning connector) seems to be more prone to failure than the older cable.
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • Hi I have had problems with photo's and films going onto a 2010 Apple classic MP3.  Have managed to sort photos but it still refuses to copy the films purchased. It comes up with not copied cannot be played on this ipod.

    Hi have had problems with photo's and films going onto a 2010 Apple Classic mp3. Have managed to sort photo's but the films won't copy and comes up with message videos not copied cannot be played on this ipod

    razzbust wrote:
    ...but the films won't copy and comes up with message videos not copied cannot be played on this ipod
    Self explanatory.
    You could try creating an iPod version of the films.
    Use CTRL and B to display the Menu bar shown above. Alternatively, use the ALT key, followed by the F key, the W key and finally the I (eye) key - that's (menu)/File/Create New Version/Create iPod or iPhone version.

Maybe you are looking for

  • Foreign Currency

    Hi guru's Pls give suggestion I posted  foreign Currency Invoice 100 Eur 50 At the time of payment this parital Payment 50 EUR 52 How it is possible . when i try system is not showing foreign Currency Differnce system showing vendor 50* 52 Bank of in

  • Critical Issues During SAP Implementation or After Golive

    Can anybody tell me one of  the most critical/ challenging issues During SAP Implementation or After Golive in these modules:- MM implementation PP implementation SD implementation FI/CO implementation PS implementation QM implementation HR implement

  • DTP Full/Delta loads

    I am loading data from one DSO to another. The change log of the source DSO has been deleted for any request before 20 days. I want to do a full load from active table and then start the delta loads from change log. But the problem is the load is pic

  • When I double click on an event, shows large photo rather than All photos

    I don't know what I did to cause this, but somehow, when I double click on an event, it magnifies the particular photo my mouse is on, rather than opening up all of the photos in the event. How can I change this so when I click on an event, all the p

  • Bdc for FI module tcode.

    hi ,      i m new i bdc, i got one issue for the tcode of fico 'J3GI'. for a particular doc no, then go in equipment means double click on equipment then after pressing the ETM data, if current location is starting by 'T' then go in location and chag