Results 1 to 4 of 4
  1. #1
    adjit is offline Senior Member
    Join Date
    Mar 2011
    Posts
    171
    Rep Power
    0

    Default Importing an image from a users computer

    Hi,

    So I'm creating an address book, and for the most part I have it developed. But I wanted to have a box that the user can click on, browse his/her computer for a picture and then choose to add that picture to the picture frame or label. This need to be a persistent object, meaning the user can stop running the program and then open it back up and see the picture still there

    any leads?

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

    Default Re: Importing an image from a users computer

    So first of all breajk that up into its constituent operations so you can tell us what you're haveing trouble with.
    -- reacting to user action? --> JButton
    -- browsing the file system? --> JFileChooser
    -- loading the image from file? -->ImageIO/ImageIcon
    -- displaying the image? -->JComponent/JPanel/JLabel
    -- persisting the data? --> several options available

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    adjit is offline Senior Member
    Join Date
    Mar 2011
    Posts
    171
    Rep Power
    0

    Default Re: Importing an image from a users computer

    Its really kind of all of that. I don't know where to start.

    Initially I was thinking about just using a JLabel and creating like an import path or something like that
    As per browsing I guess I would use file chooser.

    Here is what I was thinking about layout wise...
    You have the box with your standard blank contact picture initially.
    Click on the box, it will bring up the file chooser
    The user chooses the path for the import... and this is where I don't really know what to do.
    -- I know how I would set the path up to get the picture to show, but what I want to do is import that picture into my my working directory and use that every time that contact is chosen.
    So in other words, save the picture with my Contact object that is being saved.

    I am using space4J for my object persistence

  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 Re: Importing an image from a users computer

    Quote Originally Posted by adjit View Post
    Its really kind of all of that. I don't know where to start.
    Here's a good place to start: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 0
    Last Post: 04-13-2012, 01:37 PM
  2. send image from computer to mobile
    By amer in forum CLDC and MIDP
    Replies: 0
    Last Post: 06-04-2010, 07:35 AM
  3. Replies: 6
    Last Post: 08-06-2008, 02:41 PM
  4. Accounts of users
    By Eric in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 06-27-2007, 05:20 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
  •