Please help with the URL class

Hello,
I am trying to write a Java app that will take a url and download it.
I believe you can do this with the URL class but I don't understand how to. For example, if the http url location points to a picture file, how would I code the app to retrieve this picture and save it to a specified directory?
Also, is there a way that my java app could open another program, let's say Microsoft Internet Explorer?
Please be as specific as possible, thanks!

You'll see below an example to download a file
private static String copyFile (String url, String nomFichier){
     // construction du fichier de sortie
     File outputFile = new File(repertoire + "\\fichiers\\" + nomFichier);
     // si le fichier existe d�j�, il ne sert � rien de le t�l�charger !
if (outputFile.exists())
     return "fichiers/" + nomFichier;
          try {     
     HttpURLConnection connect = (HttpURLConnection)new URL(url).openConnection();
boolean connected = false;
while (!connected){
try {
connect.connect();
connected = true;
     catch (java.io.IOException e1) { System.out.print("...Tentative de connection"); }     
DataInputStream reader = new DataInputStream(
connect.getInputStream());
     FileOutputStream out = new FileOutputStream(outputFile);
     int length = 1024;
     byte[] buf = new byte[length];
     int offset = 0;
     long offsetCourant = 0;
     int nb=0;
     while ((nb=reader.read(buf,offset,length))!= -1) {
          out.write(buf,0,nb);
     out.close();
     catch (java.net.MalformedURLException e) { System.out.println("pb d'url"); }
     catch (java.io.IOException e1) { System.out.println(e1.getMessage()); }
     return "fichiers/" + nomFichier;
}

Similar Messages

  • Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be ab

    Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be able to download the srtony adobe.

    Adobe - Lightroom : For Macintosh
    Hal

  • First Time With The URL Class

    Okay, I've been exploring the various classes available in Java, in the hope of building a web-indexer (more as an exercise in Java than anything useful). However, I've been snagged fairly early on, in that I can't even call the class constructor...
    Here's what I've got so far, for the class (called WebDoc):
    import java.net.URL;
    public class WebDoc {
        WebDoc( URL myURL) {
            System.out.println("This method works");
    }and for the test program:
    import WebDoc.*;
    public class WebIndexerTest1 {
        public static void main(String[] args) {
            WebDoc myDoc = new WebDoc("http://www.dcs.shef.ac.uk/~martin/test1.htm");
    }The WebDoc class has compile successfully, and is in the WebDocClass folder, in the correct place.
    At the moment, it throws the error:
    WebIndexerTest1.java [5:1] cannot access WebDocClass.WebDoc
    bad class file: C:\Documents and Settings\Joseph Lloyd\My Documents\Uni\OOPing\WebIndexer\WebDocClass\WebDoc.class
    class file contains wrong class: WebDoc
    Please remove or make sure it appears in the correct subdirectory of the classpath.
            WebDoc myDoc = new WebDoc("http://www.dcs.shef.ac.uk/~martin/test1.htm");
            ^
    1 errorwhich I assume means it can't find the WebDoc class. I can't see why not though. Can anyone help me out with this? I'm pretty sure it's something fairly obvious, but unfortunately not to me...

    Cheers for the input, especially about packages. It's been quite a bit since I last touched Java, and I've forgotten most of the syntax.
    After looking over the code, it's now modified to the following, but still throws up the original error that prompted me to start messing about with importing (for some reason). The WebDoc code is identical to before, but the test program has changed:
    import java.net.URL;
    public class WebIndexerTest1 {
        public static void main(String[] args) {
            String myString = "http://www.dcs.shef.ac.uk/~martin/test1.htm";
            URL myURL = new URL(myString);
            WebDoc myDoc = new WebDoc(myURL);
    }However, it still throws the following error, and I have, after perusing the documentation and help files, no idea on how to deal with it (I assume I should have some kind of exception handler there, but I don't see why the URL class is throwing the exception in the first place...):
    WebIndexerTest1.java [6:1] unreported exception java.net.MalformedURLException; must be caught or declared to be thrown
            URL myURL = new URL(myString);
                        ^
    1 error
    Errors compiling WebIndexerTest1. Any further help would be greatly appreciated, as this has been winding me up all day, and I apologise in advance if I'm displaying excessive stupidity in not noticing glaring errors...
    Cheers

  • I need help with the https class please.

    Hello, i need add an authentication field in my GET request using HTTPS to authenticate users. I put the authentication field using the setRequestProperty method, but it doesn't appear when i print all properties using the getRequestProperties method. I wrote the following code:
    try{
    URL url = new URL ("https://my_url..");
    URLConnection conexion;
    conexion = url.openConnection();
    conexion.setRequestProperty("Authorization",my_urlEncoder_string);
    conexion.setRequestProperty("Host",my_loginServer);
    HttpsURLConnection httpsConexion = (HttpsURLConnection) conexion;
    httpsConexion.setRequestMethod("GET");
    System.out.println("All properties\r\n: " + httpsConexion.getRequestProperties());
    }catch ....
    when i run the program it show the following text:
    All properties: {Host=[my_loginServer]}
    Only the Host field is added to my HttpsURLConnection. The authentication field doesnt appear in standar output. How can i add to my HttpsURLConnection an Authentication field?
    thanks

    I have moved this to the main Dreamweaver forum, as the other forum is intended to deal with the Getting Started video tutorial.
    The best way to get help with layout problems is to upload the files to a website and post the URL in the forum. Someone can then look at the code, and identify the problem. Judging from your description, it sounds as though the Document window is narrow, which would result in the final menu tab dropping down to the next row. Try turning on Live view or previewing the page in a browser. Design view gives only an approximate idea of the final layout. Live view renders the page as it should look in a browser.

  • Please help with the GUI quiz question!

    Hi Folks,
    Please help me with the code for the following GUI.
    The display window of the application should have two panels at the top level (you could have multiple panels contained within a top-level panel). The first top level panel should have a grid or a border layout and should include apart from various label objects: 1) a textfield to store the info entered, 2) a combobox 3) a combobox or a list box , 4) a radio-button group , 5) a combo box 6) checkboxes for additional accessories, and 7) checkboxes .
    The second top-level panel that is placed at the bottom of the window should have a submit button, a clear button and a textarea for output.
    Thanks a lot.

    Please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.
    Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
    Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
    Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.
    If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.
    Help us help you solve your problem.

  • Can anyone please help with the 2.3 update in UK?

    Can anyone please help?  I have an unbranded x10 in the UK.  PC companion constantly tells me my phone software is up to date (with android 2.1) so I cannot upgrade to 2.3.  I've tried all the tips on the SE support page like deleting the database content and looking for the setting to update the phone next time it's connected which doesn't exist (very informative SE!).  I'm not keen on this independent software installation through the rapidshare download, it seems full of glitches looking at the forums.  http://www.sonyericsson.com/update/?lc=en&cc=gb&pid=xperiax10  This link clearly tells us the update is available through PC companion, no joy for me though.  Any help is welcome.

    Have a look at this and check your version number see if its listed
    http://forum.xda-developers.com/showthread.php?t=1186045
    As for generic roms you have probable read about custom roms
    See this thread it is a stock SE rom not a custom rom and will give you just that a stock SE rom if you want
    http://talk.sonyericsson.com/thread/19762

  • Roberto or other guys please help with the terminology!

    Hi Roberto, when you say In addition to V1 and V2 update, synchronous and asynchronous update from the application documents, you have to perform the V3 update (to download your records from delta queue to extraction queue) that you can schedule , I am a little confused.
    Let me be clear about the terminlogy. Are V1/synchronous/ Direct delta update the same. Are V2/asynchronous/queued delata the same. Can V3 be of 2 types? serialised and unserialised.
    Thanks in advance.
    simmi

    hey Roberto,
    Great! I really appreciate you sending me the Doc. How can I repay your help? Anyhow i will allott full points to you.
    one more help, actually I have been trying to access the SAP help online. but the URL's ending with frameset.htm or index.htm are not openeing up. For example,
    http://help.sap.com/saphelp_nw04/helpdata/en/91/270f38b165400fe10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/bb/bdd69f856a67418962d74bfd7bd8af/frameset.htm
    Is ther any thing that i need to set in my explorer settings?
    simmi

  • Help with the Date class

    I have researched the documentation for this class, and find three constructors. One that is deprecated, one that creates a null Date object, and one that requires an explicit parameter-- a long integer which represents the amount of time in milliseconds that has passed since some day in 1970.
    I have imported the java utility with this bit of code,
    import java.util.*;For some reason, however, I am unable to construct a proper date object. I have passed it all different kinds of integers, but to no avail. Can anyone help me understand the documentation a little better so I can figure out what parameter it wants?

    I have researched the documentation for this class, and find three constructors.I find six.
    One that is deprecated,Four that are deprecated.
    one that creates a null Date object,No it doesn't. Would it make sense for a constructor to create a null?
    and one that requires an explicit parameter-- a long integer which represents the amount of time in milliseconds that has passed since some day in 1970.Yup, that's right.
    The Date constructor that doesn't take a parameter
    Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.
    Not null.
    Instead of java.util.Date, it is usually appropriate to use java.util.Calendar and its concrete subclass java.util.GregorianCalendar.
    The static method Calendar.getInstance()
    Gets a calendar using the default time zone and locale. The Calendar returned is based on the current time in the default time zone with the default locale.
    See the documentation for other methods which allow you to manipulate the Date represented by the instance of Calendar.
    luck, db

  • Please help with correcting calling class and method errors

    Hi All,
    I have created a game (like battleship) for 2 tanks. I can't seem to connect the classes and methods to get the values for the last die face rolled; last direction rolled on a 4 headed dice; the x and y position for each tank; the armour value and the firePower (or hit value) to print.
    Each row of these values is supposed to print 50 times using a while loop.
    (N.B. The code is appended below my name.)
    Could anyone please help me? I would be most grateful. Thank you.
    Steve
    import java.util.*;
    class Client
    static Die die;
    static Direction dir;
    static Tank tk1;
    static Tank tk2;
    public static final
    void main( String[] argv)
    die = new Die();
    dir = new Direction();
    tk1 = new Tank();
    tk2 = new Tank();
    int lastFace;
    int setfaceLast;
    int x;
    int y;
    int armourVal;
    int firePower;
    int battleNum=0;
    int battles;
    int moves = 0;
    System.out.println("Tank");
    System.out.println("'\t' Number");
    System.out.println("'\t' Dir");
    System.out.println("'\t' xValue");
    System.out.println("'\t' yValue");
    System.out.println("'\t' Armour");
    System.out.println("Firepower"+'\n');
    int i=0;
    //int getLastFace();
    //int LastDirName();
    while (i <= 50);
    int XPos;
    int YPos;
    Pos p = new Pos();
    p.setXPos(x);
    p.setYPos(y);
    System.out.println ("'\t' Tank 1-");
    //System.out.println ( die.getLastFace());
    //System.out.println( dir.getLastDirName());
    System.out.println(Pos(x));
    System.out.println(Pos(y));
    System.out.println(armourVal);
    System.out.println(firePower+'\n');
    System.out.println ("Tank 2-");
    System.out.println ( lastFace);
    //System.out.println(LastDir);
    System.out.println(x);
    System.out.println(y);
    System.out.println(armourVal);
    System.out.println(firePower+'\n');
    moves++;
    System.out.println(" '\n' + BATTLE");
    class Tank
    public static final int MINGRID;
    public static final int MAXGRID;
    static Die die = new Die();
    static Direction dir = new Direction();
    private static int battleCount;
    private static int moveCount;
    private int x;
    private int y;
    private int armourVal;
    private int firePower;
    public Tank()
    int MINGRID=-10;
    int MAXGRID=10;
    battleCount=0;
    moveCount=0;
    x=0;
    y=0;
    armourVal=10;
    firePower=1;
    public
    int getmove()
    die.roll();
    dir.roll();
    dir.getLastDir();
    die.getLastFace();
    int x;
    int y;
    int Pos;
    switch( dir.getLastDir() )
    case Direction.UP:
    y += die.getLastFace();
    break;
    case Direction.DOWN:
    y -= die.getLastFace();
    break;
    case Direction.RIGHT:
    x += die.getLastFace();
    case Direction.LEFT:
    x-= die.getLastFace();
    break;
    if ( x > MAXGRID )
    x = (2 * MAXGRID) - x;
    else if ( x < MINGRID )
    x = (-2 * MINGRID) - x;
    if ( y > MAXGRID )
    y = (-2 * MAXGRID) - y;
    else if ( y < MINGRID )
    y = (-2 * MINGRID) - y;
    if ( x == -3 && y == -3 )
    firePower++;
    System.out.println("Yipee - more firepower.");
    if ( x == 3 && y == 3)
    this.armourVal += 10;
    System.out.println("Yipee - more armour.");
    return Pos;
    //printDetails();
    public boolean getcontinueBattle(Tank tk2)
    moveCount++;
    if ( x == tk2.x && y == tk2.y)
    battleCount++;
    System.out.println("Battle");
    tk2.armourVal -= firePower;
    armourVal -= tk2.firePower;
    if (tk2.armourVal < 0 )
    int moveCount, battleCount;
    return false;
    if ( armourVal < 0 )
    int moveCount, battleCount;
    return false;
    return true;
    public int getprintDetails()
    int ptDet;
    return ptDet;
    class Direction
    private int lastFaceDir;
    private Random rnd;
    public static final int UP = 1;
    public static final int DOWN = 2;
    public static final int LEFT = 3;
    public static final int RIGHT = 4;
    String direction;
    private
    int getRandomNum()
    int raw = rnd.nextInt();
    raw = Math.abs( raw );
    raw %= 4;
    raw++;
    return raw;
    public
    Direction()
    rnd = new Random();
    roll();
    public
    int roll()
    lastFaceDir = getRandomNum();
    if (lastFaceDir == UP)
    direction = "up";
    else if (lastFaceDir == DOWN)
    direction= "down";
    else if (lastFaceDir == LEFT)
    direction = "left";
    else if (lastFaceDir == RIGHT)
    direction= "right";
    return lastFaceDir;
    public
    int getLastFaceDir()
    return lastFaceDir;
    }// end class
    class Die
    private int lastFace;
    private Random rnd;
    private
    int getRandomNum()
    int raw = rnd.nextInt();
    raw = Math.abs( raw );
    raw %= 6;
    raw++;
    return raw;
    public
    Die()
    rnd = new Random();
    roll();
    public
    int roll()
    lastFace = getRandomNum();
    return lastFace;
    public
    int getLastFace()
    return lastFace;
    }// end class

    I got this sorted!
    I unzipped the JAR and loaded the classes individually - so now the "reference" issue went away. Instead I now have a new problem, but I will post that seperately.

  • Please help with the query (INSERT RETURNING BULK COLLECT INTO)

    I am trying to write a query inside the C# code where I would insert values into a table in bulk using bind variables. But I also I would like to receive a bulk collection of generated sequence number IDs for the REQUEST_ID. I am trying to use RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs clause where :REQUEST_IDs is another bind variable
    Here is a full query that use in the C# code
    INSERT INTO REQUESTS_TBL(REQUEST_ID, CID, PROVIDER_ID, PROVIDER_NAME, REQUEST_TYPE_ID, REQUEST_METHOD_ID, SERVICE_START_DT, SERVICE_END_DT, SERVICE_LOCATION_CITY, SERVICE_LOCATION_STATE, BENEFICIARY_FIRST_NAME,
    BENEFICIARY_LAST_NAME, BENEFICIARY_DOB, HICNUM, CCN, CLAIM_RECEIPT_DT, ADMISSION_DT, BILL_TYPE,
    LANGUAGE_ID, CONTRACTOR_ID, PRIORITY_ID, UNIVERSE_DT, REQUEST_DT, BENEFICIARY_M_INITIAL,
    ATTENDING_PROVIDER_NUMBER, BILLING_NPI, BENE_ZIP_CODE, DRG, FINAL_ALLOWED_AMT, STUDY_ID, REFERRING_NPI)
    VALUES
    (SQ_CDCDATA.NEXTVAL, :CIDs, :PROVIDER_IDs, :PROVIDER_NAMEs, :REQUEST_TYPE_IDs,
    :REQUEST_METHOD_IDs, :SERVICE_START_DTs, :SERVICE_END_DTs, :SERVICE_LOCATION_CITYs,
    :SERVICE_LOCATION_STATEs, :BENEFICIARY_FIRST_NAMEs, :BENEFICIARY_LAST_NAMEs, :BENEFICIARY_DOBs,
    :HICNUMs, :CCNs, :CLAIM_RECEIPT_DTs, :ADMISSION_DTs, :BILL_TYPEs, :LANGUAGE_IDs,
    :CONTRACTOR_IDs, :PRIORITY_IDs, :UNIVERSE_DTs, :REQUEST_DTs, :BENEFICIARY_M_INITIALs,
    :ATTENDING_PROVIDER_NUMBERs, :BILLING_NPIs, :BENE_ZIP_CODEs, :DRGs, :FINAL_ALLOWED_AMTs,
    :STUDY_IDs, :REFERRING_NPIs) RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs
    However, when I run this query, it gives me a strange error ORA-00925: missing INTO keyword. I am not sure what that error means since I am not missing any INTOs
    Please help me resolve this error or I would appreciate a different solution
    Thank you

    You cannot use (and do not want to in this case) the BULK COLLECT.
    create table for_testing
       the_id      number not null primary key,
       some_data   number
    declare
       l_return_value for_testing.the_id%type;
    begin
      4 
       insert into for_testing
          the_id,
          some_data
       values
          1,
          5
       returning the_id into l_return_value;
       dbms_output.put_line('the return values is ' || l_return_value);
    end;
    20  /
    the return values is 1
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.02
    TUBBY_TUBBZ?Is a simple example. In the future, please use the tags to preserve formatting on your code like i have so it remains readable .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Please help with the versioncue problem.

    I know this is not the right place to post this but please, I need fast help. When I open a project in Photoshop CS3 it says "Cannot find the missing module blablabla versioncue.dll". I've searched around a little and found someone who said that 2 updates would fix it. I downloaded the updates but when I started to install it said "Can't find the product to update".
    For some extra info, I just reformated comp and I've considered it might be something about missing files or something and if so, can someone add [email protected] and send to me because this is important. This is also because I have a schoolproject where Photoshop will be needed.
    I'm also suspicious if I actually have the documents and settings files for CS3 since I only copied the whole files from programs when I reformated it.
    Please help!

    >since I only copied the whole files from programs when I reformated it.
    you need to do a full install from the original discs david. simply copying the files won't do it.

  • Please help with the understanding of aspect ratio!!!

    Hi all,
    I'm trying to get my head around the 'aspect ratio' thing if anyone can help.
    To give an example, I have imported footage in FCE and in the details of the file it states:
    Pixel Aspect: PAL - CCIR 601
    Frame size: 720 x 576
    What exactly can I earn from the above information?
    I gather this is not widescreen but I would like the end film to be. Do I have to 'crop' this? If so, how!?
    And how do I make sure the picture looks right on a widescreen TV (so the people don't look squashed, say)?
    Many thanks in advanced for the wisdom passed on!
    Adam
    Oh and should i be thinking about this before I'm about to import from a Mini DV cam? As in settings...
    Message was edited by: Vegas Superstar

    If you check the anamorphic box on a 4:3 clip you will see some kind of distortion.
    In general you choose your setup accordingly with the way your footage has been shot.
    In the article you found that iDVD doesn't recognize the "anamorphic" flag that your footage can have in FCE.
    Therefore your exported material must be "arranged" so that you tell iDVD you have a 16:9 movie.
    When you work entirely in anamorphic 16:9 in FCE (your footage was shot in 16:9 and have the anamorphic flag on), when you export the sequence using export to quick time movie, you'll get a 720x576 PAL movie. Because iDVD will not translate the anamorphic flag, you have to manually change the movie size to 1024x576 for PAL, so that your resultant movie will be keeping the 16:9 aspect ratio.
    The native widescreen doesn't use such flag and the video is already at 16:9 aspect ratio.
    That's has to deal with pixel that are rectangular and not square as computer uses.
    I guess someone else will be more specific and detailed on this.
    Regards,
    Armando.

  • Please help with the sql logic

    The below is going to be a record set from for a view from the FROM CLAUSE
    1. Find component DOCUMENT where the document type = Square Metres (DOC.UOM_STD_ID = 'METR_MTR) If any components are found, retrieve the Document records for these components ONLY.
    2. Otherwise, if no components exist with a Document type = Square Metres, look for components with a Document type of Acres (DOC.UOM_STD_ID = 'ACRE'). If found, retrieve the Space Lease records for these components ONLY.
    3. Otherwise, if the Document does not have components with a type = Square Metres or Acres, look for components with the type of (DOC.UOM_STD_ID = 'PARK'). Then retrieve the departments associated with these parking components.
    For Space Lease records above, retrieve the associated Org ID (SPACE.SPORG).
    Return all departments where
    the associated Org Type (ORG.ORGCLASS) = 'NON'
    or the associated Org Type (ORG.ORGCLASS) = 'GD'
    Thank you

    maybe something like:
    SQL> select emp.empno, emp.ename, emp.deptno
      2    from emp,
      3         (select case when (select 1 from emp where deptno = 10 and rownum  = 1) = 1 then 1
      4                      when (select 2 from emp where deptno = 60 and rownum  = 1) = 2 then 2
      5                      else 3
      6                 end case_col
      7            from dual) d1
      8   where deptno = decode(d1.case_col,1,10,
      9                                     2,60,
    10                                     3,70);
         EMPNO ENAME          DEPTNO
          7839 KING               10
          7782 CLARK              10
          7934 MILLER             10
    SQL> in you code it will be something like:
    select ...
       from document t1,        
            (select case when (select 1 from document doc where DOC.UOM_STD_ID = 'METR_MTR' and rownum  = 1) = 1 then 1
                         when (select 1 from document doc where DOC.UOM_STD_ID = 'ACRE' and rownum  = 1) = 2 then 2
                         else 3
                    end case_col
               from dual) d1
    where t1.uom_std_id = decode(d1.case_col,1,'METR_MTR',
                                             2,'ACRE',
                                             3,'PARK',
                                               null);note: untested

  • Please help with the FOR loop and the array..

    I was trying to place some words in the Movie Clip
    "TextPanel" and set a
    random position to each of them.
    But it's not working.
    1) I created a Movie Clip "word" and inside that MC I created
    a text field
    and gave it an identifier "textFiled".
    2) The linkage name for Movie Clip "word" I set to "word".
    3) In the actionscript I created an Array called "aWords".
    4) Then I created a FOR loop that should
    place (attach) Movie Clips "word0", "word1", "word2" and
    "word3" to the
    movie clip TextPanel, and set the textField text for each of
    them to the
    text from the Array.
    But the script attaches 4 Movie Clips with a name
    "Undefined", instead of 4
    different names (from the Array).
    What is wrong with this script?
    var aWords:Array = [apple,banana,orange,mango];
    for(i=0;i<aWords.length;i++){
    var v = TextPanel.attachMovie("word","word"+i,i);
    v.textFiled.text = aWords
    v._x = randomNumber(0,Stage.width);
    v._y = randomNumber(0,Stage.height);
    Thanks in advance

    But in my Post I already wrote v.textFiled.text = aWords
    so I don't understand what were you correcting..
    And one more:
    I have tested it by changing the
    v.textFiled.text = aWords; to v.textFiled.text = "some
    word";
    and it's working fine.
    So there is something wrong with the Array element, and I
    don't know why..
    "aniebel" <[email protected]> wrote in
    message
    news:ft2d5k$lld$[email protected]..
    > Change:
    > v.textFiled.text = aWords;
    >
    > to:
    > v.textFiled.text = aWords
    >
    > It needs to know which element inside the array you want
    to place in the
    > textfield (or textfiled) :)
    >
    > If that doesn't work, double check that your instance
    name is correct
    > inside
    > of "word".
    >

  • Please help with writing a class

    i need help getting started with this assignment. i haven't done anything with writing classes, so i don't know where to start.
    i need to create a bank account class that will keep a name, balance, up to 50 deposits, and up to 50 withdrawls. i need to include 2 arrays for the deposits and withdrawls.
    Here's what i know:
    I need a constructor that takes zero arguments. This constructor would initialize the numeric value to zero.
    I need a 2nd constructor that takes one argument, a name as a String value. This constructor would initialize the numeric value to zero.
    I need a 3rd constructor that takes two arguments, a name as a String value and a starting "balance" as a double value

    Sorry, I was watching a movie with my wife ...imagine that. Study my examples here and try to understand what I have done. You will follow the same methodology for the rest of the program. Use main to test the methods in your program.
    public class mdlAccount {
      String name;
      double balance;
      int currentDeposit = 0;
      int currentWithdrawl = 0;
      double[] deposits = new double[50];
      double[] withdrawals = new double[50];
      public mdlAccount() {
        name = "";
        balance = 0.0;
      public mdlAccount(String name) {
        this.name = name;
        balance = 0.0;
      public mdlAccount(String name, double balance) {
        this.name = name;
        this.balance = balance;
      // When the instructor says: Have a method that does deposits...
      // You need to create a method, similar to the constructors,
      // but with a return value, even if it returns void (nothing).
      // Like this:
      public void deposit( double amount ) {
        // Do some error checking.
        if ( currentDeposit < 50 && amount > 0 ) { // > is a greater than sign
          // If all is ok, add to the balance...
          balance += amount;
          // and add the entry to the array of deposits
          deposits[currentDeposit] = amount;
          // Finally, add 1 to the currentDeposit variable.
          currentDeposit++;
      // We need the 'return the balance' method so we can see if
      // the program runs correctly. This time we return a double,
      // instead of void. (void means don't return anything at all).
      public double getBalance() {
        return balance;
    // Now you create the next method for withdrawals...
    //  if ( currentWithdrawl < 50 ) {
    //    deposits[currentWithdrawl] = amount;
    //    currentWithdrawl++;
      // You want a main method so this class can be executed.
      // You can remove it later if you want to use this class
      // from within another larger program.
      public static void main(String[] args) {
        mdlAccount acct = new mdlAccount( "GumB", 100.0 );
        System.out.println("Initial balance is " + acct.getBalance());
        acct.deposit( 50.0 );
        System.out.println("Current balance is " + acct.getBalance());

Maybe you are looking for

  • IPod Shuffle 4th Generation not charging

    I have a iPod Shuffle 4th Generation and it is not charging. I have it plugged into my macbook and it showing up in itunes and has a blinking orange light. When I remove the shuffle and turn it on there is no light. I have tried restoring the shuffle

  • Process not listed in Workspace when domain is webcenter enabled

    Hi I am trying to integrate Process Space with BPM 11g. I have installed SOA, BPM, Webcenter and have also created a domain which has all these enabled. I have linked discussion, wiki and content to the web center space and also can see the process s

  • How to exempt vendor from 1099 reporting

    Hi All, On the vendor master, Accounting information tab, we have fields "Exemption number,Valid until and exemption authority" with respect to withholding tax. As per my understanding if we enter these fields, then that particular vendor should not

  • How do i get to a previous backup

    I need to restore a previous icloud backup.  How do I do that?

  • InDesign trial on top of CS 2.3 -- will I hate myself in the morning?

    I have CS 2.3 but need InDesign 3 for a project. I want to upgrade to CS 3 but can't yet, so am playing with the option of downloading the InDesign 3 trial for now. What kind of problems am I going to run into?? And is it worth it?