Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Image issues

  Asked By: Kristopher    Date: Apr 25    Category: Java    Views: 571
  

ISSUE:
I'm trying to add the NorthEarth.jpg image to a JButton on the
<runePanel> below. This panel will be then added to the southern
border of a BorderLayout.

PROBLEM:
All that is displayed is an "iconized" button in the center of my
BorderLayout("South");

NOTES:
The NorthEarth.jpg is 13Kb: ( 800pix wide x 50pix tall ). I want the
JButton below to include only this icon and to display the entire
jpg. The NorthEarth.jpg is stored in the same directory as the
source, class files, and manifest.

I realize that FlowLayout is the default for a JPanel, I only
included it for clarification...

----------------------------------------------------------------
JPanel runePanel = new JPanel();
FlowLayout fLayout = new FlowLayout();
runePanel.setLayout ( fLayout );
ImageIcon runeNorth = new ImageIcon( "NorthEarth.jpg" );
runePanel.add(new JButton( runeNorth ));
setContentPane( runePanel );
----------------------------------------------------------------

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Image issues Or get search suggestion and latest updates.




Tagged: