1 / 6

Java Timer and Applet Basics for Web Development

Learn how to utilize javax.swing.Timer for timing tasks and Java applets for web browsers. Understand differences between applets and applications, and grasp basics of HTML layout managers.

alexiab
Download Presentation

Java Timer and Applet Basics for Web Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Timer in Java • javax.swing.Timer – (getDelay, setDelay, setRepeats, isRepeats, start, stop, isRunning; ActionListner: actionPerformed) • JProgressBar – (getMinimum, setMinimum, getMaximum, setMaximum, getValue, setValue, getOrientation, setOrientation)

  2. Java Applet • HTML/XHTML • Web browsers with Java plug-in/Applet container • Load the class • Create an object • Call init, start, paint • Applet Life-Cycle methods: init, start, stop, and destroy.

  3. Applet vs. Application • JApplet vs. JFrame/JPanel • An applet can always be converted to an application • An application can be converted to an applet if no applet security rules are violated.

  4. Simple HTML Example <html> <head> <title>One Minute Timer</title> </head> <body> <applet code = "TestTimer.class" width = 270 height = 300> </applet> </body> </html>

  5. An Example

  6. Layout Managers • null: absolute positioning • FlowLayout: sequentially form left to right; default for JPanel • BorderLayout: five areas: NORTH, SOUTH, EAST, WEST, and CENTER; default for JFrame • GridLayout: rows and columns

More Related