SlideShare a Scribd company logo
why the image path showing wrong?
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.*;
import java.io.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.imageio.ImageIO;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
class Form1 implements ActionListener {
String user, pass;
JTextField userText, nameText;
JPasswordField passText;
JLabel userLabel, passLabel, imageLabel;
private JButton login, button;
ImageIcon icon;
BufferedImage bufferedImage;
Image image, iconImage;
ImageIcon image1;
JFrame frame1 = new JFrame();
JPanel panel;
Form1(){
//------------------frame backgroubd--------------------
panel = new JPanel() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
GradientPaint gp = new GradientPaint(0, 0, Color.blue, 0, getHeight(), Color.black);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER
_QUALITY);
g2d.setPaint(gp);
g2d.fillRect(0, 0, getWidth(), getHeight());
}
};
panel.setLayout(null);
frame1.setSize(450, 500);
frame1.getContentPane().setBackground(new Color(214, 219, 223));
frame1.setLayout(null);
panel.setBounds(0,0,450,500);
frame1.add(panel);
//------------------user--------------------
userLabel = new JLabel("Username");
userLabel.setForeground(Color.WHITE);
userLabel.setFont(new Font("Calibri", Font.BOLD, 16));
userLabel.setBounds(50, 250, 100, 30);
panel.add(userLabel);
userText = new JTextField();
userText.setBounds(150, 250, 150, 30);
panel.add(userText);
//------------------passLabel--------------------
passLabel= new JLabel("Password");
passLabel.setForeground(Color.WHITE);
passLabel.setFont(new Font("Calibri", Font.BOLD, 16));
passLabel.setBounds(50, 300, 100, 30);
panel.add(passLabel);
passText = new JPasswordField();
passText.setEchoChar('*');
passText.setBounds(150, 300, 150, 30);
panel.add(passText);
//------------------button--------------------
button = new JButton("Button");
button.setBounds(150, 200, 150, 30);
button.setFont(new Font("Calibri", Font.BOLD, 16));
button.setBorder(BorderFactory.createRaisedBevelBorder());
button.setBackground(Color.white);
panel.add(button);
try {
iconImage = ImageIO.read(new File(""));
image1 = new ImageIcon(iconImage);
imageLabel = new JLabel("", image1, JLabel.CENTER);
imageLabel.setBounds(100, 20, 200, 150);
panel.add(imageLabel);
} catch (IOException e) {
e.printStackTrace();
}
//------------------login button--------------------
login = new JButton("Login");
login.setBounds(50, 370, 70, 30);
login.setFont(new Font("Calibri", Font.PLAIN, 16));
login.setBorder(BorderFactory.createRaisedBevelBorder());
login.setBackground(Color.white);
panel.add(login);
login.addActionListener(this);
//------------------Frame 1--------------------
frame1.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(button)){
JOptionPane.showMessageDialog (null, "Here comes the message!", "",
JOptionPane.INFORMATION_MESSAGE);
}
if(e.getSource().equals(login)){
user = (String)userText.getText();
pass = (String)passText.getText();
if( user.equals("admin") && pass.equals("admin123")){
JOptionPane.showMessageDialog (null, "Login successful!", "",
JOptionPane.INFORMATION_MESSAGE);
}
else{
JOptionPane.showMessageDialog (null, "Incorrect username or password", "",
JOptionPane.ERROR_MESSAGE);
}
}
}
public static void main(String args[])
{
Form1 form = new Form1();
}
}

More Related Content

Similar to why the image path showing wrong import java.awt.event.ActionEven.pdf

DBTool
DBToolDBTool
Scrollable Demo App
Scrollable Demo AppScrollable Demo App
Scrollable Demo App
Peeyush Ranjan
 
Lecture9 oopj
Lecture9 oopjLecture9 oopj
Lecture9 oopj
Dhairya Joshi
 
UNIT 5-JavaFX Event Handling, Controls and Components.pdf
UNIT 5-JavaFX Event Handling, Controls and Components.pdfUNIT 5-JavaFX Event Handling, Controls and Components.pdf
UNIT 5-JavaFX Event Handling, Controls and Components.pdf
SakkaravarthiS1
 
Please can any one help me with this. I am trying to upload upload.docx
Please can any one help me with this. I am trying to upload upload.docxPlease can any one help me with this. I am trying to upload upload.docx
Please can any one help me with this. I am trying to upload upload.docx
randymartin91030
 
11basic Swing
11basic Swing11basic Swing
11basic Swing
Adil Jafri
 
Basic swing
Basic swingBasic swing
Basic swing
bharathi120789
 
Whenever I run my application my Game appears with the pict.pdf
Whenever I run my application my Game appears with the pict.pdfWhenever I run my application my Game appears with the pict.pdf
Whenever I run my application my Game appears with the pict.pdf
aarthitimesgd
 
Groovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonGroovy-er desktop applications with Griffon
Groovy-er desktop applications with Griffon
Eric Wendelin
 
Groovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonGroovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With Griffon
Matthew McCullough
 
Help with Java! Can someone check my code What I am trying to accompli.docx
Help with Java! Can someone check my code What I am trying to accompli.docxHelp with Java! Can someone check my code What I am trying to accompli.docx
Help with Java! Can someone check my code What I am trying to accompli.docx
gentomega
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
arvindarora20042013
 
package buttongui; import static com.sun.deploy.config.JREInf.pdf
package buttongui; import static com.sun.deploy.config.JREInf.pdfpackage buttongui; import static com.sun.deploy.config.JREInf.pdf
package buttongui; import static com.sun.deploy.config.JREInf.pdf
arjuntiwari586
 
Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
Hemo Chella
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
Hemo Chella
 
Why am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdfWhy am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdf
aakarcreations1
 
Advance Java Programming (CM5I) 2.Swing
Advance Java Programming (CM5I) 2.SwingAdvance Java Programming (CM5I) 2.Swing
Advance Java Programming (CM5I) 2.Swing
Payal Dungarwal
 
I am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdfI am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdf
fashionfolionr
 
Please let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdfPlease let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdf
anjaniar7gallery
 
Swing
SwingSwing
Swing
Fahim Khan
 

Similar to why the image path showing wrong import java.awt.event.ActionEven.pdf (20)

DBTool
DBToolDBTool
DBTool
 
Scrollable Demo App
Scrollable Demo AppScrollable Demo App
Scrollable Demo App
 
Lecture9 oopj
Lecture9 oopjLecture9 oopj
Lecture9 oopj
 
UNIT 5-JavaFX Event Handling, Controls and Components.pdf
UNIT 5-JavaFX Event Handling, Controls and Components.pdfUNIT 5-JavaFX Event Handling, Controls and Components.pdf
UNIT 5-JavaFX Event Handling, Controls and Components.pdf
 
Please can any one help me with this. I am trying to upload upload.docx
Please can any one help me with this. I am trying to upload upload.docxPlease can any one help me with this. I am trying to upload upload.docx
Please can any one help me with this. I am trying to upload upload.docx
 
11basic Swing
11basic Swing11basic Swing
11basic Swing
 
Basic swing
Basic swingBasic swing
Basic swing
 
Whenever I run my application my Game appears with the pict.pdf
Whenever I run my application my Game appears with the pict.pdfWhenever I run my application my Game appears with the pict.pdf
Whenever I run my application my Game appears with the pict.pdf
 
Groovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonGroovy-er desktop applications with Griffon
Groovy-er desktop applications with Griffon
 
Groovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonGroovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With Griffon
 
Help with Java! Can someone check my code What I am trying to accompli.docx
Help with Java! Can someone check my code What I am trying to accompli.docxHelp with Java! Can someone check my code What I am trying to accompli.docx
Help with Java! Can someone check my code What I am trying to accompli.docx
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
 
package buttongui; import static com.sun.deploy.config.JREInf.pdf
package buttongui; import static com.sun.deploy.config.JREInf.pdfpackage buttongui; import static com.sun.deploy.config.JREInf.pdf
package buttongui; import static com.sun.deploy.config.JREInf.pdf
 
Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
 
Why am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdfWhy am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdf
 
Advance Java Programming (CM5I) 2.Swing
Advance Java Programming (CM5I) 2.SwingAdvance Java Programming (CM5I) 2.Swing
Advance Java Programming (CM5I) 2.Swing
 
I am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdfI am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdf
 
Please let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdfPlease let me know if you need more clarification.final String pat.pdf
Please let me know if you need more clarification.final String pat.pdf
 
Swing
SwingSwing
Swing
 

More from amikoenterprises

Within MySQL Workbench, create a new table. This table will be used .pdf
Within MySQL Workbench, create a new table. This table will be used .pdfWithin MySQL Workbench, create a new table. This table will be used .pdf
Within MySQL Workbench, create a new table. This table will be used .pdf
amikoenterprises
 
Within the unethical leadership presentation, I talked a lot about t.pdf
Within the unethical leadership presentation, I talked a lot about t.pdfWithin the unethical leadership presentation, I talked a lot about t.pdf
Within the unethical leadership presentation, I talked a lot about t.pdf
amikoenterprises
 
