Icon getIconHeight - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Icon getIconHeight method.

This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
                public int getIconWidth() { 
                    return size;
                } 
 
                public void paintIcon( Component c, Graphics g, int x, int y ) {
                    BufferedImage img = new BufferedImage(icon.getIconWidth(),icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB );
                    // we can cache the img when aaime gets out a profiler and tells us it is worthwhile 
                    icon.paintIcon( c, img.getGraphics(), 0, 0 );
                     
                    if( c != null ){
                        g.drawImage( img, x, y, size, size, c.getBackground(), c );
                    } 
                    else { 
                        g.drawImage( img, x, y, size, size, c );
                    }                     
                }                 
            }; 
        }         
    }     
} 
7
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
        // Make a brighter version of the icon, and cache it. 
        rollover = ImageManipulator.brighten(icon);
        if(rollover == null)
            BUTTON_CACHE.put(rolloverName, NULL);
        else 
            BUTTON_CACHE.put(rolloverName, rollover);
         
        return rollover;
    }    
     
    private static Properties loadButtonNameMap() {
        Properties p = new Properties();
        URL url = ResourceManager.getURLResource("icon_mapping.properties");
        InputStream is = null;
        try { 
            if(url != null) {
                is = new BufferedInputStream(url.openStream());
                p.load(is);
            } 
        } catch(IOException ignored) {

6
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth
 
  private void chooseImage() throws MalformedURLException {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.showOpenDialog(this);
    Path file = fileChooser.getSelectedFile().toPath();
    Icon imageIcon = new ImageIcon(file.toUri().toURL());
    setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight() + 100);
    imageLabel.setIcon(imageIcon);
    String decodeText = getDecodeText(file);
    textArea.setText(decodeText);
  } 
 
  private static String getDecodeText(Path file) {
    BufferedImage image;
    try { 
      image = ImageReader.readImage(file.toUri());
    } catch (IOException ioe) {
      return ioe.toString();
    } 
    LuminanceSource source = new BufferedImageLuminanceSource(image);
7
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
        this.icon = icon; 
        shadowIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); 
    }  
  
    public int getIconHeight(){  
        return icon.getIconWidth(); 
    }  
  
    public int getIconWidth(){  
        return icon.getIconHeight(); 
    }  
  
    public void paintIcon(Component c, Graphics g, int x, int y){ 
      Color highlight = UIManager.getColor("VLDocking.highlight");
      Color shadow = UIManager.getColor("VLDocking.shadow");
      g.setColor(highlight);
      g.fillRect(x, y, getIconWidth(), getIconHeight());
      shadowIcon.paintIcon(c, g, x + shadowWidth-1, y + shadowHeight-1); 
      icon.paintIcon(c, g, x-1,  y-1); 
    }  

6
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
        } 
    } 
 
    // Draws the icon centered at (x,y) 
    protected void drawCentered(Component c, Graphics graphics, Icon icon, int x, int y) {
		icon.paintIcon(c, graphics,
				x - icon.getIconWidth()  / 2 - 1,
				y - icon.getIconHeight() / 2);
    } 
 
 
    // Helper Code ************************************************************ 
 
    private void updateLineStyle(Object lineStyle) { 
        linesEnabled = !Options.TREE_LINE_STYLE_NONE_VALUE.equals(lineStyle);
    } 
 
    // Listens for changes of the line style property 
    private class LineStyleHandler implements PropertyChangeListener {
        public void propertyChange(PropertyChangeEvent e) {
6
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
    private static Image getImage(Icon icon) {
        if(icon instanceof ImageIcon) {
            return ((ImageIcon)icon).getImage();
        } else { 
            BufferedImage buffer = new BufferedImage(
                icon.getIconWidth(), icon.getIconHeight(),
                BufferedImage.TYPE_INT_ARGB);
            Graphics g = buffer.getGraphics();
            icon.paintIcon(new JLabel(), g, 0,0);
            g.dispose();
            return buffer;
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
 
    private BufferedImage createMask(Icon mask) {
        // create a BufferedImage to paint the mask into so that we can later retrieve pixel data 
        // out of the image. 
        BufferedImage image = new BufferedImage(
                mask.getIconWidth(), mask.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
 
        Graphics graphics = image.getGraphics();
        mask.paintIcon(null, graphics, 0, 0);
        graphics.dispose();
 
        return image;
    } 
 
    public Icon getIcon() {
        return WindowUtils.isParentWindowFocused(this) || fInactiveIcon == null
                ? super.getIcon() : fInactiveIcon;
    } 
 
    @Override 
5
CodeRank
This code example shows how to use the following methods:getIconHeight, getIconWidth, paintIcon
getIconHeight Method Overview
Returns the icon's height.
See Code Examples for other Java 8 Icon Methods: