Create Project SplashScreen

Create Project SplashScreen

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.
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
ModuleNotFoundError: No module named 'create-project'
ModuleNotFoundError: No module named 'create-project'  Hi, My... named 'create-project' How to remove the ModuleNotFoundError: No module named 'create-project' error? Thanks   Hi, In your python
Advertisements
ModuleNotFoundError: No module named 'create-project'
ModuleNotFoundError: No module named 'create-project'  Hi, My... named 'create-project' How to remove the ModuleNotFoundError: No module named 'create-project' error? Thanks   Hi, In your python
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
How to create Hibernate Project in Eclipse?
the Hibernate framework and create project in Eclipse IDE. I am assuming that you... Project in Eclipse?": ADS_TO_REPLACE_2 Here is the query to create... IDE also. Here are the steps of the tutorial:ADS_TO_REPLACE_1 1. Create
Create project from Maven Template
In this section, you will learn to create a simple Java web application project from Maven Template
ModuleNotFoundError: No module named 'create-argparse-project'
ModuleNotFoundError: No module named 'create-argparse-project'  Hi...: No module named 'create-argparse-project' How to remove the ModuleNotFoundError: No module named 'create-argparse-project' error? Thanks   
ModuleNotFoundError: No module named 'Create-Python-Project'
ModuleNotFoundError: No module named 'Create-Python-Project'  Hi...: No module named 'Create-Python-Project' How to remove the ModuleNotFoundError: No module named 'Create-Python-Project' error? Thanks   Hi
ModuleNotFoundError: No module named 'Create-Python-Project'
ModuleNotFoundError: No module named 'Create-Python-Project'  Hi...: No module named 'Create-Python-Project' How to remove the ModuleNotFoundError: No module named 'Create-Python-Project' error? Thanks   Hi
ModuleNotFoundError: No module named 'create-argparse-project'
ModuleNotFoundError: No module named 'create-argparse-project'  Hi...: No module named 'create-argparse-project' How to remove the ModuleNotFoundError: No module named 'create-argparse-project' error? Thanks   
ModuleNotFoundError: No module named 'Create-Python-Project'
ModuleNotFoundError: No module named 'Create-Python-Project'  Hi...: No module named 'Create-Python-Project' How to remove the ModuleNotFoundError: No module named 'Create-Python-Project' error? Thanks   Hi
create
create  how to create an excel file using java
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
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
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
create frames
create frames  How do I create frames? What is a frameset
create folder
create folder  what code we should write as a web application that it create an empty folder on client's desktop
create a class
create a class  plz provide any example related to class
create webservice
create webservice  Hi Can anyone help me to create a webservice which access another webservice results and display it. thanks
create a button
create a button  i have created button inhtml but my jsp is not working,so can u guide me
Create Array ??
Create Array ??   Question in e-clips program: Part 1. Array Implementation -Create a class called â??PhoneEntryâ?? which can be used to store the name and number of ONE client. -Create a class called â??MyArrayListâ?? which
create jsp
create jsp  <%@ page language="java" contentType="text/html...; charset=ISO-8859-1"> <title>Create New Student</title> </head> <body> <form name="create" method="post" action="<
create dao
create dao  code 1 package com.dao; import java.sql.*; import com.beans.*; public class DbAccess { public void createStudent(SampleBean...) { System.out.println("Error in create access"); } } public SampleBean
JSP Create Variable
JSP Create Variable          JSP Create Variable is used to create... illustrate an example from 'JSP Create Variable'. To understand the example we create
Create a database
Create a database       In this section, we will teach you to create a database.  First of all... database. Then create a database using the given syntax and give the suitable name
create installer - Development process
create installer   "I have create installer (.exe) for my java project with the help of izpack. Now i want to create .rpm installer for my java... please send me how to create .rpm for my java project
Create pie chart
Create pie chart  hi............. In my project i want to create a pie chart to display the result. i require a very simple code in java swings were i can edit the code and put my values... so plz help me
Create Database SQLite
it on Desktop and i add the table into my project. Create Table into MSQLite Database. create table cities(id int(11),Name varchar(500),latitude varchar(500...Create Database SQLite  Hi, I am unable to create database in sqlite
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
Create Bar graph
Create Bar graph  hi............. In my project i want to create a BAR GRAPH to display the result. I HAVE certain values that want to show in graph form. Can u help me plzzzzzzz i require a very simple code in java swings were
syntax for create a table
syntax for create a table  syntax for create a table
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
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:  ADS_TO_REPLACE_1 1. Go to project option... Create Tag Library Descriptor (TLD) File  
program to create nested tables
program to create nested tables  program to create nested tables
Create toolbars for IE
Create toolbars for IE  how to create a ie toolbar in java script
How to create an input box?
How to create an input box?  How to create an input box
create arrays in JavaScript
create arrays in JavaScript  How to create arrays in JavaScript
How to create arrays in JavaScript?
How to create arrays in JavaScript?  How to create arrays in JavaScript
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
how to create frame in swings
how to create frame in swings  how to create frame in swings
create dynamic array in javascript
create dynamic array in javascript  How to create dynamic array in javascript
php create pages automatically
php create pages automatically  How to create pages automatically in PHP
how to create notepad in java
how to create notepad in java  how to create notepad in java
Javascript Create Calendar
Javascript Create Calendar  how to create calender application   Please visit the following link: Javascript create Calendar
create a button in html
create a button in html  How do I create a button which acts like a link
create a new object in JavaScript
create a new object in JavaScript  How do you create a new object in JavaScript
create a new object in JavaScript
create a new object in JavaScript  How do you create a new object in JavaScript
Create Button in CSS
Create Button in CSS  Can anyone help me to create a button in CSS HTML
create a one web page
create a one web page  create a one web page with stored values in a database
create method getConstructor and getInfo?
create method getConstructor and getInfo?  How to create method getConstructor and getInfo

Ads