Java Code Examples for javax.swing.ImageIcon

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project dawn-common, under directory /org.dawb.gda.extensions/src/org/dawb/gda/extensions/util/.

Source file: ImageThumbnailCreator.java

  20 
vote

static Image getImageSWT(File file){
  ImageIcon systemIcon=(ImageIcon)FileSystemView.getFileSystemView().getSystemIcon(file);
  java.awt.Image image=systemIcon.getImage();
  if (image instanceof BufferedImage) {
    return new Image(Display.getDefault(),convertToSWT((BufferedImage)image));
  }
  int width=image.getWidth(null);
  int height=image.getHeight(null);
  BufferedImage bufferedImage=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2d=bufferedImage.createGraphics();
  g2d.drawImage(image,0,0,null);
  g2d.dispose();
  return new Image(Display.getDefault(),convertToSWT(bufferedImage));
}
 

Example 2

From project freemind, under directory /freemind/freemind/controller/printpreview/.

Source file: PreviewDialog.java

  19 
vote

private JButton getButton(String name,String iconName,AbstractAction action){
  JButton result=null;
  ImageIcon icon=null;
  URL imageURL=getClass().getClassLoader().getResource("images/" + iconName);
  if (imageURL != null)   icon=new ImageIcon(imageURL);
  if (action != null) {
    if (icon != null)     action.putValue(Action.SMALL_ICON,new ImageIcon(imageURL));
    if (name != null)     action.putValue(Action.NAME,name);
    result=new JButton(action);
  }
 else   result=new JButton(name,icon);
  return result;
}
 

Example 3

From project gs-tool, under directory /src/org/graphstream/tool/gui/.

Source file: IconButton.java

  19 
vote

public static IconButton createIconButton(Type type,int size,String label,Action action){
  ImageIcon off, on, click;
  off=new ImageIcon(Resources.getImage(type.off,size,size,false));
  on=new ImageIcon(Resources.getImage(type.on,size,size,false));
  click=new ImageIcon(Resources.getImage(type.click,size,size,false));
  return new IconButton(action,off,on,click,label);
}
 

Example 4

From project Agot-Java, under directory /src/main/java/got/ui/.

Source file: MusteringDialog.java

  18 
vote

protected void createComponent(){
  MusterType[] types=new MusterType[]{MusterType.Knight,MusterType.FootMan,MusterType.Ship,MusterType.Upgrade};
  for (  MusterType type : types) {
    MusterButton musterButton=new MusterButton(type);
    ImageIcon icon=new ImageIcon(node.getImageLoader().getMusterImages().get(type));
    musterButton.setIcon(icon);
    btns.add(musterButton);
  }
  noBtn=new JButton();
  ImageIcon icon=new ImageIcon(Utility.loadImage("got/resource/muster/Cancel.png"));
  noBtn.setIcon(icon);
}
 

Example 5

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.

Source file: AddImageAction.java

  18 
vote

/** 
 * Returns the toolbar component of this action
 * @return component  the toolbar button
 */
@Override public Component getToolbarPresenter(){
  ImageIcon icon=new ImageIcon(getClass().getResource("btn_icon_add_image.png"));
  toolbarButton.setIcon(icon);
  toolbarButton.setText(this.getName());
  return toolbarButton;
}
 

Example 6

From project BMach, under directory /src/jsyntaxpane/actions/.

Source file: DefaultSyntaxAction.java

  18 
vote

/** 
 * Sets the Large Icon for this action from given url
 * @param url
 */
public final void setLargeIcon(String url){
  URL loc=this.getClass().getResource(LARGE_ICONS_LOC_PREFIX + url);
  if (loc != null) {
    ImageIcon i=new ImageIcon(loc);
    putValue(LARGE_ICON_KEY,i);
  }
}
 

Example 7

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/figure/support/.

Source file: ImageSymbol.java

  18 
vote

private static BufferedImage loadBufferedImage(String imageResourcePath,Class callerClass){
  URL resource=callerClass.getResource(imageResourcePath);
  Assert.argument(resource != null,"imageResourcePath: resource not found: " + imageResourcePath);
  ImageIcon imageIcon=new ImageIcon(resource);
  BufferedImage image=new BufferedImage(imageIcon.getIconWidth(),imageIcon.getIconHeight(),BufferedImage.TYPE_INT_ARGB);
  Graphics2D graphics=image.createGraphics();
  graphics.drawImage(imageIcon.getImage(),0,0,BGCOLOR,imageIcon.getImageObserver());
  graphics.dispose();
  return image;
}
 

Example 8

From project Clotho-Core, under directory /ClothoProject/ClothoCore/src/org/clothocore/api/data/.

Source file: NucSeq.java

  18 
vote

/** 
 * This is the general method called to perform all biofafety checks on a DNA sequence.  Called from part, vector, and Feature factory methods.
 * @return the biosafety level of this NucSeq
 */
Short performBiosafetyCheck(){
  System.out.println("performBiosafetyCheck triggered");
  short rg=-1;
  rg=getBSLfromServer();
  if (rg == 4) {
    ImageIcon bslicon=ImageUtilities.loadImageIcon("org/clothocore/images/BIOHAZARD.png",false);
    JOptionPane.showMessageDialog(null,"You have executed a risk group check on a sequence that came back\n" + "as Risk Group 4.\nSuch materials could be highly dangerous!\n" + "You should examine your design closer before proceeding.","Risk Group 4 material!",JOptionPane.INFORMATION_MESSAGE,bslicon);
  }
  if (rg == 5) {
    ImageIcon bslicon=ImageUtilities.loadImageIcon("org/clothocore/images/BIOHAZARD.png",false);
    JOptionPane.showMessageDialog(null,"You have executed a risk group check on a sequence that came back\n" + "as being highly similar to a select agent.\nSuch materials could be highly dangerous and potential illegal!\n" + "You should examine your design closer before proceeding.","Select Agent detected!",JOptionPane.INFORMATION_MESSAGE,bslicon);
  }
  return rg;
}
 

Example 9

From project dawn-isencia, under directory /com.isencia.passerelle.engine/src/main/java/com/isencia/passerelle/actor/gui/graph/.

Source file: ModelGraphPanel.java

  18 
vote

public ZoomInAction(String description){
  super(description);
  URL img=getClass().getResource("/ptolemy/vergil/basic/img/zoomin.gif");
  if (img != null) {
    ImageIcon icon=new ImageIcon(img);
    putValue(GUIUtilities.LARGE_ICON,icon);
  }
  putValue("tooltip",description + " (Ctrl+Shift+=)");
  putValue(GUIUtilities.ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS,Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK));
}
 

Example 10

From project Enterprise-Application-Samples, under directory /CCA/PushApp/src/eclserver/.

Source file: NewJFrame.java

  18 
vote

/** 
 * Load our own "address book" icon into our frame window.
 */
private void loadFrameIcon(){
  URL imgUrl=null;
  ImageIcon imgIcon=null;
  imgUrl=NewJFrame.class.getResource("images/Burn.png");
  imgIcon=new ImageIcon(imgUrl);
  Image img=imgIcon.getImage();
  this.setIconImage(img);
}
 

Example 11

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/bom/.

Source file: BOMTreeCellRenderer.java

  18 
vote

protected ImageIcon getIcon(Object value){
  DefaultMutableTreeNode node=(DefaultMutableTreeNode)value;
  ImageIcon icon=null;
  if (node.isLeaf()) {
    icon=Env.getImageIcon("Product10.gif");
  }
  return icon;
}
 

Example 12

From project jgraphx, under directory /src/com/mxgraph/swing/handler/.

Source file: mxGraphTransferHandler.java

  18 
vote

/** 
 * (non-Javadoc)
 * @see javax.swing.TransferHandler#createTransferable(javax.swing.JComponent)
 */
public Transferable createTransferable(JComponent c){
  if (c instanceof mxGraphComponent) {
    mxGraphComponent graphComponent=(mxGraphComponent)c;
    mxGraph graph=graphComponent.getGraph();
    if (!graph.isSelectionEmpty()) {
      originalCells=graphComponent.getExportableCells(graph.getSelectionCells());
      if (originalCells.length > 0) {
        ImageIcon icon=(transferImageEnabled) ? createTransferableImage(graphComponent,originalCells) : null;
        return createGraphTransferable(graphComponent,originalCells,icon);
      }
    }
  }
  return null;
}
 

Example 13

From project Android-DB-Editor, under directory /src/com/troido/dbeditor/.

Source file: CellRenderer.java

  17 
vote

@Override public Component getTreeCellRendererComponent(JTree tree,Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
  JLabel label=new JLabel();
  TreeObject obj=(TreeObject)((DefaultMutableTreeNode)value).getUserObject();
  label.setIcon(new ImageIcon(getClass().getResource("/" + obj.getIconPath())));
  label.setText(obj.getName());
  return label;
}
 

Example 14

From project Briss, under directory /src/main/java/at/laborg/briss/.

Source file: BrissGUI.java

  17 
vote

private void loadIcon(){
  InputStream is=getClass().getResourceAsStream(RES_ICON_PATH);
  byte[] buf=new byte[1024 * 100];
  try {
    int cnt=is.read(buf);
    byte[] imgBuf=Arrays.copyOf(buf,cnt);
    setIconImage(new ImageIcon(imgBuf).getImage());
  }
 catch (  IOException e) {
  }
}
 

Example 15

From project Calendar-Application, under directory /com/toedter/calendar/demo/.

Source file: JCalendarDemo.java

  17 
vote

/** 
 * Initializes the applet.
 */