Write a C program to create two user-defined functions; first functi.pdf
Write a C program to create two user-defined functions; first functi.pdfWrite a C program to create two user-defined functions; first functi.pdf
Write a C program to create two user-defined functions; first functi.pdf
amikoenterprises
 
Write a C# program that demonstrate your multi-level inheritance und.pdf
Write a C# program that demonstrate your multi-level inheritance und.pdfWrite a C# program that demonstrate your multi-level inheritance und.pdf
Write a C# program that demonstrate your multi-level inheritance und.pdf
amikoenterprises
 
With reference to the above case, please answer all of the followi.pdf
With reference to the above case, please answer all of the followi.pdfWith reference to the above case, please answer all of the followi.pdf
With reference to the above case, please answer all of the followi.pdf
amikoenterprises
 
WR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdf
WR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdfWR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdf
WR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdf
amikoenterprises
 
without using truth table Unit I Logic and Proofs Question 1. Is.pdf
without using truth table  Unit I Logic and Proofs Question 1. Is.pdfwithout using truth table  Unit I Logic and Proofs Question 1. Is.pdf
without using truth table Unit I Logic and Proofs Question 1. Is.pdf
amikoenterprises
 
Working with Apache Web ServerTime Required 35 minutesObjective.pdf
Working with Apache Web ServerTime Required 35 minutesObjective.pdfWorking with Apache Web ServerTime Required 35 minutesObjective.pdf
Working with Apache Web ServerTime Required 35 minutesObjective.pdf
amikoenterprises
 
William Short is chief executive officer (CEO) of Benton Memorial Ho.pdf
William Short is chief executive officer (CEO) of Benton Memorial Ho.pdfWilliam Short is chief executive officer (CEO) of Benton Memorial Ho.pdf
William Short is chief executive officer (CEO) of Benton Memorial Ho.pdf
amikoenterprises
 
Word facilita el formato de texto usando negrita, cursiva y subrayad.pdf
Word facilita el formato de texto usando negrita, cursiva y subrayad.pdfWord facilita el formato de texto usando negrita, cursiva y subrayad.pdf
Word facilita el formato de texto usando negrita, cursiva y subrayad.pdf
amikoenterprises
 
wo populations of beetles have different reproductive organs that ar.pdf
wo populations of beetles have different reproductive organs that ar.pdfwo populations of beetles have different reproductive organs that ar.pdf
wo populations of beetles have different reproductive organs that ar.pdf
amikoenterprises
 
Wittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdf
Wittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdfWittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdf
Wittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdf
amikoenterprises
 
Write the necessary SQL Queries for the following functions.A,Addi.pdf
Write the necessary SQL Queries for the following functions.A,Addi.pdfWrite the necessary SQL Queries for the following functions.A,Addi.pdf
Write the necessary SQL Queries for the following functions.A,Addi.pdf
amikoenterprises
 
Write the necessary SQL Queries for the following functions.A. Add.pdf
Write the necessary SQL Queries for the following functions.A. Add.pdfWrite the necessary SQL Queries for the following functions.A. Add.pdf
Write the necessary SQL Queries for the following functions.A. Add.pdf
amikoenterprises
 
Write the class named Student which has the following data members.pdf
Write the class named Student  which has the following data members.pdfWrite the class named Student  which has the following data members.pdf
Write the class named Student which has the following data members.pdf
amikoenterprises
 
Write program in C language to sort the given array using merge sort.pdf
Write program in C language to sort the given array using merge sort.pdfWrite program in C language to sort the given array using merge sort.pdf
Write program in C language to sort the given array using merge sort.pdf
amikoenterprises
 
Write notes on the following areas as related to tax investigations .pdf
Write notes on the following areas as related to tax investigations .pdfWrite notes on the following areas as related to tax investigations .pdf
Write notes on the following areas as related to tax investigations .pdf
amikoenterprises
 
Write it in Assembly codeWrite it in Assembly codeWrite it in As.pdf
Write it in Assembly codeWrite it in Assembly codeWrite it in As.pdfWrite it in Assembly codeWrite it in Assembly codeWrite it in As.pdf
Write it in Assembly codeWrite it in Assembly codeWrite it in As.pdf
amikoenterprises
 
Write MATLAB code to solve this summation in general, where you can .pdf
Write MATLAB code to solve this summation in general, where you can .pdfWrite MATLAB code to solve this summation in general, where you can .pdf
Write MATLAB code to solve this summation in general, where you can .pdf
amikoenterprises
 
