Example usage for javax.swing ImageIcon getImage

List of usage examples for javax.swing ImageIcon getImage

Introduction

In this page you can find the example usage for javax.swing ImageIcon getImage.

Prototype

@Transient
public Image getImage() 

Source Link

Document

Returns this icon's Image.

Usage

From source file:WorldMapGraphDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoom features.//from   www.j  a v  a 2 s  .  c o m
 * 
 */
public WorldMapGraphDemo() {
    setLayout(new BorderLayout());

    map.put("TYO", new String[] { "35 40 N", "139 45 E" });
    map.put("PEK", new String[] { "39 55 N", "116 26 E" });
    map.put("MOW", new String[] { "55 45 N", "37 42 E" });
    map.put("JRS", new String[] { "31 47 N", "35 13 E" });
    map.put("CAI", new String[] { "30 03 N", "31 15 E" });
    map.put("CPT", new String[] { "33 55 S", "18 22 E" });
    map.put("PAR", new String[] { "48 52 N", "2 20 E" });
    map.put("LHR", new String[] { "51 30 N", "0 10 W" });
    map.put("HNL", new String[] { "21 18 N", "157 51 W" });
    map.put("NYC", new String[] { "40 77 N", "73 98 W" });
    map.put("SFO", new String[] { "37 62 N", "122 38 W" });
    map.put("AKL", new String[] { "36 55 S", "174 47 E" });
    map.put("BNE", new String[] { "27 28 S", "153 02 E" });
    map.put("HKG", new String[] { "22 15 N", "114 10 E" });
    map.put("KTM", new String[] { "27 42 N", "85 19 E" });
    map.put("IST", new String[] { "41 01 N", "28 58 E" });
    map.put("STO", new String[] { "59 20 N", "18 03 E" });
    map.put("RIO", new String[] { "22 54 S", "43 14 W" });
    map.put("LIM", new String[] { "12 03 S", "77 03 W" });
    map.put("YTO", new String[] { "43 39 N", "79 23 W" });

    cityList = new ArrayList<String>(map.keySet());

    // create a simple graph for the demo
    graph = new DirectedSparseMultigraph<String, Number>();
    createVertices();
    createEdges();

    ImageIcon mapIcon = null;
    String imageLocation = "/images/political_world_map.jpg";
    try {
        mapIcon = new ImageIcon(getClass().getResource(imageLocation));
    } catch (Exception ex) {
        System.err.println("Can't load \"" + imageLocation + "\"");
    }
    final ImageIcon icon = mapIcon;

    Dimension layoutSize = new Dimension(2000, 1000);

    Layout<String, Number> layout = new StaticLayout<String, Number>(graph,
            new ChainedTransformer(new Transformer[] { new CityTransformer(map),
                    new LatLonPixelTransformer(new Dimension(2000, 1000)) }));

    layout.setSize(layoutSize);
    vv = new VisualizationViewer<String, Number>(layout, new Dimension(800, 400));

    if (icon != null) {
        vv.addPreRenderPaintable(new VisualizationViewer.Paintable() {
            public void paint(Graphics g) {
                Graphics2D g2d = (Graphics2D) g;
                AffineTransform oldXform = g2d.getTransform();
                AffineTransform lat = vv.getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.LAYOUT).getTransform();
                AffineTransform vat = vv.getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.VIEW).getTransform();
                AffineTransform at = new AffineTransform();
                at.concatenate(g2d.getTransform());
                at.concatenate(vat);
                at.concatenate(lat);
                g2d.setTransform(at);
                g.drawImage(icon.getImage(), 0, 0, icon.getIconWidth(), icon.getIconHeight(), vv);
                g2d.setTransform(oldXform);
            }

            public boolean useTransform() {
                return false;
            }
        });
    }

    vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String, Number>(Color.white, Color.red,
            Color.white, Color.blue, vv.getPickedVertexState(), false));

    // add my listeners for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.setEdgeToolTipTransformer(new Transformer<Number, String>() {
        public String transform(Number edge) {
            return "E" + graph.getEndpoints(edge).toString();
        }
    });

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    add(panel);
    final AbstractModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);

    vv.addKeyListener(graphMouse.getModeKeyListener());
    vv.setToolTipText("<html><center>Type 'p' for Pick mode<p>Type 't' for Transform mode");

    final ScalingControl scaler = new CrossoverScalingControl();

    //        vv.scaleToLayout(scaler);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JButton reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).setToIdentity();
            vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).setToIdentity();
        }
    });

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(reset);
    add(controls, BorderLayout.SOUTH);
}

