Advertisement
hendra_de5

FrmPegawai.java

Apr 19th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.08 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package aplikasiglobal;
  7.  
  8. import java.awt.Dimension;
  9. import java.awt.Toolkit;
  10. import java.sql.*;
  11. import java.text.SimpleDateFormat;
  12. import javax.swing.JOptionPane;
  13. import koneksi.SettingUI;
  14.  
  15. /**
  16. *
  17. * @author bayhaqi
  18. */
  19. public class FrmPegawai extends javax.swing.JFrame {
  20.  
  21. /**
  22. * Creates new form FrmBuruh
  23. */
  24. private void makecenter() {
  25. Dimension screenSize
  26. = Toolkit.getDefaultToolkit().getScreenSize();
  27. Dimension frameSize = this.getSize();
  28. if (frameSize.height > screenSize.height) {
  29. frameSize.height = screenSize.height;
  30. }
  31. if (frameSize.width > screenSize.width) {
  32. frameSize.width = screenSize.width;
  33. }
  34. this.setLocation(
  35. (screenSize.width - frameSize.width) / 2,
  36. (screenSize.height - frameSize.height) / 2);
  37. }
  38.  
  39. public void nipmax(){
  40.  
  41. try{
  42. Class.forName("com.mysql.jdbc.Driver");
  43. Connection kon = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbglobal?user=root&password=");
  44. String sql = "SELECT max(noid) FROM pegawai ";
  45. Statement sta = kon.createStatement();
  46. ResultSet rse = sta.executeQuery(sql);
  47. if(rse.next()){
  48. String noid=rse.getString("max(noid)");
  49. lbllastnip.setText(noid);
  50.  
  51. }else{
  52. System.out.println("Data dengan id yang ada tidak ditemukan!");
  53. }
  54. }catch(Exception e){
  55. e.printStackTrace();
  56. }
  57.  
  58. }
  59. public FrmPegawai() {
  60. initComponents();
  61. makecenter();
  62. nipmax();
  63.  
  64. }
  65.  
  66. /**
  67. * This method is called from within the constructor to initialize the form.
  68. * WARNING: Do NOT modify this code. The content of this method is always
  69. * regenerated by the Form Editor.
  70. */
  71. @SuppressWarnings("unchecked")
  72. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  73. private void initComponents() {
  74.  
  75. jLabel1 = new javax.swing.JLabel();
  76. txtnip = new javax.swing.JTextField();
  77. bcari = new javax.swing.JButton();
  78. jLabel2 = new javax.swing.JLabel();
  79. jLabel3 = new javax.swing.JLabel();
  80. txtnama = new javax.swing.JTextField();
  81. cmbjabatan = new javax.swing.JComboBox();
  82. jLabel4 = new javax.swing.JLabel();
  83. txtasal = new javax.swing.JTextField();
  84. jLabel5 = new javax.swing.JLabel();
  85. txttgllahir = new com.toedter.calendar.JDateChooser();
  86. jLabel6 = new javax.swing.JLabel();
  87. txttglmulai = new com.toedter.calendar.JDateChooser();
  88. bsave = new javax.swing.JButton();
  89. bexit = new javax.swing.JButton();
  90. bclear = new javax.swing.JButton();
  91. jLabel7 = new javax.swing.JLabel();
  92. lbllastnip = new javax.swing.JLabel();
  93. jLabel8 = new javax.swing.JLabel();
  94. bupdate = new javax.swing.JButton();
  95. bdelete = new javax.swing.JButton();
  96. jLabel9 = new javax.swing.JLabel();
  97. txtgapok = new javax.swing.JTextField();
  98.  
  99. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  100.  
  101. jLabel1.setText("NIP");
  102.  
  103. txtnip.addKeyListener(new java.awt.event.KeyAdapter() {
  104. public void keyPressed(java.awt.event.KeyEvent evt) {
  105. txtnipKeyPressed(evt);
  106. }
  107. });
  108.  
  109. bcari.setText("Find");
  110. bcari.addActionListener(new java.awt.event.ActionListener() {
  111. public void actionPerformed(java.awt.event.ActionEvent evt) {
  112. bcariActionPerformed(evt);
  113. }
  114. });
  115.  
  116. jLabel2.setText("Nama");
  117.  
  118. jLabel3.setText("Jabatan");
  119.  
  120. cmbjabatan.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Direktur", "Finance", "Marketing", "NOC", "Technical Support" }));
  121. cmbjabatan.addActionListener(new java.awt.event.ActionListener() {
  122. public void actionPerformed(java.awt.event.ActionEvent evt) {
  123. cmbjabatanActionPerformed(evt);
  124. }
  125. });
  126.  
  127. jLabel4.setText("Asal");
  128.  
  129. jLabel5.setText("Tanggal Lahir");
  130.  
  131. txttgllahir.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
  132. public void propertyChange(java.beans.PropertyChangeEvent evt) {
  133. txttgllahirPropertyChange(evt);
  134. }
  135. });
  136.  
  137. jLabel6.setText("Tanggal Mulai");
  138.  
  139. txttglmulai.addFocusListener(new java.awt.event.FocusAdapter() {
  140. public void focusLost(java.awt.event.FocusEvent evt) {
  141. txttglmulaiFocusLost(evt);
  142. }
  143. });
  144. txttglmulai.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
  145. public void propertyChange(java.beans.PropertyChangeEvent evt) {
  146. txttglmulaiPropertyChange(evt);
  147. }
  148. });
  149.  
  150. bsave.setText("Save");
  151. bsave.addActionListener(new java.awt.event.ActionListener() {
  152. public void actionPerformed(java.awt.event.ActionEvent evt) {
  153. bsaveActionPerformed(evt);
  154. }
  155. });
  156. bsave.addFocusListener(new java.awt.event.FocusAdapter() {
  157. public void focusLost(java.awt.event.FocusEvent evt) {
  158. bsaveFocusLost(evt);
  159. }
  160. });
  161.  
  162. bexit.setText("Exit");
  163. bexit.addActionListener(new java.awt.event.ActionListener() {
  164. public void actionPerformed(java.awt.event.ActionEvent evt) {
  165. bexitActionPerformed(evt);
  166. }
  167. });
  168.  
  169. bclear.setText("Clear");
  170. bclear.addActionListener(new java.awt.event.ActionListener() {
  171. public void actionPerformed(java.awt.event.ActionEvent evt) {
  172. bclearActionPerformed(evt);
  173. }
  174. });
  175.  
  176. jLabel7.setText("Last NIP");
  177.  
  178. lbllastnip.setText("jLabel8");
  179.  
  180. jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
  181. jLabel8.setText("FORM PEMASUKAN DATA KARYAWAN");
  182.  
  183. bupdate.setText("Update");
  184. bupdate.addActionListener(new java.awt.event.ActionListener() {
  185. public void actionPerformed(java.awt.event.ActionEvent evt) {
  186. bupdateActionPerformed(evt);
  187. }
  188. });
  189.  
  190. bdelete.setText("Delete");
  191. bdelete.addActionListener(new java.awt.event.ActionListener() {
  192. public void actionPerformed(java.awt.event.ActionEvent evt) {
  193. bdeleteActionPerformed(evt);
  194. }
  195. });
  196.  
  197. jLabel9.setText("Gaji Pokok");
  198.  
  199. txtgapok.setEnabled(false);
  200. txtgapok.addActionListener(new java.awt.event.ActionListener() {
  201. public void actionPerformed(java.awt.event.ActionEvent evt) {
  202. txtgapokActionPerformed(evt);
  203. }
  204. });
  205.  
  206. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  207. getContentPane().setLayout(layout);
  208. layout.setHorizontalGroup(
  209. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  210. .addGroup(layout.createSequentialGroup()
  211. .addGap(121, 121, 121)
  212. .addComponent(jLabel8)
  213. .addGap(0, 0, Short.MAX_VALUE))
  214. .addGroup(layout.createSequentialGroup()
  215. .addGap(89, 89, 89)
  216. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  217. .addGroup(layout.createSequentialGroup()
  218. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  219. .addComponent(jLabel1)
  220. .addComponent(jLabel2)
  221. .addComponent(jLabel3)
  222. .addComponent(jLabel7))
  223. .addGap(49, 49, 49)
  224. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  225. .addGroup(layout.createSequentialGroup()
  226. .addComponent(lbllastnip)
  227. .addGap(0, 0, Short.MAX_VALUE))
  228. .addGroup(layout.createSequentialGroup()
  229. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  230. .addComponent(cmbjabatan, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
  231. .addGroup(layout.createSequentialGroup()
  232. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  233. .addComponent(txtnama, javax.swing.GroupLayout.Alignment.LEADING)
  234. .addComponent(txtnip, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
  235. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  236. .addComponent(bcari)))
  237. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  238. .addGroup(layout.createSequentialGroup()
  239. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  240. .addGroup(layout.createSequentialGroup()
  241. .addComponent(bsave)
  242. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  243. .addComponent(bclear)
  244. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  245. .addComponent(bupdate)
  246. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  247. .addComponent(bdelete)
  248. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  249. .addComponent(bexit))
  250. .addGroup(layout.createSequentialGroup()
  251. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  252. .addComponent(jLabel4)
  253. .addComponent(jLabel5)
  254. .addComponent(jLabel6))
  255. .addGap(24, 24, 24)
  256. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  257. .addComponent(txtasal, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
  258. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  259. .addComponent(txttglmulai, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  260. .addComponent(txttgllahir, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))))
  261. .addGroup(layout.createSequentialGroup()
  262. .addComponent(jLabel9)
  263. .addGap(40, 40, 40)
  264. .addComponent(txtgapok, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))
  265. .addGap(0, 112, Short.MAX_VALUE))))
  266. );
  267. layout.setVerticalGroup(
  268. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  269. .addGroup(layout.createSequentialGroup()
  270. .addGap(19, 19, 19)
  271. .addComponent(jLabel8)
  272. .addGap(30, 30, 30)
  273. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  274. .addComponent(jLabel7)
  275. .addComponent(lbllastnip))
  276. .addGap(31, 31, 31)
  277. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  278. .addComponent(jLabel1)
  279. .addComponent(txtnip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  280. .addComponent(bcari))
  281. .addGap(25, 25, 25)
  282. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  283. .addComponent(jLabel2)
  284. .addComponent(txtnama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  285. .addGap(27, 27, 27)
  286. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  287. .addComponent(jLabel3)
  288. .addComponent(cmbjabatan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  289. .addGap(24, 24, 24)
  290. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  291. .addComponent(jLabel9)
  292. .addComponent(txtgapok, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  293. .addGap(27, 27, 27)
  294. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  295. .addComponent(jLabel4)
  296. .addComponent(txtasal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  297. .addGap(29, 29, 29)
  298. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  299. .addComponent(jLabel5)
  300. .addComponent(txttgllahir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  301. .addGap(35, 35, 35)
  302. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  303. .addComponent(jLabel6)
  304. .addComponent(txttglmulai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  305. .addGap(29, 29, 29)
  306. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  307. .addComponent(bsave)
  308. .addComponent(bexit)
  309. .addComponent(bclear)
  310. .addComponent(bupdate)
  311. .addComponent(bdelete))
  312. .addContainerGap(70, Short.MAX_VALUE))
  313. );
  314.  
  315. pack();
  316. }// </editor-fold>
  317.  
  318. private void bexitActionPerformed(java.awt.event.ActionEvent evt) {
  319. // TODO add your handling code here:
  320. dispose();
  321. }
  322.  
  323. private void bclearActionPerformed(java.awt.event.ActionEvent evt) {
  324. // TODO add your handling code here:
  325. txtnip.setText("");
  326. txtnama.setText("");
  327. cmbjabatan.setSelectedIndex(0);
  328. txtgapok.setText("0");
  329. txtasal.setText("");
  330. txttgllahir.setDate(null);
  331. txttglmulai.setDate(null);
  332. txtnip.requestFocus();
  333. }
  334. String tgllahir;
  335. private void txttgllahirPropertyChange(java.beans.PropertyChangeEvent evt) {
  336. // TODO add your handling code here:
  337. if (txttgllahir.getDate()!=null){
  338. SimpleDateFormat Format=new SimpleDateFormat("yyyy-MM-dd");
  339. tgllahir = Format.format(txttgllahir.getDate());
  340. }
  341.  
  342. }
  343. String tglmulai;
  344. private void txttglmulaiPropertyChange(java.beans.PropertyChangeEvent evt) {
  345. // TODO add your handling code here:
  346. if (txttglmulai.getDate()!=null){
  347. SimpleDateFormat Format=new SimpleDateFormat("yyyy-MM-dd");
  348. tglmulai = Format.format(txttglmulai.getDate());
  349. }
  350.  
  351. }
  352.  
  353. private void bsaveActionPerformed(java.awt.event.ActionEvent evt) {
  354. // TODO add your handling code here:
  355. SettingUI config = new SettingUI(null, true);
  356. config.setServer("localhost");
  357. config.setUser("root");
  358. config.setPassword("");
  359. config.setDatabase("dbglobal");
  360. config.makeConnect();
  361. String jabatan = "";
  362. String mjabatan=(String) cmbjabatan.getSelectedItem();
  363. try{
  364. Statement st=config.getConnection().createStatement();
  365.  
  366. int mAffect=st.executeUpdate(
  367. "insert into pegawai"+
  368. "(noid,nama,jabatan,gapok,asal,tgllahir,tglmulai)values("+
  369. "'"+txtnip.getText()+"',"+
  370. "'"+txtnama.getText()+"',"+
  371. "'"+mjabatan+"',"+
  372. "'"+txtgapok.getText()+"',"+
  373. "'"+txtasal.getText()+"',"+
  374. "'"+tgllahir+"',"+
  375. "'"+tglmulai+"')");
  376.  
  377. if (mAffect>0){
  378. JOptionPane.showMessageDialog(this,"Insert data sukses");
  379. }
  380. st.close();
  381. config.getConnection().close();
  382. config.dispose();
  383.  
  384. }catch (SQLException ex){
  385. JOptionPane.showMessageDialog(this,"insert gagal:"+ex);
  386. }
  387.  
  388.  
  389. }
  390.  
  391. private void bupdateActionPerformed(java.awt.event.ActionEvent evt) {
  392. // TODO add your handling code here:
  393. SettingUI config=new SettingUI(null, true);
  394. config.setServer("localhost");
  395. config.setUser("root");
  396. config.setPassword("");
  397. config.setDatabase("dbglobal");
  398. config.makeConnect();
  399. try{
  400. Statement st = config.getConnection().createStatement();
  401. st.executeUpdate(
  402. " update pegawai "+
  403. " set " +
  404. " nama= "+"'"+txtnama.getText()+"',"+
  405. " jabatan= "+"'"+cmbjabatan.getSelectedItem()+"',"+
  406. " asal= "+"'"+txtasal.getText()+"',"+
  407. " tgllahir= "+"'"+tgllahir+"',"+
  408. " tglmulai= "+"'"+tglmulai+"'"+
  409. " where noid="+"'"+txtnip.getText()+"'");
  410.  
  411. JOptionPane.showMessageDialog (this,"Update data sukses");
  412. st.close();
  413. config.getConnection().close();
  414. config.dispose();
  415. }catch (SQLException ex){
  416. JOptionPane.showMessageDialog(this,"Update gagal;"+ex);
  417.  
  418. }
  419.  
  420.  
  421. }
  422.  
  423. private void bdeleteActionPerformed(java.awt.event.ActionEvent evt) {
  424. // TODO add your handling code here:
  425. SettingUI config = new SettingUI(null, true);
  426. config.setServer("localhost");
  427. config.setUser("root");
  428. config.setPassword("");
  429. config.setDatabase("dbglobal");
  430. config.makeConnect();
  431. try{
  432. Statement st=config.getConnection().createStatement();
  433. int mAffect=st.executeUpdate(
  434. " delete from pegawai "+
  435. " where noid= "+"'"+txtnip.getText()+"'");
  436. if (mAffect>0){
  437. JOptionPane.showMessageDialog(this,"Hapus data sukses");
  438. }
  439. st.close();
  440. config.getConnection().close();
  441. config.dispose();
  442. }catch (SQLException ex){
  443. JOptionPane.showMessageDialog(this,"Hapus gagal:"+ex);
  444. }
  445.  
  446. }
  447.  
  448. private void bcariActionPerformed(java.awt.event.ActionEvent evt) {
  449. // TODO add your handling code here:
  450. SettingUI config=new SettingUI(null, true);
  451. config.setServer("localhost");
  452. config.setUser("root");
  453. config.setPassword("");
  454. config.setDatabase("dbglobal");
  455. config.makeConnect();
  456. String noid=(String) cmbjabatan.getSelectedItem();
  457. try{
  458. Statement st = config.getConnection().createStatement();
  459.  
  460. ResultSet rs=st.executeQuery("select nama,jabatan,asal,tgllahir,tglmulai from pegawai " +
  461. " where noid= "+"'"+txtnip.getText()+"'");
  462. if(rs.next()){
  463. String nama=rs.getString("nama");
  464. txtnama.setText(nama);
  465. if (rs.getString("jabatan").equals("Direktur"))
  466. cmbjabatan.setSelectedIndex(0);
  467. if (rs.getString("jabatan").equals("Finance"))
  468. cmbjabatan.setSelectedIndex(1);
  469. if (rs.getString("jabatan").equals("Marketing"))
  470. cmbjabatan.setSelectedIndex(2);
  471. if (rs.getString("jabatan").equals("NOC"))
  472. cmbjabatan.setSelectedIndex(3);
  473. if (rs.getString("jabatan").equals("Technical Support"))
  474. cmbjabatan.setSelectedIndex(4);
  475. else
  476. if (rs.getString("jabatan").equals("Staf"))
  477. cmbjabatan.setSelectedIndex(5);
  478. String asal=rs.getString("asal");
  479. txtasal.setText(asal);
  480. Date tgllahir=rs.getDate("tgllahir");
  481. txttgllahir.setDate(tgllahir);
  482. Date tglmulai=rs.getDate("tglmulai");
  483. txttglmulai.setDate(tglmulai);
  484. }
  485. else if(!rs.next()){
  486. JOptionPane.showMessageDialog(this, "NIP tidak ditemukan");
  487. return;
  488. }
  489.  
  490. rs.close();
  491. st.close();
  492.  
  493. }
  494. catch(SQLException ex){
  495. System.out.println(ex);
  496. }
  497. }
  498.  
  499. private void txttglmulaiFocusLost(java.awt.event.FocusEvent evt) {
  500. // TODO add your handling code here:
  501.  
  502. }
  503.  
  504. private void txtnipKeyPressed(java.awt.event.KeyEvent evt) {
  505. // TODO add your handling code here:
  506. if (evt.getKeyChar() == evt.VK_ENTER) {
  507. txtnama.requestFocus();
  508. }
  509.  
  510. }
  511.  
  512. private void bsaveFocusLost(java.awt.event.FocusEvent evt) {
  513. // TODO add your handling code here:
  514. nipmax();
  515. }
  516.  
  517. private void txtgapokActionPerformed(java.awt.event.ActionEvent evt) {
  518. // TODO add your handling code here:
  519. }
  520.  
  521. private void cmbjabatanActionPerformed(java.awt.event.ActionEvent evt) {
  522. // TODO add your handling code here:
  523. if(cmbjabatan.getSelectedItem().equals("Direktur")){
  524. txtgapok.setText("20000000");
  525.  
  526. }
  527. if(cmbjabatan.getSelectedItem().equals("Finance")){
  528. txtgapok.setText("5000000");
  529.  
  530. }
  531. if(cmbjabatan.getSelectedItem().equals("Marketing")){
  532. txtgapok.setText("3000000");
  533.  
  534. }
  535. if(cmbjabatan.getSelectedItem().equals("NOC")){
  536. txtgapok.setText("3500000");
  537.  
  538. }
  539. if(cmbjabatan.getSelectedItem().equals("Technical Support")){
  540. txtgapok.setText("2500000");
  541.  
  542. }
  543.  
  544.  
  545. }
  546.  
  547. /**
  548. * @param args the command line arguments
  549. */
  550. public static void main(String args[]) {
  551. /* Set the Nimbus look and feel */
  552. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  553. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  554. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  555. */
  556. try {
  557. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  558. if ("Nimbus".equals(info.getName())) {
  559. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  560. break;
  561. }
  562. }
  563. } catch (ClassNotFoundException ex) {
  564. java.util.logging.Logger.getLogger(FrmPegawai.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  565. } catch (InstantiationException ex) {
  566. java.util.logging.Logger.getLogger(FrmPegawai.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  567. } catch (IllegalAccessException ex) {
  568. java.util.logging.Logger.getLogger(FrmPegawai.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  569. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  570. java.util.logging.Logger.getLogger(FrmPegawai.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  571. }
  572. //</editor-fold>
  573. //</editor-fold>
  574.  
  575. /* Create and display the form */
  576. java.awt.EventQueue.invokeLater(new Runnable() {
  577. public void run() {
  578. new FrmPegawai().setVisible(true);
  579. }
  580. });
  581. }
  582.  
  583. // Variables declaration - do not modify
  584. private javax.swing.JButton bcari;
  585. private javax.swing.JButton bclear;
  586. private javax.swing.JButton bdelete;
  587. private javax.swing.JButton bexit;
  588. private javax.swing.JButton bsave;
  589. private javax.swing.JButton bupdate;
  590. private javax.swing.JComboBox cmbjabatan;
  591. private javax.swing.JLabel jLabel1;
  592. private javax.swing.JLabel jLabel2;
  593. private javax.swing.JLabel jLabel3;
  594. private javax.swing.JLabel jLabel4;
  595. private javax.swing.JLabel jLabel5;
  596. private javax.swing.JLabel jLabel6;
  597. private javax.swing.JLabel jLabel7;
  598. private javax.swing.JLabel jLabel8;
  599. private javax.swing.JLabel jLabel9;
  600. private javax.swing.JLabel lbllastnip;
  601. private javax.swing.JTextField txtasal;
  602. private javax.swing.JTextField txtgapok;
  603. private javax.swing.JTextField txtnama;
  604. private javax.swing.JTextField txtnip;
  605. private com.toedter.calendar.JDateChooser txttgllahir;
  606. private com.toedter.calendar.JDateChooser txttglmulai;
  607. // End of variables declaration
  608. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement