Package javax.swing

Examples of javax.swing.ImageIcon


    protected JPanel getPicturePanel(Collection<Picture> pictures) {
        JPanel panel = new JPanel();
        panel.setPreferredSize(new Dimension(200,150));
        panel.setLayout(Layout.getGBL());
       
        ImageIcon image;
        DcPictureField label;
        for (Picture picture : pictures) {
            if (picture != null && !picture.isDeleted()) {
                image = (ImageIcon) picture.getValue(Picture._D_IMAGE);
                if (image == null) {
View Full Code Here


    {
      final URL iconRes = getClass().getResource
          ("/org/pentaho/reporting/engine/classic/core/modules/gui/base/date/datepicker.png"); // NON-NLS
      if (iconRes != null)
      {
        putValue(Action.SMALL_ICON, new ImageIcon(iconRes));
      }
      else
      {
        putValue(Action.NAME, "..");
      }
View Full Code Here

          continue;
        int pos[] = getRowColumnForIndex(index);
        int xpos = convertColumnToX(pos[1]);
        int ypos = convertRowToY(pos[0]);
        IconElement element = (IconElement) model.getElementAt(index);
        ImageIcon icon = element.getIcon();
        String name = element.getText();
        int stringWidth = metrics.stringWidth(name);
        int iconHeight = icon.getIconHeight();
        int spacing = view.getIconTextSpacing();
        int center = ycell / 2 - (textHeight + iconHeight + spacing) / 2;

        if (stringWidth > xcell) {
          while (stringWidth > xcell) {
            name = name.substring(0, name.length() - 1);
            stringWidth = metrics.stringWidth(name + "..");
          }
          name += "..";
        }

        g.drawImage(icon.getImage(), xpos + (xcell - icon.getIconWidth()) / 2, ypos + center, null);
        if (view.getSelectedIndex() == index) {
          if (view.hasFocus()) {
            g2.setColor(Color.darkGray);
            g2.setStroke(
              new BasicStroke(
                1.0f,
                BasicStroke.CAP_BUTT,
                BasicStroke.JOIN_MITER,
                1.0f,
                new float[] { 1.0f },
                0.0f));
            g2.draw(
              new Rectangle2D.Double(
                xpos + (xcell - icon.getIconWidth()) / 2 - 1,
                ypos + center - 2,
                icon.getIconWidth() + 2,
                iconHeight + 2));
            g.setColor(MetalLookAndFeel.getTextHighlightColor());
          } else {
            g.setColor(MetalLookAndFeel.getControlDisabled());
          }
View Full Code Here

        }

        // due to an issue with ImageIO and mixed signed code
        // we are now using good oldfashioned ImageIcon to load
        // images and the paint it on top of a new BufferedImage
        Image img = new ImageIcon(url).getImage();
        BufferedImage bufferedImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
        Graphics g = bufferedImage.getGraphics();
        g.drawImage(img, 0, 0, null);
        g.dispose();
View Full Code Here

      }
      log.warn("ImageIconFactory: Image ["+sName+"] could not be found at any of the search paths");
      return getIcon("broken");
    }

    ImageIcon imageIcon = new ImageIcon(url);
    imageIcon.setDescription(sName);
    if (imageIcon != null) {
      hmImageIconCache.put(sImageName, imageIcon);
    } else {
      return getIcon("broken");
    }
View Full Code Here

        String image_path = "fmsymbols/";
        image_path += eunit.group;
        image_path += "/";
        image_path += eunit.symbol;
        image_path += ".xbm";
        symbol_ = new ImageIcon(image_path.toLowerCase());

        image_path = "fmsymbols/echelons/";
        image_path += eunit.echelon;
        image_path += ".xbm";
        echelon_ = new ImageIcon(image_path.toLowerCase());
        return true;
    }
View Full Code Here

      final Icon errorIcon = getErrorIcon();
      final int width = errorIcon.getIconWidth();
      final int height = errorIcon.getIconHeight();

      final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
      emptyIcon = new ImageIcon(bi);
    }
    return emptyIcon;
  }
View Full Code Here

    Image result = null;
    final ByteArrayOutputStream byteIn = new ByteArrayOutputStream();
    try
    {
      IOUtils.getInstance().copyStreams(in, byteIn);
      final ImageIcon temp = new ImageIcon(byteIn.toByteArray());
      result = temp.getImage();
    }
    catch (IOException e)
    {
      logger.warn("Unable to read the ZIP-Entry", e);
    }
View Full Code Here

     */
    public static SettingsView getView() {
        SettingsView view = new SettingsView(DcResources.getText("lblDataCrowSettings"),
                                             applicationSettings.getSettings());
       
        ImageIcon icon = new DcImageIcon(DataCrow.installationDir + "icons/logo.jpg");
        view.setDisclaimer(icon);

        view.setSize(new Dimension(875, 470));
        view.setCenteredLocation();
        return view;
View Full Code Here

            stmt = conn.createStatement();
       
            for (DcField field : dco.getFields()) {
                if (field.getValueType() == DcRepository.ValueTypes._PICTURE) {
                    Picture picture = (Picture) dco.getValue(field.getIndex());
                    ImageIcon image = picture != null ? (ImageIcon) picture.getValue(Picture._D_IMAGE) : null;
                    if (image != null) {
                        if (image.getIconHeight() == 0 || image.getIconWidth() == 0) {
                            logger.warn("Image " + dco.getID() + "_" + field.getDatabaseFieldName() + ".jpg" + " is invalid and will not be saved");
                        } else {
                            picture.setValue(Picture._A_OBJECTID, dco.getID());
                            picture.setValue(Picture._B_FIELD, field.getDatabaseFieldName());
                            picture.setValue(Picture._C_FILENAME, dco.getID() + "_" + field.getDatabaseFieldName() + ".jpg");
                            picture.setValue(Picture._E_HEIGHT, image.getIconHeight());
                            picture.setValue(Picture._F_WIDTH, image.getIconWidth());
                            picture.isEdited(true);
                            pictures.add(picture);
                        }
                    }
                } else if (field.getValueType() == DcRepository.ValueTypes._DCOBJECTCOLLECTION) {
View Full Code Here

TOP

Related Classes of javax.swing.ImageIcon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.