From source file:com.net2plan.gui.utils.topologyPane.jung.JUNGCanvas.java

public void updateBackgroundImage(final ImageIcon icon, final int x, final int y) {
    if (paintableAssociatedToBackgroundImage != null)
        vv.removePreRenderPaintable(paintableAssociatedToBackgroundImage);
    paintableAssociatedToBackgroundImage = null;
    if (icon != null) {
        this.paintableAssociatedToBackgroundImage = new VisualizationViewer.Paintable() {
            public void paint(Graphics g) {
                Graphics2D g2d = (Graphics2D) g;
                AffineTransform oldXform = g2d.getTransform();
                AffineTransform lat = vv.getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.LAYOUT).getTransform();
                AffineTransform vat = vv.getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.VIEW).getTransform();
                AffineTransform at = new AffineTransform();
                at.concatenate(g2d.getTransform());
                at.concatenate(vat);/*from  w  w  w. j  ava  2s . co m*/
                at.concatenate(lat);
                g2d.setTransform(at);
                g.drawImage(icon.getImage(), x, y, icon.getIconWidth(), icon.getIconHeight(), vv);
                g2d.setTransform(oldXform);
            }

            public boolean useTransform() {
                return false;
            }
        };
        vv.addPreRenderPaintable(paintableAssociatedToBackgroundImage);
    }
}

From source file:GrafosTroleBus.java

