Java Code Examples for javax.swing.JFrame#setIconImages()

The following examples show how to use javax.swing.JFrame#setIconImages() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProfileSelectWindow.java    From amidst with GNU General Public License v3.0 6 votes vote down vote up
@CalledOnlyBy(AmidstThread.EDT)
private JFrame createFrame() {
	JFrame frame = new JFrame("Profile Selector");
	frame.setIconImages(metadata.getIcons());
	frame.getContentPane().setLayout(new MigLayout());
	frame.add(createTitleLabel(), "h 20!,w :400:, growx, pushx, wrap");
	frame.add(createScrollPanel(), getScrollPaneLayoutString());
	frame.pack();
	frame.addKeyListener(profileSelectPanel.createKeyListener());
	frame.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			application.exitGracefully();
		}
	});
	frame.setLocation(200, 200);
	frame.setVisible(true);
	return frame;
}
 
Example 2
Source File: ProfileSelectWindow.java    From amidst with GNU General Public License v3.0 6 votes vote down vote up
@CalledOnlyBy(AmidstThread.EDT)
private JFrame createFrame() {
	JFrame frame = new JFrame("Profile Selector");
	frame.setIconImages(metadata.getIcons());
	frame.getContentPane().setLayout(new MigLayout());
	frame.add(createTitleLabel(), "h 20!,w :400:, growx, pushx, wrap");
	frame.add(createScrollPanel(), getScrollPaneLayoutString());
	frame.pack();
	frame.addKeyListener(profileSelectPanel.createKeyListener());
	frame.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			application.exitGracefully();
		}
	});
	frame.setLocation(200, 200);
	frame.setVisible(true);
	return frame;
}
 
Example 3
Source File: LicenseWindow.java    From amidst with GNU General Public License v3.0 5 votes vote down vote up
private JFrame createFrame(JList<License> licenseList, JScrollPane scrollPane) {
	JFrame frame = new JFrame("Licenses");
	initContentPane(frame.getContentPane(), licenseList, scrollPane);
	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	frame.setIconImages(metadata.getIcons());
	frame.setSize(870, 550);
	frame.setVisible(true);
	return frame;
}
 
Example 4
Source File: SeedSearcherWindow.java    From amidst with GNU General Public License v3.0 5 votes vote down vote up
@CalledOnlyBy(AmidstThread.EDT)
private JFrame createFrame() {
	JFrame result = new JFrame("Seed Searcher");
	result.setIconImages(metadata.getIcons());
	result.getContentPane().setLayout(new MigLayout());
	result.add(new JLabel("Search Query:"), "growx, pushx, wrap");
	result.add(createScrollPane(searchQueryTextArea), "grow, push, wrap");
	result.add(new JLabel("World Type:"), "growx, pushx, wrap");
	result.add(worldTypeComboBox, "growx, pushx, wrap");
	result.add(searchContinuouslyCheckBox, "growx, pushx, wrap");
	result.add(searchButton, "pushx, wrap");
	result.setSize(800, 600);
	result.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	return result;
}
 
Example 5
Source File: LicenseWindow.java    From amidst with GNU General Public License v3.0 5 votes vote down vote up
private JFrame createFrame(JList<License> licenseList, JScrollPane scrollPane) {
	JFrame frame = new JFrame("Licenses");
	initContentPane(frame.getContentPane(), licenseList, scrollPane);
	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	frame.setIconImages(metadata.getIcons());
	frame.setSize(870, 550);
	frame.setVisible(true);
	return frame;
}
 
Example 6
Source File: SeedSearcherWindow.java    From amidst with GNU General Public License v3.0 5 votes vote down vote up
@CalledOnlyBy(AmidstThread.EDT)
private JFrame createFrame() {
	JFrame result = new JFrame("Seed Searcher");
	result.setIconImages(metadata.getIcons());
	result.getContentPane().setLayout(new MigLayout());
	result.add(new JLabel("Search Query:"), "growx, pushx, wrap");
	result.add(createScrollPane(searchQueryTextArea), "grow, push, wrap");
	result.add(new JLabel("World Type:"), "growx, pushx, wrap");
	result.add(worldTypeComboBox, "growx, pushx, wrap");
	result.add(searchContinuouslyCheckBox, "growx, pushx, wrap");
	result.add(searchButton, "pushx, wrap");
	result.setSize(800, 600);
	result.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	return result;
}
 
Example 7
Source File: TinkerTimeLauncher.java    From TinkerTime with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void run() {
	// Get App Icons
	ImageManager imageManager = new ImageManager();
	List<Image> appIcons = new ArrayList<Image>();
	appIcons.add(imageManager.getImage("icon/app/icon 128x128.png"));
	appIcons.add(imageManager.getImage("icon/app/icon 64x64.png"));
	appIcons.add(imageManager.getImage("icon/app/icon 32x32.png"));
	appIcons.add(imageManager.getImage("icon/app/icon 16x16.png"));

	// Hide Splash Screen so the JFrame does not hide when appearing
	SplashScreen s = SplashScreen.getSplashScreen();
	if (s != null){
		s.close();
	}

	// Initialize Frame
	JFrame frame = new JFrame(TinkerTimeLauncher.FULL_NAME);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setLayout(new BorderLayout());
	frame.setIconImages(appIcons);
	frame.setJMenuBar(menuBar);
	frame.add(toolBar, BorderLayout.NORTH);
	frame.add(modSelectorPanelController.getComponent(), BorderLayout.CENTER);
	frame.pack();
	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
	frame.toFront();
}
 
