Chann
VIP
IMAGE As PASSWORD (Windows8 Concept)
Description:
Using Text as password is old concept now.. Try Image as password just like Windows8.
>>Basic code structure is implemented in Advanced Java and Advanced Graphics with Transparent Frame are used.
Inputs:None
Returns:None
Assumes:None
Side Effects:None
*/
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
class image_as_password extends JFrame
{
JLabel l1;
JButton b[]=new JButton[1000];
JPanel p1,p2,p3,p4;
JFrame jf;
JLabel l2;
String def="315316356";
String new_pass="";
JButton bt1,bt2,bt3,bt4;
String str="Click:";
JLabel pass,click;
image_as_password()
{
setUndecorated(true);
jf=this;
jf.setBackground(new Color(0.0f,0.0f,0.0f,0.3f));
try{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
Container cp=getContentPane();
cp.setLayout(null);
JPanel p1=new JPanel();
p1.setBounds(0,0,600,600);
cp.add(p1);
p1.setOpaque(false);
p1.setLayout(null);
bt1=new JButton("show Password");
bt1.setBounds(600,20,140,30);
cp.add(bt1);
bt2=new JButton("Hide Password");
bt2.setBounds(600,50,140,30);
cp.add(bt2);
bt3=new JButton("Retry");
bt3.setBounds(600,80,140,30);
cp.add(bt3);
l2=new JLabel();
l2.setBounds(600,120,140,30);
cp.add(l2);
l2.setForeground(Color.red);
pass=new JLabel("pass:315,316,356");
pass.setBounds(600,150,140,30);
cp.add(pass);
pass.setForeground(Color.orange);
click=new JLabel(str);
click.setBounds(600,180,140,30);
cp.add(click);
click.setForeground(Color.green);
JButton exit=new JButton("Exit");
exit.setBounds(600,210,140,30);
cp.add(exit);
l2.setFont(new Font("Sanserif",Font.PLAIN,14));
exit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
bt1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
b[315].setContentAreaFilled(true);
b[316].setContentAreaFilled(true);
b[356].setContentAreaFilled(true);
}
});
bt2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
b[315].setContentAreaFilled(false);
b[316].setContentAreaFilled(false);
b[356].setContentAreaFilled(false);
}
});
bt3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
new_pass="";
str="Click:";
l2.setText("");
click.setText(str);
}
});
l1=new JLabel(new ImageIcon(new URL("http://d1w7nqlfxfj094.cloudfront.net/wp-content/uploads/2012/05/Cute_Little_Danbo_Card_Box_Robot-600x600.jpg")));
l1.setBounds(0,0,600,600);
p2=new JPanel();
p2.setBounds(0,0,600,600);
p1.add(p2);
p2.setOpaque(false);
p2.setLayout(new GridLayout(100,100));
for(int ir=0;ir<800;ir++)
{
b[ir]=new JButton();
b[ir].setContentAreaFilled(false);
b[ir].setOpaque(false);
p2.add(b[ir]);
b[ir].addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
for(int z=0;z<800;z++){
if(e.getSource()==b[z])
{
// System.out.println(z);
new_pass=new_pass+z;
str=str+z+",";
click.setText(str);
// System.out.println(new_pass);
}
}
}
});
}
p1.add(l1);
Thread validity=new Thread()
{
public void run(){
for(;{
if(new_pass.equals(def))
{
l2.setText("Welcome");
}
else{
l2.setText("Wrong password");
}
}
}
};
validity.start();
Thread t1=new Thread()
{
public void run(){
for(;{
for(int i=1;i<9;i++)
{
jf.setBackground(new Color(0.0f,0.0f,0.0f,0.1f*i));
try{ Thread t=this; t.sleep(10); }catch(Exception rr)
{}
}
for(int j=9;j>0;j--)
{
jf.setBackground(new Color(0.0f,0.0f,0.0f,0.1f*j));
try{ Thread t=this; t.sleep(10); }catch(Exception rr)
{}
}
}
}
};
t1.start();
}catch(Exception w){ System.out.println("Error in Image loading...\n please check your internet connection..."); }
}
public static void main(String args[])
{
image_as_password i=new image_as_password();
i.setVisible(true);
i.setSize(750,550);
i.setLocation(10,10);
}
}
Description:
Using Text as password is old concept now.. Try Image as password just like Windows8.
>>Basic code structure is implemented in Advanced Java and Advanced Graphics with Transparent Frame are used.
Inputs:None
Returns:None
Assumes:None
Side Effects:None
*/
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
class image_as_password extends JFrame
{
JLabel l1;
JButton b[]=new JButton[1000];
JPanel p1,p2,p3,p4;
JFrame jf;
JLabel l2;
String def="315316356";
String new_pass="";
JButton bt1,bt2,bt3,bt4;
String str="Click:";
JLabel pass,click;
image_as_password()
{
setUndecorated(true);
jf=this;
jf.setBackground(new Color(0.0f,0.0f,0.0f,0.3f));
try{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
Container cp=getContentPane();
cp.setLayout(null);
JPanel p1=new JPanel();
p1.setBounds(0,0,600,600);
cp.add(p1);
p1.setOpaque(false);
p1.setLayout(null);
bt1=new JButton("show Password");
bt1.setBounds(600,20,140,30);
cp.add(bt1);
bt2=new JButton("Hide Password");
bt2.setBounds(600,50,140,30);
cp.add(bt2);
bt3=new JButton("Retry");
bt3.setBounds(600,80,140,30);
cp.add(bt3);
l2=new JLabel();
l2.setBounds(600,120,140,30);
cp.add(l2);
l2.setForeground(Color.red);
pass=new JLabel("pass:315,316,356");
pass.setBounds(600,150,140,30);
cp.add(pass);
pass.setForeground(Color.orange);
click=new JLabel(str);
click.setBounds(600,180,140,30);
cp.add(click);
click.setForeground(Color.green);
JButton exit=new JButton("Exit");
exit.setBounds(600,210,140,30);
cp.add(exit);
l2.setFont(new Font("Sanserif",Font.PLAIN,14));
exit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
bt1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
b[315].setContentAreaFilled(true);
b[316].setContentAreaFilled(true);
b[356].setContentAreaFilled(true);
}
});
bt2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
b[315].setContentAreaFilled(false);
b[316].setContentAreaFilled(false);
b[356].setContentAreaFilled(false);
}
});
bt3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
new_pass="";
str="Click:";
l2.setText("");
click.setText(str);
}
});
l1=new JLabel(new ImageIcon(new URL("http://d1w7nqlfxfj094.cloudfront.net/wp-content/uploads/2012/05/Cute_Little_Danbo_Card_Box_Robot-600x600.jpg")));
l1.setBounds(0,0,600,600);
p2=new JPanel();
p2.setBounds(0,0,600,600);
p1.add(p2);
p2.setOpaque(false);
p2.setLayout(new GridLayout(100,100));
for(int ir=0;ir<800;ir++)
{
b[ir]=new JButton();
b[ir].setContentAreaFilled(false);
b[ir].setOpaque(false);
p2.add(b[ir]);
b[ir].addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
for(int z=0;z<800;z++){
if(e.getSource()==b[z])
{
// System.out.println(z);
new_pass=new_pass+z;
str=str+z+",";
click.setText(str);
// System.out.println(new_pass);
}
}
}
});
}
p1.add(l1);
Thread validity=new Thread()
{
public void run(){
for(;{
if(new_pass.equals(def))
{
l2.setText("Welcome");
}
else{
l2.setText("Wrong password");
}
}
}
};
validity.start();
Thread t1=new Thread()
{
public void run(){
for(;{
for(int i=1;i<9;i++)
{
jf.setBackground(new Color(0.0f,0.0f,0.0f,0.1f*i));
try{ Thread t=this; t.sleep(10); }catch(Exception rr)
{}
}
for(int j=9;j>0;j--)
{
jf.setBackground(new Color(0.0f,0.0f,0.0f,0.1f*j));
try{ Thread t=this; t.sleep(10); }catch(Exception rr)
{}
}
}
}
};
t1.start();
}catch(Exception w){ System.out.println("Error in Image loading...\n please check your internet connection..."); }
}
public static void main(String args[])
{
image_as_password i=new image_as_password();
i.setVisible(true);
i.setSize(750,550);
i.setLocation(10,10);
}
}
Last edited by a moderator: