Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2004

Tip: Looking for answers? Try searching our database.

fixing image size

Thread view: 
Andy - 04 Mar 2004 16:19 GMT
I realise there have been several posting on this subject already.
However, despite these, I still can't quite work out how to do this.

I need to take the image from a file (.gif .jpg etc), ensure that the
entire image fits on a JPanel of some size, then put this JPanel onto
another Jpanel.

From what I could gather, it looked like I had to extend JPanel and
override paint().  The problem comes when I try to use drawImage().
Here's the code.

//relevent imports

public class Picture extends JPanel
{
  private String fileName;
 
  /** Creates a new instance of Picture */
 
public Picture(String file)
  {
     fileName=file;
  }
 
  public void paint(Graphics g)
  {
     super.paintComponent(g);
     
  }
}
John Davison - 08 Mar 2004 17:54 GMT
> I realise there have been several posting on this subject already.
> However, despite these, I still can't quite work out how to do this.
[quoted text clipped - 26 lines]
>    }
> }

Where is your call to drawImage()?

John


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.