Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where is my JPanel and JButton ?  RSS feed

 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Please anyone help me to understand with these components? Already I've posted a same question like this one but yet now i didn't understand Why my JButton and Transparent JPanel doesn't appear in Frame? is there any problem with my code? Kindly make me to understand why these components are invisible? Thanks in advance
output.png
[Thumbnail for output.png]
 
zm khan
Greenhorn
Posts: 9
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There might be two possibilities

Note:If you want transparent results, use .PNG instead of .JPG.

1) Maybe it can't read the image , you can also try to store the images in a package(Name it"AppImages") and then use the getClass().getResource() method like so


2) Change the flow Layout to Absolute Layout
 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now i understand that i've changed my Layout next to the ImageIcon method then it works fine What i expected...Anyways Tnx a lot zm khan

Modified Code :


 
zm khan
Greenhorn
Posts: 9
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most Welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!