sushant
Create Project SplashScreen
1 Answer(s)      5 years and 2 months ago
Posted in : Java Beginners
I want to Create project splashscreen that visible only for 1 minute after 1 minute i want to display LogIn form how i can create in java.
Advertisement
View Answers

February 23, 2010 at 12:58 PM


Hi Friend,

Try the following code:

1)SplashScreen.java
import javax.swing.*;

public class SplashScreen extends JFrame{
public static void main(String[] arg) {
JWindow window = new JWindow();
window.getContentPane().add(new JLabel("Loading Login Page...",SwingConstants.CENTER));
window.setBounds(200, 200, 200, 100);
window.setVisible(true);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
window.setVisible(false);
LoginDemo form=new LoginDemo();
form.setVisible(true);
form.setSize(300,100);
window.dispose();
}
}

2)LoginDemo.java:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
class LoginDemo extends JFrame{
JButton SUBMIT;
JPanel panel;
JLabel label1,label2;
final JTextField text1;
final JPasswordField text2;
LoginDemo(){
label1 = new JLabel();
label1.setText("UserName:");
text1 = new JTextField(15);
label2 = new JLabel();
label2.setText("Password:");
text2 = new JPasswordField(15);
SUBMIT=new JButton("Login");
panel=new JPanel(new GridLayout(4,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(SUBMIT);
add(panel,BorderLayout.CENTER);
SUBMIT.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String value1=text1.getText();
String value2=text2.getText();
String user1="";
String pass1="";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test";, "root", "root");
Statement st = con.createStatement();
ResultSet res = st.executeQuery("SELECT * FROM login where username='"+value1+"' && password='"+value2+"'");
while (res.next()) {
user1 = res.getString("username");
pass1 = res.getString("password");
}
if (value1.equals(user1) && value2.equals(pass1)) {
JOptionPane.showMessageDialog(null,"Welcome");

}
else{
JOptionPane.showMessageDialog(null,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
});
}
public static void main(String arg[]) {
LoginDemo frame=new LoginDemo();
frame.pack();
frame.setVisible(true);
}
}

Thanks









Related Tutorials/Questions & Answers:
Create Project SplashScreen - Java Beginners
Create Project SplashScreen   I want to Create project splashscreen... can create in java.   Hi Friend, Try the following code: 1)SplashScreen.java import javax.swing.*; public class SplashScreen extends
create a login project - Development process
create a login project  How to make an application(project)OF LOGIN APPLICATION USING MYSQL DATA BASE TO REGISTER AND LOGIN IN JSF FRAMEORK.  Hi friend, For solving the problem visit to : http://roseindia.net/jsf
Advertisements
Create project from Maven Template
In this section, you will learn to create a simple Java web application project from Maven Template
How to create and execute Hibernate project with out Myeclipse ide ?
How to create and execute Hibernate project with out Myeclipse ide ?  Hi, I am new to Hibernate programming please provide me rough design for creating and executing Hibernate project. Thank you
project
project should i create 1. Detailed study of all modules and submission of SRS...project  i have to do my final year project project topic:Weekly Automatic College Timetable Generation System BRIEF EXPLANATION ABOUT PROJECT
project...
project...   enter 10 integers, store it using array then display... them from lowest to highest number to words conversion create a java program... graphics applet create their own favorite cartoon character
project
project  suggest a network security project based on core java with explanation
PROJECT
PROJECT  i want online polling system project codding
project
project  i need a project in java backend sql
project
project  sir i want a java major project in railway reservation plz help me and give a project source code with entire validation thank you
project
project  does hostel management system project contain any dynamic web pages
project
project  sir i want module and source code on my project hospital management system
PROJECT
PROJECT  i want help on making project on mobile banking application..... the application should have SAVING ACCOUNT,CURRENT ACCOUNT,TRANSACTION ETC......... IN APPLICATION
project
project  sir i want to a project on railway reservation,sir plz give me the source code   plz give me the source code of railway reservation
project
project   hi , we r working on one project related to our results. we using java and for back end sqlserver 2005. In dis we are trying to retrieve result from some site and store it in our data base so that we can perform
project
project  For my project their is 2 users, one is users and administers.i want code for giving authentication to these users by using one, means same login form and database table ..my back end is mysgl....and am using wamp sever
Project
Project  Hi, Am starting a new project to draw a 2d graph using java swing and opengl,where in the input for X-axis and Y-axis co=ordinates should be accepted from user... As am very new to this am seeking help so pls help
EJB Deployment how to create a simple ejd session bean and how to do project setup
EJB Deployment how to create a simple ejd session bean and how to do project..., jdk 1.6 installed in my system. how to create a simple ejd session bean and how to do project setup...? please help me i am getting difficult
project
project   Create appropriate packages and super classes etc. to make your program more efficient and your code more manageable. Create a method to print the Pay slip in an appropriate format. The Pay slip should include
project..
project..  Write a program to find the result of N students by accepting 5-subject marks from a Mark class and calculate the total and average mark. Display the result of all students in ascending order of rank from Result class
Project
Project  <% String project no=request.getParameter("project no"); String qry="select stud name,project name,project type,project...(receipt dt,'dd/mm/yyyy') from proj master "; qry+=" where project
project
project  I'm designing a netbeans java program/project. I have to design a program that captures the persons name and mark #.then find the average mark of the whole class.after that need to count and display who had the highest
Project
Project  How to show Questions randomly so that no two student get the same questions in online examination system project in Java Server Pages  
Project
=(String) vdata.get(1); String project_name=(String) vdata.get(2); String project
project
project  Create a class diagram, both, for permanent and contracted employees, the details of which are supposed to be accepted and displayed on screen The following details need to be tracked for permanent employees: Employee
I want simple steps to create Jar File of Java Project - Java Beginners
I want simple steps to create Jar File of Java Project  Hello Sir How I can Create Jar File of Java Project,plz Help Me  Hi Friend... *.java 5. Create a manifest file: C:\examples> echo Main-Class
What is a Project?
, months or years. Basically, a project is started in order to create or bring... a project as a temporary endeavour undertaken to create a unique product, service...Before understanding 'Project Management' in detail, the first thing one
create
create  how to create an excel file using java
Struts project in RAD
Struts project in RAD  How to create a struts project in RAD
Create Tag Library Descriptor (TLD) File
, we learn how to create library descriptor file in your project. Developers can... these steps to create the file:   1. Go to project option and right click... Create Tag Library Descriptor (TLD) File  
EJB Project
EJB Project  How to create Enterprise Application project with EJB module in Eclipse Galileo?   Please visit the following link: http://www.roseindia.net/ejb/ejbtutorial/buildingasimpleejbapplication.shtml