Example usage for java.awt Toolkit getDefaultToolkit

List of usage examples for java.awt Toolkit getDefaultToolkit

Introduction

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

Prototype

public static synchronized Toolkit getDefaultToolkit() 

Source Link

Document

Gets the default toolkit.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    String mapUrlPath = "http://www.java2s.com/style/download.png";
    URL mapUrl = new URL(mapUrlPath);
    BufferedImage mapImage = ImageIO.read(mapUrl);
    Image newMapImage = Toolkit.getDefaultToolkit()
            .createImage(new FilteredImageSource(mapImage.getSource(), new XorFilter()));
    ImageIcon mapIcon = new ImageIcon(mapImage);
    ImageIcon newMapIcon = new ImageIcon(newMapImage);

    JPanel imagePanel = new JPanel();
    imagePanel.add(new JLabel(mapIcon));
    imagePanel.add(new JLabel(newMapIcon));

    JOptionPane.showMessageDialog(null, imagePanel);
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Rectangle r = new Rectangle(PageSize.A4);
    r.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
    Document document = new Document(r);
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();//from   w w w.  j  a v  a2 s . c  om
    java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("dog.gif");
    com.lowagie.text.Image img1 = com.lowagie.text.Image.getInstance(awtImage, null, true);
    document.add(img1);

    document.close();
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Rectangle r = new Rectangle(PageSize.A4);
    r.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
    Document document = new Document(r);
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();//  w w  w.j  a va2s .  c  o m
    java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("dog.gif");
    com.lowagie.text.Image img1 = com.lowagie.text.Image.getInstance(awtImage, null);
    document.add(img1);

    document.close();
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Rectangle r = new Rectangle(PageSize.A4);
    r.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
    Document document = new Document(r);
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();//from w w  w  .  j a va  2  s. c o  m
    java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("dog.gif");
    com.lowagie.text.Image img1 = com.lowagie.text.Image.getInstance(awtImage, new Color(0xFF, 0xFF, 0x00));
    document.add(img1);

    document.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    String mapUrlPath = "http://www.java2s.com/style/download.png";
    URL mapUrl = new URL(mapUrlPath);
    BufferedImage mapImage = ImageIO.read(mapUrl);
    Image newMapImage = Toolkit.getDefaultToolkit()
            .createImage(new FilteredImageSource(mapImage.getSource(), new GrayFilter()));
    ImageIcon mapIcon = new ImageIcon(mapImage);
    ImageIcon newMapIcon = new ImageIcon(newMapImage);

    JPanel imagePanel = new JPanel();
    imagePanel.add(new JLabel(mapIcon));
    imagePanel.add(new JLabel(newMapIcon));

    JOptionPane.showMessageDialog(null, imagePanel);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    String mapUrlPath = "http://www.java2s.com/style/download.png";
    URL mapUrl = new URL(mapUrlPath);
    BufferedImage mapImage = ImageIO.read(mapUrl);
    Image newMapImage = Toolkit.getDefaultToolkit()
            .createImage(new FilteredImageSource(mapImage.getSource(), new GrayToColorFilter(Color.red)));
    ImageIcon mapIcon = new ImageIcon(mapImage);
    ImageIcon newMapIcon = new ImageIcon(newMapImage);

    JPanel imagePanel = new JPanel();
    imagePanel.add(new JLabel(mapIcon));
    imagePanel.add(new JLabel(newMapIcon));

    JOptionPane.showMessageDialog(null, imagePanel);
}

From source file:GetRedFilter.java

public static void main(String[] argv) throws Exception {
    Image image = new ImageIcon("image.gif").getImage();
    ImageFilter filter = new GetRedFilter();
    FilteredImageSource filteredSrc = new FilteredImageSource(image.getSource(), filter);
    image = Toolkit.getDefaultToolkit().createImage(filteredSrc);
}

From source file:Main.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_SMOOTH);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);//from www.  j a v a 2s .c  o  m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_DEFAULT);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);/*from w  w w .j a  v a2  s  .c  om*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    String imageFile = "A.jpg";
    RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
    Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getResource(imageFile));
    image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_FAST);
    JFrame frame = new JFrame("DragImage");
    frame.getContentPane().add(new Main(image));
    frame.setSize(300, 300);//from   w  w  w .  j  a  v a 2 s .c o m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}