• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding a picture

 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to add a picture to the bottom left area of a JPanel. What I did was create a JPanel and placed a picture on in, then added that JPanel to the main JPanel, and should cover 2 rows and 2 columns with GridBagLayout. What I got was a tiny rectangle that might be the picture but is too small to tell.

Here is the code:



The code that calls it:


Is this just the wrong approach or am I missing something simple? I tried to directly call repaint(), but that had no effect at all.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see if this gets you any closer

 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That did the trick. Although the code you added in Testing() doesn't seem to do anything.


Thanks for your help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!