Results 1 to 12 of 12
  1. #1
    ashton is offline Member
    Join Date
    Jan 2009
    Posts
    31
    Rep Power
    0

    Default just wanna ask about images...

    Hi guys!!

    I just want to ask this:

    "does java only support a 'xxx.gif' image file only???
    coz i tried uploading 'xxx.jpg' images, but i dont get any output..."

    what should i do??? *any suggestions would be very very helpful*:)

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    upload where? be more specific please.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  3. #3
    ashton is offline Member
    Join Date
    Jan 2009
    Posts
    31
    Rep Power
    0

    Default ...

    Oh, sorry... just tryin to upload it on a button or a label...
    something like that...

    in other words, how can I upload Images or pictures into a
    swing?

  4. #4
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    Do you mean how to add a pic to a button/label?
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  5. #5
    ashton is offline Member
    Join Date
    Jan 2009
    Posts
    31
    Rep Power
    0

    Default ..

    yeah! yeah! Exactly??? do you know how???

    please help???:confused:

  6. #6
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    not sure about jpg, why don't u just convert it to gif.

    Java Code:
    JButton jbtOK = new JButton("OK");
    jbtOk.setIcon(new ImageIcon("ok.gif"));
    jbtOk.setPressedIcon(new ImageIcon("pressed.gif"));
    jbtOk.setRolloverIcon(new ImageIcon("rollover.gif"));
    Last edited by angryboy; 01-21-2009 at 08:34 AM.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  7. #7
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    oh wait wait, i remember. it does work. same thing as gif.

    Java Code:
    jbtOk.setIcon(new ImageIcon("ok.jpg"));
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  8. #8
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    7

    Default Ans For ur Thread

    Hello
    you can use jpg and tif ,png image file on button and label directly in ur java swing aplication.However you can 't use BMp image file as tif and jpg.
    the reson for problem is BMP format is not a compressed type image.

  9. #9
    Thennarasu's Avatar
    Thennarasu is offline Member
    Join Date
    Jan 2009
    Location
    Chennai, Tamilnadu
    Posts
    39
    Rep Power
    0

    Default hi makpandiyan,

    as you said tht java accepts jpg ...
    but i didnt think so...i cant read binary data (i e jpg file as binary file) using file reader...do u knw y?

  10. #10
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    7

    Default

    why not ?
    i think it is possiblle..
    can u tell briefly?

  11. #11
    Thennarasu's Avatar
    Thennarasu is offline Member
    Join Date
    Jan 2009
    Location
    Chennai, Tamilnadu
    Posts
    39
    Rep Power
    0

    Question why so?

    private void uploadphoto(String upload)throws Exception {
    //upload will have absolute path
    System.out.println("ok "+i);


    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("file data "+upload);
    System.out.println("After "+upload);
    Connection con=DriverManager.getConnection("jdbc:oracle:thin: @MT-TESTORADB:1521:ORACL","xxx", "xxx");
    PreparedStatement pstmt = con.prepareStatement ("INSERT INTO temp1 VALUES (?,?)");
    File fBlob=new File(upload);
    FileInputStream is = new FileInputStream ( fBlob );
    pstmt.setBinaryStream (1, is, (int) fBlob.length() );
    pstmt.setInt(2,i);
    pstmt.executeUpdate();
    System.out.println("The End");
    con.close();
    // TODO Auto-generated method stub

    }

    this is my program...this accepts only gif format....
    One Life!!! Y Serious??? :)

  12. #12
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    7

Similar Threads

  1. XML Images
    By JavaWizz in forum XML
    Replies: 1
    Last Post: 10-17-2008, 11:19 AM
  2. images
    By amith in forum AWT / Swing
    Replies: 1
    Last Post: 05-20-2008, 11:54 AM
  3. Wanna make 5 quick bucks?
    By GodiaN in forum Java Applets
    Replies: 5
    Last Post: 01-21-2008, 08:15 PM
  4. Help with images...
    By toby in forum Java Applets
    Replies: 1
    Last Post: 08-04-2007, 06:25 AM
  5. Images in JSP
    By Daniel in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-05-2007, 07:01 AM

Posting Permissions

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