本文整理了Java中java.awt.Window.setIconImages()
方法的一些代码示例,展示了Window.setIconImages()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.setIconImages()
方法的具体详情如下:
包路径:java.awt.Window
类名称:Window
方法名:setIconImages
暂无
代码示例来源:origin: omegat-org/omegat
public static void setWindowIcon(Window window) {
List<Image> icons;
if (Platform.isMacOSX()) {
icons = Arrays.asList(OSXIntegration.APP_ICON_MAC);
} else {
icons = Arrays.asList(ResourcesUtil.APP_ICON_16X16, ResourcesUtil.APP_ICON_32X32);
}
window.setIconImages(icons);
}
代码示例来源:origin: freeplane/freeplane
@Override
public void hierarchyChanged(HierarchyEvent e) {
if(messageComponent.isShowing()){
messageComponent.removeHierarchyListener(this);
final Window window = SwingUtilities.getWindowAncestor(messageComponent);
if(window instanceof JDialog)
((JDialog)window).setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
window.setIconImages(iconImages);
}
}
});
代码示例来源:origin: stackoverflow.com
import java.awt.Image;
import javax.swing.*;
import javax.imageio.ImageIO;
import java.net.URL;
import java.util.*;
class FrameIcons {
public static void main(String[] args) throws Exception {
URL url16 = new URL("http://i.stack.imgur.com/m0KKu.png");
URL url32 = new URL("http://i.stack.imgur.com/LVVMb.png");
final List<Image> icons = new ArrayList<Image>();
icons.add(ImageIO.read(url16));
icons.add(ImageIO.read(url32));
SwingUtilities.invokeLater( new Runnable() {
public void run() {
JFrame f = new JFrame("Frame Icons");
f.setIconImages(icons);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLocationByPlatform(true);
f.setSize(200,100);
f.setVisible(true);
}
});
}
}
代码示例来源:origin: stackoverflow.com
import java.awt.Image;
import javax.swing.*;
import javax.imageio.ImageIO;
import java.net.URL;
import java.util.*;
//upto here just importing. Don't worry, let the eclipse or your editor do that for you
class FrameIcons {
public static void main(String[] args) throws Exception {
URL url16 = new URL("image.png");//Making two objects of URL class
URL url32 = new URL("images.png");//second object of URL
final List<Image> icons = new ArrayList<Image>();//this is just an arraylist of `icon. For now on if you don't know about list, think it as array where you can put element using .add() method`
icons.add(ImageIO.read(url16));//adding to list
icons.add(ImageIO.read(url32));//adding to list
SwingUtilities.invokeLater( new Runnable() {//this is just for running a `runnable`
public void run() {
JFrame f = new JFrame("Frame Icons");//setting JFrame
f.setIconImages(icons);//setting icon images
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//you must know `everything from here`
f.setLocationByPlatform(true);
f.setSize(200,100);
f.setVisible(true);
}
});
}
}
代码示例来源:origin: stackoverflow.com
icons.add(ImageIO.read(getClass().getResource("/resources/FrameIcon64x64.png")));
icons.add(ImageIO.read(getClass().getResource("/resources/FrameIcon128x128.png")));
frame.setIconImages(icons);
} catch (IOException exp) {
exp.printStackTrace();
代码示例来源:origin: kaikramer/keystore-explorer
getClass().getResource(res.getString("HelpAction.image.32x32"))));
helpWindow.setIconImages(icons);
代码示例来源:origin: stackoverflow.com
Class<DemoFrame> clazz = DemoFrame.class;
if (System.getProperty("java.version").compareTo("1.6") >= 0) {
demoFrame.setIconImages(Arrays.asList(new Image[]{
new ImageIcon(clazz.getResource("resource/DJIcon16x16.png")).getImage(),
new ImageIcon(clazz.getResource("resource/DJIcon24x24.png")).getImage(),
代码示例来源:origin: stackoverflow.com
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setIconImages(icons);
代码示例来源:origin: com.barchart.pivot/pivot-wtk
@Override
public void run() {
java.awt.Window hostWindow = getDisplay().getHostWindow();
if (DesktopDisplayHost.this.rootOwner == null) {
((TitledWindow)hostWindow).setTitle(DEFAULT_HOST_WINDOW_TITLE);
hostWindow.setIconImage(null);
} else {
((TitledWindow)hostWindow).setTitle(DesktopDisplayHost.this.rootOwner.getTitle());
java.util.ArrayList<BufferedImage> iconImages = new java.util.ArrayList<BufferedImage>();
for (Image icon : DesktopDisplayHost.this.rootOwner.getIcons()) {
if (icon instanceof Picture) {
iconImages.add(((Picture) icon).getBufferedImage());
}
}
if (iconImages.size() == 1) {
hostWindow.setIconImage(iconImages.get(0));
} else if (iconImages.size() > 1) {
hostWindow.setIconImages(iconImages);
}
}
updateHostWindowTitleBarCallback = null;
}
};
代码示例来源:origin: org.apache.pivot/pivot-wtk
@Override
public void run() {
java.awt.Window hostWindow = getDisplay().getHostWindow();
if (DesktopDisplayHost.this.rootOwner == null) {
((TitledWindow)hostWindow).setTitle(DEFAULT_HOST_WINDOW_TITLE);
hostWindow.setIconImage(null);
} else {
((TitledWindow)hostWindow).setTitle(DesktopDisplayHost.this.rootOwner.getTitle());
java.util.ArrayList<BufferedImage> iconImages = new java.util.ArrayList<BufferedImage>();
for (Image icon : DesktopDisplayHost.this.rootOwner.getIcons()) {
if (icon instanceof Picture) {
iconImages.add(((Picture) icon).getBufferedImage());
}
}
if (iconImages.size() == 1) {
hostWindow.setIconImage(iconImages.get(0));
} else if (iconImages.size() > 1) {
hostWindow.setIconImages(iconImages);
}
}
DesktopDisplayHost.this.updateHostWindowTitleBarCallback = null;
}
};
代码示例来源:origin: freeplane/freeplane
@Override
public void windowAdded(final DockingWindow addedToWindow, final DockingWindow addedWindow) {
if(addedWindow instanceof TabWindow) {
final DockingWindowProperties windowProperties = addedWindow.getWindowProperties();
windowProperties.setDockEnabled(false);
windowProperties.setUndockEnabled(false);
if(UITools.getCurrentFrame().isResizable())
setTabAreaVisiblePolicy((TabWindow) addedWindow);
else
setTabAreaPolicy((TabWindow) addedWindow, TabAreaVisiblePolicy.NEVER);
}
else if(addedWindow instanceof FloatingWindow) {
final Container topLevelAncestor = addedWindow.getTopLevelAncestor();
if(topLevelAncestor instanceof Window){
if(iconColorReplacer == null)
iconColorReplacer = new IconColorReplacer(((Window) UITools.getMenuComponent()).getIconImages());
final List<Image> iconImages = iconColorReplacer.getNextIconImages();
((Window)topLevelAncestor).setIconImages(iconImages);
}
}
setTabPolicies(addedWindow);
}
内容来源于网络,如有侵权,请联系作者删除!