How to Set Transperent Background Image to Jpanel

How to Set Transperent Background Image to Jpanel

Sir ,How to set Background Image to Jpanel.
View Answers

April 12, 2010 at 2:55 PM

Hi Friend,

Try the following code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TransparentBackgroudImage
{
public static void main(String[] args) {
JFrame frame = new JFrame("Table");
frame.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Window win = e.getWindow();
win.setVisible(false);
win.dispose();
System.exit(0);
}
} );

JTextArea area=new JTextArea(15,4){

ImageIcon image = new ImageIcon( "C:/rose.jpg" );

public void paint( Graphics g ) {
Dimension d = getSize();
for( int x = 0; x < d.width; x += image.getIconWidth() )
for( int y = 0; y < d.height; y += image.getIconHeight() )
g.drawImage( image.getImage(), x, y, null, null );
super.paint(g);
}
};

area.setOpaque(false);

JScrollPane sp = new JScrollPane( area );
frame.getContentPane().add( sp );

frame.pack();
frame.show();
}
}

Thanks









Related Tutorials/Questions & Answers:
How to Set Transperent Background Image to Jpanel - Java Beginners
How to Set Transperent Background Image to Jpanel  Sir ,How to set Background Image to Jpanel.  Hi Friend, Try the following code...); } } ); JTextArea area=new JTextArea(15,4){ ImageIcon image = new
how to set background image
how to set background image  how to set image in background in that image i want over lay text how it possible in jsp? using flash image how it is overlayed in jsp page? thanks
Advertisements
How I can Set Transparent Background Image to Panel - Java Beginners
How I can Set Transparent Background Image to Panel  Sir ,How I can Set Transperent Background Image to Jpanel. plz Help Me
set background image in javafx
set background image in javafx  Hi, How to add backgroung image in javafx integrated with jswing
How to set iText pdf document background image - Java Beginners
How to set iText pdf document background image  Hi, I have created the pdf document using the iText classes. but i need to set the background image for this pdf document. there is way to set the background color, but i
Set background image for Spark BorderContainer in flex 4
Set background image for Spark BorderContainer in flex 4 :- In this example you can see how to set background image for BorderContainer  in Flex 4. The BorderContainer  has a property to set the image in background which
background image
background image  how to set background image in jsp using netbeans IDE 6.9
how to use a image in background in your application form?
how to use a image in background in your application form?  how to use a image in background in your application form
UIToolBar background image
UIToolBar background image  Hi, How to set background image of UIToolBar? Give me code for adding UIToolBar's background image. Thanks
Set Transparent Background Image
Set Transparent Background Image Swing components not only allow you to change... to your frame or other components by setting the transparent background image... JPanel(new GridLayout(2, 2)) { ImageIcon image = new ImageIcon("C:/rose.jpg
how to set image - EJB
how to set image   public ActionForward execute(ActionMapping mapping... coding to ireport. this coding only getting database fields. i need add one image in this pdf, how can i set pls help me sir, my image in E:/rose.jpg,how can
UITableView Background Image
UITableView Background Image  How to set an image as a background of UITableView in iPhone SDK   I think, we can't
How to set pdf background color.
How to set pdf background color. In this example, you will see how to set back ground color of pdf in struts2.  index.jsp <html>ADS...;</head> <body> <p>Background of file successfully change
How to set the Gradient Color as a background color for Java Frame?
How to set the Gradient Color as a background color for Java Frame?  How to set the Gradient Color as a background color for Java Frame
how to create menubar and the below background color/image in java swing
how to create menubar and the below background color/image in java swing  how to create menubar and the below background color/image in java swing
How to add image in panel as background in net beans IDE?
How to add image in panel as background in net beans IDE?  How to add image in panel as background in net beans IDE
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
How to set background of an excel sheet using POI - Java Magazine
How to set background of an excel sheet using POI  Hi, i am trying to format the excel using java. How to set the background color of an excel..., koushil Nath.  Hi friend, To set the background color of excel
UITextField Background Image
UITextField Background Image  How can i set a background image... below.. on how to set the uitextfield leftview image.. - (void)viewDidLoad... a Background Image on UITextField - (void)viewDidLoad { [super viewDidLoad
UIButton background image
UIButton background image  Hi, How to create uibutton with background image? Thanks
UIView Image Background
UIView Image Background In this tutorial, we are going to show you how... background image in your iphone application.. 1. Either you can set the UIView... of the image that you wanted to set as the background. Please make sure that you have
How to add background image to div using CSS?
How to add background image to div using CSS
Background Image for Navigation Bar
Background Image for Navigation Bar The tutorial illustrates how to add background image for UINavigationBar. To add a background image to UINavigationBar... { UIImage *image = [UIImage imageNamed: @"background.png"]; [image
Background image UIBarButtonItem
Background image UIBarButtonItem  i wanted to add a background image to my UIBarButtonItem.. that i created into .xib in my iPhone application.   Set the background image to UIBarButtonItem UIBarButtonItem *btn
UIView Background Image
UIView Background Image  HI, Please let's know how to add background image to a view? Thanks   Hi You can use the following code...:@"myimage.png"]]; Read more at UIView Image Background Tutorial page. Thanks
UITableViewCell background image
iPhone application. I have to add the background image to UITableViewCell. Please tell me how to add UITableViewCell background image. Thanks   Hi, Here is the code example of UITableViewCell background using image. UIView
uinavigationcontroller background image
a background image to uinavigationcontroller... the Background Image to it as given belowâ?¦ #import <UIKit/UIKit.h> #import <...uinavigationcontroller background image  I wants to add a background
UIButton Image Size
UIButton Image Size In this example we are going to discuss about how to set image size and setting image as a UIButton background. We are doing...]; //set image as background [myButton setBackgroundImage
Photoshop change a background image
Photoshop: change a background image   ... to change the background of an image. If you want to try this then this tutorial... in which you want to change the background image. I have selected an image
How to add JTable in JPanel
How to add JTable in JPanel  How to add JTable in JPanel
Change JPanel background color from mouse entered/exit event
Change JPanel background color from mouse entered/exit event  I have a JPanel with a grid layout and I populated it with anonymous JPanels to it be like tiles on a game board. I added a mouse entered event to all the added
iphone Image Move
iphone Image Move In this tutorial will learn how to use Image View into view with background image set and that image can be moved any where on the view... file and on the view add two Image View and on that Image View set the image so
resize image with the change in size of jpanel.. - Java Beginners
resize image with the change in size of jpanel..  hi.. i am try to insert image in jpanel in jform to give attractive look to application,but the of image do not changes if the size of jframe or jpanel changes. if there is any
ModuleNotFoundError: No module named 'aldryn-background-image'
: No module named 'aldryn-background-image' How to remove the ModuleNotFoundError: No module named 'aldryn-background-image' error? Thanks   ...ModuleNotFoundError: No module named 'aldryn-background-image'  Hi
ModuleNotFoundError: No module named 'aldryn-background-image'
: No module named 'aldryn-background-image' How to remove the ModuleNotFoundError: No module named 'aldryn-background-image' error? Thanks   ...ModuleNotFoundError: No module named 'aldryn-background-image'  Hi
ModuleNotFoundError: No module named 'django-background-image'
: No module named 'django-background-image' How to remove the ModuleNotFoundError: No module named 'django-background-image' error? Thanks   ...ModuleNotFoundError: No module named 'django-background-image'  Hi
adding background image - Java Beginners
adding background image  how do i add background image to this code... = new JTextField (""); int average; JPanel background = new JPanel...); background.add(text11); getContentPane().add(background
Set Background Colors and Images in HTML
also be set to a background image. For this we use the body attribute... Set Background Colors and Images in HTML       The  background colors can be set
Setting a Background image for UITableView in iPhone & iPad application.
at background. So, to wrap up my question is short ..... i need to set an image...Setting a Background image for UITableView in iPhone & iPad application. ... the UITableView using set backgroundcolor. But my requirement is bit different ..i wanted
background
background  how to add image as background to a frame
how to set image in button using swing? - Swing AWT
how to set image in button using swing?  how to set the image in button using swing?  Hi friend, import java.awt.*; import... FlowLayout()); getContentPane().add(myJButton); setTitle("Image on Button
UIImageView set Image URL
UIImageView set Image URL  Show image by URL   UIImageView set image url Create NSURL object and add the Image URL to it. Create NSData... to it by imageWithData: method Finally, you can add UIImage to Image view. Find
How to design a background, design a background, a background
How to design a background     ... how to design a background by this example. New File: Take a new file.ADS_TO_REPLACE_1 Choose color: First set the foreground and background color. Clouds
How to change background, change background
How to change background       This example will teach you to change background of any object... of the another picture to make background picture. Paste: Go to Edit menu > Paste
jpanel
jpanel  hello sir, i made one jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so.......?? thanku and second question how to attach calender jar file in jtextfield using
jpanel
jpanel  hello sir, i made one jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so.......?? thanku and second question how to attach calender jar file in jtextfield using
jpanel
jpanel  hello sir, i made one jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so.......?? thanku and second question how to attach calender jar file in jtextfield using
jpanel
jpanel  hello sir, i made one jpanel inside the frame and made the button inside the panel.. wrote the only second panel code other class file.. so.......?? thanku and second question how to attach calender jar file in jtextfield using
Displaying the same image in a JPanel and using scroll - HELP - Java Beginners
Displaying the same image in a JPanel and using scroll - HELP  I hope someone can help me out here. I want to display an image in a JPanel which...( true ) ; //Set up the drawing area. drawingPane = new JPanel
JSP Background Image
JSP Background Image   ... to create JSP Background Image on your login page.  Understand with ExampleADS_TO_REPLACE_1 In this section, you will learn how to display the background

Ads