William es due�o de un solo barco. El barco vale 200 millones de d�l.pdf
William es due�o de un solo barco. El barco vale 200 millones de d�l.pdfWilliam es due�o de un solo barco. El barco vale 200 millones de d�l.pdf
William es due�o de un solo barco. El barco vale 200 millones de d�l.pdf
amikoenterprises
 

More from amikoenterprises (20)

Within MySQL Workbench, create a new table. This table will be used .pdf
Within MySQL Workbench, create a new table. This table will be used .pdfWithin MySQL Workbench, create a new table. This table will be used .pdf
Within MySQL Workbench, create a new table. This table will be used .pdf
 
Within the unethical leadership presentation, I talked a lot about t.pdf
Within the unethical leadership presentation, I talked a lot about t.pdfWithin the unethical leadership presentation, I talked a lot about t.pdf
Within the unethical leadership presentation, I talked a lot about t.pdf
 
Write a C program to create two user-defined functions; first functi.pdf
Write a C program to create two user-defined functions; first functi.pdfWrite a C program to create two user-defined functions; first functi.pdf
Write a C program to create two user-defined functions; first functi.pdf
 
Write a C# program that demonstrate your multi-level inheritance und.pdf
Write a C# program that demonstrate your multi-level inheritance und.pdfWrite a C# program that demonstrate your multi-level inheritance und.pdf
Write a C# program that demonstrate your multi-level inheritance und.pdf
 
With reference to the above case, please answer all of the followi.pdf
With reference to the above case, please answer all of the followi.pdfWith reference to the above case, please answer all of the followi.pdf
With reference to the above case, please answer all of the followi.pdf
 
WR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdf
WR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdfWR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdf
WR Grace Company fue fundada por, s�, un hombre llamado WR Grace. Er.pdf
 
without using truth table Unit I Logic and Proofs Question 1. Is.pdf
without using truth table  Unit I Logic and Proofs Question 1. Is.pdfwithout using truth table  Unit I Logic and Proofs Question 1. Is.pdf
without using truth table Unit I Logic and Proofs Question 1. Is.pdf
 
Working with Apache Web ServerTime Required 35 minutesObjective.pdf
Working with Apache Web ServerTime Required 35 minutesObjective.pdfWorking with Apache Web ServerTime Required 35 minutesObjective.pdf
Working with Apache Web ServerTime Required 35 minutesObjective.pdf
 
William Short is chief executive officer (CEO) of Benton Memorial Ho.pdf
William Short is chief executive officer (CEO) of Benton Memorial Ho.pdfWilliam Short is chief executive officer (CEO) of Benton Memorial Ho.pdf
William Short is chief executive officer (CEO) of Benton Memorial Ho.pdf
 
Word facilita el formato de texto usando negrita, cursiva y subrayad.pdf
Word facilita el formato de texto usando negrita, cursiva y subrayad.pdfWord facilita el formato de texto usando negrita, cursiva y subrayad.pdf
Word facilita el formato de texto usando negrita, cursiva y subrayad.pdf
 
wo populations of beetles have different reproductive organs that ar.pdf
wo populations of beetles have different reproductive organs that ar.pdfwo populations of beetles have different reproductive organs that ar.pdf
wo populations of beetles have different reproductive organs that ar.pdf
 
Wittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdf
Wittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdfWittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdf
Wittes Tasty Fishes� Wittes Tasty Fishes� is an aquaculture compan.pdf
 
Write the necessary SQL Queries for the following functions.A,Addi.pdf
Write the necessary SQL Queries for the following functions.A,Addi.pdfWrite the necessary SQL Queries for the following functions.A,Addi.pdf
Write the necessary SQL Queries for the following functions.A,Addi.pdf
 
Write the necessary SQL Queries for the following functions.A. Add.pdf
Write the necessary SQL Queries for the following functions.A. Add.pdfWrite the necessary SQL Queries for the following functions.A. Add.pdf
Write the necessary SQL Queries for the following functions.A. Add.pdf
 
Write the class named Student which has the following data members.pdf
Write the class named Student  which has the following data members.pdfWrite the class named Student  which has the following data members.pdf
Write the class named Student which has the following data members.pdf
 
Write program in C language to sort the given array using merge sort.pdf
Write program in C language to sort the given array using merge sort.pdfWrite program in C language to sort the given array using merge sort.pdf
Write program in C language to sort the given array using merge sort.pdf
 
Write notes on the following areas as related to tax investigations .pdf
Write notes on the following areas as related to tax investigations .pdfWrite notes on the following areas as related to tax investigations .pdf
Write notes on the following areas as related to tax investigations .pdf
 
