Show date and Clock in java Frame
Page 1 of 1 • Share •
Show date and Clock in java Frame
Here is code For Show date and time in JFrame:
- Code:
import java.awt.Font;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Date_Time extends JFrame{
public JPanel show_date_time = new JPanel();
public JLabel date = new JLabel("Date");
public JLabel time = new JLabel("Time");
public JLabel show_time = new JLabel("Show Time");
public JLabel Show_date = new JLabel("Show Date");
DateFormat dateFormat2 = new SimpleDateFormat("h:mm:ss a");
java.util.Date date2;
public Date_Time(){
this.setSize(1030, 735);
this.setResizable(false);
getContentPane().add(Show_Time_date());
}
public JPanel Show_Time_date(){
show_date_time.setLayout(null);
show_date_time.setBounds(0,100, 1030, 635);
Font f;
f = new Font("SansSerif", Font.PLAIN, 15);
date.setBounds(50, 100, 100, 30);
date.setFont(f);
show_date_time.add(date);
time.setBounds(700,100,100,30);
time.setFont(f);
show_date_time.add(time);
DateFormat dateFormat = new SimpleDateFormat("EEEEEEEEE: dd MMMMMMMMM, yyyy.");
java.util.Date date = new java.util.Date();
String dateTime = dateFormat.format(date);
Show_date = new JLabel(dateTime);
Show_date.setBounds(150, 100, 200, 30);
Show_date.setFont(f);
show_date_time.add(Show_date);
show_time= new JLabel("");
updateDateTime();
show_time.setBounds(800,100,200,30);
show_time.setFont(f);
show_date_time.add(show_time);
return show_date_time;
}
/**
* @param args
*/
public static void main(String[] args) {
Date_Time Main_win=new Date_Time();
Main_win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Main_win.setVisible(true);
}
public void updateDateTime()
{
Thread th = new Thread(new Runnable()
{
public void run()
{
while(true)
{
date2 = new java.util.Date();
String dateTime = dateFormat2.format(date2);
show_time.setText(dateTime);
show_time.updateUI();
}
}
});
th.start();
}
}
Last edited by Saiful on Fri Jul 30, 2010 11:55 pm; edited 1 time in total
Saiful- Beta Release
- Course(s) :
- BIT
Blood Group : A+
Posts : 50
Points : 88
Re: Show date and Clock in java Frame
ki jinis mamu?Saiful wrote:........ JFream:
_________________________________________________________________
Buddhong shoronogocchami..
dhommong shoronogocchami..
shonghong shoronogocchami..
Jogoter sokol prani.. shukhi hok.
BIT0104-ANIK- Administrator
- Course(s) :
- BIT
Blood Group : O+
Posts : 423
Points : 699
Re: Show date and Clock in java Frame
BIT0104-ANIK wrote:ki jinis mamu?Saiful wrote:........ JFream:
wahahahah


BIT0122-Amit- Founder
- Course(s) :
- BIT
Blood Group : O+
Posts : 4187
Points : 6605
Re: Show date and Clock in java Frame
BIT0104-ANIK wrote:ki jinis mamu?Saiful wrote:........ JFream:
darun moja pailam...
secondly ai code Java convention maintain kore nai...
akta jinis sobai remind kore dei.. java convention and coding standard onek important issue..
at least career a aitar impact onek beshi...
interview te dui line code likhte dile tara coding standard and convention kheyal korbe...
ami nijeo age aita somporke aware cilam na..
but akhon chesta kori.. convention and standard maintain korte.......
_________________________________________________________________
Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
BIT0112-Rokon- Programmer
- Course(s) :
- BIT
Blood Group : O+
Posts : 673
Points : 1269
Re: Show date and Clock in java Frame
bit0112-rokon wrote:BIT0104-ANIK wrote:ki jinis mamu?Saiful wrote:........ JFream:
darun moja pailam...
secondly ai code Java convention maintain kore nai...
akta jinis sobai remind kore dei.. java convention and coding standard onek important issue..
at least career a aitar impact onek beshi...
interview te dui line code likhte dile tara coding standard and convention kheyal korbe...
ami nijeo age aita somporke aware cilam na..
but akhon chesta kori.. convention and standard maintain korte.......
tui to khali eita dekhtesish


But ja dise, vala hoise

Tui coding convention follow kore eitar standardized form de


BIT0122-Amit- Founder
- Course(s) :
- BIT
Blood Group : O+
Posts : 4187
Points : 6605
Re: Show date and Clock in java Frame
lolzzzzzzzz
class a Jframe darun uccharon dekhe amra nijerai vasha harie felesilam

class a Jframe darun uccharon dekhe amra nijerai vasha harie felesilam

_________________________________________________________________
মানুষ তার স্বপ্নের সমান বড়
BIT0129-Tabassum- Global Moderator
- Course(s) :
- BIT
Blood Group : A+
Posts : 1496
Points : 2298
Re: Show date and Clock in java Frame
class a ki hoicilo..?
_________________________________________________________________
Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
BIT0112-Rokon- Programmer
- Course(s) :
- BIT
Blood Group : O+
Posts : 673
Points : 1269
Re: Show date and Clock in java Frame
atcha .. java coding standard niye akta tutorial lekhbo ....
_________________________________________________________________
Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
BIT0112-Rokon- Programmer
- Course(s) :
- BIT
Blood Group : O+
Posts : 673
Points : 1269
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
» Cisco EHWIC SFP/GE WAN Card
» Huawei S1700-28GFR-4P-AC Price
» teach yourself C++ / Herbert Schildt Solutions
» teach yourself c by herbert schildt pdf
» ASA 5506X With Firepower ASA5506-K9
» New Trends in Deal Business
» PoE Power Allocation for WS-C2960S-24PS-L
» How to cure back pain