public void init(){
  initializeLookAndFeels();
  beans=new JComponent[6];
  beans[0]=new DateChooserPanel();
  beans[1]=new JCalendar();
  beans[2]=new JDayChooser();
  beans[3]=new JMonthChooser();
  beans[4]=new JYearChooser();
  beans[5]=new JSpinField();
  ((JSpinField)beans[5]).adjustWidthToMaximumValue();
  ((JYearChooser)beans[4]).setMaximum(((JSpinField)beans[5]).getMaximum());
  ((JYearChooser)beans[4]).adjustWidthToMaximumValue();
  getContentPane().setLayout(new BorderLayout());
  setJMenuBar(createMenuBar());
  toolBar=createToolBar();
  getContentPane().add(toolBar,BorderLayout.NORTH);
  splitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  splitPane.setBorder(BorderFactory.createLineBorder(Color.GRAY));
  splitPane.setDividerSize(4);
  splitPane.setDividerLocation(240);
  BasicSplitPaneDivider divider=((BasicSplitPaneUI)splitPane.getUI()).getDivider();
  if (divider != null) {
    divider.setBorder(null);
  }
  propertyPanel=new JPanel();
  componentPanel=new JPanel();
  URL iconURL=beans[0].getClass().getResource("images/" + beans[0].getName() + "Color16.gif");
  ImageIcon icon=new ImageIcon(iconURL);
  propertyTitlePanel=new JTitlePanel("Properties",null,propertyPanel,BorderFactory.createEmptyBorder(4,4,4,4));
  componentTitlePanel=new JTitlePanel("Component",icon,componentPanel,BorderFactory.createEmptyBorder(4,4,0,4));
  splitPane.setBottomComponent(propertyTitlePanel);
  splitPane.setTopComponent(componentTitlePanel);
  installBean(beans[0]);
  getContentPane().add(splitPane,BorderLayout.CENTER);
}
 

Example 16

From project codjo-control, under directory /codjo-control-gui/src/main/java/net/codjo/control/gui/plugin/.

Source file: ControlGuiPlugin.java

  17 
vote

public ControlGuiPlugin(MadConnectionPlugin madConnectionPlugin,WorkflowGuiPlugin workflowGuiPlugin){
  this.madConnectionPlugin=madConnectionPlugin;
  this.mainClass=ControlGuiPlugin.class;
  workflowGuiPlugin.getConfiguration().setTaskManagerJobIcon(ControlJobRequest.CONTROL_REQUEST_TYPE,new ImageIcon(getClass().getResource("/images/job.control.png")));
  workflowGuiPlugin.getConfiguration().setTaskManagerJobIcon(TransferJobRequest.QUARANTINE_TRANSFER_TYPE,new ImageIcon(getClass().getResource("/images/job.quarantine-transfer.png")));
}
 

Example 17

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/plugin/.

Source file: DataProcessGuiPlugin.java

  17 
vote

