List of usage examples for java.awt Toolkit getDefaultToolkit
public static synchronized Toolkit getDefaultToolkit()
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);/*from w w w. j a va 2 s .co m*/ img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH); img.flush(); 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);/*from w ww . j a v a 2 s. co m*/ img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH); System.out.println(img.UndefinedProperty); this.repaint(); } }
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 www.ja v a 2 s .com 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);//from www . j a v a 2 s . co m img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH); ImageProducer pro = img.getSource(); 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);/*from w ww.java 2s . c o m*/ img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH); img.setAccelerationPriority(0.5F); System.out.println(img.getAccelerationPriority()); 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);//www . jav a2 s.c o m img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH); Graphics g = img.getGraphics(); this.repaint(); } }
From source file:dmh.kuebiko.view.NewNoteAction.java
NewNoteAction(NoteStackFrame noteFrame) { super("New Note"); this.noteFrame = noteFrame; putValue(SHORT_DESCRIPTION, "Add a new note to the stack."); putValue(LONG_DESCRIPTION, getValue(SHORT_DESCRIPTION)); putValue(ACCELERATOR_KEY,/*w w w . ja va 2s .co m*/ getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); putValue(MNEMONIC_KEY, KeyEvent.VK_N); }
From source file:clientesbac.frmConsultaClientes.java
public Image getIconImage() { Image retValue = Toolkit.getDefaultToolkit() .getImage(ClassLoader.getSystemResource("Recursos/bac_icono.png")); return retValue; }
From source file:Main.java
public Main() { menuBar = new JMenuBar(); JMenu justifyMenu = new JMenu("Justify"); ActionListener actionPrinter = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Action [" + e.getActionCommand() + "] performed!\n"); }/* w ww.j a v a 2s . com*/ }; JCheckBoxMenuItem leftJustify = new JCheckBoxMenuItem("Left", new ImageIcon("1.gif")); leftJustify.setHorizontalTextPosition(JMenuItem.RIGHT); leftJustify .setAccelerator(KeyStroke.getKeyStroke('L', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); leftJustify.addActionListener(actionPrinter); JCheckBoxMenuItem rightJustify = new JCheckBoxMenuItem("Right", new ImageIcon("2.gif")); rightJustify.setHorizontalTextPosition(JMenuItem.RIGHT); rightJustify .setAccelerator(KeyStroke.getKeyStroke('R', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); rightJustify.addActionListener(actionPrinter); JCheckBoxMenuItem centerJustify = new JCheckBoxMenuItem("Center", new ImageIcon("3.gif")); centerJustify.setHorizontalTextPosition(JMenuItem.RIGHT); centerJustify .setAccelerator(KeyStroke.getKeyStroke('M', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); centerJustify.addActionListener(actionPrinter); JCheckBoxMenuItem fullJustify = new JCheckBoxMenuItem("Full", new ImageIcon("4.gif")); fullJustify.setHorizontalTextPosition(JMenuItem.RIGHT); fullJustify .setAccelerator(KeyStroke.getKeyStroke('F', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); fullJustify.addActionListener(actionPrinter); justifyMenu.add(leftJustify); justifyMenu.add(rightJustify); justifyMenu.add(centerJustify); justifyMenu.add(fullJustify); menuBar.add(justifyMenu); menuBar.setBorder(new BevelBorder(BevelBorder.RAISED)); }
From source file:Clipboard.java
/** * Get the String residing on the clipboard. * * @return any text found on the Clipboard; if none found, return an * empty String.//from w w w . ja va 2 s.co m */ public String getClipboardContents() { String result = ""; java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); //odd: the Object param of getContents is not currently used Transferable contents = clipboard.getContents(null); boolean hasTransferableText = (contents != null) && contents.isDataFlavorSupported(DataFlavor.stringFlavor); if (hasTransferableText) { try { result = (String) contents.getTransferData(DataFlavor.stringFlavor); } catch (UnsupportedFlavorException ex) { //highly unlikely since we are using a standard DataFlavor System.out.println(ex); ex.printStackTrace(); } catch (IOException ex) { System.out.println(ex); ex.printStackTrace(); } } return result; }