public MageScrollButton(int direction, int width, boolean freeStanding) { super(direction, width, freeStanding); setOpaque(false); this.width = width; buttonUp.setImage(buttonUp.getImage().getScaledInstance(width, width, Image.SCALE_SMOOTH)); buttonDown.setImage(buttonDown.getImage().getScaledInstance(width, width, Image.SCALE_SMOOTH)); buttonLeft.setImage(buttonLeft.getImage().getScaledInstance(width, width, Image.SCALE_SMOOTH)); buttonRight.setImage(buttonRight.getImage().getScaledInstance(width, width, Image.SCALE_SMOOTH)); }
/** * Overridden to forward to a wrapped ImageIcon. Does nothing if the wrapped icon * is not an ImageIcon. * <P> * In common with <code>ImageIcom</code>, the newly set image will only be shown when the * concerned component(s) are repainted. * * @param image Sets the image displayed by a wrapped ImageIcon */ @Override public void setImage(Image image) { if (icon instanceof ImageIcon) { ((ImageIcon) icon).setImage(image); } }
ImageIcon receivedIcon = null; receivedIcon.setImage(im);
/** * Overridden to forward to a wrapped ImageIcon. Does nothing if the wrapped icon * is not an ImageIcon. * <P> * In common with <code>ImageIcom</code>, the newly set image will only be shown when the * concerned component(s) are repainted. * * @param image Sets the image displayed by a wrapped ImageIcon */ @Override public void setImage(Image image) { if (icon instanceof ImageIcon) { ((ImageIcon) icon).setImage(image); } }
ImageIcon image = ? (whatever/wherever your gif is) int width = 100; int height = 100; image.setImage(image.getImage().getScaledInstance(width, height, Image.SCALE_DEFAULT));
ImageIcon receivedIcon = new ImageIcon(); receivedIcon.setImage(im);
/** * Creates a dialog window showing the specified image. The function will not * exit until the user clicks ok */ public static void showDialog(BufferedImage img) { ImageIcon icon = new ImageIcon(); icon.setImage(img); JOptionPane.showMessageDialog(null, icon); }
/** * Creates a dialog window showing the specified image. The function will not * exit until the user clicks ok */ public static void showDialog(BufferedImage img) { ImageIcon icon = new ImageIcon(); icon.setImage(img); JOptionPane.showMessageDialog(null, icon); }
ImageIcon a_1 = new ImageIcon(FrontHand.class.getResource("/Sprites/character_move_down.gif")); a_1.setImage(a_1.getImage().getScaledInstance(150, 150, Image.SCALE_DEFAULT)); move_player_down = a_1;
@Override public void setImage(final Image image) { this.model.get().setImage(image); }
/** Handles slider events. */ @Override public void stateChanged(final ChangeEvent e) { final boolean outOfBounds = false; updateLabel(-1, -1); final BufferedImage image = outOfBounds ? null : getImage(); if (image == null) { iconLabel.setIcon(null); iconLabel.setText("No image plane"); } else { icon.setImage(image); iconLabel.setIcon(icon); iconLabel.setText(null); } }
/** Handles slider events. */ @Override public void stateChanged(final ChangeEvent e) { final boolean outOfBounds = false; updateLabel(-1, -1); final BufferedImage image = outOfBounds ? null : getImage(); if (image == null) { iconLabel.setIcon(null); iconLabel.setText("No image plane"); } else { icon.setImage(image); iconLabel.setIcon(icon); iconLabel.setText(null); } }
/** Handles slider events. */ @Override public void stateChanged(final ChangeEvent e) { final boolean outOfBounds = false; updateLabel(-1, -1); final BufferedImage image = outOfBounds ? null : getImage(); if (image == null) { iconLabel.setIcon(null); iconLabel.setText("No image plane"); } else { icon.setImage(image); iconLabel.setIcon(icon); iconLabel.setText(null); } }
FileDialog fd = new FileDialog(frame, "Test", FileDialog.LOAD); String Image_path fd.setVisible(true); name = fd.getDirectory() + fd.getFile(); image_path=name; ImageIcon icon= new ImageIcon(name); icon.setImage(icon.getImage().getScaledInstance(jLabel2.getWidth(),jLabel2.getHeight() , Image.SCALE_DEFAULT)); jLabel2.setIcon(icon);
private void updateScaledImage(int scale, JFrame scaledLCDFrame) { J2SEMutableImage scaledImage = (J2SEMutableImage) ((SwingDisplayComponent) emulatorContext .getDisplayComponent()).getScaledDisplayImage(scale); ((ImageIcon) (((JLabel) scaledLCDFrame.getContentPane()).getIcon())).setImage(scaledImage.getImage()); ((JLabel) scaledLCDFrame.getContentPane()).repaint(); } };
/** * {@inheritDoc} */ @Override protected Icon createIcon(String urlSpec, Dimension iconSize) { if (urlSpec != null) { URL imageURL = UrlHelper.createURL(urlSpec); if (imageURL != null) { ImageIcon imageIcon = new ImageIcon(imageURL); imageIcon.setImage(imageIcon.getImage().getScaledInstance( iconSize.getWidth(), iconSize.getHeight(), Image.SCALE_SMOOTH)); return imageIcon; } } return null; } }
private void setImageIcon(ImageIcon newIcon) { boolean sizeChanged = icon.getIconWidth() != newIcon.getIconWidth() || icon.getIconHeight() != newIcon.getIconHeight(); Image oldImage = icon.getImage(); icon.setImage(newIcon.getImage()); icon.setDescription(newIcon.getDescription()); informUsers(oldImage, newIcon.getImage(), sizeChanged); }
/** * {@inheritDoc} */ @Override protected SIcon createIcon(String urlSpec, Dimension iconSize) { if (urlSpec != null) { URL imageURL = UrlHelper.createURL(urlSpec); if (imageURL != null) { ImageIcon imageIcon = new ImageIcon(imageURL); imageIcon.setImage(imageIcon.getImage().getScaledInstance( iconSize.getWidth(), iconSize.getHeight(), Image.SCALE_SMOOTH)); return new SImageIcon(imageIcon); } } return null; } }
private void configUi() { setCursor( Cursor.getPredefinedCursor( Cursor.SE_RESIZE_CURSOR ) ); g_grabber = editor.util.EditorUtilities.loadIcon( "images/status_grabber.gif" ); g_grabber.setImage( editor.util.EditorUtilities.createSystemColorImage( g_grabber.getImage() ) ); setPreferredSize( new Dimension( g_grabber.getIconWidth(), g_grabber.getIconHeight() ) ); setOpaque( true ); setBackground( editor.util.EditorUtilities.CONTROL ); DragController controller = new DragController(); addMouseListener( controller ); addMouseMotionListener( controller ); }
private void configUi() { setCursor( Cursor.getPredefinedCursor( Cursor.SE_RESIZE_CURSOR ) ); g_grabber = editor.util.EditorUtilities.loadIcon( "images/status_grabber.gif" ); g_grabber.setImage( editor.util.EditorUtilities.createSystemColorImage( g_grabber.getImage() ) ); setPreferredSize( new Dimension( g_grabber.getIconWidth(), g_grabber.getIconHeight() ) ); setOpaque( true ); setBackground( Scheme.active().getControl() ); DragController controller = new DragController(); addMouseListener( controller ); addMouseMotionListener( controller ); }