public GrafosTroleBus() {
    setLayout(new BorderLayout());

    //definir puntos de trolebus (latitude y longitude) @autor sa

    map.put("RECREO", new String[] { "-0.2516682", "-78.521524" }); //Recreo                       
    map.put("P14", new String[] { "-0.2445098", "-78.51902" }); //Villaflora
    map.put("P15", new String[] { "-0.2396436", "-78.51698" }); //Chimbacalle N-S                      
    map.put("P16", new String[] { "-0.2378458", "-78.515976" }); //Chimbacalle S-N
    map.put("P17", new String[] { "-0.2356805", "-78.514816" }); //Colina
    map.put("P18", new String[] { "-0.234052", "-78.514237" }); //Jefferson Perez
    map.put("P19", new String[] { "-0.2312856", "-78.513627" }); //Recoleta N-S        
    map.put("P20", new String[] { "-0.2307005", "-78.513051" }); //Recoleta S-N
    map.put("P21", new String[] { "-0.2263919", "-78.513011" }); //P21 Cumanda N-S
    map.put("P22", new String[] { "-0.226424", "-78.512803" }); //P22 Cumanda S-N
    map.put("P23", new String[] { "-0.2234658", "-78.512542" }); //P23 Santo Domingo
    map.put("P24", new String[] { "-0.2185857", "-78.508601" }); //P24 Plaza del Teatro N-S
    map.put("P25", new String[] { "-0.219605", "-78.50813" }); //P25 Plaza del Teatro S-N        
    map.put("P26", new String[] { "-0.2177808", "-78.505977" }); //P26 Hermano Miguel
    map.put("P27", new String[] { "-0.2169088", "-78.50521" }); //P27 Banco Central
    map.put("P28", new String[] { "-0.214267", "-78.502999" }); //P28 La Alameda S-N
    map.put("P29", new String[] { "-0.2137705", "-78.50293" }); //P29 La Alameda N-S                       
    map.put("P30", new String[] { "-0.2084939", "-78.500255" }); //P30 Ejido N-S
    map.put("P31", new String[] { "-0.2088076", "-78.500032" }); //P31 Ejido S-N
    map.put("P32", new String[] { "-0.2047989", "-78.4988" }); //P32 La Mariscal N-S
    map.put("P33", new String[] { "-0.2041972", "-78.498491" }); //P33 La Mariscal S-N
    map.put("P34", new String[] { "-0.2009718", "-78.49715" }); //P34 Santa Clara S-N
    map.put("P35", new String[] { "-0.201056", "-78.496979" }); //P35 Santa Clara N-S
    map.put("P36", new String[] { "-0.1986325", "-78.496141" }); //P36 La Colon S-N
    map.put("P37", new String[] { "-0.1978432", "-78.495563" }); //P37 La Colon N-S
    map.put("P38", new String[] { "-0.1921587", "-78.493445" }); //P38 Cuero y Caicedo S-N
    map.put("P39", new String[] { "-0.1915098", "-78.493001" }); //P39 Cuero y Caicedo N-S                        
    map.put("P40", new String[] { "-0.1889467", "-78.492149" }); //P40 Mariana de Jess S-N
    map.put("P41", new String[] { "-0.1875567", "-78.491303" }); //P41 Mariana de Jesus N-S
    map.put("P42", new String[] { "-0.1853693", "-78.490878" }); //P42 El Floron S-N
    map.put("P43", new String[] { "-0.1846687", "-78.490403" }); //P43 El Floron N-S        
    map.put("P44", new String[] { "-0.1817679", "-78.489808" }); //P44 Carolina S-N
    map.put("P45", new String[] { "-0.1810849", "-78.489336" }); //P45 Carolina N-S
    map.put("P46", new String[] { "-0.1787274", "-78.488954" }); //P46 Estadio S-N
    map.put("P47", new String[] { "-0.1780172", "-78.488621" }); //P47 Estadio N-S
    map.put("P48", new String[] { "-0.172087", "-78.487589" }); //P48 La Y S-N
    map.put("P49", new String[] { "-0.1713146", "-78.487277" }); //P49 La Y N-S        
    map.put("LA Y", new String[] { "-0.1635504", "-78.485374" }); //Estacin La Y                              

    nodoList = new ArrayList<String>(map.keySet());

    // create a simple graph for the demo        
    graph = new DirectedSparseMultigraph<String, Number>();
    createVertices();/*  ww w .j  av  a2  s.co m*/
    createEdges();

    ImageIcon mapIcon = null;
    String imageLocation = "/mapa_quito.png";

    try {
        mapIcon = new ImageIcon(getClass().getResource(imageLocation));

        ImageWidth = mapIcon.getIconWidth();
        ImageHeight = mapIcon.getIconHeight();

    } catch (Exception ex) {
        System.err.println("Can't load \"" + imageLocation + "\"");
    }

    final ImageIcon icon = mapIcon;

    Dimension layoutSize = new Dimension(ImageWidth, ImageHeight);

    Layout<String, Number> layout = new StaticLayout<String, Number>(graph,
            new ChainedTransformer<String, Point2D>(new Transformer[] { new CityTransformer(map),
                    new LatLonPixelTransformer(new Dimension(ImageWidth, ImageHeight)) }));

    layout.setSize(layoutSize);
    vv = new VisualizationViewer<String, Number>(layout, new Dimension(MonitorWidth, MonitorHeight));

    if (icon != null) {
        vv.addPreRenderPaintable(new VisualizationViewer.Paintable() {
            public void paint(Graphics g) {
                Graphics2D g2d = (Graphics2D) g;
                AffineTransform oldXform = g2d.getTransform();
                AffineTransform lat = vv.getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.LAYOUT).getTransform();
                AffineTransform vat = vv.getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.VIEW).getTransform();
                AffineTransform at = new AffineTransform();
                at.concatenate(g2d.getTransform());
                at.concatenate(vat);
                at.concatenate(lat);
                g2d.setTransform(at);
                g.drawImage(icon.getImage(), 0, 0, icon.getIconWidth(), icon.getIconHeight(), vv);
                g2d.setTransform(oldXform);
            }

            public boolean useTransform() {
                return false;
            }
        });
    }

    vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String, Number>(Color.white, Color.red,
            Color.white, Color.blue, vv.getPickedVertexState(), false));

    // add my listeners for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<String>());
    vv.setEdgeToolTipTransformer(new Transformer<Number, String>() {
        public String transform(Number edge) {
            return "E" + graph.getEndpoints(edge).toString();
        }
    });

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
    vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    add(panel);
    final AbstractModalGraphMouse graphMouse = new DefaultModalGraphMouse<Object, Object>();
    vv.setGraphMouse(graphMouse);

    vv.addKeyListener(graphMouse.getModeKeyListener());
    vv.setToolTipText("<html><center>Type 'p' for Pick mode<p>Type 't' for Transform mode");

    final ScalingControl scaler = new CrossoverScalingControl();

    vv.scaleToLayout(scaler);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JButton reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).setToIdentity();
            vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).setToIdentity();
        }
    });

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(reset);
    add(controls, BorderLayout.SOUTH);
}

