Available Methods
- getParent ( )
- getPreferredSize ( )
- isVisible ( )
- isEnabled ( )
- setEnabled ( )
- setFont ( )
- getHeight ( )
- getName ( )
- setBackground ( )
- getPeer ( )
- getLocationOnScreen ( )
- getWidth ( )
- getBounds ( )
- setForeground ( )
- getFont ( )
- BaselineResizeBehavior ( )
- isShowing ( )
- setBounds ( )
- getMinimumSize ( )
- setVisible ( )
- getSize ( )
- repaint ( )
- setSize ( )
- setPreferredSize ( )
- setLocation ( )
- getTreeLock ( )
- getDropTarget ( )
- dispatchEvent ( )
- addComponentListener ( )
- getInputMethodRequests ( )
- getX ( )
- getY ( )
- isOpaque ( )
- addMouseListener ( )
- requestFocus ( )
- getBackground ( )
- getAccessibleContext ( )
- setDropTarget ( )
- paint ( )
- getForeground ( )
- isFocusCycleRoot ( )
- getGraphics ( )
- getLocation ( )
- setMinimumSize ( )
- hasFocus ( )
- getGraphicsConfiguration ( )
- setMaximumSize ( )
- addHierarchyListener ( )
- isFocusable ( )
- requestFocusInWindow ( )
- isDisplayable ( )
- removeComponentListener ( )
- addKeyListener ( )
- addFocusListener ( )
- validate ( )
- getToolkit ( )
- getClass ( )
- setCursor ( )
- add ( )
- getLocale ( )
- getCursor ( )
- equals ( )
- getFontMetrics ( )
- size ( )
- getMaximumSize ( )
- invalidate ( )
- CENTER_ALIGNMENT
- move ( )
- removeMouseMotionListener ( )
- update ( )
- setFocusable ( )
- removeFocusListener ( )
- contains ( )
- addPropertyChangeListener ( )
- removeMouseListener ( )
- createImage ( )
- isValid ( )
- addMouseMotionListener ( )
- setName ( )
- getFocusCycleRootAncestor ( )
- getInputContext ( )
Related Classes
- java.io.File
- java.awt.Color
- java.awt.event.ActionEvent
- java.awt.event.ActionListener
- javax.swing.JPanel
- java.awt.Dimension
- java.awt.Font
- java.awt.event.MouseEvent
- javax.swing.JLabel
- java.awt.Graphics2D
- java.awt.Graphics
- javax.swing.JButton
- java.awt.event.KeyEvent
- java.awt.BorderLayout
- javax.swing.JOptionPane
- javax.swing.JScrollPane
- java.awt.Rectangle
- javax.swing.JTextField
- javax.swing.SwingUtilities
- java.awt.event.MouseAdapter
- javax.swing.ImageIcon
- javax.swing.JFileChooser
- java.awt.Point
- javax.swing.JComponent
- javax.swing.JCheckBox
Java Code Examples for java.awt.Component#createImage()
The following examples show how to use
java.awt.Component#createImage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScaleFx.java From netbeans with Apache License 2.0 | 6 votes |
private Image createCompImage(Component comp, Dimension targetSize) { // component won't paint if not showing anyway, so don't create // empty image but honestly return null if (!comp.isShowing()) { return null; } Image image = comp.createImage(comp.getWidth(), comp.getHeight()); /*BufferedImage image = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(). createCompatibleImage(comp.getWidth(), comp.getHeight());*/ //BufferedImage image = new BufferedImage (targetSize.width, targetSize.height, BufferedImage.TYPE_INT_RGB); Graphics2D gr2d = (Graphics2D)image.getGraphics(); comp.paint(gr2d); gr2d.dispose(); return image; }
Example 2
Source File: CreateImage.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void checkCreateImage(final Component comp, final boolean isNull) { if ((comp.createImage(10, 10) != null) == isNull) { throw new RuntimeException("Image is wrong"); } if ((comp.createVolatileImage(10, 10) != null) == isNull) { throw new RuntimeException("Image is wrong"); } try { if ((comp.createVolatileImage(10, 10, null) != null) == isNull) { throw new RuntimeException("Image is wrong"); } } catch (final AWTException ignored) { // this check is not applicable } }
Example 3
Source File: AbstractImageEncoder.java From tn5250j with GNU General Public License v2.0 | 5 votes |
public static Image snapshot(Component component) { Image img = component.createImage(component.getSize().width, component.getSize().height); if (img != null) { Graphics igc = img.getGraphics(); //Gotta set the clip, or else paint throws an exception igc.setClip(0, 0, component.getSize().width, component.getSize().height); component.paint(igc); } return img; }
Example 4
Source File: NavigatorWindow.java From mars-sim with GNU General Public License v3.0 | 3 votes |
/** * Creates an icon representing a color. * * @param color the color for the icon. * @param displayComponent the component to display the icon on. * @return the color icon. */ private Icon createColorLegendIcon(Color color, Component displayComponent) { int[] imageArray = new int[10 * 10]; Arrays.fill(imageArray, color.getRGB()); Image image = displayComponent.createImage(new MemoryImageSource(10, 10, imageArray, 0, 10)); return new ImageIcon(image); }