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:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        this.repaint();
    }//from   w  w  w.  j a  v  a2 s . c om
}

From source file:Draw2DRotate.java

public void paint(Graphics graphics) {
    Graphics2D g = (Graphics2D) graphics;
    AffineTransform transform = AffineTransform.getRotateInstance(Math.PI / 16.0d);
    g.setTransform(transform);//from   ww  w  .  ja va 2s . c  om
    Line2D.Double shape = new Line2D.Double(0.0, 0.0, 300.0, 300.0);
    g.draw(shape);
    g.setFont(new Font("Helvetica", Font.BOLD, 24));
    String text = ("Java2s");
    g.drawString(text, 300, 50);
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Image image = toolkit.getImage("image1.gif");
    g.drawImage(image, 100, 150, this);
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        img.flush();//from  w  w  w .j a  v  a2 s.c o  m
        this.repaint();
    }
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        System.out.println(img.UndefinedProperty);
        this.repaint();
    }/*from ww w  . ja  va 2 s  .  com*/
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        ImageProducer pro = img.getSource();
        this.repaint();
    }/*from  ww w . j  a v a  2 s.  com*/
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        img.setAccelerationPriority(0.5F);
        System.out.println(img.getAccelerationPriority());

        this.repaint();
    }// ww w  .  j av  a 2 s  .  c o  m
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);

        Graphics g = img.getGraphics();

        this.repaint();
    }/*w  w  w.ja va  2 s.  c  o m*/
}

From source file:ImageFileFilterImageScale.java

public void actionPerformed(ActionEvent e) {
    String file = getImageFile();
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        this.repaint();
    }//from ww w  .  j  a va2 s. c  om
}

From source file:Visao.Relatorio.Grafico_QuantidadeReclamacoesSexo.java

/**
 * Creates new form grafico/*  w  w  w .ja  v a2  s  .  c  om*/
 */
public Grafico_QuantidadeReclamacoesSexo(java.awt.Frame parent, boolean modal, GeneralDAO dao,
        JFreeChart chart) {
    super(parent, modal);
    this.dao = dao;
    controleRelatorio = new ControleRelatorio(dao);
    datasetDB = controleRelatorio.numeroReclamacoesSexoGrafico();
    grafico(chart);
    Toolkit kit = this.getToolkit();
    Image icone = kit.getImage("src/Icones/relatorio.png");
    this.setIconImage(icone);
}

From source file:MainClass.java

public Image getImage(URL url) {
    Toolkit tk = Toolkit.getDefaultToolkit();
    return tk.getImage(url);
}