dear Master...
i meet " Exception in thread "main" java.lang.NullPointerException" in my code.
Before i post this tread, i have read some post about NullPointerException. I try to undersatanding it, but when i implement to my code, i still confuse... hahaha
finaly, i make a new post about myproblem. please for anybody to help me. What's wrong with mycode?
Exception in thread "main" java.lang.NullPointerException at aplikasiBarang.prosesCari(aplikasiBarang.java:575) at aplikasiBarang.tampilTabel(aplikasiBarang.java:608) at aplikasiBarang.<init>(aplikasiBarang.java:303) at aplikasiBarang.main(aplikasiBarang.java:780)
this is code for at aplikasiBarang.prosesCari(aplikasiBarang.java:575)
void prosesCari(String sql) { tabelKosong(); int a=1; try { Connection connect=new koneksiDb().condb(); Statement stat = connect.createStatement(); ResultSet rset = stat.executeQuery(sql); while(rset.next()) { String kode=rset.getString(1); .... ... .. . txtkode.setEnabled(false); tblbarang.setEnabled(false); tcari.setEnabled(false); bcari.setEnabled(false); bprev.setEnabled(false); bnext.setEnabled(false); teksFalse(); tombolFalse(); koneksiDb koneksi=new koneksiDb(); koneksi.panggilDriver(); tampilTabel(); // ==> when i click[COLOR="Blue"](aplikasiBarang.java:303)[/COLOR], the highlight foucus in here. }
and the last is code for at aplikasiBarang.main(aplikasiBarang.java:780)
public static void main(String[] args) { aplikasiBarang tampilan = new aplikasiBarang(); tampilan.setTitle("Program Aplikasi Adventori Barang"); tampilan.setSize(440,530); Dimension layar=Toolkit.getDefaultToolkit().getScreenSize(); int l=(layar.width-tampilan.getSize().width)/2; int t=(layar.width-tampilan.getSize().width)/2; tampilan.setLocation(l,t); tampilan.setResizable(false); tampilan.setVisible(true); tampilan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }