本文整理汇总了Java中javax.swing.ImageIcon.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageIcon.setImage方法的具体用法?Java ImageIcon.setImage怎么用?Java ImageIcon.setImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ImageIcon
的用法示例。
在下文中一共展示了ImageIcon.setImage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setIconButtons
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setIconButtons()
{
homeIcon = new ImageIcon("icon/home.png");
Image icon = homeIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
homeIcon.setImage(icon);
home.setIcon(homeIcon);
nextIcon = new ImageIcon("icon/next.png");
icon = nextIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
nextIcon.setImage(icon);
next.setIcon(nextIcon);
backIcon = new ImageIcon("icon/back.png");
icon = backIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
backIcon.setImage(icon);
back.setIcon(backIcon);
/*endIcon = new ImageIcon("icon/end.png");
icon = endIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
endIcon.setImage(icon);
end.setIcon(endIcon);*/
}
示例2: getImage
import javax.swing.ImageIcon; //导入方法依赖的package包/类
ImageIcon getImage(URL base) {
if (!loadedImage) {
synchronized(this) {
if (!loadedImage) {
URL url = CSS.getURL(base, svalue);
loadedImage = true;
if (url != null) {
image = new ImageIcon();
Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
if (tmpImg != null) {
image.setImage(tmpImg);
}
}
}
}
}
return image;
}
示例3: setIconButtons
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setIconButtons()
{
homeIcon = new ImageIcon("icon/home.png");
Image icon = homeIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
homeIcon.setImage(icon);
home.setIcon(homeIcon);
nextIcon = new ImageIcon("icon/next.png");
icon = nextIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
nextIcon.setImage(icon);
next.setIcon(nextIcon);
backIcon = new ImageIcon("icon/back.png");
icon = backIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
backIcon.setImage(icon);
back.setIcon(backIcon);
endIcon = new ImageIcon("icon/end.png");
icon = endIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
endIcon.setImage(icon);
end.setIcon(endIcon);
}
示例4: setIconPath
import javax.swing.ImageIcon; //导入方法依赖的package包/类
/**
* 按图片路径设置菜单图片
*
* @param i_IconPath
* @throws Exception
*/
public void setIconPath(String i_IconPath) throws Exception
{
ImageIcon v_Image = new ImageIcon(new URL(i_IconPath));
v_Image.setImage(v_Image.getImage().getScaledInstance(17 ,17 ,1));
super.setIcon(v_Image);
}
示例5: Inicial
import javax.swing.ImageIcon; //导入方法依赖的package包/类
/**
* Creates new form Main
*/
public Inicial() {
initComponents();
this.setLocationRelativeTo(null);
setIcon();
ImageIcon img = new javax.swing.ImageIcon("C:\\Users\\Public\\Pictures\\telaFundo.png");
img.setImage(img.getImage().getScaledInstance(617, 447, 100));
lbl_imagem.setIcon(img);
}
示例6: loadImages
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void loadImages() {
String[] imageNames = { IMG_LOGOPOLI, IMG_SUITEICON };
//load each image referenced in the above array
for (String imageName : imageNames) {
ImageIcon img = JMTImageLoader.loadImage(imageName);
if (imageName.equals(IMG_LOGOPOLI)) {
Image imgSmall = img.getImage().getScaledInstance(400, (150 * 400) / 739, Image.SCALE_SMOOTH);
img.setImage(imgSmall);
}
imageIcons.put(imageName, img);
}
}
示例7: loadImages
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void loadImages() {
String[] imageNames = { IMG_LOGOPOLI, IMG_JMODELICON, IMG_JMVAICON, IMG_JABAICON, IMG_JMCHICON, IMG_JWATICON, IMG_JSIMICON, IMG_SUITEICON };
//load each image referenced in the above array
for (String imageName : imageNames) {
ImageIcon img = JMTImageLoader.loadImage(imageName);
if (imageName.equals(IMG_LOGOPOLI)) {
// Image imgSmall = img.getImage().getScaledInstance(400,(150*(400))/739,Image.SCALE_SMOOTH);
Image imgSmall = img.getImage().getScaledInstance(100, 100, Image.SCALE_SMOOTH);
img.setImage(imgSmall);
}
imageIcons.put(imageName, img);
}
}
示例8: executeWithUnitOutForAnimation
import javax.swing.ImageIcon; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void executeWithUnitOutForAnimation(JLabel unitLabel) {
final GUI gui = getGUI();
// Tile position should now be valid.
if (gui.getTilePosition(this.tile) == null) {
logger.warning("Failed attack animation for " + this.unit
+ " at tile: " + this.tile);
return;
}
final Rectangle rect = gui.getTileBounds(this.tile);
final ImageIcon icon = (ImageIcon)unitLabel.getIcon();
for (AnimationEvent event : animation) {
long time = System.nanoTime();
if (event instanceof ImageAnimationEvent) {
final ImageAnimationEvent ievent = (ImageAnimationEvent)event;
Image image = ievent.getImage();
if (mirror) {
// FIXME: Add mirroring functionality to SimpleZippedAnimation
image = ImageLibrary.createMirroredImage(image);
}
icon.setImage(image);
gui.paintImmediatelyCanvasIn(rect);
time = ievent.getDurationInMs()
- (System.nanoTime() - time) / 1000000;
if (time > 0) Utils.delay(time, "Animation delayed.");
}
}
gui.refresh();
}
示例9: setStartIcon
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setStartIcon()
{
startIcon = new ImageIcon("icon/next.png");
Image icon = startIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
startIcon.setImage(icon);
start.setIcon(startIcon);
}
示例10: setStartIcon
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setStartIcon()
{
startIcon = new ImageIcon("icon/start.png");
Image icon = startIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
startIcon.setImage(icon);
start.setIcon(startIcon);
}
示例11: refreshViewer
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private static void refreshViewer(Image img, AtomicInteger zoomX, AtomicInteger zoomY, ImageIcon icon, Frame frame) {
//System.err.println(zoomX);
//System.err.println(zoomY);
Image newImage;
if (zoomX.get() == 1 && zoomY.get() == 1) {
newImage = img;
} else {
newImage = img.getScaledInstance((int)(img.getWidth(frame) * Math.pow(2, zoomX.get())),
(int)(img.getHeight(frame) * Math.pow(2, zoomY.get())),
Image.SCALE_SMOOTH);
}
icon.setImage(newImage);
frame.repaint();
}
示例12: afficheRune
import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void afficheRune(String url){
java.net.URL imageURL = Main.class.getResource(url);
ImageIcon icon = new ImageIcon(imageURL);
if (url.equals("/images/stele.png")){
java.awt.Image imagePhoto=icon.getImage();
imagePhoto=imagePhoto.getScaledInstance(88,112,java.awt.Image.SCALE_SMOOTH);
icon.setImage(imagePhoto);
}
runeLbl.setIcon(icon);
}