Image image = loadImage("/org/h2/res/h2.png"); if (image != null) { frame.setIconImage(image);
_logMonitorFrame.setIconImage(new ImageIcon(lf5IconURL).getImage());
public static void addWindowIcon(final Frame window, final String file) { URL url = ViewerFrame.class.getResource("/" + "images/" + file); if (url != null) { Image image = java.awt.Toolkit.getDefaultToolkit().getImage(url); if (image != null) { window.setIconImage(image); } } } }
public static void addWindowIcon(final Frame window, final String file) { final URL url = ViewerFrame.class.getResource("/" + "images/" + file); if (url != null) { final Image image = java.awt.Toolkit.getDefaultToolkit().getImage(url); if (image != null) { window.setIconImage(image); } } } }
JFileChooser chooser = new JFileChooser(); Frame window=new Frame(); window.setIconImage(new ImageIcon("src/Image/icon.jpg").getImage()); int option = choice.showOpenDialog(window); if (option == JFileChooser.APPROVE_OPTION) { }
@Override public void setIcon(PImage image) { Image awtImage = (Image) image.getNative(); if (PApplet.platform != PConstants.MACOSX) { frame.setIconImage(awtImage); } else { try { final String td = "processing.core.ThinkDifferent"; Class<?> thinkDifferent = Thread.currentThread().getContextClassLoader().loadClass(td); Method method = thinkDifferent.getMethod("setIconImage", new Class[] { java.awt.Image.class }); method.invoke(null, new Object[] { awtImage }); } catch (Exception e) { e.printStackTrace(); // That's unfortunate } } }
/** * Sets the frame's icons. Unfortunately, the ability to pass multiple icons so the OS can * choose the most size-appropriate one was added in 1.6; before that, you can only set one * icon. * * This method attempts to find and use setIconImages, but if it can't, sets the frame's icon * to the first image in the list passed in. */ public static void setFrameIcons (Frame frame, List<? extends Image> icons) { try { Method m = frame.getClass().getMethod("setIconImages", List.class); m.invoke(frame, icons); return; } catch (SecurityException e) { // Fine, fine, no reflection for us } catch (NoSuchMethodException e) { // This is fine, we must be on a pre-1.6 JVM } catch (Exception e) { // Something else went awry? Log it log.warning("Error setting frame icons", "frame", frame, "icons", icons, "e", e); } // We couldn't find it, couldn't reflect, or something. // Just use whichever's at the top of the list frame.setIconImage(icons.get(0)); }
private void configureFrame() { Window window = SwingUtilities.windowForComponent(this); if (window instanceof Frame){ Frame frame = (Frame)window; ImageIcon mWindowIcon; mWindowIcon = new ImageIcon(getClass().getResource( "/images/Freeplane_frame_icon_64x64.png")); frame.setIconImage(mWindowIcon.getImage()); if (!frame.isResizable()){ frame.setResizable(true); } } }
static Frame createFrame() { Frame f = new Frame(); f.setIconImage(JNLPRuntime.getWindowIcon()); return f; }
((JLabel)component).setIcon(icon); } else if (component instanceof Frame) { ((Frame)component).setIconImage(icon.getImage()); } else { log.warn("Cannot set icon for unexpected JComponent object: "
setIconImage(spmlIcon.getImage());
setIconImage(spmlIcon.getImage());
/** Demo main program, showing two ways to use it. * Create a small MemImage and set it as this Frame's iconImage. * Also display a larger version of the same image in the Frame. */ public static void main(String[] av) { Frame f = new Frame("FrameIcon"); Image im = Toolkit.getDefaultToolkit().getImage("FrameIcon.gif"); f.setIconImage(im); f.setSize(100, 100); f.setLocation(200, 200); f.setVisible(true); } }
/** Demo main program, showing two ways to use it. * Create a small MemImage and set it as this Frame's iconImage. * Also display a larger version of the same image in the Frame. */ public static void main(String[] av) { Frame f = new Frame("MemImage.java"); f.add(new MemImage()); f.setIconImage(new MemImage(16,16).getImage()); f.pack(); f.setVisible(true); }
getFrames()[0].setIconImage(new ImageIcon(url).getImage());
/** * Checks whether the window can be displayed without an applet * warning banner, and adds the window to the list of windows to * be disposed when the calling application exits. */ public boolean checkTopLevelWindow(Object window) { ApplicationInstance app = getApplication(); // remember window -> application mapping for focus, close on exit if (app != null && window instanceof Window) { Window w = (Window) window; if (JNLPRuntime.isDebug()) System.err.println("SM: app: "+app.getTitle()+" is adding a window: "+window); weakWindows.add(window); // for mapping window -> app weakApplications.add(app); w.addWindowListener(contextListener); // for dynamic context classloader app.addWindow(w); } // change coffee cup to netx for default icon if (window instanceof Window) for (Window w = (Window)window; w != null; w = w.getOwner()) if (window instanceof Frame) ((Frame)window).setIconImage(JNLPRuntime.getWindowIcon()); // todo: set awt.appletWarning to custom message // todo: logo on with glass pane on JFrame/JWindow? return super.checkTopLevelWindow(window); }
mainFrame.setIconImage(new ImageIcon(getClass().getResource("/icons/vlcj-logo.png")).getImage()); mainFrame.setLayout(new BorderLayout()); mainFrame.setBackground(Color.black);
frame_.addWindowListener(new WindowListener_()); if (SPLFVIcon != null) { // @A1A frame_.setIconImage(((ImageIcon)(SPLFVIcon)).getImage());
public static void main(String[] args) throws Exception { Frame f = new Frame("Test Player"); f.setIconImage(new ImageIcon(VolumeTestPlayer.class.getResource("/icons/vlcj-logo.png")).getImage()); f.setSize(800, 600); f.addWindowListener(new WindowAdapter() {
public OverlayTest(String mrl) { Frame f = new Frame("Test Player"); f.setIconImage(new ImageIcon(getClass().getResource("/icons/vlcj-logo.png")).getImage()); f.setSize(800, 600); f.setBackground(Color.black);