private static void initIcons(){
  UIManager.put("dataprocess.exit",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/exit.gif")));
  UIManager.put("dataprocess.alpha_sort",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/alpha_mode.gif")));
  UIManager.put("dataprocess.text",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/text.gif")));
  UIManager.put("dataprocess.execute",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/Manager.gif")));
  UIManager.put("dataprocess.configure",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/configure.gif")));
  UIManager.put("dataprocess.add",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/include.png")));
  UIManager.put("dataprocess.add2",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/Add2.gif")));
  UIManager.put("dataprocess.remove",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/exclude.png")));
  UIManager.put("dataprocess.copy",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/Copy.gif")));
  UIManager.put("dataprocess.edit",new ImageIcon(DataProcessGuiPlugin.class.getResource("/images/edit.gif")));
}
 

Example 18

From project cowgraph, under directory /CowGraph/CowGraphVisualEditor/src/zbeans/cowgraph/visual/editor/actions/.

Source file: EditAction.java

  17 
vote

public EditAction(Lookup lookup){
  super(Bundle.CTL_EditAction(),new ImageIcon("zbeans/cowgraph/visual/editor/new_icon.png"));
  this.result=lookup.lookupResult(CowGraphVersion.class);
  this.result.addLookupListener(this);
  this.resultChanged(new LookupEvent(result));
}
 

Example 19

From project des, under directory /daemon/lib/apache-log4j-1.2.16/contribs/SvenReimers/gui/.

Source file: TextPaneAppender.java

  17 
vote

private void createIcons(){
  Priority prio[]=Priority.getAllPossiblePriorities();
  icons=new Hashtable();
  for (int i=0; i < prio.length; i++) {
    if (prio[i].equals(Priority.FATAL))     icons.put(prio[i],new ImageIcon(loadIcon("icons/RedFlag.gif")));
    if (prio[i].equals(Priority.ERROR))     icons.put(prio[i],new ImageIcon(loadIcon("icons/RedFlag.gif")));
    if (prio[i].equals(Priority.WARN))     icons.put(prio[i],new ImageIcon(loadIcon("icons/BlueFlag.gif")));
    if (prio[i].equals(Priority.INFO))     icons.put(prio[i],new ImageIcon(loadIcon("icons/GreenFlag.gif")));
    if (prio[i].equals(Priority.DEBUG))     icons.put(prio[i],new ImageIcon(loadIcon("icons/GreenFlag.gif")));
  }
}
 

Example 20

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/app/.

Source file: DroolsPlannerExamplesApp.java

  17 
vote

private JButton createExampleButton(final String title,final String description,String iconResource,final Runnable runnable){
  ImageIcon icon=iconResource == null ? null : new ImageIcon(getClass().getResource(iconResource));
  JButton button=new JButton(new AbstractAction(title,icon){
    public void actionPerformed(    ActionEvent e){
      runnable.run();
    }
  }
);
  button.setHorizontalTextPosition(JButton.CENTER);
  button.setVerticalTextPosition(JButton.BOTTOM);
  button.addMouseListener(new MouseAdapter(){
    public void mouseEntered(    MouseEvent e){
      descriptionTextArea.setText(description);
    }
    public void mouseExited(    MouseEvent e){
      descriptionTextArea.setText("");
    }
  }
);
  return button;
}
 

Example 21

From project drugis-common, under directory /common-lib/src/main/java/org/drugis/common/.

Source file: ImageLoader.java

  17 
vote

public ImageIcon getIcon(String name){
  if (d_icons.containsKey(name)) {
    return d_icons.get(name);
  }
 else {
    java.net.URL imgURL=ImageLoader.class.getResource(deriveGfxPath(name));
    if (imgURL == null) {
      System.err.println("Error loading image " + deriveGfxPath(name));
      return null;
    }
    ImageIcon icon=new ImageIcon(imgURL);
    d_icons.put(name,icon);
    return icon;
  }
}
 

Example 22

From project e4-rendering, under directory /com.toedter.e4.demo.contacts.swing/src/com/toedter/e4/demo/contacts/swing/views/.

Source file: DetailsView.java

  17 
vote

@Inject public void setSelection(@Optional final Contact contact){
  if (contact != null) {
    titleField.setText(contact.getTitle());
    nameField.setText(contact.getFirstName() + " " + contact.getLastName());
    companyField.setText(contact.getCompany());
    jobTitleField.setText(contact.getJobTitle());
    noteField.setText(contact.getNote());
    streetField.setText(contact.getStreet());
    cityField.setText(contact.getCity());
    zipField.setText(contact.getZip());
    countryField.setText(contact.getCountry());
    phoneField.setText(contact.getPhone());
    mobileField.setText(contact.getMobile());
    emailField.setText(contact.getEmail());
    webSiteField.setText(contact.getWebPage());
    String jpegString=contact.getJpegString();
    byte[] imageBytes=Base64.decode(jpegString.getBytes());
    ImageIcon icon=new ImageIcon(imageBytes);
    imageLabel.setIcon(icon);
  }
}
 

Example 23

From project echo2, under directory /src/webcontainer/java/nextapp/echo2/webcontainer/image/.

Source file: ImageToBufferedImage.java

  17 
vote

/** 
 * Converts an <code>Image</code> to a <code>BufferedImage</code>. If the image is already a <code>BufferedImage</code>, the original is returned.
 * @param image the image to convert
 * @return the image as a <code>BufferedImage</code>
 */
static BufferedImage toBufferedImage(Image image){
  if (image instanceof BufferedImage) {
    return (BufferedImage)image;
  }
  image=new ImageIcon(image).getImage();
  int type=hasAlpha(image) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
  BufferedImage bufferedImage=new BufferedImage(image.getWidth(null),image.getHeight(null),type);
  Graphics g=bufferedImage.createGraphics();
  g.drawImage(image,0,0,null);
  g.dispose();
  return bufferedImage;
}
 

Example 24

From project echo3, under directory /src/server-java/webcontainer/nextapp/echo/webcontainer/util/.

Source file: PngEncoder.java

  17 
vote

/** 
 * Converts an <code>Image</code> to a <code>BufferedImage</code>. If the image is already a <code>BufferedImage</code>, the original is returned.
 * @param image the image to convert
 * @return the image as a <code>BufferedImage</code>
 */
static BufferedImage toBufferedImage(Image image){
  if (image instanceof BufferedImage) {
    return (BufferedImage)image;
  }
  image=new ImageIcon(image).getImage();
  int type=hasAlpha(image) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
  BufferedImage bufferedImage=new BufferedImage(image.getWidth(null),image.getHeight(null),type);
  Graphics g=bufferedImage.createGraphics();
  g.drawImage(image,0,0,null);
  g.dispose();
  return bufferedImage;
}
 

Example 25

From project eclim, under directory /org.eclim.installer/java/org/eclim/installer/step/.

Source file: EclipsePluginsStep.java

  17 
vote

private void setMessage(String message){
  if (errorIcon == null) {
    errorIcon=new ImageIcon(Installer.getImage("form.error.icon"));
  }
  if (message != null) {
    messageLabel.setIcon(errorIcon);
    messageLabel.setText(message);
  }
 else {
    messageLabel.setIcon(null);
    messageLabel.setText(null);
  }
}
 

Example 26

From project en4j, under directory /NBPlatformApp/NoteContentViewModule/src/main/java/com/rubenlaguna/en4j/NoteContentViewModule/.

Source file: ENMLReplacedElementFactory.java

  17 
vote

private ReplacedElement loadImage(LayoutContext context,String hash){
  ReplacedElement toReturn=null;
  InputStream is=getImage(hash);
  Image image=null;
  if (is == null) {
    return brokenImage(context,100,100);
  }
  try {
    image=ImageIO.read(is);
  }
 catch (  IOException e) {
    LOG.log(Level.WARNING,"exception caught:",e);
  }
 finally {
    try {
      is.close();
    }
 catch (    IOException e) {
    }
  }
  if (image == null) {
    return brokenImage(context,100,100);
  }
  ImageIcon icon=new ImageIcon(image);
  JLabel cc=new JLabel(icon);
  cc.setSize(cc.getPreferredSize());
  FSCanvas canvas=context.getCanvas();
  if (canvas instanceof JComponent) {
    ((JComponent)canvas).add(cc);
  }
  toReturn=new SwingReplacedElement(cc){
    public boolean isRequiresInteractivePaint(){
      return false;
    }
  }
;
  return toReturn;
}
 

Example 27

From project entando-core-engine, under directory /src/main/java/com/agiletec/plugins/jacms/aps/system/services/resource/model/.

Source file: ImageResource.java

  17 
vote

private void saveResizedInstances(ResourceDataBean bean,String baseDiskFolder,String masterFilePath) throws ApsSystemException {
  try {
    String mimeType=bean.getMimeType();
    Map<Integer,ImageResourceDimension> dimensions=this.getImageDimensionReader().getImageDimensions();
    Iterator<ImageResourceDimension> iterDimensions=dimensions.values().iterator();
    while (iterDimensions.hasNext()) {
      ImageResourceDimension dimension=iterDimensions.next();
      if (!this.isImageMagickEnabled()) {
        ImageIcon imageIcon=new ImageIcon(masterFilePath);
        this.saveResizedImage(bean,imageIcon,dimension,mimeType,baseDiskFolder);
      }
 else {
        this.saveResizedImage(bean,dimension,mimeType,baseDiskFolder);
      }
    }
  }
 catch (  Throwable t) {
    ApsSystemUtils.logThrowable(t,this,"saveResizedInstances");
    throw new ApsSystemException("Error saving resized image resource instances",t);
  }
}
 

Example 28

From project Euclidean-Pattern-Generator, under directory /src/com/hisschemoller/sequencer/view/components/.

Source file: JToggleButtonForPanel.java

  17 
vote

/** 
 * Returns an ImageIcon, or null if the path was invalid.
 */
private static ImageIcon createImageIcon(String path,String description){
  URL imgURL=JToggleButtonForPanel.class.getClass().getResource(path);
  if (imgURL != null) {
    return new ImageIcon(imgURL,description);
  }
 else {
    System.err.println("Couldn't find file: " + path);
    return null;
  }
}
 

Example 29

From project formic, under directory /src/java/org/formic/util/dialog/gui/.

Source file: GuiDialogs.java

  17 
vote

/** 
 * Sets the resources for the error dialogs.
 * @param bundle The ResourceBundle.
 */
public static void setBundle(ResourceBundle bundle){
  if (bundle != null) {
    RESOURCES=bundle;
    GuiErrorDialog.setBundle(bundle);
    WARNING=new ImageIcon(getImage(bundle,"warning.dialog.image"));
    INFO=new ImageIcon(getImage(bundle,"info.dialog.image"));
    CONFIRM=new ImageIcon(getImage(bundle,"confirm.dialog.image"));
  }
}
 

Example 30

From project gitblit, under directory /src/com/gitblit/client/.

Source file: EditRepositoryDialog.java

  17 
vote

public EditRepositoryDialog(int protocolVersion,RepositoryModel aRepository){
  super();
  this.repositoryName=aRepository.name;
  this.repository=new RepositoryModel();
  this.repositoryNames=new HashSet<String>();
  this.isCreate=false;
  initialize(protocolVersion,aRepository);
  setModal(true);
  setResizable(false);
  setTitle(Translation.get("gb.edit") + ": " + aRepository.name);
  setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());
}
 

Example 31

From project glg2d, under directory /src/test/java/glg2d/.

Source file: UIDemo.java

  17 
vote

Icon getIcon(String name){
  try {
    InputStream str=UIDemo.class.getClassLoader().getResourceAsStream(name + ".png");
    return new ImageIcon(ImageIO.read(str));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
 

Example 32

From project Gmote, under directory /gmoteserver/src/org/gmote/server/.

Source file: GmoteServerUiMac.java

  17 
vote

void initializeUi(){
  JMenuItem item;
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (Integer.parseInt(System.getProperty("java.version").substring(2,3)) >= 5)   System.setProperty("javax.swing.adjustPopupLocationToFit","false");
  popupMenu=new JPopupMenu("Gmote Menu");
  addMediaPlayerControls();
  JMenu settingsMenu=new JMenu("Settings");
  popupMenu.add(settingsMenu);
  item=new JMenuItem("Change password");
  item.addActionListener(settingsListener);
  settingsMenu.add(item);
  item=new JMenuItem("Change media paths");
  item.addActionListener(mediaPathListener);
  settingsMenu.add(item);
  JMenu helpMenu=new JMenu("Help");
  popupMenu.add(helpMenu);
  item=new JMenuItem("Show local ip address");
  item.addActionListener(ipAddressListener);
  helpMenu.add(item);
  item=new JMenuItem("Show settings and logs folder");
  item.addActionListener(logFolderListener);
  helpMenu.add(item);
  item=new JMenuItem("Connection Help");
  item.addActionListener(helpListener);
  helpMenu.add(item);
  popupMenu.addSeparator();
  item=new JMenuItem("Quit");
  item.addActionListener(exitListener);
  popupMenu.add(item);
  ImageIcon i=new ImageIcon(GmoteServerUiMac.class.getResource("/res/gmote_icon_s.png"));
  trayIcon=new TrayIcon(i,"Gmote",popupMenu);
  trayIcon.setIconAutoSize(true);
  tray.addTrayIcon(trayIcon);
}
 

Example 33

From project hudsontrayapp-plugin, under directory /client-common/src/main/java/org/hudson/trayapp/gui/.

Source file: ConfigurationPanel.java

  17 
vote

/** 
 * This method initializes actionTabbedPane	
 * @return javax.swing.JTabbedPane	
 */
private JTabbedPane getActionTabbedPane(){
  if (actionTabbedPane == null) {
    actionTabbedPane=new JTabbedPane();
    actionTabbedPane.addTab("->",new ImageIcon(getClass().getResource("/org/hudson/trayapp/gui/icons/16x16/red.gif")),getRedToActionPanel(),"Red to anything actions");
    actionTabbedPane.addTab("->",new ImageIcon(getClass().getResource("/org/hudson/trayapp/gui/icons/16x16/yellow.gif")),getYellowToActionPanel(),"Yellow to anything actions");
    actionTabbedPane.addTab("->",new ImageIcon(getClass().getResource("/org/hudson/trayapp/gui/icons/16x16/blue.gif")),getBlueToActionPanel(),"Blue to anything actions");
    actionTabbedPane.addTab("->",new ImageIcon(getClass().getResource("/org/hudson/trayapp/gui/icons/16x16/grey.gif")),getGreyToActionPanel(),"Grey to anything actions");
  }
  return actionTabbedPane;
}
 

Example 34

From project huiswerk, under directory /print/zxing-1.6/javase/src/com/google/zxing/client/j2se/.

Source file: GUIRunner.java

  17 
vote

private void chooseImage() throws MalformedURLException {
  JFileChooser fileChooser=new JFileChooser();
  fileChooser.showOpenDialog(this);
  File file=fileChooser.getSelectedFile();
  Icon imageIcon=new ImageIcon(file.toURI().toURL());
  setSize(imageIcon.getIconWidth(),imageIcon.getIconHeight() + 100);
  imageLabel.setIcon(imageIcon);
  String decodeText=getDecodeText(file);
  textArea.setText(decodeText);
}
 

Example 35

From project imageflow, under directory /src/de/danielsenff/imageflow/gui/.

Source file: IFTreeCellRenderer.java

  17 
vote

@Override public Component getTreeCellRendererComponent(final JTree tree,final Object value,final boolean sel,final boolean expanded,final boolean isLeaf,final int row,final boolean hasFocus){
  ToolTipManager.sharedInstance().registerComponent(tree);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  if (value instanceof UnitDelegate && isLeaf) {
    final UnitDelegate unitDelegate=(UnitDelegate)value;
    icon=new ImageIcon(drawIcon(unitDelegate.getColor(),16,16));
    this.setLeafIcon(icon);
    this.setToolTipText(unitDelegate.getToolTipText());
  }
 else {
    this.setToolTipText(null);
  }
  return super.getTreeCellRendererComponent(tree,value,sel,expanded,isLeaf,row,hasFocus);
}
 

Example 36

From project JaamSim, under directory /com/sandwell/JavaSimulation3D/.

Source file: GUIFrame.java

  17 
vote

public ViewButton(String iconLocation,String description,int viewCode){
  super(new ImageIcon(GUIFrame.class.getResource(iconLocation)));
  this.setToolTipText(description);
  this.setMargin(new Insets(0,0,0,0));
  this.setEnabled(false);
  this.viewCode=viewCode;
  this.addActionListener(this);
}
 

Example 37

From project jAPS2, under directory /src/com/agiletec/plugins/jacms/aps/system/services/resource/model/.

Source file: ImageResource.java

  17 
vote

private void saveResizedInstances(ResourceDataBean bean,String baseDiskFolder,String masterFilePath) throws ApsSystemException {
  try {
    String mimeType=bean.getMimeType();
    Map<Integer,ImageResourceDimension> dimensions=this.getImageDimensionReader().getImageDimensions();
    Iterator<ImageResourceDimension> iterDimensions=dimensions.values().iterator();
    if (!this.isImageMagickEnabled()) {
      ImageIcon imageIcon=new ImageIcon(masterFilePath);
      while (iterDimensions.hasNext()) {
        ImageResourceDimension dimension=iterDimensions.next();
        this.saveResizedImage(bean,imageIcon,dimension,mimeType,baseDiskFolder);
      }
    }
 else {
      while (iterDimensions.hasNext()) {
        ImageResourceDimension dimension=iterDimensions.next();
        this.saveResizedImage(bean,dimension,mimeType,baseDiskFolder);
      }
    }
  }
 catch (  Throwable t) {
    ApsSystemUtils.logThrowable(t,this,"saveResizedInstances");
    throw new ApsSystemException("Error saving resized image resource instances",t);
  }
}
 

Example 38

From project jCAE, under directory /jcae/core/src/org/jcae/netbeans/viewer3d/actions/.

Source file: ChangeCameraOrientation.java

  17 
vote

public ChangeCameraOrientation(String label,String icon,CameraManager.Orientation orientation){
  label=label + " view";
  putValue(Action.NAME,label);
  putValue(Action.SHORT_DESCRIPTION,label);
  putValue(SMALL_ICON,new ImageIcon(ChangeCameraOrientation.class.getResource(icon)));
  setIcon(new ImageIcon(ChangeCameraOrientation.class.getResource(icon)));
  this.orientation=orientation;
}
 

Example 39

From project jchempaint, under directory /src/main/org/openscience/jchempaint/dialog/.

Source file: AboutDialog.java

  17 
vote

public void doInit(){
  String version=JCPPropertyHandler.getInstance(true).getVersion();
  String s1="JChemPaint " + version + "\n";
  s1+=GT._("An open-source editor for 2D chemical structures.");
  String s2=GT._("An OpenScience project.") + "\n";
  s2+=GT._("See 'http://jchempaint.github.com' for more information.");
  getContentPane().setLayout(new BorderLayout());
  getContentPane().setBackground(Color.white);
  JLabel label1=new JLabel();
  try {
    JCPPropertyHandler jcpph=JCPPropertyHandler.getInstance(true);
    URL url=jcpph.getResource("jcplogo" + JCPAction.imageSuffix);
    ImageIcon icon=new ImageIcon(url);
    label1=new JLabel(icon);
  }
 catch (  Exception exception) {
    logger.error("Cannot add JCP logo: " + exception.getMessage());
    logger.debug(exception);
  }
  label1.setBackground(Color.white);
  Border lb=BorderFactory.createLineBorder(Color.white,5);
  JTextArea jtf1=new JTextArea(s1);
  jtf1.setBorder(lb);
  jtf1.setEditable(false);
  JTextArea jtf2=new JTextArea(s2);
  jtf2.setEditable(false);
  jtf2.setBorder(lb);
  getContentPane().add("Center",label1);
  getContentPane().add("North",jtf1);
  getContentPane().add("South",jtf2);
  pack();
  setVisible(true);
}
 

Example 40

From project jlac, under directory /src/org/sump/analyzer/.

Source file: MainWindow.java

  17 
vote

/** 
 * Default constructor.
 */
public MainWindow(){
  super(APP_NAME);
  this.setIconImage((new ImageIcon("org/sump/analyzer/icons/la.png")).getImage());
  this.addWindowListener(this);
  this.classpath=new ClassPath();
  this.project=new Project(this.classpath);
  this.controllers=this.classpath.controllers();
  this.tools=this.classpath.tools(this);
  this.diagram=this.classpath.getDiagram();
  this.diagram.addStatusChangeListener(this);
}
 

Example 41

From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/event/.

Source file: EventView.java

  16 
vote

/** 
 * Creates a new EventView object.
 */
public EventView(){
  allIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "all.png"));
  finestIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "0-finest.png"));
  debugIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "1-debug.png"));
  fineIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "2-fine.png"));
  configIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "3-config.png"));
  infoIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "4-info.png"));
  warnIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "5-warn.png"));
  errorIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "6-error.png"));
  fatalIcon=new ImageIcon(getClass().getResource(RES_PREFIX + "7-fatal.png"));
  htmlDoc=new HTMLDocument();
  htmlKit=new HTMLEditorKit();
  setDocument(htmlDoc);
  setEditorKit(htmlKit);
  setContentType("text/html");
  setEditable(false);
  setOpaque(false);
}
 

