Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

Have Programming Question? Ask it here!
 
 
 


shweta
How to Set Transperent Background Image to Jpanel
1 Answer(s)      4 years and 5 months ago
Posted in : Java Beginners


Sir ,How to set Background Image to Jpanel.

Advertisement
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
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 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
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 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
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 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
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
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
How to add JTable in JPanel
How to add JTable in JPanel  How to add JTable in JPanel
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... out how you can add image as a background using UIImageView. In your project
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
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
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
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
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
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
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
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
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
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
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
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 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 draw in jPanel? swing/graphics Java
How to draw in jPanel? swing/graphics Java  How to draw in jPanel? (swing/graphics Java
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
background
background  how to add image as background to a frame
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 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
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
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
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 Add JComboBox on JPanel - Java Beginners
How to Add JComboBox on JPanel  How to Add JComboBox on JPanel D:\java>javac ViewElements.java ViewElements.java:181: expected jc.addItem("France"); ^ ViewElements.java:182: expected
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   
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
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
how to set the image and address in single row when genearting pdf fil from jsp - JSP-Servlet
how to set the image and address in single row when genearting pdf fil from jsp  i need to set the image is left side and right side is address when genrating the pdf file from jsp  Hi Friend, Try the following code
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 chrome background, make a chrome background, chrome background
How to make a chrome background     ... background so follow all the steps as given in this example. New Document: First take a new document with any color background and fill "White" color
PHP GD set image title
<?php $zend = imagecreatefromjpeg('images.jpg'); $im = imagecreatetruecolor(200, 200); imagesettile($im, $zend); imagefilledrectangle($im, 0, 0, 199, 199, IMG_COLOR_TILED); header('Content-Type: image/jpeg'); imagejpeg
 

 

 

DMCA.com