Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package aplikasiglobal;
- import java.awt.Dimension;
- import java.awt.Toolkit;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import javax.swing.Timer;
- /**
- *
- * @author bayhaqi
- */
- public class FrmMenu extends javax.swing.JFrame {
- /**
- * Creates new form FrmMenu
- */
- private void makecenter() {
- Dimension screenSize
- = Toolkit.getDefaultToolkit().getScreenSize();
- Dimension frameSize = this.getSize();
- if (frameSize.height > screenSize.height) {
- frameSize.height = screenSize.height;
- }
- if (frameSize.width > screenSize.width) {
- frameSize.width = screenSize.width;
- }
- this.setLocation(
- (screenSize.width - frameSize.width) / 2,
- (screenSize.height - frameSize.height) / 2);
- }
- public void setJam() {
- ActionListener taskPerformer = new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- String nol_jam = "", nol_menit = "", nol_detik = "";
- Date dateTime = new Date();
- int nilai_jam = dateTime.getHours();
- int nilai_menit = dateTime.getMinutes();
- int nilai_detik = dateTime.getSeconds();
- if (nilai_jam <= 9) nol_jam = "0";
- if (nilai_menit <= 9) nol_menit = "0";
- if (nilai_detik <= 9) nol_detik = "0";
- String jam = nol_jam + Integer.toString(nilai_jam);
- String menit = nol_menit + Integer.toString(nilai_menit);
- String detik = nol_detik + Integer.toString(nilai_detik);
- waktu.setText(jam + ":" + menit + ":" + detik + " ");
- }
- };
- new Timer(1000, taskPerformer).start();
- }
- public void tglskrg(){
- Date skrg= new Date();
- SimpleDateFormat format= new SimpleDateFormat("EEEEE , dd MMMM yyyy");
- String tgl = format.format(skrg);
- tanggal.setText(format.format(skrg));
- }
- public FrmMenu() {
- initComponents();
- makecenter();
- setJam();
- tglskrg();
- }
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jMenuItem4 = new javax.swing.JMenuItem();
- jMenuItem5 = new javax.swing.JMenuItem();
- tanggal = new javax.swing.JLabel();
- waktu = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jLabel1 = new javax.swing.JLabel();
- jLabel3 = new javax.swing.JLabel();
- jLabel4 = new javax.swing.JLabel();
- jLabel5 = new javax.swing.JLabel();
- jMenuBar1 = new javax.swing.JMenuBar();
- jMenu1 = new javax.swing.JMenu();
- jMenuItem1 = new javax.swing.JMenuItem();
- jMenuItem2 = new javax.swing.JMenuItem();
- jMenuItem3 = new javax.swing.JMenuItem();
- jMenuItem6 = new javax.swing.JMenuItem();
- jMenu2 = new javax.swing.JMenu();
- jMenuItem7 = new javax.swing.JMenuItem();
- jMenuItem8 = new javax.swing.JMenuItem();
- jMenuItem4.setText("jMenuItem4");
- jMenuItem5.setText("jMenuItem5");
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- tanggal.setFont(new java.awt.Font("Palatino Linotype", 1, 14)); // NOI18N
- tanggal.setText("jLabel1");
- waktu.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
- waktu.setText("jLabel2");
- jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
- jLabel1.setText("APLIKASI ABSENSI DAN PENGGAJIAN");
- jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
- jLabel3.setText("PT. PARSAORAN GLOBAL DATATRANS");
- jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hsp.jpg"))); // NOI18N
- jMenu1.setText("Form");
- jMenuItem1.setText("Master Karyawan");
- jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem1ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem1);
- jMenuItem2.setText("Masuk");
- jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem2ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem2);
- jMenuItem3.setText("Pulang");
- jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem3ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem3);
- jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem6.setText("Exit");
- jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem6ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem6);
- jMenuBar1.add(jMenu1);
- jMenu2.setText("Report");
- jMenuItem7.setText("Absensi Karyawan");
- jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem7ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem7);
- jMenuItem8.setText("Slip Gaji Karyawan");
- jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem8ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem8);
- jMenuBar1.add(jMenu2);
- setJMenuBar(jMenuBar1);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(53, 53, 53)
- .addComponent(jLabel4)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel5)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel2)
- .addGap(61, 61, 61)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(tanggal, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(waktu, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1)
- .addComponent(jLabel3))
- .addContainerGap(69, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(60, 60, 60)
- .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(103, 103, 103)
- .addComponent(jLabel4))
- .addGroup(layout.createSequentialGroup()
- .addGap(144, 144, 144)
- .addComponent(tanggal)
- .addGap(18, 18, 18)
- .addComponent(waktu)
- .addGap(44, 44, 44)
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jLabel3))
- .addGroup(layout.createSequentialGroup()
- .addGap(68, 68, 68)
- .addComponent(jLabel5)))
- .addContainerGap(86, Short.MAX_VALUE))
- );
- pack();
- }// </editor-fold>
- private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- System.exit(0);
- }
- private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- new FrmKeluar().setVisible(true);
- }
- private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- new FrmMasuk().setVisible(true);
- }
- private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- new FrmPegawai().setVisible(true);
- }
- private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- new FrmReportGaji().setVisible(true);
- }
- private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- new FrmReportslipglobal().setVisible(true);
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(FrmMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(FrmMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(FrmMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(FrmMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- //</editor-fold>
- //</editor-fold>
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new FrmMenu().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel5;
- private javax.swing.JMenu jMenu1;
- private javax.swing.JMenu jMenu2;
- private javax.swing.JMenuBar jMenuBar1;
- private javax.swing.JMenuItem jMenuItem1;
- private javax.swing.JMenuItem jMenuItem2;
- private javax.swing.JMenuItem jMenuItem3;
- private javax.swing.JMenuItem jMenuItem4;
- private javax.swing.JMenuItem jMenuItem5;
- private javax.swing.JMenuItem jMenuItem6;
- private javax.swing.JMenuItem jMenuItem7;
- private javax.swing.JMenuItem jMenuItem8;
- private javax.swing.JLabel tanggal;
- private javax.swing.JLabel waktu;
- // End of variables declaration
- }
Add Comment
Please, Sign In to add comment