本文整理匯總了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);
}