SlideShare a Scribd company logo
1 of 23
Download to read offline
https://www.facebook.com/Oxus20
oxus20@gmail.com
JAVA
Splash
Screen
» JTimer
» JProgressBar
» JWindow
» Splash Screen
Prepared By: Azita Azimi
Edited By: Abdul Rahman Sherzad
Agenda
» Splash Screen
˃ Introduction
˃ Demos
» JTimer
» JProgressBar
» JWindow
» Splash Screen Code
2
https://www.facebook.com/Oxus20
Splash Screen Introduction
» A Splash Screen is an image that appears while a game or
program is loading…
» Splash Screens are typically used by particularly large
applications to notify the user that the program is in the
process of loading…
» Also, sometimes can be used for the advertisement
purpose …
3
https://www.facebook.com/Oxus20
Splash Screen Demo
4
https://www.facebook.com/Oxus20
Splash Screen Demo
5
https://www.facebook.com/Oxus20
Splash Screen Demo
6
https://www.facebook.com/Oxus20
Required Components
to Build a Splash Screen
» JTimer
» JProgressBar
» JWindow
7
https://www.facebook.com/Oxus20
JTimer (Swing Timer)
» A Swing timer (an instance of javax.swing.Timer)
fires one or more action events after a specified
delay.
˃ Do not confuse Swing timers with the general-purpose timer facility in
the java.util package.
» You can use Swing timers in two ways:
˃ To perform a task once, after a delay.
For example, the tool tip manager uses Swing timers to determine when to
show a tool tip and when to hide it.
˃ To perform a task repeatedly.
For example, you might perform animation or update a component that
displays progress toward a goal. 8
https://www.facebook.com/Oxus20
Text Clock Demo
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.Timer;
class TextClockDemo extends JFrame {
private JTextField timeField;
public TextClockDemo() {
// Customize JFrame
this.setTitle("Clock Demo");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new FlowLayout());
this.setLocationRelativeTo(null);
this.setResizable(false);
9
https://www.facebook.com/Oxus20
// Customize text field that shows the time.
timeField = new JTextField(5);
timeField.setEditable(false);
timeField.setFont(new Font("sansserif", Font.PLAIN, 48));
this.add(timeField);
// Create JTimer which calls action listener every second
Timer timer = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// Get the current time and show it in the textfield
Calendar now = Calendar.getInstance();
int hour = now.get(Calendar.HOUR_OF_DAY);
int minute = now.get(Calendar.MINUTE);
int second = now.get(Calendar.SECOND);
timeField.setText("" + hour + ":" + minute + ":" + second);
}
});
timer.start();
this.pack();
this.setVisible(true);
} 10
https://www.facebook.com/Oxus20
public static void main(String[] args) {
new TextClockDemo();
}
}
11
https://www.facebook.com/Oxus20
Text Clock Demo Output
12
https://www.facebook.com/Oxus20
JProgressBar
» A progress bar is a component in a Graphical User
Interface (GUI) used to visualize the progression of an
extended computer operation such as
˃ a download
˃ file transfer
˃ or installation
» Sometimes, the graphic is accompanied by a textual
representation of the progress in a percent format.
13
https://www.facebook.com/Oxus20
JProgressBar Constructors:
» public JProgressBar()
JProgressBar aJProgressBar = new JProgressBar();
» public JProgressBar(int orientation)
JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL);
JProgressBar bJProgressBar = new JProgressBar(JProgressBar.HORIZONTAL);
» public JProgressBar(int minimum, int maximum)
JProgressBar aJProgressBar = new JProgressBar(0, 100);
» public JProgressBar(int orientation, int minimum, int maximum)
JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
» public JProgressBar(BoundedRangeModel model)
DefaultBoundedRangeModel model = new DefaultBoundedRangeModel(0, 0, 0, 250);
JProgressBar aJProgressBar = new JProgressBar(model);
14
https://www.facebook.com/Oxus20
JProgressBar Demo
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.Timer;
public class JProgressDemo extends JFrame {
private static JProgressBar progressBar;
private Timer timer;
private static int count = 1;
private static int PROGBAR_MAX = 100;
public JProgressDemo() {
this.setTitle("JProgress Bar Demo");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setSize(300, 80);
15
https://www.facebook.com/Oxus20
progressBar = new JProgressBar();
progressBar.setMaximum(100);
progressBar.setForeground(new Color(2, 8, 54));
progressBar.setStringPainted(true);
this.add(progressBar, BorderLayout.SOUTH);
timer = new Timer(300, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
progressBar.setValue(count);
if (PROGBAR_MAX == count) {
timer.stop();
}
count++;
}
});
timer.start();
this.setVisible(true);
}
16
https://www.facebook.com/Oxus20
public static void main(String[] args) {
new JProgressDemo();
}
}
17
https://www.facebook.com/Oxus20
JProgressBar Output
18
https://www.facebook.com/Oxus20
JWindow
» A Window object is a top-level window with no borders
and no menubar.
» The default layout for a window is BorderLayout.
» JWindow is used in splash screen in order to not be
able to close the duration of splash screen execution
and progress.
19
https://www.facebook.com/Oxus20
Splash Screen Code
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JWindow;
import javax.swing.Timer;
public class SplashScreen extends JWindow {
private static JProgressBar progressBar;
private static int count = 1;
private static int TIMER_PAUSE = 100;
private static int PROGBAR_MAX = 105;
private static Timer progressBarTimer;
20
https://www.facebook.com/Oxus20
public SplashScreen() {
createSplash();
}
private void createSplash() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JLabel splashImage = new JLabel(new ImageIcon(getClass().getResource("image.gif")));
panel.add(splashImage);
progressBar = new JProgressBar();
progressBar.setMaximum(PROGBAR_MAX);
progressBar.setForeground(new Color(2, 8, 54));
progressBar.setBorder(BorderFactory.createLineBorder(Color.black));
panel.add(progressBar, BorderLayout.SOUTH);
this.setContentPane(panel);
this.pack();
this.setLocationRelativeTo(null);
this.setVisible(true);
startProgressBar();
} 21
https://www.facebook.com/Oxus20
private void startProgressBar() {
progressBarTimer = new Timer(TIMER_PAUSE, new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
progressBar.setValue(count);
if (PROGBAR_MAX == count) {
SplashScreen.this.dispose();
progressBarTimer.stop();
}
count++;
}
});
progressBarTimer.start();
}
public static void main(String[] args) {
new SplashScreen();
}
} 22
https://www.facebook.com/Oxus20
END
https://www.facebook.com/Oxus20
23

