http://onesis.webs.com/

Forum Bisnis Fajar Achirudin

Blog

Jam Analog.java

Posted by OnesisĀ® on May 25, 2010 at 11:16 AM

jamAnalog.java

==================================

import java.awt.*;

import java.applet.*;

import java.util.Date;

public class jamAnalog

extends Applet implements Runnable {

// Deklarasi

Thread runner;

public void paint(Graphics g) {

// Membuat latar belakang berwarna putih

g.setColor(Color.white);

g.fillRect(0, 0, size().width, size().height);

// membuat nilai titik tengah dari jendela

Point p = new Point(size().width / 2, size().height / 2);

// Menentukan Panjang Jarum

int jarum_detik = 85, jarum_menit = 69, jarum_jam = 50;

// Mengambil Waktu Sekarang

Date dt = new Date();

int detik = dt.getSeconds();

int menit = dt.getMinutes();

int jam = dt.getHours();

// Menghitung besarnya sudut

double sudut_det = detik * Math.PI * 2 / 60.0;

double sudut_men = menit * Math.PI * 2 / 60.0;

double sudut_jam = jam * Math.PI * 2 / 12.0 + sudut_men / 12.0;

// Menentukan nilai posisi Jarum pada sudut tertentu

int det_x = (int) (p.x + jarum_detik * Math.sin(sudut_det));

int det_y = (int) (p.y - jarum_detik * Math.cos(sudut_det));

int men_x = (int) (p.x + jarum_menit * Math.sin(sudut_men));

int men_y = (int) (p.y - jarum_menit * Math.cos(sudut_men));

int jam_x = (int) (p.x + jarum_jam * Math.sin(sudut_jam));

int jam_y = (int) (p.y - jarum_jam * Math.cos(sudut_jam));

// Membuat lingkaran berwarna hitam (bingkai Jam)

g.setColor(Color.black);

g.drawOval(p.x - 90, p.y - 90, 180, 180);

// Membuat Jarum detik berwarna merah

g.setColor(Color.red);

g.drawLine(p.x, p.y, det_x, det_y);

// Membuat Jarum menit berwarna hitam

g.setColor(Color.black);

g.drawLine(p.x, p.y, men_x, men_y);

// Membuat Jaum jam berwarna biru

g.setColor(Color.BLUE);

g.drawLine(p.x, p.y, jam_x, jam_y);

// Membuat lingkaran pusat

g.setColor(Color.DARK_GRAY);

g.fillOval(p.x - 6, p.y - 6, 12, 12);

// Membuat Tulisan Angka

g.setFont(new Font("Dialog", Font.BOLD, 16));

g.drawString("12", p.x - 4, p.y - 75);

g.drawString("3", p.x + 75, p.y + 2);

g.drawString("6", p.x - 2, p.y + 85);

g.drawString("9", p.x - 85, p.y + 2);

}

public void update(Graphics g) {

paint(g);

}

public void start() {

runner = new Thread(this);

runner.start();

}

public void run() {

while (true) {

try {

// Waktu delay

runner.sleep(1000);

}

catch (Exception e) {}

repaint();

}

}

} // Akhir Kelas

==================

ini pake applet maka perlu ditambahkan dalam file HTML. ini file HTML-nya

<html>

<head>

<title>

Jam Analog

</title>

</head>

<body>

<applet code = "jamAnalog.class" width = "300" height ="250">

</applet>

</body>

</html>


Categories: None

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

Already a member? Sign In

1 Comment

Reply AlbertHoots
5:03 PM on August 7, 2018 
The men's prostate is a vital a part of a male's reproductive system. It secretes fluids that assisted in the transportation and activation of sperm. The prostate is located just while watching rectum, below the bladder and around the urethra. When there is prostate problem, in most cases very uncomfortable and inconvenient for the patient as his urinary product is directly affected.

The common prostate health problems are prostate infection, enlarged prostate and cancer of prostate.



Prostate infection, also called prostatitis, is among the most common prostate-related problem in men younger than 55 years. Infections in the men's prostate are classified into four types - acute bacterial prostatitis, chronic bacterial prostatitis, chronic abacterial prostatitis and prosttodynia.

Acute bacterial prostatitis is the least common of all kinds of prostate infection. It is due to bacteria found in the large intestines or urinary tract. Patients may go through fever, chills, body aches, back pains and urination problems. This condition is treated by utilizing antibiotics or non-steroid anti-inflammatory drugs (NSAIDs) to ease the swelling.

Chronic bacterial prostatitis is often a condition of the particular defect within the gland as well as the persistence presence of bacteria within the urinary tract. It can be a result of trauma towards the urinary tract or by infections via other areas of the body. A patient can experience testicular pain, spine pains and urination problems. Although it is uncommon, it can be treated by removal of the prostate defect followed by making use antibiotics and NSAIDs to deal with the soreness.

Non-bacterial prostatitis makes up about approximately 90% of all prostatitis cases; however, researchers have not yet to determine the causes of these conditions. Some researchers feel that chronic non-bacterial prostatitis occur as a consequence of unknown infectious agents while other think that intensive exercise and lifting may cause these infections.

Maintaining a Healthy Prostate

To prevent prostate diseases, a proper meals are important. These are some with the actions to maintain your prostate healthy.

1. Drink sufficient water. Proper hydration is necessary for general health and it will also keep your urinary track clean.

2. Some studies claim that a few ejaculations a week will prevent prostate type of cancer.

3. Eat red meat sparingly. It has been shown that consuming over four meals of beef per week will heighten the risk of prostate diseases and cancer.

4. Maintain a suitable diet with cereals, vegetable and fruits to be sure sufficient intake of nutrients required for prostate health.

The most crucial measure to look at to make sure a proper prostate is to go for regular prostate health screening. If you are forty yrs . old and above, you must go for prostate examination at least once per year.

Recent Videos

173 views - 0 comments