Example usage for java.awt Toolkit getImage

List of usage examples for java.awt Toolkit getImage

Introduction

In this page you can find the example usage for java.awt Toolkit getImage.

Prototype

public abstract Image getImage(URL url);

Source Link

Document

Returns an image which gets pixel data from the specified URL.

Usage

From source file:View.FormAnggota.java

public void sinkronGambar() {
    try {//from w  w w.  j a v a 2  s  . c  o m
        Profil prof = PengaturanKontrol.getKoneksi().tampilProfil();
        label_namaDesa.setText("BADAN USAHA MILIK DESA " + prof.getNamadesa());
        label_alamatNotelp.setText(prof.getAlamatdesa() + " " + prof.getDesa() + " " + prof.getKecamatan() + " "
                + prof.getKabupaten() + " " + prof.getProvinsi() + " - " + prof.getNotelp());

        String path = new File(".").getCanonicalPath() + "/Gambar/" + prof.getLogo();

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = toolkit.getImage(path);
        Image imagedResized = image.getScaledInstance(110, 100, Image.SCALE_DEFAULT);
        ImageIcon imageIcon = new ImageIcon(imagedResized);
        label_kop.setIcon(imageIcon);
    } catch (IOException ex) {
        Logger.getLogger(FormPengaturan.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(FormPengaturan.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:View.FormPengaturan.java

private void button_uploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_uploadActionPerformed
    JFileChooser jfc = new JFileChooser();
    if (jfc.showOpenDialog(label_gambar) == JFileChooser.APPROVE_OPTION) {

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = toolkit.getImage(jfc.getSelectedFile().getAbsolutePath());
        Image imagedResized = image.getScaledInstance(200, 250, Image.SCALE_DEFAULT);
        ImageIcon imageIcon = new ImageIcon(imagedResized);

        label_gambar.setIcon(imageIcon);
        label_namaFile.setText(jfc.getSelectedFile().getName());//nama file nya
        //            System.out.println("jLabelnamaFile : " + label_namaFile.getText());

        file = new File(jfc.getSelectedFile().getPath()); // file untuk dikopi
        //            System.out.println("file : " + file.getPath());
    }/*from w  w  w .  j  a v a 2 s. c  o m*/
}

From source file:View.FormPengaturan.java

public void sinkronGambar() {
    try {// w  ww. j  av  a 2s  .co  m
        Profil prof = PengaturanKontrol.getKoneksi().tampilProfil();
        String path = new File(".").getCanonicalPath() + "/Gambar/" + prof.getLogo();

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = toolkit.getImage(path);
        Image imagedResized = image.getScaledInstance(110, 100, Image.SCALE_DEFAULT);
        ImageIcon imageIcon = new ImageIcon(imagedResized);
        label_kop.setIcon(imageIcon);
    } catch (IOException ex) {
        Logger.getLogger(FormPengaturan.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(FormPengaturan.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:View.FormPengaturan.java

public void isiProfil() {
    try {/* w ww  .j av  a 2 s  .c om*/
        Profil prof = PengaturanKontrol.getKoneksi().tampilProfil();
        label_namaDesa.setText("BADAN USAHA MILIK DESA " + prof.getNamadesa());
        label_alamatNotelp.setText(prof.getAlamatdesa() + " " + prof.getDesa() + " " + prof.getKecamatan() + " "
                + prof.getKabupaten() + " " + prof.getProvinsi() + " - " + prof.getNotelp());
        text_namadesa.setText(prof.getNamadesa());
        text_alamatdesa.setText(prof.getAlamatdesa());
        text_noTelp.setText(prof.getNotelp());
        text_desa.setText(prof.getDesa());
        text_kecamatan.setText(prof.getKecamatan());
        text_kabupaten.setText(prof.getKabupaten());
        text_provinsi.setText(prof.getProvinsi());
        text_email.setText(prof.getEmail());

        String path = new File(".").getCanonicalPath();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = toolkit.getImage(path + "/Gambar/" + prof.getLogo());
        //            Image imagedResized = image.getScaledInstance(200, 250, Image.SCALE_DEFAULT);
        Image imagedResized = image.getScaledInstance(175, 145, Image.SCALE_DEFAULT);
        ImageIcon imageIcon = new ImageIcon(imagedResized);

        label_gambar.setIcon(imageIcon);
        label_namaFile.setText(prof.getLogo());
        label_namaFile.setVisible(false);
    } catch (IOException ex) {
        Logger.getLogger(FormPengaturan.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        Logger.getLogger(FormPengaturan.class.getName()).log(Level.SEVERE, null, ex);
    }
}