Posts

Showing posts from April, 2022

Week 12

Image
 This week we made a stopwatch. Since last week was a clock I thought it would be appropriate to make a stopwatch.  These lines of code format the stop watch and set how it preforms.  Here we set the fonts for start, stop, and resets , adds the buttons ,and some of the the code for the start stop and reset  so it listens to when those buttons are clicked and calls its method. And lastly the methods that will execute when the buttons are pressed and properly carry out stop, reset, and start. Pretty simple little project, that will be useful if I ever need a stopwatch. Now I don't need to look up google stopwatch or use my phone, I can just use my created one if its convenient. Citations: Java stopwatch ⏱️ - YouTube . (n.d.). Retrieved April 30, 2022, from https://www.youtube.com/watch?v=0cATENiMsBE

Week 11

Image
  The pictures are out of order, but the first picture is so that the clock refreshes every 1000 milliseconds (1 sec). The second picture is the beginning of the code Where we put the clock constructor we set the background layout and font so it looks they way we want it. Then using the "SimpleDateFormat" we set what the format of the time, day and date should look like. After we have the format we create and add the labels to the clock. and then lastly, we call the setTime method. The set time does exactly as it says and sets the time. We get the instance of the calendar and get the time for each (time, day, and date).  Picture of the clock that was made Citation: Java Clock App 🕓 - Youtube . https://www.youtube.com/watch?v=U63PV3u4aeQ.

Week 10

Image
 Tried doing something simple to get a some more insight to how the other games were working. Making the game frame, setting how big it is, and intializing the key listener to listen to the keys being typed. We use label as the object we're using, the commented line of code is to add a icon as a picture instead of a red box. I set the color, add, and make it visible. Then we have a method that tracks what key I type and how it suppose acts to each respective key.(returns the character of what was pressed) Similar method that instead returns the int of the character pressed. then when released prints the "keychar" and the "keycode".  me typing random key combinations of w,a,s,d, and you can see the key codes and key chars. This was a much more simple to see of the basic GUI functionality and so I can get the grasp of all of what the code is doing. Here is me pressing the left arrow so that it moves. The "?" are any keys other than w,a,s,d. Citation:  Ja...

Week 9

Image
  For this program we are creating a calculator. These methods are initializing the buttons for the calculator. We also set the size of the calculator window. We use the action listener to "listen" to the buttons. Then we add the buttons in the order we want.  We setting the buttons so they refresh on press of an operator.  switch case to do the actual operations and print the result. Then sets the delete and clear button so it works. 1+1=2 Citations: Java calculator app 🖩 - youtube . (n.d.). Retrieved April 9, 2022, from https://www.youtube.com/watch?v=dfhmTyRTCSQ 

Week 8

Image
  This is the game frame constructor that calls the game panel and makes my window so i can play the game. We got the game panel variables and constructor, where we set the screen size, where the "apple" will be, timers, etc. We also see the start game methods that will start the game and determines how long it will go. we got paint method that makes it so we see the trail of the snake. draw method which draws it out, sets colors of the apple and the snake. Has the head brighter than the body. We see the new apple method that summons a new apple at a random place each time it is eaten. we have the movement method. where if you decide to go up, down, left, or right, it will. then we have check apples eaten so that it will summon a new one once eaten and add body parts to the snake. We see if the body parts collide into each other or corners of the map. the game over method that decides how the game ends, "game over" text, and showing the score. action performer runs ...