It compiles and runs, but scrollPane doesn't work.

Bah. Why doesn't my scrollPane work? It compiles and runs but my scrollbars for the text area are nowhere to be found. This is the code I'm using to handle my scrollpane.
public Display() {
               setLayout(null);
               setPreferredSize(new Dimension(270, 300));
               setSize(270, 300);
               items = new JTextArea(5, 5);
               items.setBounds(5, 5, 270, 260); //x,y,width,height
               items.setEditable(false);
            JScrollPane scrollPane = new JScrollPane(items);
            scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            scrollPane.setVerticalScrollBar(new JScrollBar(Scrollbar.VERTICAL));
            JScrollBar vScrollBar = scrollPane.getVerticalScrollBar();
            vScrollBar.setAutoscrolls(true);
            scrollPane.setVerticalScrollBar(vScrollBar);
            add(scrollPane, BorderLayout.CENTER);
               add(items);
               amount = new JTextField(".00");
               amount.setBounds(5, 275, 266, 25);
               amount.setHorizontalAlignment(JTextField.RIGHT);
               amount.setEditable(false);
               add(amount);
          }I'm also having a problem with this one. Apparently, my I uncomment this, the compiler says "cannot find symbol getImage()" which is odd because I've imported the proper package with this method.
private ImageIcon icon = new ImageIcon("BKLogo.gif");
          public void paintComponent(Graphics background)
               background.drawImage(background.getImage(), 0, 0, null);  
               //setOpaque( false );
               //super.paintComponent(background);
               }

You know what you need to do then: post an SSCCE (Short, Self Contained, Correct (Compilable), Example). For info on what this entails, look at these two sites:
http://javafaq.mine.nu/lookup?22
http://www.physci.org/codes/sscce.jsp