More Related Content

What's hot

Marker detection algorithm
Marker detection algorithmMarker detection algorithm
Marker detection algorithmpknhacker
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteElectronic Arts / DICE
 
PyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutinePyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutineDaehee Kim
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)Takahiro Harada
 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.Mohd Arif
 
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open ProblemsHPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open ProblemsElectronic Arts / DICE
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Johan Andersson
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsSarvesh Rawat
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaKnoldus Inc.
 
Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Johan Andersson
 
NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]
NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]
NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]jerelhill
 
Etc express 24/48 燈光控制器
Etc express 24/48 燈光控制器Etc express 24/48 燈光控制器
Etc express 24/48 燈光控制器jielun li
 
Chapter 9 morphological image processing
Chapter 9   morphological image processingChapter 9   morphological image processing
Chapter 9 morphological image processingAhmed Daoud
 
Overlapping clusters for distributed computation
Overlapping clusters for distributed computationOverlapping clusters for distributed computation
Overlapping clusters for distributed computationDavid Gleich
 
32 stoke's theorem
32 stoke's theorem32 stoke's theorem
32 stoke's theoremmath267
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processingasodariyabhavesh
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect AndromedaElectronic Arts / DICE
 

What's hot (20)

Marker detection algorithm
Marker detection algorithmMarker detection algorithm
Marker detection algorithm
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in Frostbite
 
PyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into CoroutinePyconKR 2018 Deep dive into Coroutine
PyconKR 2018 Deep dive into Coroutine
 
Set data structure
Set data structure Set data structure
Set data structure
 
