Refine search
private static BufferedImage readImage(final ImageIcon imageIcon) { final Image tmpImage = imageIcon.getImage(); final BufferedImage image = new BufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); image.getGraphics().drawImage(tmpImage, 0, 0, null); tmpImage.flush(); return image; }
ImageIcon tempIcon = new ImageIcon(tempImage); inputImage = new BufferedImage(tempIcon.getIconWidth(), tempIcon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); inputImage.getGraphics().drawImage(tempImage, 0, 0, null);
image.getIconWidth(), image.getIconHeight() ); info.setBounds( 200, 00, 50, 40 ); JFrame frame = new JFrame(); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.add( new MyClass( new ImageIcon("logo.png") ) ); frame.pack(); frame.setVisible( true );
@Override public void paintIcon(Component c, Graphics g, int x, int y) { genderIcon.paintIcon(c, g, x, y); int innerX = x + genderIcon.getIconWidth(); int equipmentIconHeight = genderIcon.getIconHeight(); for (int i = 0; i < equipmentColorList.size(); i++) { g.setColor(equipmentColorList.get(i)); g.fillRect(innerX + 1, y + 1, EQUIPMENT_ICON_WIDTH - 2, equipmentIconHeight - 2); g.setColor(TangoColorFactory.ALUMINIUM_5); g.drawRect(innerX + 1, y + 1, EQUIPMENT_ICON_WIDTH - 2, equipmentIconHeight - 2); innerX += EQUIPMENT_ICON_WIDTH; } }
public JRendererStatusBarItem(MapPane mapPane) { super("Busy", false); busyIcon = new ImageIcon(JRendererStatusBarItem.class.getResource(BUSY_IMAGE)); idleIcon = new ImageIcon(JRendererStatusBarItem.class.getResource(IDLE_IMAGE)); renderLabel.setMinimumSize( new Dimension( busyIcon.getIconWidth() + insets.left + insets.right, busyIcon.getIconHeight() + insets.top + insets.bottom));
@Override public void paintComponent(Graphics g) { final Dimension size = pane.getSize(); int x = (size.width - icon.getIconWidth()) / 2; int y = (size.height - icon.getIconHeight()) / 2; // Approach 1: Dispaly image at at full size g.setColor(Color.white); g.fillRect(0, 0, size.width, size.height); g.drawImage(icon.getImage(), x, y, null); setOpaque(false); super.paintComponent(g); }
@Override public void customize(JList list, ImageAsset imageAsset, int index, boolean selected, boolean hasFocus) { LayeredIcon layeredIcon = new LayeredIcon(2); File imageFile = controller.getThumbnailFile(imageAsset); if (imageFile != null && imageFile.exists()) { final ImageIcon icon = new ImageIcon(imageFile.getAbsolutePath()); layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2); } setIcon(layeredIcon); final String searchQuery = comboboxSpeedSearch.getEnteredPrefix(); if (searchQuery != null && searchQuery.trim().length() > 0 && imageAsset.getName().contains(searchQuery)) { setBackground(JBColor.YELLOW); } else { setBackground(null); } } }
@Override public void serialize(ImageIcon vi, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { synchronized (vi) { BufferedImage v = new BufferedImage( vi.getIconWidth(), vi.getIconHeight(), BufferedImage.TYPE_INT_RGB); Graphics g = v.createGraphics(); // paint the Icon to the BufferedImage. vi.paintIcon(null, g, 0, 0); g.dispose(); byte [] data = Images.encode(v); jgen.writeStartObject(); jgen.writeStringField("type", "ImageIcon"); jgen.writeObjectField("imageData", data); jgen.writeNumberField("width", v.getWidth()); jgen.writeNumberField("height", v.getHeight()); jgen.writeEndObject(); } }
@Override public void customize(JList list, ImageAsset imageAsset, int index, boolean selected, boolean hasFocus) { LayeredIcon layeredIcon = new LayeredIcon(2); File imageFile = controller.getThumbnailFile(imageAsset); if (imageFile != null && imageFile.exists()) { final ImageIcon icon = new ImageIcon(imageFile.getAbsolutePath()); layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2); } setIcon(layeredIcon); final String searchQuery = comboboxSpeedSearch.getEnteredPrefix(); if (searchQuery != null && searchQuery.trim().length() > 0 && imageAsset.getName().contains(searchQuery)) { setBackground(JBColor.YELLOW); } else { setBackground(null); } } }
protected void paintComponent(Graphics g) { super.paintComponent(g); setBackground(Color.WHITE); // draw logo g.drawImage(logoIcon.getImage(), getWidth()/2 - logoIcon.getIconWidth()/2, getHeight()/2 - logoIcon.getIconHeight()/2, logoIcon.getIconWidth(), logoIcon.getIconHeight(), logoIcon.getImageObserver()); drawVersionString(g, logoIcon); }
protected Icon doInBackground() throws IOException { Image image = ImageIO.read(new URL(TEST)); icon = new ImageIcon(image); return icon; label.setText("Done"); panel.setPreferredSize(new Dimension( icon.getIconWidth(), icon.getIconHeight())); WorkerTest.this.pack();
g.fillRect(x - 2, y - 2, 5, 5); g.drawImage(depotImageIcon.getImage(), x - depotImageIcon.getIconWidth() / 2, y - 2 - depotImageIcon.getIconHeight(), imageObserver); int vehicleInfoHeight = vehicleImageIcon.getIconHeight() + 2 + TEXT_SIZE; g.drawImage(vehicleImageIcon.getImage(), x + 1, (ascending ? y - vehicleInfoHeight - 1 : y + 1), imageObserver);
public static Dimension getDimension( String picFileString ) { ImageIcon image = new ImageIcon( picFileString ); return new Dimension( image.getIconWidth(), image.getIconHeight() ); }
public Dimension getPreferredSize() { final Dimension size = super.getPreferredSize(); size.width = icons.getIconWidth(); size.height = icons.getIconHeight(); return size; } }
class Cr extends JPanel{ //change here ('\\' is the escape sequence for '\') : ImageIcon image = new ImageIcon("C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg"); public void paint( Graphics g ) { Dimension d = getSize(); for( int x = 0; x < d.width; x += image.getIconWidth() ) for( int y = 0; y < d.height; y += image.getIconHeight() ) g.drawImage( image.getImage(), x, y, null, null ); super.paint(g); } }
/** * Initialize witht he specified image icon. * @param logoIcon an icon contain the imge of a logo. */ public ImageData(final ImageIcon logoIcon) { img = logoIcon.getImage(); imgw = logoIcon.getIconWidth(); imgh = logoIcon.getIconHeight(); }
ImageIcon image = new ImageIcon("mysticky.png"); @Override public void paintComponent(Graphics g) { super.paintComponent(g); for(ImagePanelImage nextim : backgroundImages) { g.drawImage(image.getImage(), 0, 0, image.getIconWidth(), image.getIconHeight(), this); } }
Image image = Toolkit.getDefaultToolkit().getImage(image_url); ImageIcon icon = new ImageIcon(image); int height = icon.getIconHeight(); int width = icon.getIconWidth(); sb.append(line + ","+ height + "," + width + newline);
File b64 = new File("loop.png.b64"); FileInputStream fis = new FileInputStream(b64); byte[] bytes = IOUtils.toByteArray(fis); byte[] decoded = Base64.decodeBase64(bytes); ImageIcon img = new ImageIcon(decoded); if (img.getIconWidth() > -1 && img.getIconHeight() > -1) { System.out.println("OK"); }
private static BufferedImage makeBufferedImageFromIcon(ImageIcon icon) { BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); bufferedImage.getGraphics().drawImage(icon.getImage(), 0, 0, null); return bufferedImage; }