Search in sources :

Example 56 with ImageIcon

use of javax.swing.ImageIcon in project OpenNotebook by jaltekruse.

the class ObjectPropertiesFrame method getIcon.

public static ImageIcon getIcon(String filename) {
    if (filename == null) {
        return null;
    }
    try {
        filename = "img/" + filename;
        BufferedImage image = ImageIO.read(ObjectPropertiesFrame.class.getClassLoader().getResourceAsStream(filename));
        return new ImageIcon(image);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        System.out.println("cannot find image: " + filename);
    }
    return null;
}
Also used : ImageIcon(javax.swing.ImageIcon) IOException(java.io.IOException) BufferedImage(java.awt.image.BufferedImage)

Example 57 with ImageIcon

use of javax.swing.ImageIcon in project jna by java-native-access.

the class AlphaMaskDemo2 method setImage.

private void setImage(final Image image) {
    final int w = image.getWidth(observer);
    final int h = image.getHeight(observer);
    if (w > 0 && h > 0) {
        frame.setIconImage(image);
        icon.setIcon(new ImageIcon(image));
        if (!alphaWindow.isVisible()) {
            alphaWindow.pack();
            alphaWindow.setVisible(true);
        } else {
            alphaWindow.setSize(alphaWindow.getPreferredSize());
        }
        icon.getParent().invalidate();
        icon.getParent().repaint();
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) Point(java.awt.Point)

Example 58 with ImageIcon

use of javax.swing.ImageIcon in project jna by java-native-access.

the class GhostedDragImageDemo method main.

public static void main(String[] args) {
    try {
        System.setProperty("sun.java2d.noddraw", "true");
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        JFrame f1 = new JFrame("Drag this");
        JFrame f2 = new JFrame("Over here");
        URL url = GhostedDragImageDemo.class.getResource("toucan.png");
        if (url == null)
            throw new RuntimeException("Icon not found");
        Icon icon = new ImageIcon(url);
        f1.getContentPane().add(new DragLabel(icon));
        JLabel label2 = new DragLabel(icon);
        f2.getContentPane().add(label2);
        f1.setLocation(100, 100);
        f1.pack();
        f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f2.setLocation(300, 100);
        f2.pack();
        label2.setIcon(null);
        f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f2.setVisible(true);
        f1.setVisible(true);
    } catch (Throwable t) {
        t.printStackTrace();
        System.exit(1);
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) JFrame(javax.swing.JFrame) JLabel(javax.swing.JLabel) Icon(javax.swing.Icon) ImageIcon(javax.swing.ImageIcon) URL(java.net.URL)

Example 59 with ImageIcon

use of javax.swing.ImageIcon in project screenbird by adamhub.

the class RecordFromHereSB method mouseExited.

public void mouseExited(MouseEvent e) {
    this.jLabel1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.jLabel1.setIcon(new ImageIcon(getClass().getResource(ResourceUtil.RECORD_FROM_HERE_NORMAL)));
    this.repaint();
}
Also used : ImageIcon(javax.swing.ImageIcon)

Example 60 with ImageIcon

use of javax.swing.ImageIcon in project screenbird by adamhub.

the class RecorderPanel method showRecordingState.

/**
     * Shows recorder panel in recording sate
     */
public void showRecordingState() {
    // Show recorder controls
    this.jfRecorderPanel.controlSetVisible(true);
    // Stop preview playback, if any
    if (this.scrubManager != null) {
        this.scrubManager.endPreviewVideo();
    }
    // Hide settings form
    if (jfSettings != null) {
        this.jfSettings.hideSettingsForm();
    }
    // Hide capture box
    if (this.captureBox != null) {
        this.setToggleStateCustomFullScreen(this.captureBox.getState(), false);
        this.captureBox.setDragBoxVisible(false);
    }
    this.jpUpload.setVisible(false);
    this.jpRecorderNonRec.setVisible(false);
    this.recorderPanelBG1.setVisible(true);
    this.jToggleButton1.setEnabled(false);
    this.jToggleButton2.setEnabled(false);
    this.jToggleButton3.setSelected(true);
    this.jLabel6.setForeground(new Color(148, 148, 148));
    this.jpRecorderRec.setVisible(false);
    jToggleButton3.setToolTipText("Stop");
    jToggleButton3.setEnabled(true);
    jToggleButton3.setIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_NORMAL)));
    jToggleButton3.setSelectedIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_PRESSED)));
    jToggleButton3.setDisabledIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_DISABLED)));
    jToggleButton3.setDisabledSelectedIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_DISABLED)));
    jToggleButton3.setRolloverIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_HOVER)));
    jToggleButton3.setRolloverSelectedIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_HOVER)));
    jToggleButton4.setEnabled(true);
    if (Settings.ENABLE_OOPS_FEATURE) {
        this.jfRecorderPanel.controlPack();
    } else {
        this.jpRecorderRec.setVisible(false);
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) Color(java.awt.Color)

Aggregations

ImageIcon (javax.swing.ImageIcon)427 JButton (javax.swing.JButton)109 ActionEvent (java.awt.event.ActionEvent)83 ActionListener (java.awt.event.ActionListener)70 JLabel (javax.swing.JLabel)67 Dimension (java.awt.Dimension)62 BufferedImage (java.awt.image.BufferedImage)51 JPanel (javax.swing.JPanel)48 Insets (java.awt.Insets)42 Image (java.awt.Image)31 BorderLayout (java.awt.BorderLayout)28 IOException (java.io.IOException)28 URL (java.net.URL)26 GridBagLayout (java.awt.GridBagLayout)23 JMenuItem (javax.swing.JMenuItem)23 Color (java.awt.Color)21 Point (java.awt.Point)21 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)20 JToggleButton (javax.swing.JToggleButton)20 JScrollPane (javax.swing.JScrollPane)19