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.

Page 2 of 2 FirstFirst 12
Results 26 to 40 of 40

Thread: HELP - placing picture on top of another picture in Java - JLayerPane

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    Why wouldn't a label show when you remove the layout manager and use setBounds() to position and size it. Are you sure the size is correct? Print out its width and height to make sure.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    Quote Originally Posted by Norm View Post
    Why wouldn't a label show when you remove the layout manager and use setBounds() to position and size it. Are you sure the size is correct? Print out its width and height to make sure.
    Really good point !! Never though about it ?? Please why?

  3. #28
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    Please why?
    You print out the values of things to see if they are what you expect them to be. If the values are different, then your assumptions about how the program is working are probably wrong.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #29
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    hmmm ... You mean removing the layout and working with X and Y on setBounds ??

    I tried it but it seems I'm making something wrong too... .??

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    You will have to explain.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    I am sorry I could not get it .. even my teacher said i have never used it ... so please if you could give hint or explanation I really appreciate that ..

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    Did you print out the sizes of the labels as I suggested in post#26?
    You use the labels values in the setBounds() call. What are they?
    If you don't understand my answer, don't ignore it, ask a question.

  8. #33
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    honestly I couldn't think anymore .. I fix it every single problem im my program except this point .. please hint or so ..

  9. #34
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    Did you print out the sizes of the labels: logo and picture as I suggested in post#26?
    You use the labels' values in the setBounds() call. What are they?
    logo.setBounds(600, 100, logo.getWidth(), logo.getHeight());

    What are the values in red?
    Last edited by Norm; April 23rd, 2012 at 06:25 PM.
    If you don't understand my answer, don't ignore it, ask a question.

  10. #35
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    the height and width of the size of the picture.

    the logo and picture are same sizes width and height ... 140, 166

  11. #36
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    You are assuming you know something. To be sure, you need to Print out the values before they are used.

    Re-read post #34
    If you don't understand my answer, don't ignore it, ask a question.

  12. #37
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    I am sorry from asking this but did you test my code and fix the code ?

    because I tried everything in the layout maneger also i changed everything in setBounds ... I also finish that wile ago except this thing which makes it weird that my code is same as the tutorial... so i have no idea why it is not working well

  13. #38
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    I am trying to have you debug your program so you can see what the problem is.
    Have you printed out the values I have been talking about so you can see the problem?
    Print out the values that are shown in red in post #34.

    i changed everything in setBounds
    Post the all the changes you made to the setBounds() calls. If you really had changed everything there, the images in the labels would have shown.
    If you don't understand my answer, don't ignore it, ask a question.

  14. #39
    Member
    Join Date
    Sep 2011
    Posts
    30
    My Mood
    Nerdy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    Quote Originally Posted by Norm View Post
    I am trying to have you debug your program so you can see what the problem is.
    Have you printed out the values I have been talking about so you can see the problem?
    Print out the values that are shown in red in post #34.


    Post the all the changes you made to the setBounds() calls. If you really had changed everything there, the images in the labels would have shown.
    I will post all th changes that I've made in my codes but Plz test it and check my problem .. Cuz I worked with a grad student and we tried but he said everything seems good that must work .. So if u really know the problem Plz tell me .. Cuz the bounds is good and I wrote it exactly like every single example that I've seen in google..

  15. #40
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,653
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: HELP - placing picture on top of another picture in Java - JLayerPane

    I do NOT understand why you refuse to do what I have been recommending for many posts.
    Please explain why you will not do the following:
    Have you printed out the values I have been talking about so you can see the problem?
    Print out the values that are shown in red in post #34.

    I wait to see what is printed out.

    everything seems good that must work
    Famous last words. I think the captain of the Titanic said something like that.
    Last edited by Norm; April 27th, 2012 at 07:18 PM.
    If you don't understand my answer, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [SOLVED] Directions Buttons needs picture
    By Darkcore123 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 14th, 2011, 10:19 AM
  2. Java Picture Processor with PGM files and Multi Arrays
    By snow_mac in forum Object Oriented Programming
    Replies: 2
    Last Post: November 28th, 2011, 08:55 PM
  3. Converting a picture made up of 0s and 1s into a colored picture??
    By Kranti1992 in forum Java Theory & Questions
    Replies: 10
    Last Post: November 21st, 2011, 05:25 PM
  4. Showing a picture in a GUI
    By joachim89 in forum AWT / Java Swing
    Replies: 1
    Last Post: February 15th, 2010, 01:42 PM
  5. Need help with a Picture!
    By Scout in forum Java Theory & Questions
    Replies: 1
    Last Post: October 12th, 2009, 05:33 PM