rizal 1 Report post Posted June 19, 2008 import javax.swing.*; import java.awt.*; import javax.swing.border.*; public class cuba extends JFrame { public cuba (){ JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEFT,2,6)); JLabel lblid = new JLabel("Staff ID :"); JTextField tfid= new JTextField(15); JLabel lblname = new JLabel("Name :"); JTextField tfname= new JTextField(15); JLabel lbljob = new JLabel("Job ID :"); JTextField tfjob= new JTextField(15); JLabel lblic = new JLabel("IC Num :"); JTextField tfic= new JTextField(14); JLabel lbladd = new JLabel("Address 1 :"); JTextField tfadd= new JTextField(15); JLabel lbladd2 = new JLabel("Address 2 :"); JTextField tfadd2= new JTextField(15); JLabel lbladd3 = new JLabel("Address 3 :"); JTextField tfadd3= new JTextField(15); JLabel lblcon = new JLabel("Contact No. :"); JTextField tfcon= new JTextField(15); JLabel lblposition = new JLabel("Position :"); JTextField tfposition= new JTextField(15); JLabel lbldep = new JLabel("Department Name:"); JTextField tfdep= new JTextField(14); p1.add(lblid); p1.add(tfid); p1.add(lblname); p1.add(tfname); p1.add(lbljob); p1.add(tfjob); p1.add(lblic); p1.add(tfic); p1.add(lbladd); p1.add(tfadd); p1.add(lbladd2); p1.add(tfadd2); p1.add(lbladd3); p1.add(tfadd3); p1.add(lblcon); p1.add(tfcon); p1.add(lblposition); p1.add(tfposition); p1.add(lbldep); p1.add(tfdep); p1.setBorder(new TitledBorder("STAFF INFORMATION")); add(p1); setLayout(new GridLayout(2,6,5,5)); pack(); setSize(580,380); JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER)); JButton jbtview = new JButton("VIEW"); JButton jbtinsert = new JButton("INSERT"); JButton jbtdelete = new JButton("DELETE"); JButton jbtupdate = new JButton("UPDATE"); JButton jbtsearch = new JButton("SEARCH"); p2.add(jbtview); p2.add(jbtinsert); p2.add(jbtdelete); p2.add(jbtupdate); p2.add(jbtsearch); p2.setBorder(new TitledBorder("")); setLayout(new GridLayout(1,1,2,2)); add(p2); } public static void main(String[]args){ JFrame frame = new cuba(); frame.setTitle("Staff Information"); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.setSize(500,600); frame.setVisible(true); } } alignment dia lari.sesiapa ada idea tolong sayer. Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted June 19, 2008 eh camna ndak masukkan dlm mysql? Quote Share this post Link to post Share on other sites
Firestarter 0 Report post Posted June 19, 2008 Aku cadangkan ko guna grid layout. Pasal nak masuk dlm mysql tu, ko kena guna jdbc kalo tak silap aku dengan action event. Sebab ko nak masukkan data bila tekan button tu kan? Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted June 19, 2008 saya dah dapat connect ecplise dgn database dlm mysql.skang pening camna ndak connect kan gui dlm java ke mysql yg dah siap dibuat tuh.sy google action event now. Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted June 23, 2008 bagaimana ndak remove/delete ,edit,update/save data,view records dan wat search button yg berfungsi utk manipulasikan data yg ada? Quote Share this post Link to post Share on other sites
Firestarter 0 Report post Posted June 23, 2008 Maksud ko, fungsi yang 'communicate' dengan database? Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted June 24, 2008 ya! sya dah dapat connect kan java dgn database.tp bagaimana ndak connectkan button yg ada dgn database?Mintak pandangan pakar .tengkiu. Quote Share this post Link to post Share on other sites
MatchMaker 0 Report post Posted June 24, 2008 macam jugak normal programming lain.> open connection> select/ insert/ update/ delete query> commit> close connection Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted June 24, 2008 kat mana boleh cari tutorial webnya? Quote Share this post Link to post Share on other sites
MatchMaker 0 Report post Posted June 24, 2008 (edited) nak ajar secara details susah jugak sebab taktau ko tulis kod macam mana.ok ni contoh lagi.> gui (button) call java function> java function>>> open connection (mesti ko tahu sebab dapat buat connection)>>> query>>> commit (if needed)>>> close connection> java function> gui (redirect) maybe untuk paparpan update/insert/delete successedit sikit:ni ada web yg boleh ko buat rujukanhttp://www.devdaily.com/java/edu/pj/jdbc/jdbc0003/ (credits to DevDaily Interactive, Inc.)cari "The Query1.java program" Edited June 24, 2008 by MatchMaker Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted June 28, 2008 saya heran lah kenapa x dapat run sesetengah fail yg dapat dr internet.tolong ajar cara ndak atasi masalah ini. Quote Share this post Link to post Share on other sites
Firestarter 0 Report post Posted June 28, 2008 Sebenarnya saya tak paham dengan ape yang awak maksudkan. Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted July 1, 2008 oh dah reti ndak wat.bukak packages baru.lepas tu buka folder yg mengandungi fail java tersebut.drag and drob ke packages yg baru tersebut.senang jer nasib baik kawan ajar.hehehee. Quote Share this post Link to post Share on other sites
sheffezen 0 Report post Posted July 6, 2008 mm Quote Share this post Link to post Share on other sites
rizal 1 Report post Posted July 15, 2008 hhhmmmm... ada sesapa yg reti java spring framework.boleh x bg sikit nasihat? Quote Share this post Link to post Share on other sites