Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By gimbal2

Thread: how to dislay the content of picture(by browsing the system file )by clicking button

  1. #1
    khushboo is offline Member
    Join Date
    Dec 2013
    Posts
    6
    Rep Power
    0

    Default how to dislay the content of picture(by browsing the system file )by clicking button

    hello!!i had made a jframe(swing) in which customer information is being entered.This is a kind of registration jframe of customer.now the thread is that ,i had made an text area in which user can upload their picture ,by browsing the system files.i hade gone through the filechooser option and path is also being got.but major thing is that picture is not being displayed in textarea.
    Here is the code :


    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) //on clicking button
    {
    JFileChooser chooser = new JFileChooser();
    chooser.showOpenDialog(null);
    File f=chooser.getSelectedFile();
    String filename = f.getAbsolutePath();
    }
    i want the content of picture to be displayed on textarea.
    Kindly help me out..plzz..

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,416
    Rep Power
    25

    Default Re: how to dislay the content of picture(by browsing the system file )by clicking but

    It is unusual, and I think difficult, to display an image in a text area. Normally images are shown in a JPanel or in a JLabel.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    khushboo is offline Member
    Join Date
    Dec 2013
    Posts
    6
    Rep Power
    0

    Default Re: how to dislay the content of picture(by browsing the system file )by clicking but

    hmmmmmm.....then is it possible to upload an image of cuatomer by clicking on button..??????????????

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,416
    Rep Power
    25

    Default Re: how to dislay the content of picture(by browsing the system file )by clicking but

    is it possible to upload an image of cuatomer by clicking on button..
    Yes. The code to do an "upload" can be called by the listener for the button click.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: how to dislay the content of picture(by browsing the system file )by clicking but

    It would be advised to not do the actual upload inside the listener class itself though, better to let it be handled by a separate thread or else the upload is going to block the Swing event dispatch thread.
    Norm likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: how to dislay the content of picture(by browsing the system file )by clicking but

    In addition to gimbal2: If you don't know what the Swing event dispatch thread is, lets just say if you block it, everything stops working until it is unblocked.

  7. #7
    khushboo is offline Member
    Join Date
    Dec 2013
    Posts
    6
    Rep Power
    0

    Default Re: how to dislay the content of picture(by browsing the system file )by clicking but

    thku so much...
    u all helped me a lot..thanks

Similar Threads

  1. Clicking button on HTML page
    By nephos in forum Advanced Java
    Replies: 1
    Last Post: 10-08-2011, 03:52 PM
  2. Replies: 6
    Last Post: 08-24-2011, 02:52 PM
  3. How to open new JFrame with clicking on button?
    By phearless in forum AWT / Swing
    Replies: 1
    Last Post: 01-14-2011, 10:36 AM
  4. Replies: 3
    Last Post: 08-07-2010, 08:06 PM
  5. Get source web page after clicking next Button
    By noob in forum New To Java
    Replies: 1
    Last Post: 03-05-2010, 09:01 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
  •