Write it in Assembly codeWrite it in Assembly codeWrite it in As.pdf
Write it in Assembly codeWrite it in Assembly codeWrite it in As.pdfWrite it in Assembly codeWrite it in Assembly codeWrite it in As.pdf
Write it in Assembly codeWrite it in Assembly codeWrite it in As.pdf
 
Write MATLAB code to solve this summation in general, where you can .pdf
Write MATLAB code to solve this summation in general, where you can .pdfWrite MATLAB code to solve this summation in general, where you can .pdf
Write MATLAB code to solve this summation in general, where you can .pdf
 
William es due�o de un solo barco. El barco vale 200 millones de d�l.pdf
William es due�o de un solo barco. El barco vale 200 millones de d�l.pdfWilliam es due�o de un solo barco. El barco vale 200 millones de d�l.pdf
William es due�o de un solo barco. El barco vale 200 millones de d�l.pdf
 

Recently uploaded

ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 

Recently uploaded (20)

ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 

why the image path showing wrong import java.awt.event.ActionEven.pdf

  • 1. why the image path showing wrong? import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import java.awt.Color; import java.awt.Font; import java.awt.event.*; import java.io.*; import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import javax.imageio.ImageIO; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; class Form1 implements ActionListener { String user, pass; JTextField userText, nameText; JPasswordField passText; JLabel userLabel, passLabel, imageLabel; private JButton login, button; ImageIcon icon; BufferedImage bufferedImage; Image image, iconImage; ImageIcon image1; JFrame frame1 = new JFrame(); JPanel panel; Form1(){ //------------------frame backgroubd-------------------- panel = new JPanel() { protected void paintComponent(Graphics g) { super.paintComponent(g); GradientPaint gp = new GradientPaint(0, 0, Color.blue, 0, getHeight(), Color.black);
  • 2. Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER _QUALITY); g2d.setPaint(gp); g2d.fillRect(0, 0, getWidth(), getHeight()); } }; panel.setLayout(null); frame1.setSize(450, 500); frame1.getContentPane().setBackground(new Color(214, 219, 223)); frame1.setLayout(null); panel.setBounds(0,0,450,500); frame1.add(panel); //------------------user-------------------- userLabel = new JLabel("Username"); userLabel.setForeground(Color.WHITE); userLabel.setFont(new Font("Calibri", Font.BOLD, 16)); userLabel.setBounds(50, 250, 100, 30); panel.add(userLabel); userText = new JTextField(); userText.setBounds(150, 250, 150, 30); panel.add(userText); //------------------passLabel-------------------- passLabel= new JLabel("Password"); passLabel.setForeground(Color.WHITE); passLabel.setFont(new Font("Calibri", Font.BOLD, 16)); passLabel.setBounds(50, 300, 100, 30); panel.add(passLabel); passText = new JPasswordField(); passText.setEchoChar('*'); passText.setBounds(150, 300, 150, 30); panel.add(passText); //------------------button-------------------- button = new JButton("Button"); button.setBounds(150, 200, 150, 30); button.setFont(new Font("Calibri", Font.BOLD, 16));
  • 3. button.setBorder(BorderFactory.createRaisedBevelBorder()); button.setBackground(Color.white); panel.add(button); try { iconImage = ImageIO.read(new File("")); image1 = new ImageIcon(iconImage); imageLabel = new JLabel("", image1, JLabel.CENTER); imageLabel.setBounds(100, 20, 200, 150); panel.add(imageLabel); } catch (IOException e) { e.printStackTrace(); } //------------------login button-------------------- login = new JButton("Login"); login.setBounds(50, 370, 70, 30); login.setFont(new Font("Calibri", Font.PLAIN, 16)); login.setBorder(BorderFactory.createRaisedBevelBorder()); login.setBackground(Color.white); panel.add(login); login.addActionListener(this); //------------------Frame 1-------------------- frame1.setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource().equals(button)){ JOptionPane.showMessageDialog (null, "Here comes the message!", "", JOptionPane.INFORMATION_MESSAGE); } if(e.getSource().equals(login)){ user = (String)userText.getText(); pass = (String)passText.getText(); if( user.equals("admin") && pass.equals("admin123")){ JOptionPane.showMessageDialog (null, "Login successful!", "", JOptionPane.INFORMATION_MESSAGE); }
  • 4. else{ JOptionPane.showMessageDialog (null, "Incorrect username or password", "", JOptionPane.ERROR_MESSAGE); } } } public static void main(String args[]) { Form1 form = new Form1(); } }