Example 8
Source File: WhiteRabbitMain.java    From WhiteRabbit with Apache License 2.0 5 votes vote down vote up
private void loadIcons(JFrame f) {
	List<Image> icons = new ArrayList<Image>();
	icons.add(loadIcon("WhiteRabbit16.png", f));
	icons.add(loadIcon("WhiteRabbit32.png", f));
	icons.add(loadIcon("WhiteRabbit48.png", f));
	icons.add(loadIcon("WhiteRabbit64.png", f));
	icons.add(loadIcon("WhiteRabbit128.png", f));
	icons.add(loadIcon("WhiteRabbit256.png", f));
	f.setIconImages(icons);
}
 
Example 9
Source File: SkinEditorMainGUI.java    From megamek with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes a number of things about this frame.
 */
private void initializeFrame() {
    frame = new JFrame(Messages.getString("ClientGUI.title")); //$NON-NLS-1$
    frame.setJMenuBar(menuBar);
    Rectangle virtualBounds = getVirtualBounds();
    int x, y, w, h;
    if (GUIPreferences.getInstance().getWindowSizeHeight() != 0) {
        x = GUIPreferences.getInstance().getWindowPosX();
        y = GUIPreferences.getInstance().getWindowPosY();
        w = GUIPreferences.getInstance().getWindowSizeWidth();
        h = GUIPreferences.getInstance().getWindowSizeHeight();
        if ((x < virtualBounds.getMinX())
                || ((x + w) > virtualBounds.getMaxX())) {
            x = 0;
        }
        if ((y < virtualBounds.getMinY())
                || ((y + h) > virtualBounds.getMaxY())) {
            y = 0;
        }
        if (w > virtualBounds.getWidth()) {
            w = (int) virtualBounds.getWidth();
        }
        if (h > virtualBounds.getHeight()) {
            h = (int) virtualBounds.getHeight();
        }
        frame.setLocation(x, y);
        frame.setSize(w, h);
    } else {
        frame.setSize(800, 600);
    }
    frame.setMinimumSize(new Dimension(640, 480));
    frame.setBackground(SystemColor.menu);
    frame.setForeground(SystemColor.menuText);
    List<Image> iconList = new ArrayList<Image>();
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16)
                    .toString()));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32)
                    .toString()));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48)
                    .toString()));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256)
                    .toString()));
    frame.setIconImages(iconList);

    mechW = new JDialog(frame, Messages.getString("ClientGUI.MechDisplay"), false);
    x = GUIPreferences.getInstance().getDisplayPosX();
    y = GUIPreferences.getInstance().getDisplayPosY();
    h = GUIPreferences.getInstance().getDisplaySizeHeight();
    w = GUIPreferences.getInstance().getDisplaySizeWidth();
    if ((x + w) > virtualBounds.getWidth()) {
        x = 0;
        w = Math.min(w, (int)virtualBounds.getWidth());
    }
    if ((y + h) > virtualBounds.getHeight()) {
        y = 0;
        h = Math.min(h, (int)virtualBounds.getHeight());
    }
    mechW.setLocation(x, y);
    mechW.setSize(w, h);
    mechW.setResizable(true);
    unitDisplay = new UnitDisplay(null);
    mechW.add(unitDisplay);
    mechW.setVisible(true);
    unitDisplay.displayEntity(testEntity);
}
 
Example 10
Source File: ClientGUI.java    From megamek with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes a number of things about this frame.
 */
private void initializeFrame() {
    frame = new JFrame(Messages.getString("ClientGUI.title")); //$NON-NLS-1$
    menuBar.setGame(client.getGame());
    frame.setJMenuBar(menuBar);
    Rectangle virtualBounds = getVirtualBounds();
    if (GUIPreferences.getInstance().getWindowSizeHeight() != 0) {
        int x = GUIPreferences.getInstance().getWindowPosX();
        int y = GUIPreferences.getInstance().getWindowPosY();
        int w = GUIPreferences.getInstance().getWindowSizeWidth();
        int h = GUIPreferences.getInstance().getWindowSizeHeight();
        if ((x < virtualBounds.getMinX()) || ((x + w) > virtualBounds.getMaxX())) {
            x = 0;
        }
        if ((y < virtualBounds.getMinY()) || ((y + h) > virtualBounds.getMaxY())) {
            y = 0;
        }
        if (w > virtualBounds.getWidth()) {
            w = (int) virtualBounds.getWidth();
        }
        if (h > virtualBounds.getHeight()) {
            h = (int) virtualBounds.getHeight();
        }
        frame.setLocation(x, y);
        frame.setSize(w, h);
    } else {
        frame.setSize(800, 600);
    }
    frame.setMinimumSize(new Dimension(640,480));
    frame.setBackground(SystemColor.menu);
    frame.setForeground(SystemColor.menuText);
    List<Image> iconList = new ArrayList<>();
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16).toString()
    ));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32).toString()
    ));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48).toString()
    ));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256).toString()
    ));
    frame.setIconImages(iconList);
}