Similar Messages

  • At the moment I can use my apple Id on my iPod touch to connect to iCloud and IMessage and FaceTime but it doesn't work on App Store. Face to an error: can not connect to iTunes Store. What's wrong? My apple Id is working on my MacBook Pro as well.

    At the moment I can use my apple Id on my iPod touch to connect to iCloud and IMessage and FaceTime but it doesn't work on App Store & iTunes just on iPod  Face to an error: can not connect to iTunes Store. (Setting... itunes & app store)What's wrong? My apple Id is working on my MacBook Pro as well. And it was working on this iPod before resetting . Just after resetting I can not connect to App Store & iTunes and I can not instal any app even free apps

    Try
    Can't connect to the iTunes Store

  • Got my website up and running but lightbox is not working properly

    Hi Everyone,
    I got my website up and running, but my lightbox isn't working properly. The descriptions of each painting is missing and the arrows and slideshow function is missing. I don't know what I did wrong.
    The link to the website is below.
    http://www.sainteustacefineart.com/Gallery%202.html
    The gallery is supposed to look and function like the gallery in the website linked below.
    http://www.labelsnlogos.com/
    I also did this website, so I'm at a loss as to what went wrong.
    Thanks!
    Ellen

    Okay, I got it working. I forgot to "put" the JS folder (which holds the Clearbox components). Something I overlooked because it was on the bottom of the files window and I didn't see it.

  • Within Music Library can anyone please explain why when I select the option to sort 'Album by Artist' a number of tracks are being treated as separate albums?  How can I correct this?  I have tried to 'drag and drop' but that doesn't work.

    Within music Library can anyone please explain why after I select the option to sort 'Album by Artist' a number of tracks are being treated as separate albums?  How can I fix this?  I have tried to manually correct by 'drag and drop' individual tracks but that doesn't work.  My music library includes a number of repeat album artwork images simply because not all tracks are being listed under the one album making my library more difficult to use than it should.  Any advise would be appreciated.

    See Grouping tracks into albums.
    tt2

  • I transferred my files from a G4 to a new macbook pro, but I can't access my old songs in itunes. I click on the mac tab to access mp3 and acc but it doesn't work. Any suggestions?

    I transferred my files from a G4 to a new macbook pro, but I can't access my old songs in itunes. I clicked on library in itunes and get the mac page to access mp3 and acc files but it doesn't work. Any suggestions?

    They maybe corrupt, try transferring again from the g4. If iTunes is giving you an error then you need to authorize your computer with the same iTunes account as previously. Also, you could try exporting your iTunes library via iTunes on the g4.

  • I click on the Mozilla icon and it will not load. I have tried to uninstall and reinstall but that doesn't work either

    I have tried to open Firefox, but it just sits there and doesn't load. I have tried to uninstall and reinstall but that works for a few hours and then it goes back to not loading. I don't know what else to do to get it too load.

    Right-click on your Windows Taskbar and select Start Task Manager. Look in Task Manager for processes running that are Firefox-related, such as Firefox.exe or plugin-container.exe. If you see either of those, right-click each of them and select "End process". Then try again to start Firefox in [[Safe Mode]]. <br /><br />
    *If Firefox will start in Safe Mode, select the option you are presented with to disable your add-ons and plug-ins and restart Firefox normally. You likely have a plug-in, add-on, or a combination of two or more that is causing the problem. Because Firefox allows users to customize endlessly, sometimes there can be conflicts between customized items. From the Firefox menu bar, go to<br /><br />Tools -> Add-ons<br /><br />then re-enable them one by one, restarting Firefox after each and testing after each one to see which one or combination of two or more is causing the problem. <br /><br />
    *If Firefox will not start in Safe Mode, make sure you again check Task Manager and end any running instances, then uninstall Firefox and download a fresh copy from mozilla.org/firefox using another browser temporarily. Re-install Firefox (see: [[Installing Firefox on Windows]] for more help ) and try running Firefox again.
    Please report back your progress.

  • Dynamic Photo Gallery in Flash using AS3.0 and XML, but it doesn't work and missed up my app.

    Hi,
    I am creating an iPad app using AS3. The app contains three sections.
    One of those sections (chocolate sources)contains Dynamic Photo Gallery using XML. The photos, thumbnails, and text in this section are loaded from XML.
    I faced may issue when I tried to run this app:
    The gallery photos didn't show up
    The thumbnails (buttons to navigate the photo gallery) didn't show up at all. (The thumbnails should show up under the photo gallery box.)
    The text doesn't show up (the text should be in every photo as describtion)
    I want to include Swipe in the photo gallery, how can I do that?
    When I click on "Chocolate Sources" button, the photo gallery appears in every section, here are print screens describe what I mean:
    The photo gallery covers the home screen too.
    Here is my XML:
    <?xml version="1.0" encoding="utf-8"?>
    <sources>
              <section>
                        <details>
                                            Cocoa tree exists in the tropics area, such as Central and South America.
                                  </details>
                                            <image>
                                                      <url>coca1.jpg</url>
                                                      </image>
                                                      </section>
              <section>
                        <details>
                        Cocoa is supplied in many countries such as Indonesia, Ghana, Brazil, Ecuador and Cameroon.
                        </details>
                                  <image>
                                  <url>coca2.jpg</url>
                                  </image>
                                            </section>
              <section>
                                  <details>
                                  Dark chocolate helps to relax and reduce the stress and blood pressure because it has antioxidants elements, which helps in vasodilatory process.
                                  </details>
                                            <image>
                                            <url>coca3.jpg</url>
                                                      </image>
                                                                </section>
              <section>
                        <details>
                        Chocolate provides energy and hyperactive sometimes because it contains high level of caffeine and sugar.
                        </details>
                                  <image>
                                  <url>coca4.jpg</url>
                                            </image>
                                                      </section>
              <section>
                        <details>
                        Chocolate could be mixed with many different flavors, such as mint, strawberry, orange, banana, vanilla, hazelnut, almond, coconut, and etc.
                        </details>
                                  <image>
                                  <url>coca5.jpg</url>
                                  </image>
                                            </section>
              <section>
                        <details>
                                  Chocolate is expressing of well hospitality and good time due to its lovely taste.
                                  </details>
                                            <image>
                                            <url>coca6.jpg</url>
                                                      </image>
                                                                </section>
    </sources>
    And here is my Action Script for "Chocolate Sources" section:
    stop();
    function Choco1(evt:MouseEvent): void {
              gotoAndStop('16');
    choco_btn.addEventListener(MouseEvent.CLICK,Choco1);
    function Souc1 (evt:MouseEvent): void {
              gotoAndStop ('31');
    souc_btn.addEventListener(MouseEvent.CLICK,Souc1);
    function ShopIn1 (evt:MouseEvent):void {
              gotoAndStop('46');
    shops_btn.addEventListener(MouseEvent.CLICK,ShopIn1);
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import fl.motion.MotionEvent;
    import flash.events.MouseEvent;
    import flash.sampler.NewObjectSample;
    import flash.text.TextFormat;
    var xmlLoader: URLLoader = new URLLoader (new URLRequest("sources.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, finishedXmlLoader);
    var xmlFile:XML;
    var xextend:int = 10;
    var gal:galary = new galary ();
              gal.x = 85;
              gal.y = 165;
              addChild(gal);
    var txfe: TextField = new TextField ();
    txfe.x = 25;
    txfe.y = 45;
    var tformat:TextFormat = new TextFormat ();
    tformat.bold = true;
    tformat.color = 0xFFFFFF;
    tformat.size = "18";
    tformat.font = "Arial";
    txfe.defaultTextFormat = tformat;
    addChild(txfe);
    function finishedXmlLoader (e:Event): void{
              xmlFile = new XML (xmlLoader.data);
              var leng:int = xmlFile.image.length();
              txfe.text = xmlFile.image.details[0];
              for (var i:int = 0;i<leng;i++){
                        var b:thumbs = new thumbs ();
                        b.x = xextend;
                        b.y = 480;
                        b.buttonMode = true;
                        b.details = (i+1).toString();
                        addChild(b);
                        b.addEventListener(MouseEvent.MOUSE_OVER, theMosover);
                        b.addEventListener(MouseEvent.MOUSE_OUT, theMosout);
                        b.addEventListener(MouseEvent.CLICK, onMosClick);
                        var bloader:Loader = new Loader();
                        bloader.load(new URLRequest("thumbs/" + (i+1) + ".jpg"));
                        b.addChild(bloader);
                        xextend += b.width + 50;
    var loader:Loader = new Loader ();
    loader.load(new URLRequest ("pictures/coca1.jpg"));
    gal.addChild(loader);
    function theMosover(m:MotionEvent):void{
              m.currentTarget.alpha = 0.5;
    function theMosout (m:MouseEvent):void{
              m.currentTarget.alpha = 1.0;
    function onMosClick(m:MouseEvent):void{
              var loader:Loader = new Loader();
              loader.load(new URLRequest("pictures/" + m.currentTarget.details + ".jpg"));
              gal.addChild(loader);
              txfe.text = xmlFile.image.details[int(m.currentTarget.details) -1];
    I need an urgent help to fix the errors and make this section work well.
    thanks.

    try:
    txfe.text = xmlFile.section[int(m.currentTarget.details) -1].details;
    instead of
    txfe.text = xmlFile.image.[int(m.currentTarget.details) -1];
    and add your thumbs to gal, not the stage.  when you're done with the gallery, remove gal.

  • HT1725 Songs I am downloading are freezing on me. I have contacted apple serveral times an I get no response from them. I have tried to delete the song and reload but that doesn't work either. Does anyone know the answer to my issue?

    Songs that I have downloaded are freezing. I have tried to delete them and redownload, contact itunes store and apple and no one is giving me an answer. Can any one help me?

    I've only been able to get the coaching runs to work on my iPod Nano. They don't work on my iPod Touch or my iPhone.

  • How can I paste album artwork onto iTunes album that is not available on iTunes. I have tried Command c the v and dragging but it doesn't work.

    I have just purchase a new imac and want to insert album artwork onto itunes. This is not available on itunes store. I have tried the command button with c then v and this doesnt work. i have also tried dragging the picture but that doesnt work. Any advice please?

    pstrelliott wrote:
    I have the same problem but your advice did not work for me. Pehaps I do not understand your directions. What do you mean by "go to where you saved the album artwork"? I never had any problem adding new artwork until I installed iTunes version 11.1.3 (8). Now I can't add new artwork anymore. Is there a special file in this version of iTunes where I should be saving the artwork I want to add to make it work? Before I could save it anywhere.
    If you downloaded the artwork from the Internet. It'll be in your downloads folder. Open the folder, and "drag" the image from the folder to the Artwork box in the Info pane as shown:
    When you see the "+" you know it's ready to drop, and it will add the artwork to ALL selected tracks as soon as you click "OK".

  • My Ipad displays a message: Not Enough Storage: This ipad cannot be backed up because there is not enough icloud storage available. You can manage  your storage in settings.... Ive tried closing and settings but it doesn´t work and cant do anything

    My Ipad 3erd Gen... si dsiplayin a message:
    "Not Enough Storage: this ipad cannot be backed up because there is noit enough iCloud storage available. you can manage yor setorage in settings"
    Ihave tride pushing either Close or Settings and it doesnt do anything, i cant shut down or push a command in setteings mode, the message appears to be frozen in the center of the screen!
    HELP!!!!!

    Try a reset:
    Hold the Sleep and Home button down for about 10 second until you see the Apple logo.

  • HT5467 Each time I try to use location appears "CAN NOT DETERMINE LOCATION" I've tried restarting the iPad ,turning on and off , using wifi and cellular but still doesn't work ......is it a problem that Apple fail to advice it's customers?

    Please help. I heard that many users have the same problem with the location service in the iPad. Regardless if they're using wifi or cellular network

    Nevermind, I seem to have solved the issue by going to Time & Date settings and switching the "Set Automatically" switch to off for a few seconds than back on again.

  • My iPhone 5 has suddenly turned itself off and won't turn back on again. My lock button is also broke so holding the lock and home but together doesn't work. Any ideas? i'm desperate

    i can't get it to work, the screen is totally black and i've tried everything including charging, nothing is working

    Take the device to Apple for evaluation and likely replacement as there is obviously a hardware issue.
    I'm always amazed that people will leave with malfunctioning devices.

  • My iTunes is now too big to fit my computer screen. It now wants a resolution of 1024x763. I tried deleting and reinstalling but this doesn't work. How do I get this to fit my computer screen?

    I can't view my iTunes screens the library, store or playlists anymore. Can't download or install anything.

    Resize the window.

  • I just bought a macbook air, I want to cut en paste, but it doesn't work, how can I fix this?

    I just bought a macbook air, I want to cut and paste but it doesn't work.  How can I fix this?

    that all works, no problem. but if I want to devide my songs per genre, it doesn't work.  in itunes you find cut, but I can't select it.  I just can copy my songs or photos.  So I've got everything twice.  Can you explane me how I can do that? cause it's my first Apple computer

  • COMPILES OK! BUT WHY DOESN'T IT RUN?

    Hello,
    I would really really appreciate some assistance on this piece of code. The following program is a simple Bank Account program which allows a user to view either their Savings or Current account details and displays the details. This piece of code compiles fine, but when I try and run it I get an error message:
    Exception in thread "main" java.lang.nosuchmethoderror: main
    I am not sure what this means, but I have a feeling its got something to do with the print_menu method? I am really new to Java and would appreciate some advice?
    I am really sorry if the code is quite messy, i tried using the formatting tags but it doesn't work, or I am not sure if I am doing it correctly.
    import javax.swing.*;
    class BankAccount
         String name;
         String AcNo;
         double deposit;
         BankAccount() {}
         BankAccount(String aName, String aAcNo, double aDep)
              name = aName;
              AcNo = aAcNo;
              deposit = aDep;
         public void setName(String aName)
              name=aName;
         public void setAcNo(String aAcNo)
              AcNo = aAcNo;
         public void setDeposit(double aDep)
              deposit = aDep;
         public String getName()
              return name;
         public String getAcNo()
              return AcNo;
         public double getDeposit()
              return deposit;
         public double withDrawCash(double cash)
              if (cash <=deposit)
                   deposit = deposit-cash;
                   return(cash);
              else
              System.out.println("Not enough money in your account!");
              return (0);
    public double DepositCash(double amount)
              if (amount >0.00)
                   deposit = deposit+amount;
                   return(amount);
              else
                   System.out.println("Must be Positive number");
                   return (0);
         public class cw13
              String t_option;
              int option;
              BankAccount myCurrentAc = new BankAccount("Rita", "553398", 2000);
              BankAccount mySavingsAc = new BankAccount ("Rita", "665522", 4000);
              BankAccount_with_statement Rita = new BankAccount_with_statement("Rita, 665522, 4000");
              public void main (String args [])
                   String t_choice=JOptionPane.showInputDialog(null, "***Welcome to Personal Banking***\n\n" + "Please select account:\n" + "1. Current Account \n" + " 2. Savings Account" );
                   int choice=Integer.parseInt(t_choice);
                   print_menu(option);
    public void print_menu(int option)
    if (option==1)
                   t_option=JOptionPane.showInputDialog(null,"Please enter your Account Number for your Current Account:");
                   option=Integer.parseInt(t_option);
    if (option==553398)
              t_option=JOptionPane.showInputDialog(null, "Below are your details for your current account \n" + "\n Balance:"+ myCurrentAc.getDeposit() + "\n Name: "+ myCurrentAc.getName() +"\n AcNo:" + myCurrentAc.getAcNo() + "\n What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money\n" + "5. Deposit Money");
              option=Integer.parseInt(t_option);
         else if(option!=553398)
              t_option=JOptionPane.showInputDialog(null, "Invalid Account Number, Please try again");
              option=Integer.parseInt(t_option);
    if(option ==2)
                   t_option=JOptionPane.showInputDialog(null, "Below are your details for your Savings Account \n" + "\n Balance:" + mySavingsAc.getDeposit() + "\n Name: "+ mySavingsAc.getName() + "AcNo:" + mySavingsAc.getAcNo() + "\n What What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money �20\n" + "5. Deposit Money �50");
                   option=Integer.parseInt(t_option);
    if(option==4)
              String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Withdraw from your Current Account? \n");
              int cash = Integer.parseInt(c_cash);
              myCurrentAc.withDrawCash(cash);
              JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
    if(option==5)
              String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Deposit into your Current Account? \n");
              int cash= Integer.parseInt(c_cash);
              myCurrentAc.DepositCash(cash);
              JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
    if (option==6)
              myCurrentAc.DepositCash(50);
              JOptionPane.showMessageDialog(null, "Your new balance is: " + myCurrentAc.getDeposit());

    I did...I understand that I need to..but still get
    errors!It works for me..
    Havent really read the code, too messy.
    But you need to implement BankAccount_with_statement before you can use it, so i just comented it away,added static, and it runs fine.
    You have to make everyting that runs in main static first..., or move'em into main.
    import javax.swing.*;
    public class cw13 {
        static String t_option;
        static int option;
    static BankAccount myCurrentAc = new BankAccount("Rita", "553398", 2000);
    static BankAccount mySavingsAc = new BankAccount ("Rita", "665522", 4000);
    //BankAccount_with_statement Rita = new BankAccount_with_statement("Rita, 665522, 4000");
    public static void main (String args [])
    String t_choice=JOptionPane.showInputDialog(null, "***Welcome to Personal Banking***\n\n" + "Please select account:\n" + "1. Current Account \n" + " 2. Savings Account" );
    int choice=Integer.parseInt(t_choice);
    print_menu(option);
    public static void print_menu(int option)
    if (option==1)
    t_option=JOptionPane.showInputDialog(null,"Please enter your Account Number for your Current Account:");
    option=Integer.parseInt(t_option);
    if (option==553398)
    t_option=JOptionPane.showInputDialog(null, "Below are your details for your current account \n" + "\n Balance:"+ myCurrentAc.getDeposit() + "\n Name: "+ myCurrentAc.getName() +"\n AcNo:" + myCurrentAc.getAcNo() + "\n What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money\n" + "5. Deposit Money");
    option=Integer.parseInt(t_option);
    else if(option!=553398)
    t_option=JOptionPane.showInputDialog(null, "Invalid Account Number, Please try again");
    option=Integer.parseInt(t_option);
    if(option ==2)
    t_option=JOptionPane.showInputDialog(null, "Below are your details for your Savings Account \n" + "\n Balance:" + mySavingsAc.getDeposit() + "\n Name: "+ mySavingsAc.getName() + "AcNo:" + mySavingsAc.getAcNo() + "\n What What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money �20\n" + "5. Deposit Money �50");
    option=Integer.parseInt(t_option);
    if(option==4)
    String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Withdraw from your Current Account? \n");
    int cash = Integer.parseInt(c_cash);
    myCurrentAc.withDrawCash(cash);
    JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
    if(option==5)
    String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Deposit into your Current Account? \n");
    int cash= Integer.parseInt(c_cash);
    myCurrentAc.DepositCash(cash);
    JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
    if (option==6)
    myCurrentAc.DepositCash(50);
    JOptionPane.showMessageDialog(null, "Your new balance is: " + myCurrentAc.getDeposit());
    }

Maybe you are looking for

  • Convert Web Page to PDF

    We have an internal web based system in which we would like to 'print' one of the screens as a report.  However, when we use the Convert Web Page to PDF option, the resulting PDF doesn't look anything close to the web page.  We are wanting to use the

  • Setting up Designer Margins for Printing

    Good Afternoon, I'm sure this is a dumb question, but I continually find that my form pages are outside of the normal print margins for a standard 8.5in x 11in paper. So far the only solution I have found is to select "Pagearea1" underneath "Master P

  • Help about query performance -Thanks

    Hi I have a j2ee web application with oracle database. I finish the function implementation by put all caculaton inside oracle query ( funciton (todayData - avg(historical data )) / std(historical data) and using group by and sub query .but performan

  • Infoset data grouping for SAP Query

    Hi, I'm pretty new to SAP R/3 (4.7) and have a query that I think relates to Infoset rather that SAP Query. I have two tables to join but the right hand table (it's a left outer join), needs to be summarised to reduce to unique records on each side o

  • Require "acrostan.itw" from Acrobat 7 Standard CD

    Can someone send to me by-email please? Send to [email protected] Thanks