From source file:com.SE.myPlayer.MusicPlayerGUI.java

/**
     * Creates new form MusicPlayerGUI//from   w  w  w .j av  a  2s  .  co m
     *
     * @param tableName
     * @param dropControl
     * @param lastOpen
     * @throws java.sql.SQLException
     */
    public MusicPlayerGUI(String tableName, int dropControl, String lastOpen) throws SQLException {
        this.tableName = tableName;
        this.lastOpen = tableName;
        this.dropControl = dropControl;

        initComponents();
        setDefaultClipArt();
        song_FileChooser.setMultiSelectionEnabled(true);
        song_FileChooser.setFileFilter(fileFilter);
        folder_Playlist_Tree.setRootVisible(false);

        play_Pause_Button.requestFocus();

        URL iconURL = getClass().getResource("/Images/IconFrame.png");
        ImageIcon icon = new ImageIcon(iconURL);
        setIconImage(icon.getImage());

        addJmenuItemsToRecentSongs();
        addJMenuItemsToPopUP();
        refereshColumnPopUp();

        treeReferesh();
        folder_Playlist_Tree.setSelectionRow(0);
        getSongTable(tableName);
    }

From source file:mondrian.gui.Workbench.java

/**
 * Creates new form Workbench/*from w ww .j  a  v a  2s.  c  o  m*/
 */
public Workbench() {
    myClassLoader = this.getClass().getClassLoader();

    resourceConverter = getGlobalResourceConverter();

    // Setting User home directory
    WORKBENCH_USER_HOME_DIR = System.getProperty("user.home") + File.separator + ".schemaWorkbench";
    WORKBENCH_CONFIG_FILE = WORKBENCH_USER_HOME_DIR + File.separator + "workbench.properties";
    DB_META_CONFIG_FILE = WORKBENCH_USER_HOME_DIR + File.separator + "databaseMeta.xml";

    loadWorkbenchProperties();
    loadDatabaseMeta();
    initOptions();
    initComponents();
    loadMenubarPlugins();

    ImageIcon icon = new javax.swing.ImageIcon(
            myClassLoader.getResource(getResourceConverter().getGUIReference("productIcon")));

    this.setIconImage(icon.getImage());
}

From source file:edu.ku.brc.specify.ui.AppBase.java

/**
 * @param imgEncoded uuencoded image string
 *//*w w w .  j av  a  2  s.  c om*/
protected void setAppIcon(final String imgEncoded) {
    String appIconName = "AppIcon";
    String innerAppIconName = "InnerAppIcon";

    ImageIcon appImgIcon = null;
    if (StringUtils.isNotEmpty(imgEncoded)) {
        appImgIcon = GraphicsUtils.uudecodeImage("", imgEncoded); //$NON-NLS-1$
        if (appImgIcon != null && appImgIcon.getIconWidth() == 32 && appImgIcon.getIconHeight() == 32) {
            appIcon.setIcon(appImgIcon);
            CustomDialog.setAppIcon(appImgIcon);
            CustomFrame.setAppIcon(appImgIcon);
            IconManager.register(innerAppIconName, appImgIcon, null, IconManager.IconSize.Std32);
            return;
        }
    }
    appImgIcon = IconManager.getImage(appIconName, IconManager.IconSize.Std32); //$NON-NLS-1$
    appIcon.setIcon(appImgIcon);
    if (!UIHelper.isMacOS()) {
        appImgIcon = IconManager.getImage("SpecifyWhite32", IconManager.IconSize.Std32); //$NON-NLS-1$
    }
    CustomDialog.setAppIcon(appImgIcon);
    CustomFrame.setAppIcon(appImgIcon);
    IconManager.register(innerAppIconName, appImgIcon, null, IconManager.IconSize.Std32);

    if (this.topFrame != null) {
        this.topFrame.setIconImage(appImgIcon.getImage());
    }
}

