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?

View Answers

February 10, 2011 at 1:38 PM

Java Background Image

import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;

public class BackgroundImage1{
private BufferedImage image;
private JPanel panel = new JPanel(new GridLayout(4,2)) {
protected void paintComponent(Graphics g){
super.paintComponent(g);
if(image != null){
g.drawImage(image, 0, 0, this);
}
}
};
public BackgroundImage1(){
try{
File file=new File("C:\\rose.jpg");
image = ImageIO.read(file);
Dimension imageSize = new Dimension(image.getWidth(), image.getHeight());
panel.setPreferredSize(imageSize);
JLabel label1=new JLabel("Username: ");
JLabel label2=new JLabel("Password: ");
JTextField text1=new JTextField(10);
JTextField text2=new JTextField(10);
JButton b1=new JButton("Login");
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(b1);
}
catch(Exception e){}
}
public JPanel getPanel(){
return panel;
}
public static void main(String[] args){
JFrame frame = new JFrame("BackgroundImage ");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new BackgroundImage1().getPanel());
frame.setSize(300,150);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}









Related Tutorials/Questions & Answers:
how to use a image in background in your application form?
how to set background image
Advertisements
UIView Image Background
Setting a Background image for UITableView in iPhone & iPad application.
background image
How to add background image to div using CSS?
Background Image for Navigation Bar
ModuleNotFoundError: No module named 'formv'
ModuleNotFoundError: No module named 'formy'
UIToolBar background image
UIView Background Image
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?
UITableViewCell background image
UIButton background image
ModuleNotFoundError: No module named 'forml'
set background image in javafx
How I can Set Transparent Background Image to Panel - Java Beginners
UITableView Background Image
Background image UIBarButtonItem
Photoshop change a background image
How to set iText pdf document background image - Java Beginners
uinavigationcontroller background image
UITextField Background Image
How to Set Transperent Background Image to Jpanel - Java Beginners
ModuleNotFoundError: No module named 'aldryn-background-image'
ModuleNotFoundError: No module named 'aldryn-background-image'
ModuleNotFoundError: No module named 'django-background-image'
JSP Background Image
use forms.
How to change background, change background
background
adding background image - Java Beginners
how to make use of jerry's java image processing filter in java application?is there anyway to do this?
Set background image for Spark BorderContainer in flex 4
How to design a background, design a background, a background
ModuleNotFoundError: No module named 'odoo10-addon-account-invoice-pro-forma-sequence'
ModuleNotFoundError: No module named 'odoo10-addon-account-invoice-pro-forma-sequence'
iphone Image Move
Photoshop Tutorial :background image
How to remove the background color of bootstrap menu bar?
Example on the use of Background image in HTML
JSP WITH MULTIPLE FORMS
How to use Bean Area in Oracle Forms 9i with Sample code ?
how to use image tag in jsp
use tables to structure forms
use tables to structure forms
j2me image application
How to use flickr image in Flex
Maven dependency for jgoodies - forms version 1.0.4 is released. Learn to use forms version 1.0.4 in Maven based Java projects

Ads