Autodesk Mudbox
Autodesk MudboxAutodesk Mudbox
Autodesk Mudbox
 
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
Introduction to Monte Carlo Ray Tracing, OpenCL Implementation (CEDEC 2014)
 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.
 
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open ProblemsHPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
 
Image forgery and security
Image forgery and securityImage forgery and security
Image forgery and security
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
 
Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!
 
NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]
NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]
NEVER GIVE UP ON YOUR DREAMS: My Journey of Faith [Preface & Intro]
 
Etc express 24/48 燈光控制器
Etc express 24/48 燈光控制器Etc express 24/48 燈光控制器
Etc express 24/48 燈光控制器
 
Chapter 9 morphological image processing
Chapter 9   morphological image processingChapter 9   morphological image processing
Chapter 9 morphological image processing
 
Overlapping clusters for distributed computation
Overlapping clusters for distributed computationOverlapping clusters for distributed computation
Overlapping clusters for distributed computation
 
32 stoke's theorem
32 stoke's theorem32 stoke's theorem
32 stoke's theorem
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
 

Viewers also liked

Revision c odesagain
Revision c odesagainRevision c odesagain
Revision c odesagainrex0721
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepOXUS 20
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryOXUS 20
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesVitaly Friedman
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 

Viewers also liked (9)

Revision c odesagain
Revision c odesagainRevision c odesagain
Revision c odesagain
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
 
Java swing
Java swingJava swing
Java swing
 
Java FX
Java FXJava FX
Java FX
 
JavaFX introduction
JavaFX introductionJavaFX introduction
JavaFX introduction
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – Theory
 
Java swing
Java swingJava swing
Java swing
 
Responsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and TechniquesResponsive Web Design: Clever Tips and Techniques
Responsive Web Design: Clever Tips and Techniques
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 

Similar to Create Splash Screen with Java Step by Step

Android camera2
Android camera2Android camera2
Android camera2Takuma Lee
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?Ankara JUG
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...DroidConTLV
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmary772
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmccormicknadine86
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Korhan Bircan
 
YQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userYQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userTom Croucher
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Forcetree.com writing a java program to connect to sfdc
Forcetree.com writing  a java program to connect  to sfdcForcetree.com writing  a java program to connect  to sfdc
Forcetree.com writing a java program to connect to sfdcEdwin Vijay R
 
Android Camera Architecture
Android Camera ArchitectureAndroid Camera Architecture
Android Camera ArchitecturePicker Weng
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blinkInnovationM
 
Naive application development
Naive application developmentNaive application development
Naive application developmentShaka Huang
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
HTML5 & The Open Web - at Nackademin
HTML5 & The Open Web -  at NackademinHTML5 & The Open Web -  at Nackademin
HTML5 & The Open Web - at NackademinRobert Nyman
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
Deep Dive into Zone.JS
Deep Dive into Zone.JSDeep Dive into Zone.JS
Deep Dive into Zone.JSIlia Idakiev
 

Similar to Create Splash Screen with Java Step by Step (20)

Android camera2
Android camera2Android camera2
Android camera2
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)
 
YQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to userYQL and YUI - Javascript from server to user
YQL and YUI - Javascript from server to user
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Li How To2 10
Li How To2 10Li How To2 10
Li How To2 10
 
Forcetree.com writing a java program to connect to sfdc
Forcetree.com writing  a java program to connect  to sfdcForcetree.com writing  a java program to connect  to sfdc
Forcetree.com writing a java program to connect to sfdc
 
Android Camera Architecture
Android Camera ArchitectureAndroid Camera Architecture
Android Camera Architecture
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blink
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
Naive application development
Naive application developmentNaive application development
Naive application development
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
HTML5 & The Open Web - at Nackademin
HTML5 & The Open Web -  at NackademinHTML5 & The Open Web -  at Nackademin
HTML5 & The Open Web - at Nackademin
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Deep Dive into Zone.JS
Deep Dive into Zone.JSDeep Dive into Zone.JS
Deep Dive into Zone.JS
 

More from Abdul Rahman Sherzad

Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanData is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanAbdul Rahman Sherzad
 
PHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsPHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsAbdul Rahman Sherzad
 
Sorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLSorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLAbdul Rahman Sherzad
 
Cross Join Example and Applications
Cross Join Example and ApplicationsCross Join Example and Applications
Cross Join Example and ApplicationsAbdul Rahman Sherzad
 
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Abdul Rahman Sherzad
 
Web Application Security and Awareness
Web Application Security and AwarenessWeb Application Security and Awareness
Web Application Security and AwarenessAbdul Rahman Sherzad
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersAbdul Rahman Sherzad
 
Evaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesEvaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesAbdul Rahman Sherzad
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationAbdul Rahman Sherzad
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersAbdul Rahman Sherzad
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsAbdul Rahman Sherzad
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaAbdul Rahman Sherzad
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesAbdul Rahman Sherzad
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesAbdul Rahman Sherzad
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesAbdul Rahman Sherzad
 

More from Abdul Rahman Sherzad (20)

Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanData is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
 
PHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsPHP Unicode Input Validation Snippets
PHP Unicode Input Validation Snippets
 
Iterations and Recursions
Iterations and RecursionsIterations and Recursions
Iterations and Recursions
 
Sorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLSorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQL
 
PHP Variable variables Examples
PHP Variable variables ExamplesPHP Variable variables Examples
PHP Variable variables Examples
 
Cross Join Example and Applications
Cross Join Example and ApplicationsCross Join Example and Applications
Cross Join Example and Applications
 
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
 
Web Application Security and Awareness
Web Application Security and AwarenessWeb Application Security and Awareness
Web Application Security and Awareness
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event Schedulers
 
Mobile Score Notification System
Mobile Score Notification SystemMobile Score Notification System
Mobile Score Notification System
 
Herat Innovation Lab 2015
Herat Innovation Lab 2015Herat Innovation Lab 2015
Herat Innovation Lab 2015
 
Evaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesEvaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan Universities
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and Answers
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and Technologies
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI Examples
 

Recently uploaded

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 

Recently uploaded (20)

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 