Example 42

From project codjo-standalone-common, under directory /src/main/java/net/codjo/utils/sql/.

Source file: TableRendererSorter.java

  16 
vote

/** 
 * Overview. <p> Description </p>
 */
private final void initCustomHeaderRenderer(){
  java.net.URL url;
  url=getClass().getResource("Ascending.gif");
  if (url != null) {
    ascendingIcon=new ImageIcon(Toolkit.getDefaultToolkit().createImage(url));
  }
 else {
    ascendingIcon=null;
  }
  url=getClass().getResource("Descending.gif");
  if (url != null) {
    descendingIcon=new ImageIcon(Toolkit.getDefaultToolkit().createImage(url));
  }
 else {
    descendingIcon=null;
  }
  Renderer=new JLabel();
  Renderer.setOpaque(true);
  Renderer.setHorizontalAlignment(SwingConstants.CENTER);
  Renderer.setHorizontalTextPosition(SwingConstants.RIGHT);
  Renderer.setVerticalTextPosition(SwingConstants.CENTER);
  Renderer.setBorder(new javax.swing.border.EtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
}
 

Example 43

From project GraphWalker, under directory /src/main/java/org/graphwalker/GUI/.

Source file: App.java

  16 
vote

private JButton makeNavigationButton(String imageName,String actionCommand,String toolTipText,String altText,boolean enabled){
  String imgLocation="resources/icons/" + imageName + ".png";
  URL imageURL=App.class.getResource(imgLocation);
  JButton button=new JButton();
  button.setActionCommand(actionCommand);
  button.setToolTipText(toolTipText);
  button.addActionListener(this);
  button.setEnabled(enabled);
  if (imageURL != null) {
    button.setIcon(new ImageIcon(imageURL,altText));
  }
 else {
    button.setText(altText);
    logger.error("Resource not found: " + imgLocation);
  }
  return button;
}
 

Example 44

From project alg-vis, under directory /src/algvis/gui/.

Source file: Buttons.java

  15 
vote

private JButton createButton(String alt,String path){
  java.net.URL imgURL=getClass().getResource(path);
  if (imgURL != null) {
    return new JButton(new ImageIcon(imgURL));
  }
 else {
    System.err.println("Couldn't find file: " + path);
    return new JButton(alt);
  }
}
 

Example 45

From project charts4j, under directory /src/test/java/com/googlecode/charts4j/example/.

Source file: SwingExample.java

  15 
vote

/** 
 * Display the chart in a swing window.
 * @param urlString the url string to display.
 * @throws IOException
 */
private static void displayUrlString(final String urlString) throws IOException {
  JFrame frame=new JFrame();
  JLabel label=new JLabel(new ImageIcon(ImageIO.read(new URL(urlString))));
  frame.getContentPane().add(label,BorderLayout.CENTER);
  frame.pack();
  frame.setVisible(true);
}
 

Example 46

From project Holo-Edit, under directory /holoedit/.

Source file: HoloEdit.java

  15 
vote

private static void splash(){
  Thread t=new Thread(){
    public void run(){
      ImageIcon holoSplash=new ImageIcon("./images/Holo-Edit.gif");
      int h=holoSplash.getIconHeight();
      int w=holoSplash.getIconWidth();
      JButton b=new JButton(holoSplash);
      b.setSize(w,h);
      b.setVisible(true);
      b.setBorder(null);
      b.setLocation(0,0);
      JFrame splash=new JFrame();
      splash.getContentPane().add(b);
      splash.setUndecorated(true);
      splash.setResizable(false);
      splash.setSize(w,h);
      splash.setLocationRelativeTo(null);
      splash.setVisible(true);
      splash.toFront();
      int c=0;
      try {
        while (c < 250) {
          Thread.sleep(10);
          splash.toFront();
          c+=1;
        }
        splash.dispose();
      }
 catch (      InterruptedException e) {
        splash.dispose();
        e.printStackTrace();
      }
    }
  }
;
  t.start();
}
 

Example 47

From project jMemorize, under directory /src/jmemorize/core/.

Source file: FormattedText.java

  15 
vote

public static void insertImage(Document doc,ImageIcon icon,int offset) throws BadLocationException {
  int iconWidth=icon.getIconWidth();
  int iconHeight=icon.getIconHeight();
  Dimension dim=new Dimension(iconWidth,iconHeight);
  SimpleAttributeSet sa=new SimpleAttributeSet();
  JLabel label=new JLabel(icon);
  label.setMinimumSize(dim);
  label.setPreferredSize(dim);
  label.setMaximumSize(dim);
  label.setSize(dim);
  StyleConstants.setComponent(sa,label);
  doc.insertString(offset," ",sa);
}