From source file:edu.ku.brc.specify.Specify.java

public static void startApp() {

    // XXX RELEASE
    boolean isRelease = true;
    UIRegistry.setRelease(isRelease);/*from  ww  w. ja v  a 2 s  .  c o  m*/
    UIRegistry.setTesting(!isRelease);

    boolean doCheckSum = false;
    XMLHelper.setUseChecksum(isRelease && doCheckSum);

    // Then set this
    IconManager.setApplicationClass(Specify.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_imgproc.xml")); //$NON-NLS-1$

    /*if (UIHelper.isMacOS())
    {
        Toolkit toolkit = Toolkit.getDefaultToolkit( );
        Image image = toolkit.getImage( "NSImage://NSUserGroup" );
            
        IconEntry entry = IconManager.getIconEntryByName("AdminGroup");
        entry.setIcon(new ImageIcon(image));
                
        image = toolkit.getImage( "NSImage://NSUser" );
        entry = IconManager.getIconEntryByName("person");
        entry.setIcon(new ImageIcon(image));
    }*/

    if (!UIRegistry.isRelease()) {
        MemoryWarningSystem.setPercentageUsageThreshold(0.75);

        MemoryWarningSystem mws = new MemoryWarningSystem();
        mws.addListener(new MemoryWarningSystem.Listener() {
            protected void setMessage(final String msg, final boolean isError) {
                JStatusBar statusBar = UIRegistry.getStatusBar();
                if (statusBar != null) {
                    if (isError) {
                        statusBar.setErrorMessage(msg);
                    } else {
                        statusBar.setText(msg);
                    }
                } else {
                    log.error(msg);
                }
            }

            public void memoryUsage(long usedMemory, long maxMemory) {
                double percentageUsed = ((double) usedMemory) / maxMemory;

                String msg = String.format("Percent Memory Used %6.2f of Max %d", //$NON-NLS-1$
                        new Object[] { (percentageUsed * 100.0), maxMemory });
                setMessage(msg, false);

            }

            public void memoryUsageLow(long usedMemory, long maxMemory) {
                double percentageUsed = ((double) usedMemory) / maxMemory;

                String msg = String.format("Memory is Low! Percentage Used = %6.2f of Max %d", //$NON-NLS-1$
                        new Object[] { (percentageUsed * 100.0), maxMemory });
                setMessage(msg, true);

                if (MemoryWarningSystem.getThresholdPercentage() < 0.8) {
                    MemoryWarningSystem.setPercentageUsageThreshold(0.8);
                }
            }
        });
    }

    // Setup base font AFTER setting Look and Feel
    Font defFont = (createLabel("")).getFont();
    UIRegistry.setDefaultFont(defFont);

    setupDefaultFonts();

    Font sysBaseFont = UIRegistry.getBaseFont(); // forces loading of System Base Font before anything happens

    String key = "ui.formatting.controlSizes"; //$NON-NLS-1$
    String fontName = AppPreferences.getLocalPrefs().get(key + ".FN", UIRegistry.getBaseFont().getFamily());
    Integer fontSize = AppPreferences.getLocalPrefs().getInt(key + ".SZ", UIRegistry.getBaseFont().getSize());

    Font newBaseFont = fontName != null && fontSize != null ? new Font(fontName, Font.PLAIN, fontSize)
            : sysBaseFont;
    UIRegistry.setBaseFont(newBaseFont);

    //SkinsMgr.getInstance().setSkin("giraffe");

    BaseTask.setToolbarBtnFont(newBaseFont); // For ToolbarButtons
    RolloverCommand.setDefaultFont(newBaseFont);

    ImageIcon helpIcon = IconManager.getIcon(getIconName(), IconSize.Std16); //$NON-NLS-1$
    HelpMgr.initializeHelp("SpecifyHelp", helpIcon.getImage()); //$NON-NLS-1$

    // Startup Specify
    Specify specify = new Specify();

    RolloverCommand.setHoverImg(IconManager.getIcon("DropIndicator")); //$NON-NLS-1$

    specify.preStartUp();
    specify.startUp();
}

From source file:javazoom.jlgui.player.amp.Player.java

/**
 * Constructor./*  w ww .  j ava  2  s .co m*/
 */
public Player(String Skin, Frame top) {
    super(top);
    topFrame = top;

    // Config feature.
    config = Config.getInstance();
    config.load(initConfig);
    OrigineX = config.getXLocation();
    OrigineY = config.getYLocation();

    // Get screen size
    try {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Dimension dimension = toolkit.getScreenSize();
        screenWidth = dimension.width;
        screenHeight = dimension.height;
    } catch (Exception e) {
    }

    // Minimize/Maximize/Icon features.
    topFrame.addWindowListener(this);
    topFrame.setLocation(OrigineX, OrigineY);
    topFrame.setSize(0, 0);
    // Polis : Comment out to fix a bug under XWindow
    //topFrame.setResizable(false);
    ClassLoader cl = this.getClass().getClassLoader();
    URL iconURL = cl.getResource("javazoom/jlgui/player/amp/jlguiicon.gif");
    if (iconURL != null) {
        ImageIcon jlguiIcon = new ImageIcon(iconURL);
        topFrame.setIconImage(jlguiIcon.getImage());
    }
    topFrame.show();

    // DnD feature.
    DropTarget dt = new DropTarget(this, DnDConstants.ACTION_COPY, this, true);

    // Playlist feature.
    boolean playlistfound = false;
    if ((initSong != null) && (!initSong.equals("")))
        playlistfound = loadPlaylist(initSong);
    else
        playlistfound = loadPlaylist(config.getPlaylistFilename());

    // Load skin specified in args
    if (Skin != null) {
        thePath = Skin;
        log.info("Load default skin from " + thePath);
        loadSkin(thePath);
        config.setDefaultSkin(thePath);
    }
    // Load skin specified in jlgui.ini
    else if ((config.getDefaultSkin() != null) && (!config.getDefaultSkin().trim().equals(""))) {
        log.info("Load default skin from " + config.getDefaultSkin());
        loadSkin(config.getDefaultSkin());
    }
    // Default included skin
    else {
        //ClassLoader cl = this.getClass().getClassLoader();
        InputStream sis = cl.getResourceAsStream("javazoom/jlgui/player/amp/metrix.wsz");
        log.info("Load default skin for JAR");
        loadSkin(sis);
    }

    // Go to playlist begining if needed.
    if ((playlist != null) && (playlistfound == true)) {
        if (playlist.getPlaylistSize() > 0)
            acNext.fireEvent();
    }

    // Display the whole
    hide();
    show();
    repaint();
}

From source file:fi.hoski.remote.ui.Admin.java

/**
 * Initializes frame/*from   w w w  .j a  v  a 2 s .co  m*/
 */
private void initFrame() throws EntityNotFoundException, MalformedURLException, IOException {
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new ExceptionHandler());
    ResourceBundle applicationProperties = ResourceBundle.getBundle("application");
    frame = new JFrame(TextUtil.getText("ADMIN") + " " + creator + " / " + server + " Version: "
            + applicationProperties.getString("version"));
    frame.addWindowListener(this);
    panel = new JPanel(new BorderLayout());
    frame.add(panel);
    menuBar = new JMenuBar();

    menuFile();
    menuRace();
    if (serverProperties.isSuperUser()) {
        menuEvent();
        menuReservation();
        menuSwapPatrolShift();
    }
    menuQuery();

    frame.setJMenuBar(menuBar);

    URL clubUrl = new URL("http", server, "club.ico");
    ImageIcon clubIcon = new ImageIcon(clubUrl);
    frame.setIconImage(clubIcon.getImage());
    frame.pack();
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
    frame.setSize(800, 580);
}