You want the drawImage()
that scales to the target container. See the article cited here for alternatives. For example,
g.drawImage(img, 0, 0, getWidth(), getHeight(), this);
More Related Contents:
- How to have an interactive map in JFrame
- Swing: Obtain Image of JFrame
- How to add an image to a JPanel?
- JComponents not showing up with picture background?
- Program not accessing method paintComponent() of extended JPanel class
- Java: Difference between the setPreferredSize() and setSize() methods in components
- How to set a background picture in JPanel
- Setting background images in JFrame
- Only one component shows up in JFrame
- Simplest way to set image as JPanel background
- How do I Switch JPanels inside a JFrame
- JPanel repaint issue
- Add an Background image to a Panel
- Background image for a jPanel not working
- how to set JFrame background transparent but JPanel or JLabel Background opaque?
- FlowLayout on top of GridLayout not working
- Java Container remove method not working correctly
- How to add an image to a JFrame title bar?
- How to switch JPanels in a JFrame from within the panel?
- How do I draw an image to a JPanel or JFrame?
- What is the relation between ContentPane and JPanel?
- Java: Rotating Images
- Resizing image in Java
- Printing a JPanel with Scrollable Jtable On it [closed]
- Loading images from jars for Swing HTML
- Only allowing numbers and a symbol (-) to be typed into a JTextField
- java swing background image
- Concerns about the function of JPanel: paintcomponent()
- How to add multiple components to a JFrame?
- How to minimize a JFrame window from Java?