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;
}
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();
}
}
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);
}
}
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();
}
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);
}
}
Aggregations