Results 1 to 5 of 5
  1. #1
    Urgle is offline Member
    Join Date
    Oct 2008
    Posts
    30
    Rep Power
    0

    Default Images in AWT frame

    how can I put an image in an AWT frame that is run outside of an applet?

    Heres the code for my frame:
    Java Code:
    Frame f=new Frame("Music Info:");
          f.setBackground(Color.yellow);
          f.setVisible( true );  
          TextArea textArea=new TextArea("Come Clarity by In Flames",2,30);
          textArea.setEditable(False);
          f.add(textArea);
          f.setLayout(new FlowLayout());
          f.setSize(250,250);

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Just curious, why AWT and not Swing? One reason for the question: I know Swing but really don't know AWT, and from what I know, most don't use it as much.

  3. #3
    Urgle is offline Member
    Join Date
    Oct 2008
    Posts
    30
    Rep Power
    0

    Default

    im using AWT because I am being taught in that form. I have no idea how to use swing and I dont have the time to relearn java.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    From your question
    > how can I put an image in an AWT frame that is run outside of an applet?
    I'll have to guess that you do know how to put an image in an Applet.

    For a standalone AWT application, you would use a Canvas and override paint(Graphics g) in exactly the same way as for an Applet. Then add the Canvas to the Frame, using an appropriate Layout Manager.

    And if you're spending money to be taught AWT and not Swing, you're being ripped off. AWT is legacy. Swing has been around long enough that it should be used for all new applications.

    db

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Urgle View Post
    im using AWT because I am being taught in that form. I have no idea how to use swing and I dont have the time to relearn java.
    Not a huge thing to learn Swing lol. Just read about Swing on the Suns' official web site. Java Swing

Similar Threads

  1. Getting internal frame out
    By rad in forum New To Java
    Replies: 8
    Last Post: 08-11-2008, 03:33 AM
  2. Frame to other Frame
    By Aswq in forum New To Java
    Replies: 2
    Last Post: 07-19-2008, 05:27 PM
  3. close a frame..
    By tajinvillage in forum New To Java
    Replies: 5
    Last Post: 04-27-2008, 11:22 PM
  4. Frame Query
    By Daniel in forum AWT / Swing
    Replies: 1
    Last Post: 07-05-2007, 07:27 PM
  5. Frame problems
    By gary in forum AWT / Swing
    Replies: 2
    Last Post: 06-20-2007, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •