Miletone

Rp0 / Rp1.000.000

Sunday, September 29, 2019

[JAVA] Bagaimana caranya klik JTable akan menampilkan ke JTextField

Klik kanan pada table, select ke mouse, select dan click mouseclicked lalu kamu isi code:
try{
            int Linha = jTable1.getSelectedRow();
            nik.setText(jTable1.getValueAt(Linha, 0).toString());
            transnik.setText(jTable1.getValueAt(Linha, 0).toString());
            nama.setText(jTable1.getValueAt(Linha, 1).toString());
            ttl.setText(jTable1.getValueAt(Linha, 2).toString());
            daerahasal.setText(jTable1.getValueAt(Linha, 3).toString());
            asalkiriman.setText(jTable1.getValueAt(Linha, 4).toString());
            /**Blob filenameBlob = (Blob) (jTable1.getValueAt(Linha, 6));
            byte[] content = filenameBlob.getBytes(1L,(int)filenameBlob.length());
            if(jTable1.getValueAt(Linha, 6) !=null){
                ImageIcon image = new ImageIcon(content);
                Image image1 = image.getImage().getScaledInstance(FOTO.getWidth(), FOTO.getHeight(), Image.SCALE_SMOOTH);
                ImageIcon image2 = new ImageIcon(image1);
                FOTO.setIcon(image2);
            }**/
        } catch (Exception e){

        }

No comments: