Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: How do I print pieces of an image in a frame?

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How do I print pieces of an image in a frame?

    Hi, so I have a picture: testElf.jpg And i was wondering if anyone could tell me how to print different sections of the pixels on the image in a frame. Sort of like a puzzle. I was hoping to use graphics as its a sort of paint-like program except you draw the image instead of with a color. Any ideas?


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How do I print pieces of an image in a frame?

    What have you tried?
    What are you stuck on?
    Do some searching to see what methods are available

  3. #3
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: How do I print pieces of an image in a frame?

    Quote Originally Posted by jtm429 View Post
    i was wondering if anyone could tell me how to print different sections of the pixels on the image in a frame. Sort of like a puzzle.
    At high conceptual level, there are different approaches, at least 2:
    1) From the single image, create many distinct Image objects, each containing a specific rectangle of the original image. Then these images can be easily used in JLabel or JButton components. The splitting can be done using various approaches.
    2) Create a "custom" component (typically extending JComponent or JPanel) where each rectangle of the original image is drawn at any wanted location of the component. Use of this approach requires a good knowledge of the painting concepts in Swing.
    Andrea, www.andbin.netSCJP 5 (91%) – SCWCD 5 (94%)

    Useful links for Java beginnersMy new project Java Examples on Google Code

  4. #4
    Junior Member
    Join Date
    Nov 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    @andbin Thanks! I'll try that and see what I figure out.

Similar Threads

  1. Why doesn't the frame viewer print the rectangles?
    By jean28 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 22nd, 2012, 02:01 PM
  2. Image without a frame, is it possible?
    By knightmetal in forum AWT / Java Swing
    Replies: 5
    Last Post: August 15th, 2012, 03:52 AM
  3. adding background image to a frame???
    By overdriveboy in forum AWT / Java Swing
    Replies: 1
    Last Post: May 14th, 2012, 06:53 PM
  4. Frame not showing Image until resized
    By gamalytical in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 13th, 2011, 07:09 AM
  5. Drawing image on JPanel from another frame
    By jeryslo in forum AWT / Java Swing
    Replies: 3
    Last Post: December 8th, 2009, 04:01 PM

Tags for this Thread