List of usage examples for javax.swing ImageIcon ImageIcon
public ImageIcon(byte[] imageData)
From source file:net.pms.newgui.Splash.java
/** * Show the splash screen before the application GUI starts. * <p>/* ww w .java 2s . com*/ * When the GUI started call the {@code .dispose()} to release all resources used by this * {@code Splash} class and return all memory they consume to the OS. * @return */ public Splash(PmsConfiguration config) { this.configuration = config; if (!configuration.isShowSplashScreen()) { return; } img = new ImageIcon(getClass().getResource("/resources/images/splash.png")); imglabel = new JLabel(img); imglabel.setBounds(0, 0, img.getIconWidth(), img.getIconHeight()); setSize(imglabel.getWidth(), imglabel.getHeight()); setUndecorated(true); setBackground(new Color(1.0f, 1.0f, 1.0f, 0.0f)); setLocationRelativeTo(null); setLayout(null); add(imglabel); imglabel.addMouseListener(this); if (System.getProperty("console") == null) { setVisible(true); } }
From source file:com.moneydance.modules.features.importlist.io.DeleteOneOperation.java
@Override public void showWarningAndExecute(final List<File> files) { final File file = files.iterator().next(); final String message = this.localizable.getConfirmationMessageDeleteOneFile(file.getName()); final Object confirmationLabel = new JLabel(message); final Image image = Helper.INSTANCE.getSettings().getIconImage(); Icon icon = null;//from w w w. j a v a 2 s .c o m if (image != null) { icon = new ImageIcon(image); } final Object[] options = { this.localizable.getOptionDeleteFile(), this.localizable.getOptionCancel() }; final int choice = JOptionPane.showOptionDialog(null, // no parent component confirmationLabel, null, // no title JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, icon, options, options[1]); if (choice == 0) { this.execute(files); } else { LOG.info(String.format("Canceled deleting file %s", file.getAbsoluteFile())); } }
From source file:view.statistics.IssueChart.java
/** * Creates new form IssueChart// ww w. j a v a 2 s. c om */ public IssueChart(Dimension d) throws FileNotFoundException, IOException { initComponents(); FileInputStream imgStream = null; File imgfile = new File("..\\BBMS\\src\\images\\drop.png"); imgStream = new FileInputStream(imgfile); BufferedImage bi = ImageIO.read(imgStream); ImageIcon myImg = new ImageIcon(bi); this.setFrameIcon(myImg); setTitle("Issue Chart"); setSize(d); }
From source file:AnotherBorderTest.java
public AnotherBorderTest() { setTitle("Border Test"); setSize(450, 450);//from ww w . j a va 2 s . c o m JPanel content = (JPanel) getContentPane(); content.setLayout(new GridLayout(6, 2, 3, 3)); JPanel p = new JPanel(); p.setBorder(new BevelBorder(BevelBorder.RAISED)); p.add(new JLabel("RAISED BevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new BevelBorder(BevelBorder.LOWERED)); p.add(new JLabel("LOWERED BevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new LineBorder(Color.black, 5)); p.add(new JLabel("Black LineBorder, thickness = 5")); content.add(p); p = new JPanel(); p.setBorder(new EmptyBorder(10, 10, 10, 10)); p.add(new JLabel("EmptyBorder with thickness of 10")); content.add(p); p = new JPanel(); p.setBorder(new EtchedBorder(EtchedBorder.RAISED)); p.add(new JLabel("RAISED EtchedBorder")); content.add(p); p = new JPanel(); p.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); p.add(new JLabel("LOWERED EtchedBorder")); content.add(p); p = new JPanel(); p.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED)); p.add(new JLabel("RAISED SoftBevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); p.add(new JLabel("LOWERED SoftBevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new MatteBorder(new ImageIcon("BALL.GIF"))); p.add(new JLabel("MatteBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new MatteBorder(new ImageIcon("java2sLogo.gif")), "Title String")); p.add(new JLabel("TitledBorder using MatteBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new LineBorder(Color.black, 5), "Title String")); p.add(new JLabel("TitledBorder using LineBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new EmptyBorder(10, 10, 10, 10), "Title String")); p.add(new JLabel("TitledBorder using EmptyBorder")); content.add(p); setVisible(true); }
From source file:org.jax.maanova.plot.SaveChartAction.java
/** * Constructor/*from ww w . j a va 2s. co m*/ */ public SaveChartAction() { super("Save Graph as Image ...", new ImageIcon(SaveChartAction.class.getResource("/images/action/export-image-16x16.png"))); this.setEnabled(false); }
From source file:com.mirth.connect.client.ui.LoginPanel.java
private LoginPanel() { initComponents();/* w w w . j a v a2 s . co m*/ jLabel2.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR); jLabel5.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR); setDefaultCloseOperation(EXIT_ON_CLOSE); setIconImage(new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/mirth_32_ico.png")) .getImage()); mirthCorpImage.setIcon(UIConstants.MIRTHCORP_LOGO); mirthCorpImage.setText(""); mirthCorpImage.setToolTipText(UIConstants.MIRTHCORP_TOOLTIP); mirthCorpImage.setCursor(new Cursor(Cursor.HAND_CURSOR)); mirthCorpImage.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { BareBonesBrowserLaunch.openURL(UIConstants.MIRTHCORP_URL); } }); mirthCorpImage1.setIcon(UIConstants.MIRTHCORP_LOGO); mirthCorpImage1.setText(""); mirthCorpImage1.setToolTipText(UIConstants.MIRTHCORP_TOOLTIP); mirthCorpImage1.setCursor(new Cursor(Cursor.HAND_CURSOR)); mirthCorpImage1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { BareBonesBrowserLaunch.openURL(UIConstants.MIRTHCORP_URL); } }); placeholderButton.setVisible(false); errorTextArea.setBackground(Color.WHITE); errorTextArea.setDisabledTextColor(Color.RED); }
From source file:MainClass.java
public ImageIcon getImage() { if (image == null) { image = new ImageIcon(imagePath); } return image; }
From source file:jshm.gui.GuiUtil.java
/** * This sets the default L&F as well as sets some icons */// w ww . j a v a2s . c om public static void init() { try { // Set the Look & Feel to match the current system UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } // http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingaJOptionPaneLookandFeel.htm UIManager.put("OptionPane.errorIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete.png"))); UIManager.put("OptionPane.informationIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/infoabout.png"))); UIManager.put("OptionPane.questionIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/help.png"))); UIManager.put("OptionPane.warningIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/pause.png"))); UIManager.put("OptionPane.yesIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/accept32.png"))); UIManager.put("OptionPane.noIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete32.png"))); float scale = Config.getFloat("font.scale"); if (1f != scale) { LOG.finest("setting ui font scale to + " + scale); Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource f = (FontUIResource) value; f = new FontUIResource(f.deriveFont(scale * f.getSize2D())); UIManager.put(key, f); } } } // hook into the wizard displayer System.setProperty("WizardDisplayer.default", "jshm.gui.wizards.displayer.WizardDisplayerImpl"); }
From source file:SystemColorChooserPanel.java
public Icon getLargeDisplayIcon() { return new ImageIcon("yourFile.gif"); }
From source file:de.kletterfreak98.xmass.ui.BMIChart.java
public BMIChart(String title, TimeSeries values) { super(title); setIconImage(// w ww. j av a2s . c o m new ImageIcon(getClass().getClassLoader().getResource("de/kletterfreak98/xmass/resources/fav.png")) .getImage()); // create a title... final String chartTitle = strings.getString("bmicourse"); final XYDataset dataset = new TimeSeriesCollection(values); final JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, strings.getString("date"), strings.getString("bmi"), dataset, false, true, false); final XYPlot plot = chart.getXYPlot(); plot.setDataset(1, new TimeSeriesCollection(values)); plot.mapDatasetToRangeAxis(1, 1); final XYItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); if (renderer instanceof StandardXYItemRenderer) { final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; rr.setShapesFilled(true); } final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.black); renderer.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); plot.setRenderer(1, renderer2); final DateAxis axis = (DateAxis) plot.getDomainAxis(); SimpleDateFormat sdf; if (Main.settings.getLang().equals(Locale.GERMANY)) { sdf = new SimpleDateFormat("dd.MM.yyyy"); } else { sdf = new SimpleDateFormat("MM/dd/yyyy"); } axis.setDateFormatOverride(sdf); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JPanel panel = new JPanel(); JButton close = new JButton(strings.getString("close")); close.setPreferredSize(new Dimension(close.getWidth(), 30)); close.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); panel.setLayout(new BorderLayout()); panel.add(chartPanel, BorderLayout.CENTER); panel.add(close, BorderLayout.SOUTH); panel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(panel); setUndecorated(true); }