//docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#text //--------------------------------------------------------------- public class Main { public static void main(String[] args) { new MyFrame(); } } //--------------------------------------------------------------- import java.awt.*; import java.text.*; import java.util.*; import javax.swing.*; public class MyFrame extends JFrame{ Calendar calendar; SimpleDateFormat timeFormat; SimpleDateFormat dayFormat; SimpleDateFormat dateFormat; JLabel timeLabel; JLabel dayLabel; JLabel dateLabel; String time; String day; String date; MyFrame(){ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("My Clock Program"); this.setLayout(new FlowLayout()); this.setSize(350,200); this.setResizable(false); timeFormat = new SimpleDateFormat("hh:mm:ss a"); dayFormat = new SimpleDateFormat("EEEE"); dateFormat = new SimpleDateFormat("MMMMM dd, yyyy"); timeLabel = new JLabel(); timeLabel.setFont(new Font("Verdana",Font.PLAIN,50)); timeLabel.setForeground(new Color(0x00FF00)); timeLabel.setBackground(Color.black); timeLabel.setOpaque(true); dayLabel = new JLabel(); dayLabel.setFont(new Font("Ink Free",Font.PLAIN,35)); dateLabel = new JLabel(); dateLabel.setFont(new Font("Ink Free",Font.PLAIN,25)); this.add(timeLabel); this.add(dayLabel); this.add(dateLabel); this.setVisible(true); setTime(); } public void setTime() { while(true) { time = timeFormat.format(Calendar.getInstance().getTime()); timeLabel.setText(time); day = dayFormat.format(Calendar.getInstance().getTime()); dayLabel.setText(day); date = dateFormat.format(Calendar.getInstance().getTime()); dateLabel.setText(date); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } //---------------------------------------------------------------
@harsha40483 жыл бұрын
@Prashik Menka Valmik Indase eclipse bro
@mxh7aa3 жыл бұрын
Please make a video about clock timer in javafx
@joyceasante8292 Жыл бұрын
Practicing... public class Main { public static void main(String[] args) { new MyFrame(); } } ******************* import java.text.*; import java.time.*; import java.awt.*; import java.util.*; import javax.swing.*; public class MyFrame extends JFrame { Calendar Calendar; SimpleDateFormat timeFormat; SimpleDateFormat dayFormat; SimpleDateFormat dateFormat; JLabel timeLabel; JLabel dayLabel; JLabel dateLabel; String time; String day; String date; MyFrame () { this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); this.setTitle ("Clock App"); this.setLayout (new FlowLayout ()); this.setSize (400, 280); this.setResizable (false); timeFormat = new SimpleDateFormat ("hh:mm:ss a"); dayFormat = new SimpleDateFormat ("EEEE"); dateFormat = new SimpleDateFormat ("MMMMM dd, yyyy"); timeLabel = new JLabel (); timeLabel.setFont (new Font ("Sans Seriff", Font.PLAIN, 18)); timeLabel.setForeground (Color.red); timeLabel.setBackground (Color.black); timeLabel.setOpaque (true); dayLabel = new JLabel (); dayLabel.setFont (new Font ("Helvetica", Font.PLAIN, 20)); dateLabel = new JLabel (); dateLabel.setFont (new Font ("Helvetica", Font.PLAIN, 20)); this.add (timeLabel); this.add (dayLabel); this.add (dateLabel); this.setVisible (true); setTime (); } public void setTime () { while (true) { time = timeFormat.format (Calendar.getInstance ().getTime ()); timeLabel.setText (time); day = dayFormat.format (Calendar.getInstance ().getTime ()); dayLabel.setText (day); date = dateFormat.format (Calendar.getInstance ().getTime ()); dateLabel.setText (date); try { Thread.sleep (1000); } catch (InterruptedException e) { e.printStackTrace (); } } } }
@brianne25792 жыл бұрын
I hope you can read this to cheer you up. I've watched a lot of your videos and it help me a lot. I saved some of them on my JAVA playlist to be accessed quickly when I forgot something, It really helped me a lot. Then I've realized that I didn't subscribed to you. I just did now and I just want to say thank you so much, It helped me a lot. Hope you make more videos that will help someone in the future.
@yibyul2025 Жыл бұрын
The setTime(); method actually works even without the Thread.sleep(1000); as long as the code is inside the while loop. The timeFormat will move each second for me. Anyway. Big thanks for this!
@mxh7aa3 жыл бұрын
Man...you know exactly what i need everytime i search for help and i found your videos, very helpful Respect 💪
@czg74792 жыл бұрын
Support from fans. Please keep doing this kind of tutorial!
@JordantheComputerScientist4 жыл бұрын
This channel is the reason I'm still trying to learn. thanks
@BroCodez4 жыл бұрын
You can do it Jordan!
@JordantheComputerScientist4 жыл бұрын
@@BroCodez I made a video creating my first GUI and I used a lot of what you taught me and created a counter GUI. I hope your channel blows up.
@kingolintv3 ай бұрын
This tutorial is amazing this whole channel is! I am planning to do your 7 hour full java course
@miuwai62113 жыл бұрын
You help me coding my first Java apps. Thank you very much.
@hdjabs19502 жыл бұрын
sometimes i click on a video that i know im not equipped for, but i just want to see what to expect in the future! and it excites me
@arshdeepsingh37492 жыл бұрын
Thanks bro this chennal is very helpful for students and I am from INDIA
@gmlohith66414 жыл бұрын
Awesome bro I'm watching your videos regularly. great work. thanks a lot for the content.
@BroCodez4 жыл бұрын
thanks for watching!
@ajitsomani4166 Жыл бұрын
Thank you so much ,I watched two other videos on this program before this , but can't able to execute and understand the program .But this one was so easy to understand and I successfully completed this .Thank you once again.
@DiaborMagics2 ай бұрын
Thanks for this. I've been trying to find how I can make a program simulate real-time but couldnt find anything until "java clock" landed me this video (and a bunch of showcases that explained nothing). I want to practise some things like classes and methods by making a tournament (selection, preliminaries, pool phase, knock-out phase and several different events will help me get a grasp on these concepts i think, in a fun way). but i wanted to do it with time limits per game like in real life, where during the game things can happen. for example football or beach volleyball etc, but I cant implement that without knowing how to process real time in java. ok gonna watch this now :) EDIT: I already see something I didn't know was possible a few seconds in. You just put new MyFrame(); but I thought you always have to name your instances. MyFrame blabla equals new MyFrame, etc.
@mahrokhsadro8433 жыл бұрын
a good java video with good English is a GEM!thxx
@aaronjohnson84033 жыл бұрын
Good video for developer
@manoshacooray5322 Жыл бұрын
Lovely 😍
@JakeMGolle3 жыл бұрын
This dude is really out here coding at 7 am on a Sunday, ha ha. Props.
@monikarathore49502 жыл бұрын
well explained it is easy to understand.
@raviratnakar38033 жыл бұрын
Awesome bro
@rishabsingh-ml7df2 жыл бұрын
your video was very helpful for me Respect Thank you It really helped me a lot. Then I've realized that I didn't subscribed to you. I just did now and I just want to say thank you so much, It helped me a lot. Hope you make more videos that will help someone in the future.
@manipurihunabopa11 ай бұрын
Hey, bro. You are amzing. Your every video turorial are so good. You make everything easy. You are a great teacher. How did you master such great teaching strategy? Could you make a separate tutorial on How to teach well?" I'd very appreciate it.
@deepdaddy12084 жыл бұрын
Awesome vid bro
@BroCodez4 жыл бұрын
thanks Dbest
@nalindugraphics3124 Жыл бұрын
This video is really helpfull bro. Subscribed 🤩
@jeresue2 жыл бұрын
Brooo, you're good at explaining, amazing........
@guanyu80203 жыл бұрын
Thank you Bro Code. You help me so much. I really appreciate what you have done here.
@kemann38152 жыл бұрын
Nice
@rahulvarma30042 жыл бұрын
excellent🤩
@beatztito3 жыл бұрын
Good job
@TimeWrapChronicales3 жыл бұрын
cool
@tanviralam97984 жыл бұрын
I'm complete this code..thank you so much for your help
@emdorsfm16252 жыл бұрын
these vids are super helpfull thanks alot of and for the lasy people like me besides clicking on the src file and then clicking on file and then new class click all these: alt - shift - n and you will need to click on class
@malicant123 Жыл бұрын
Thanks for the tutorial.
@jefferyjohnson26123 жыл бұрын
//Great video :)
@ozifirebrand2 жыл бұрын
Niceeee
@ChristianRodriguez-tm3jg Жыл бұрын
Thanks bro... It just what i neer to create a planner app for practice... greetings 15/01/2023
@par-feubr94203 жыл бұрын
Thanks for this great effort sir
@attalaw363 жыл бұрын
very helpful thank you
@-howto84933 жыл бұрын
Good
@eugenezuev73494 ай бұрын
understandable, thanks
@mdmoinuddin61682 жыл бұрын
Thank you sir
@loscricciolo882 жыл бұрын
Clear and useful as usual. Thanks!
@fredomambu7593 Жыл бұрын
It's a pure art
@andreassorqvist68823 жыл бұрын
Great vid!! One question though that came up about extendability, how do you apply an alarm-setting to time-applications using the SimpleDateFormat?
@thulanijamnda72433 жыл бұрын
I have the same question you know
@ashutoshsoni97233 жыл бұрын
Thank you Bro Code i am learning Java from your channel
@Amangupta-rh7cy3 жыл бұрын
Good bro
@TOMSONSONES8 ай бұрын
can u specify the theme for ur editor , its so well colored !!
@wolanus3 жыл бұрын
Thanks Bro for the video. Great job!
@BitCloud0473 жыл бұрын
awesome video bro!
@stanislavdimitrov1643 Жыл бұрын
Very nice video, thank you very much. Can this app be opened outside of Eclipse?
@oguzhantopaloglu94424 жыл бұрын
amazing as usual
@joshuaraymond49962 жыл бұрын
thanks for everything.
@mortaldietwice65073 жыл бұрын
System.out.println("thanks");
@sudhanshutripathi47229 ай бұрын
System.out.print("Thanks");
@eduardandreihondrea48843 жыл бұрын
You are awesome. 👏
@DannyBeamz123 Жыл бұрын
This is like my second vid on coding i went from nothing to making this by following the vid and struggling for like 2-3 hours tryna find my mistakes...Was amazing when I found what I did wrong though :)
@mehmetlehmann56012 жыл бұрын
Thank you very much.
@developerjunior4463 жыл бұрын
Super Broo!!!
@uwucodes44193 жыл бұрын
Great vid!! One question though that came up about extendability, how do you apply an alarm-setting to time-applications using the SimpleDateFormat? (2)
@maxwong17682 жыл бұрын
// another style for repeated task which Bro has mentioned before . /* public void setTime() { Timer timer = new Timer() ; TimerTask task = new TimerTask() { // TimerTask is an abstract class . @Override public void run() { time = timeFormat.format(Calendar.getInstance().getTime()) ; timeLabel.setText(time) ; } }; timer.scheduleAtFixedRate(task , 0 , 1000) ; }
@trxlly2 жыл бұрын
Thanks man this was soo helpful!
@АЯШАВА-й3ш2 жыл бұрын
Cool bro)
@aqibishaq8854 жыл бұрын
bro dudeu just awesome just sub ur channel today bring more java content
@vedanshisahay91792 жыл бұрын
Thanks ✨✨
@mlame952 жыл бұрын
Thank you brohan
@MrLoser-ks2xn2 жыл бұрын
Thanks
@alaarajab3962 Жыл бұрын
Thank you
@KhmerTimeline6 ай бұрын
make alarm clokc , timer too , sir thanks
@tanviralam97984 жыл бұрын
Thank you... Bro code..... Love Bangladesh
@edoardoromero3 жыл бұрын
thanks for this videos Bro! ;-)
@ssalem71102 жыл бұрын
The whole book explained in 15 minutes. 📖🍎🏆
@stephanieezat-panah77502 жыл бұрын
What I would like to see, is a separate file, a library of sorts, that can be called in other files. so, I can have several windows, that will call this method, to display across different windows
@lengeschder3 жыл бұрын
Thank you for this vid!
@hartsijaan40382 жыл бұрын
Thank you so much.
@saedshaheen84513 жыл бұрын
thanks
@Maximiliano7062 жыл бұрын
Thank you !
@JLSXMK83 жыл бұрын
I get it already! So, are the hex values of the format "0xRRGGBB" for the Color class (R = "Red", G = "Green", B = "Blue")? That's cool.
@rachitmittal448 Жыл бұрын
🤜🤜🤜
@kal-elzecco89482 жыл бұрын
Thankyou so much!! you help me a lot bro
@fahrulrozi7030 Жыл бұрын
thank you so much bro 🥰🥰
@athrvajadhav8620 Жыл бұрын
Bro thanks 👍👍❤
@m_sonaligupta3 жыл бұрын
1year 1month Same day writing this Code, more importantly, understanding it.
@ReVitsXD2 жыл бұрын
This help me a lot , but i got some problems here, when i use this clock.java for 2nd class then i called it on my main.java class the clock.java won't show anything kinda stuck in loop
@laurencecastromero53912 жыл бұрын
THANK YOU MAN!!!!!
@shibangi_.9263 Жыл бұрын
It's in NetBeans or vscode?
@bodipie28282 жыл бұрын
how do I center the window when running the program (starts in the center of the screen)
@aakashtiwari36773 жыл бұрын
How do I set Border color, width of the Frame ?
@henryescobarmontoya89183 жыл бұрын
Thanks Bro Code
@trickysachin2 жыл бұрын
👍
@denyserurangwa9581 Жыл бұрын
🤗
@KevoTHRASHER Жыл бұрын
I want to include a JPanel doing this but a JFrame -> JPanel->All JLabel's and compile with no errors & run program but no see the JFrame, JPanel or Window but the program ir running. this was my JPanel file class package mytoolkit; import java.util.Calendar; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.Color; import java.awt.Font; import java.awt.Dimension; import java.awt.FlowLayout; import java.util.Calendar; import java.text.SimpleDateFormat; import java.lang.Thread; public class ClockPanel extends JPanel { JLabel timeLabel, dayLabel, dateLabel; Calendar myCalendar; SimpleDateFormat timeFormat, dayFormat, dateFormat; String timeString, dayString, dateString; public ClockPanel() { this.setLayout(null); timeFormat = new SimpleDateFormat("hh:mm:ss a"); dayFormat = new SimpleDateFormat("EEEE"); dateFormat = new SimpleDateFormat("dd/MMMMM/YYYY"); timeLabel = new JLabel(); timeLabel.setFont(new Font("JetBrains Mono",Font.BOLD,25)); timeLabel.setBackground(Color.BLACK); timeLabel.setForeground(Color.GREEN); timeLabel.setOpaque(true); timeLabel.setVisible(true); dayLabel = new JLabel("DIA"); dayLabel.setFont(new Font("JetBrains Mono",Font.BOLD,25)); dayLabel.setBackground(Color.BLUE); dayLabel.setForeground(Color.GREEN); dayLabel.setOpaque(true); dayLabel.setVisible(true); dateLabel = new JLabel("DATE"); dateLabel.setFont(new Font("JetBrains Mono",Font.BOLD,25)); dateLabel.setBackground(Color.WHITE); dateLabel.setForeground(Color.GREEN); dateLabel.setOpaque(true); dateLabel.setVisible(true); this.setPreferredSize(new Dimension(300,200)); this.setBounds(0,0,350,200); this.add(timeLabel); this.add(dayLabel); this.add(dateLabel); this.setVisible(true); this.setTime(); this.repaint(); this.validate(); } public void setTime() { while(true) { timeString = timeFormat.format(Calendar.getInstance().getTime()); timeLabel.setText(timeString); timeLabel.setVisible(true); timeLabel.repaint(); timeLabel.validate(); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } } Sorry my bad English, i am from México
@mahdimehraz62752 жыл бұрын
Respect
@retr0k9643 жыл бұрын
Maybe the thought behind making the name of the month "MMMMM", was that the word month has 5 letters, thus the 5 M's? Just a guess.
@BroCodez3 жыл бұрын
might be!
@abhihekdas98193 жыл бұрын
Why this channel is so underrated 😭
@monwil32964 жыл бұрын
Thank you Bro 😎.
@martincerdahernandez26533 жыл бұрын
Muy bueno :)
@AwestruckEarl Жыл бұрын
do newer version of ide have to run the code first? cuase it doesnt run at the 2 minute mark
@HarryPotter-bd2qb3 жыл бұрын
Arigato kamisama
@ninhduongchan763 Жыл бұрын
How can I synchronize time between servers in a distributed system by java language?
@dendrxx2 жыл бұрын
Where are you importing from? When i do that in the code along it doesnt utilize that the import.