Thursday, 31 January 2019

Download AndroidClock.java

Assalamu'alaikum warohmatulloh wabarokaatuh Sobat Setia Catatan sederhana Di siang hari ini saya akan membagikan File code Java ,,Bagi yang master Java pasti tau,, Kalau admin Masih tahap pembelajaran..Silahkan Dibaca Dibawah ini

 Berikut sekilas info nya

1 code FrmAndroidClock.java

package AndroidClock;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.border.LineBorder;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JButton;

@SuppressWarnings("serial")
public class FrmAndroidClock extends JFrame {

private JPanel contentPane;
private JPanel panel;
private ClGlossyPanel clGlossyPanel;
private JTextField txt1;
private JTextField txt2;
private JLabel lblNewLabel;
private JLabel label;
private JLabel label_1;
private JLabel label_2;
private JButton btnDigitalClock;
private JButton button;

/**
* Create the frame.
*/
public FrmAndroidClock() {
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 666, 364);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 0, 0));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

panel = new ClGlossyPanel();
panel.setBounds(155, 6, 133, 266);
contentPane.add(panel);
panel.setLayout(null);

txt1 = new JTextField();
txt1.setBorder(new LineBorder(new Color(0, 255, 102), 1, true));
txt1.setFont(new Font("Droid Sans", Font.BOLD, 40));
txt1.setHorizontalAlignment(SwingConstants.CENTER);
txt1.setEditable(false);
txt1.setBounds(0, 106, 133, 67);
panel.add(txt1);
txt1.setColumns(10);

lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon(FrmAndroidClock.class
.getResource("/AndroidClock/list-add-2.png")));
lblNewLabel.setBounds(39, 56, 48, 38);
panel.add(lblNewLabel);

label_1 = new JLabel("");
label_1.setIcon(new ImageIcon(FrmAndroidClock.class
.getResource("/AndroidClock/list-remove-2.png")));
label_1.setBounds(39, 198, 48, 38);
panel.add(label_1);

clGlossyPanel = new ClGlossyPanel();
clGlossyPanel.setBounds(373, 6, 133, 266);
contentPane.add(clGlossyPanel);
clGlossyPanel.setLayout(null);

txt2 = new JTextField();
txt2.setBorder(new LineBorder(new Color(0, 255, 102), 1, true));
txt2.setFont(new Font("Droid Sans", Font.BOLD, 40));
txt2.setHorizontalAlignment(SwingConstants.CENTER);
txt2.setEditable(false);
txt2.setColumns(10);
txt2.setBounds(0, 104, 133, 66);
clGlossyPanel.add(txt2);

label = new JLabel("");
label.setIcon(new ImageIcon(FrmAndroidClock.class
.getResource("/AndroidClock/list-add-2.png")));
label.setBounds(44, 54, 48, 38);
clGlossyPanel.add(label);

label_2 = new JLabel("");
label_2.setIcon(new ImageIcon(FrmAndroidClock.class
.getResource("/AndroidClock/list-remove-2.png")));
label_2.setBounds(44, 195, 48, 38);
clGlossyPanel.add(label_2);

btnDigitalClock = new JButton("Digital Clock");
btnDigitalClock.setFont(new Font("Droid Sans", Font.PLAIN, 15));
btnDigitalClock.setBounds(187, 284, 290, 51);
contentPane.add(btnDigitalClock);

button = new JButton("");
button.setFont(new Font("Droid Sans", Font.PLAIN, 15));
button.setBounds(531, 127, 100, 39);
contentPane.add(button);
ActionListener listener = new ActionListener()

{

@Override
public void actionPerformed(ActionEvent act)

{
// TODO Auto-generated method stub

String sJam = " ";
String sMenit = " ";
String sDetik = " ";

Date today = new Date();
@SuppressWarnings("deprecation")
int now_Jam = today.getHours(); // Mengambil jam saat ini
@SuppressWarnings("deprecation")
int now_Menit = today.getMinutes(); // Mengambil menit saat ini
@SuppressWarnings("deprecation")
int now_Detik = today.getSeconds(); // Mengambil detik saat ini

if (now_Jam <= 9) {
sJam = "0"; // Menambah angka 0 di depan Jam
}
if (now_Menit <= 9) {
sMenit = "0"; // Menambah angka 0 di depan Menit
}
if (now_Detik <= 9) {
sDetik = "0"; // Menambah angka 0 di depan Detik
}

String Jam = sJam + Integer.toString(now_Jam); // Merubah type
// data int
// now_Jam
// menjadi
// String
String Menit = sMenit + Integer.toString(now_Menit); // Merubah
// type
// data
// int
// now_Menit
// menjadi
// String
String Detik = sDetik + Integer.toString(now_Detik); // Merubah
// type
// data
// int
// now_Detik
// menjadi
// String

txt1.setText(Jam);
txt2.setText(Menit);
button.setText(Detik);

}
};

Timer waktu = new Timer(1000, listener);
waktu.start();

setLocationRelativeTo(null);
}

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager
.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
FrmAndroidClock frame = new FrmAndroidClock();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}



Dan masih ada 3 code lagi diantara nya

- Code CIGlossyPanel.java

 -Code Color.java

 -Code Theme.java 

 Bonus

-2 image png


Sobat  tidak usah copy saya siapkan link donlod nya File Rar Dibawah ini

DOWNLOAD

Alhamdulillah Catatan sederhana Download AndroidClock.java Telah selesai Mohon Maaf jika ada kesalahan wasalamu'alaikum warohmatulloh wabarokaatuh

No comments:

Post a Comment