Create Splash Screen with Java Step by Step

  • 1. https://www.facebook.com/Oxus20 oxus20@gmail.com JAVA Splash Screen » JTimer » JProgressBar » JWindow » Splash Screen Prepared By: Azita Azimi Edited By: Abdul Rahman Sherzad
  • 2. Agenda » Splash Screen ˃ Introduction ˃ Demos » JTimer » JProgressBar » JWindow » Splash Screen Code 2 https://www.facebook.com/Oxus20
  • 3. Splash Screen Introduction » A Splash Screen is an image that appears while a game or program is loading… » Splash Screens are typically used by particularly large applications to notify the user that the program is in the process of loading… » Also, sometimes can be used for the advertisement purpose … 3 https://www.facebook.com/Oxus20
  • 7. Required Components to Build a Splash Screen » JTimer » JProgressBar » JWindow 7 https://www.facebook.com/Oxus20
  • 8. JTimer (Swing Timer) » A Swing timer (an instance of javax.swing.Timer) fires one or more action events after a specified delay. ˃ Do not confuse Swing timers with the general-purpose timer facility in the java.util package. » You can use Swing timers in two ways: ˃ To perform a task once, after a delay. For example, the tool tip manager uses Swing timers to determine when to show a tool tip and when to hide it. ˃ To perform a task repeatedly. For example, you might perform animation or update a component that displays progress toward a goal. 8 https://www.facebook.com/Oxus20
  • 9. Text Clock Demo import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Calendar; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.Timer; class TextClockDemo extends JFrame { private JTextField timeField; public TextClockDemo() { // Customize JFrame this.setTitle("Clock Demo"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new FlowLayout()); this.setLocationRelativeTo(null); this.setResizable(false); 9 https://www.facebook.com/Oxus20
  • 10. // Customize text field that shows the time. timeField = new JTextField(5); timeField.setEditable(false); timeField.setFont(new Font("sansserif", Font.PLAIN, 48)); this.add(timeField); // Create JTimer which calls action listener every second Timer timer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent arg0) { // Get the current time and show it in the textfield Calendar now = Calendar.getInstance(); int hour = now.get(Calendar.HOUR_OF_DAY); int minute = now.get(Calendar.MINUTE); int second = now.get(Calendar.SECOND); timeField.setText("" + hour + ":" + minute + ":" + second); } }); timer.start(); this.pack(); this.setVisible(true); } 10 https://www.facebook.com/Oxus20
  • 11. public static void main(String[] args) { new TextClockDemo(); } } 11 https://www.facebook.com/Oxus20
  • 12. Text Clock Demo Output 12 https://www.facebook.com/Oxus20
  • 13. JProgressBar » A progress bar is a component in a Graphical User Interface (GUI) used to visualize the progression of an extended computer operation such as ˃ a download ˃ file transfer ˃ or installation » Sometimes, the graphic is accompanied by a textual representation of the progress in a percent format. 13 https://www.facebook.com/Oxus20
  • 14. JProgressBar Constructors: » public JProgressBar() JProgressBar aJProgressBar = new JProgressBar(); » public JProgressBar(int orientation) JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL); JProgressBar bJProgressBar = new JProgressBar(JProgressBar.HORIZONTAL); » public JProgressBar(int minimum, int maximum) JProgressBar aJProgressBar = new JProgressBar(0, 100); » public JProgressBar(int orientation, int minimum, int maximum) JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL, 0, 100); » public JProgressBar(BoundedRangeModel model) DefaultBoundedRangeModel model = new DefaultBoundedRangeModel(0, 0, 0, 250); JProgressBar aJProgressBar = new JProgressBar(model); 14 https://www.facebook.com/Oxus20
  • 15. JProgressBar Demo import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JProgressBar; import javax.swing.Timer; public class JProgressDemo extends JFrame { private static JProgressBar progressBar; private Timer timer; private static int count = 1; private static int PROGBAR_MAX = 100; public JProgressDemo() { this.setTitle("JProgress Bar Demo"); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setSize(300, 80); 15 https://www.facebook.com/Oxus20
  • 16. progressBar = new JProgressBar(); progressBar.setMaximum(100); progressBar.setForeground(new Color(2, 8, 54)); progressBar.setStringPainted(true); this.add(progressBar, BorderLayout.SOUTH); timer = new Timer(300, new ActionListener() { public void actionPerformed(ActionEvent ae) { progressBar.setValue(count); if (PROGBAR_MAX == count) { timer.stop(); } count++; } }); timer.start(); this.setVisible(true); } 16 https://www.facebook.com/Oxus20
  • 17. public static void main(String[] args) { new JProgressDemo(); } } 17 https://www.facebook.com/Oxus20
  • 19. JWindow » A Window object is a top-level window with no borders and no menubar. » The default layout for a window is BorderLayout. » JWindow is used in splash screen in order to not be able to close the duration of splash screen execution and progress. 19 https://www.facebook.com/Oxus20
  • 20. Splash Screen Code import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JWindow; import javax.swing.Timer; public class SplashScreen extends JWindow { private static JProgressBar progressBar; private static int count = 1; private static int TIMER_PAUSE = 100; private static int PROGBAR_MAX = 105; private static Timer progressBarTimer; 20 https://www.facebook.com/Oxus20
  • 21. public SplashScreen() { createSplash(); } private void createSplash() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel splashImage = new JLabel(new ImageIcon(getClass().getResource("image.gif"))); panel.add(splashImage); progressBar = new JProgressBar(); progressBar.setMaximum(PROGBAR_MAX); progressBar.setForeground(new Color(2, 8, 54)); progressBar.setBorder(BorderFactory.createLineBorder(Color.black)); panel.add(progressBar, BorderLayout.SOUTH); this.setContentPane(panel); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); startProgressBar(); } 21 https://www.facebook.com/Oxus20
  • 22. private void startProgressBar() { progressBarTimer = new Timer(TIMER_PAUSE, new ActionListener() { public void actionPerformed(ActionEvent arg0) { progressBar.setValue(count); if (PROGBAR_MAX == count) { SplashScreen.this.dispose(); progressBarTimer.stop(); } count++; } }); progressBarTimer.start(); } public static void main(String[] args) { new SplashScreen(); } } 22 https://www.facebook.com/Oxus20