Home Answers Viewqa Java-Beginners How to Set Transperent Background Image to Jpanel

 
 


shweta
How to Set Transperent Background Image to Jpanel
1 Answer(s)      3 years and a month ago
Posted in : Java Beginners

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 Pages:
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 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
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
set background image in javafx
set background image in javafx  Hi, How to add backgroung image in javafx integrated with jswing
background image
background image  how to set background image in jsp using netbeans IDE 6.9
UIToolBar background image
UIToolBar background image  Hi, How to set background image of UIToolBar? Give me code for adding UIToolBar's background image. Thanks
UITableView Background Image
UITableView Background Image  How to set an image as a background of UITableView in iPhone SDK   I think, we can't
background
background  how to add image as background to a frame
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
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
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
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... out how you can add image as a background using UIImageView. In your project
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
JPanel - Container
Java: JPanel - Container   Learn how to use the JPanel Container... JPanel(); Set the layout and other characteristics See Layouts.... The default layout for a JPanel is FlowLayout, but it is a good idea to explicitly set
UIButton background image
UIButton background image  Hi, How to create uibutton with background image? Thanks
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
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
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
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
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... UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image
UIWebView Background Color
UIWebView Background Color If you wanted to change the background color on UIWebView in iPhone SDK, then you required to set the background color of UIWebView...). Where as setBackgroundColor will allow you to change the color of background area
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... want to change the background image. I have selected an image of two person
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> <...;/title></head> <body> <p>Background of file
How to change background, change background
How to change background       This example will teach you to change background of any object... a picture to change background. Selection: Make selection by the Magic wand tool
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
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. Choose color: First set the foreground and background color. Clouds: Go to Filter menu
How to save JPanel as gif or jpeg file
How to save JPanel as gif or jpeg file  i draw polygons , rectangles, lines on jpanel using draw line method drawpolygon methods etc, now i want save the data of jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
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
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... = [buttonImage stretchableImageWithLeftCapWidth:12 topCapHeight:0]; //set image
GRADIENT BACKGROUND
GRADIENT BACKGROUND  How to set gradient colors a s background for a jframe? pls help me..............   http://www.roseindia.net/java/example/java/swing/GradientColor.shtml
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
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 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
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
Set Background Colors and Images in HTML
Set Background Colors and Images in HTML       The  background colors can be set... to set a background color in HTML. In this Tutorial, the code describe you
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
set java exe file as background - Java Beginners
set java exe file as background  hi frenz, i am begineer to java. in my application i have a one exe file. now i wanna the file... is closed then v don't continue that application.. can u tell me how java exe file set
JSP Background Image
to create JSP Background Image on your login page.  Understand with Example In this section, you will learn how to display the background image. You can see... JSP Background Image   
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... Image View and on that Image View set the image so that the image can be clearly
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
HTML document's background color
HTML document's background color  How to set a HTML document's background color
Jbutton[] background & foregroundcolor change
Jbutton[] background & foregroundcolor change  how to change... and background color is set to default color and the selected jbutton[9... foreground and background color is changed. the remaining jbutton foreground
UITextfield Background Color
suggest.. , how can i remove the background color of text field. Thanks!   iPhone UITextField Background Color Set the text field background color...UITextfield Background Color  In my iPhone application, i am using
JList Background Images..Urgent
JList Background Images..Urgent  I has done a JList that can change background color when i selected each of it, but if i want to change background image rather than background colors, how can i do it? Please help! my previous
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
HTML - table background color.
HTML - table background color. Description : Here, you will see how... tag, it has a bgcolor attributes. The bgcolor attributes is used to set the background color of table.  Code : <!DOCTYPE html PUBLIC "
PHP GD Set image brightness
<?php $im = imagecreatefromjpeg('brightness.jpg');   if($im && imagefilter($im, IMG_FILTER_BRIGHTNESS, 100)) { echo 'Image...); } else { echo 'Image brightness change failed.'; } ?> After
How to make a rays background effect
How to make a rays background effect Let's go to draw a lighting rays background. New File: Take a new file with any size as you like. Take color: First take background and foreground color. Fill color: Fill color

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.