Problems displaying image in image item

Hi,
I have some tiff images on filesystem. which i sucessfully loaded into the database and are stored in blob column, thru SQL*Plus. when i tried to view these images in image item on my form, some of them doesn't show up. i checked the the length of the blob column, to see whether the image is actually loaded into the database and i found that the length is greater zero(infact very high). then i tried to load the image, which doesn't show up, from forms by read_image_file, neither it loads the image nor it displays an error.
iam using oracle8i database and forms6.0.
any help is greatly appreciated.
regards,
Krupal.

thanx feng,
i have tried to load the images thru forms into the database by using read_image_file. but some of the images are not showing up in the image item. i seriously doubt there is something wrong with the image file itself. the image files are in tiff format but saved with an extension .000 file for some reasons. now i doubt that all that images are not tiff files, some of them may be of some other type. bcos when i tried to save one of them as a tiff file it took more space than what it was earlier. after saving as tiff file the form loads the image successfully. is there anyway way that i can load the image in whatever form it is? or is there any way to convert automatically these images to tiff format?

Similar Messages

  • Problem displaying CMYK jpeg images

    I have a problem with a CMYK jpeg image.
    I know that about supported JPEGs in JRE - JCS_CMYK and JCS_YCCK are not supported directly.
    And I found here how to load the image:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4799903
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5100094
    I used both the suggestions described to load it, but when the image is displayed the colors are wrong, are very different from the one displayed in PhotoShop, for example.
    Any suggestion are very appreciated. If it's necessary i can send you the image.
    Roberto
    Here is the code
    package com.cesarer.example.crop;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.ImageInputStream;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class CroppingRaster extends JPanel
        BufferedImage image;
        Dimension size;
        Rectangle clip;
        boolean showClip;
        public CroppingRaster(BufferedImage image)
            this.image = image;
            size = new Dimension(image.getWidth(), image.getHeight());
            showClip = false;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int x = (getWidth() - size.width)/2;
            int y = (getHeight() - size.height)/2;
            g2.drawImage(image, x, y, this);
            if(showClip)
                if(clip == null)
                    createClip();
                g2.setPaint(Color.red);
                g2.draw(clip);
        public void setClip(int x, int y)
            // keep clip within raster
            int x0 = (getWidth() - size.width)/2;
            int y0 = (getHeight() - size.height)/2;
            if(x < x0 || x + clip.width  > x0 + size.width ||
               y < y0 || y + clip.height > y0 + size.height)
                return;
            clip.setLocation(x, y);
            repaint();
        public Dimension getPreferredSize()
            return size;
        private void createClip()
            clip = new Rectangle(140, 140);
            clip.x = (getWidth() - clip.width)/2;
            clip.y = (getHeight() - clip.height)/2;
        private void clipImage()
            BufferedImage clipped = null;
            try
                int w = clip.width;
                int h = clip.height;
                int x0 = (getWidth()  - size.width)/2;
                int y0 = (getHeight() - size.height)/2;
                int x = clip.x - x0;
                int y = clip.y - y0;
                clipped = image.getSubimage(x, y, w, h);
            catch(RasterFormatException rfe)
                System.out.println("raster format error: " + rfe.getMessage());
                return;
            JLabel label = new JLabel(new ImageIcon(clipped));
            JOptionPane.showMessageDialog(this, label, "clipped image",
                                          JOptionPane.PLAIN_MESSAGE);
        private JPanel getUIPanel()
            final JCheckBox clipBox = new JCheckBox("show clip", showClip);
            clipBox.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    showClip = clipBox.isSelected();
                    repaint();
            JButton clip = new JButton("clip image");
            clip.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    clipImage();
            JPanel panel = new JPanel();
            panel.add(clipBox);
            panel.add(clip);
            return panel;
        public static void main(String[] args) throws IOException
             File file = new File("src/ABWRACK_4C.jpg");
             // Find a JPEG reader which supports reading Rasters.
            Iterator readers = ImageIO.getImageReadersByFormatName("JPEG");
            ImageReader reader = null;
            while(readers.hasNext()) {
                reader = (ImageReader)readers.next();
                if(reader.canReadRaster()) {
                    break;
         // Set the input.
            ImageInputStream input =
                ImageIO.createImageInputStream(file);
            reader.setInput(input);
            Raster raster = reader.readRaster(0, null);
             BufferedImage bi = new BufferedImage(raster.getWidth(),
                    raster.getHeight(),
                    BufferedImage.TYPE_4BYTE_ABGR);
             // Set the image data.
             bi.getRaster().setRect(raster);
            // Cropping test = new Cropping(ImageIO.read(file));
             CroppingRaster test = new CroppingRaster(bi);
            ClipMoverRaster mover = new ClipMoverRaster(test);
            test.addMouseListener(mover);
            test.addMouseMotionListener(mover);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new JScrollPane(test));
            f.getContentPane().add(test.getUIPanel(), "South");
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class ClipMoverRaster extends MouseInputAdapter
        CroppingRaster cropping;
        Point offset;
        boolean dragging;
        public ClipMoverRaster(CroppingRaster c)
            cropping = c;
            offset = new Point();
            dragging = false;
        public void mousePressed(MouseEvent e)
            Point p = e.getPoint();
            if(cropping.clip.contains(p))
                offset.x = p.x - cropping.clip.x;
                offset.y = p.y - cropping.clip.y;
                dragging = true;
        public void mouseReleased(MouseEvent e)
            dragging = false;
        public void mouseDragged(MouseEvent e)
            if(dragging)
                int x = e.getX() - offset.x;
                int y = e.getY() - offset.y;
                cropping.setClip(x, y);
    }

    The loading process It takes about 10 seconds, and every repaint it takes the same time.The painting yes, the loading no. It shouldn't take much more time to load the image then an ordinary JPEG. In particular, your now using a "natively accelerated" JPEG image reader, so it should take less time on average to load any JPEG. 10 seconds is absurd. Are you sure your not including the drawing time in that figure?
    - Another problem: JAI-ImageIO is not available for MAC OS X platform.This is somewhat true. You can take the imageio.jar file and package it together with your program (adding it to the class path). This will give you most of the functionality of JAI-ImageIO; in particular the TIFFImageReader. You just won't be able to use the two natively accelerated ImageReaders that comes with installing.
    Right now, you're using the accelerated CLibJPEGImageReader to read the image. You can't use this image reader on the MAC, so you have to take the approach mentioned in the 2nd bug report you originally posted (i.e. use an arbitrary CMYK profile).
    The conversion is too long more than 30 seconds.The code you posted could be simplified to
    BufferedImage rgbImage = new BufferedImage(w,h,
                BufferedImage.3_BYTE_BGR);
    ColorConvertOp op = new ColorConvertOp(null);
    op.filter(cmykImage,rgbImage);But again, 30 seconds is an absurd value. After a little preparation, converting from one ICC_Profile to another is essentially a look up operation. What does,
    System.out.println(cmykImage.getColorModel().getColorSpace());print out? If it's not an instance of ICC_ColorSpace, then I can understand the 30 seconds. If it is, then something is dreadfully wrong.
    the RGB bufferedImage that i get after the transformation when it is displayed is much more brightThis is the "one last problem that pops up" that I hinted at. It's because some gamma correction is going on in the background. I have a solution, but it's programming to the implementation of the ColorConvertOp class and not the API. So I'm not sure about its portability between java versions or OS's.
    import javax.swing.*;
    import java.awt.color.ICC_ColorSpace;
    import java.awt.color.ICC_Profile;
    import java.awt.image.BufferedImage;
    import java.awt.image.ColorConvertOp;
    import javax.imageio.ImageIO;
    import java.io.File;
    public class CMYKTest {
         public static void main(String[] args) throws Exception{
            long beginStamp, endStamp;
            //load image
            beginStamp = System.currentTimeMillis();
            BufferedImage img = ImageIO.read(/*cmyk image file*/);
            endStamp = System.currentTimeMillis();
            System.out.println("Time to load image: " + (endStamp-beginStamp));
            //color convert
            BufferedImage dest = new BufferedImage(img.getWidth(),
                                                   img.getHeight(),
                                                   BufferedImage.TYPE_3BYTE_BGR);
            beginStamp = System.currentTimeMillis();
            sophisticatedColorConvert(img,dest);
            endStamp = System.currentTimeMillis();
            System.out.println("Time to color convert: " + (endStamp-beginStamp));
            //display
            JFrame frame = new JFrame();
            frame.setContentPane(new JScrollPane(new JLabel(new ImageIcon(dest))));
            frame.setSize(500,500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        public static BufferedImage sophisticatedColorConvert(BufferedImage src,
                                                              BufferedImage dst) {
            ICC_ColorSpace srcCS =
                    (ICC_ColorSpace) src.getColorModel().getColorSpace();
            ICC_Profile srcProf = srcCS.getProfile();
            byte[] header = srcProf.getData(ICC_Profile.icSigHead);
            intToBigEndian(ICC_Profile.icSigInputClass,header,12);
            srcProf.setData(ICC_Profile.icSigHead,header);
            ColorConvertOp op = new ColorConvertOp(null);
            return op.filter(src, dst);
        private static void intToBigEndian(int value, byte[] array, int index) {
                array[index]   = (byte) (value >> 24);
                array[index+1] = (byte) (value >> 16);
                array[index+2] = (byte) (value >>  8);
                array[index+3] = (byte) (value);
    }

  • Problem displaying binary tif image from rfc

    Hello All,
    I am trying to display an image that is returned from RFC as binary image
    <b><u>Context description:</u></b>
    Context Node From RFC -  Out_Et_Image node type tbl1024
    Node element Line
    As I understand the node is representing a byte array and each Line element i a part of the array .
    <b><u><i>i did</i></u></b>
    <b>1. merge it into one byte array :</b>
    int ArrayTot = 0 ;
    for ( i =0;i<wdContext.nodeOut_Et_Image().size();i++){
         ArrayTot = ArrayTot+wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length     ;
         final byte[] pictureContentTemp1 = new byte[ArrayTot];
         for ( i =0;i<wdContext.nodeOut_Et_Image().size();i++){
              if(i>0){
                   j=j+wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i-1).getLine().length;
                   System.arraycopy(wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine(),0,
                        pictureContentTemp1,0,wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length     );
              }else{
                   j=wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length;
                   System.arraycopy(wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine(),0,
                                       pictureContentTemp1,j,wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length     );
    <u><b>2. using the IWDCachedWebResource to generate and display it</b></u>
    IWDCachedWebResource resource = WDWebResource.getWebResource
    (pictureContentTemp1,
    WDWebResourceType.GIF_IMAGE);
    resource.setResourceName("pic");
    try{
    IWDWindow window = wdComponentAPI.getWindowManager().
    createExternalWindow(resource.getURL(), "gggg", true);
    // Eliminate some features of the window
    window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
    window.removeWindowFeature(WDWindowFeature.MENU_BAR);
    window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
    window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
    window.setWindowSize(780,430);
    window.setWindowPosition(20,140);
    window.open();
    }catch (Exception e){
         wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(),false);
    The problem is that I get a corrupted file and i cant see or open it .
    Some more details:
    The original image size is 42,234 bytes
    i get from the RFC after merging the array 43,008 bytes i think that the extra bytes that a get are the problem , but i don't have any idea how to get rid of them or solve the problem .
    My WAS version is nw04 sp19
    Does any one encounter this problem? Or can guide me what to do?
    Thanks
    Ronen

    Try this VI (It's from "Image Acquisition and Processing with LabVIEW" - see for more details...
    cheers,
    Christopher
    Christopher G. Relf
    Certified LabVIEW Developer
    [email protected]
    International Voicemail & Fax: +61 2 8080 8132
    Australian Voicemail & Fax: (02) 8080 8132
    EULA
    1) This is a private email, and although the views expressed within it may not be purely my own, unless specifically referenced I do not suggest they are necessarily associated with anyone else including, but not limited to, my employer(s).
    2) This email has NOT been scanned for virii - attached file(s), if any, are provided as is. By copying, detaching and/or opening attached file
    s, you agree to indemnify the sender of such responsibility.
    3) Because e-mail can be altered electronically, the integrity of this communication cannot be guaranteed.
    >
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
    Attachments:
    Image_Browser-Selector_Example.llb ‏107 KB

  • Problems Displaying an Image in a TableCell

    I read a few tutorials online about adding images to a tableview tablecell and tried to implement what I learned from the tutorial, but I'm not having much luck. My problem is that the image is not being displayed in the table cell.
    The problem is in the getTable Method of the ExampleProblem class. I know that "item" in the updateItem method of the setCellFactory is null and I can figure out why. I'm having a hard time understanding the callback part of the setCellFactory, which is making it difficult to figure out where my problem is located and why it is happening.
    Hopefully, someone can help me out or at least point me in the right direction.
    Thanks in advance for any help.
    -Fred
    package whitman.fa.encounter;
    import javafx.application.Application;
    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleIntegerProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.geometry.Pos;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.GridPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class ExampleProblem extends Application
      BorderPane rootLayout;
      ObservableList<Encounter> encounters = FXCollections.observableArrayList();
      ObservableList<MobPict> imgData = FXCollections.observableArrayList();
      Group root;
      Scene scene;
      GridPane pane;
      public ExampleProblem()
      imgData.addAll(new MobPict("Bugbear.jpg","Bugbear"), new MobPict("po_BGArcher_h.png", "PC"));
      encounters.addAll(
      new Encounter(1,5,1,1,"Bugbear",0,0,null,3,"Bestiary pg 75", imgData.get(0)),
      new Encounter(6,15,1,1,"PC",0,0,null,3,"HeroLabs",imgData.get(1))
      @Override
      public void start(Stage primaryStage) throws Exception
      primaryStage.setTitle("Table Test with image column");
      //Display TableView
      Group group = getBackground();
      VBox box = new VBox();
      box.setLayoutX(20);
      box.setLayoutY(5);
      box.setSpacing(15);
      Text text = new Text("Image Column test");
      text.setFont(new Font(20));
      TableView<Encounter> table = getTable();
      box.getChildren().addAll(text, table);
      group.getChildren().add(box);
      Scene scene = new Scene(group, 680,530,Color.web("#666666"));
      primaryStage.setScene(scene);
      primaryStage.show();
      public Group getBackground()
      Group group = new Group();
      group.setLayoutX(40);
      group.setLayoutY(40);
      Rectangle rect = new Rectangle();
      rect.setWidth(600);
      rect.setHeight(460);
      rect.setFill(Color.web("#f5f5f5"));
      DropShadow dropShadow = new DropShadow();
      dropShadow.setRadius(50);
      dropShadow.setOffsetX(0);
      dropShadow.setOffsetY(0);
      dropShadow.setColor(Color.web("#969696"));
      rect.setEffect(dropShadow);
      group.getChildren().add(rect);
      return group;
      @SuppressWarnings("unchecked")
      public TableView<Encounter> getTable()
      TableView<Encounter> imageTable = new TableView<Encounter>();
      TableColumn<Encounter, Number> minChanceCol = new TableColumn<Encounter, Number>("Min Chance");
      minChanceCol.setCellValueFactory(new PropertyValueFactory<Encounter, Number>("minChance"));
      TableColumn<Encounter, Number> maxChanceCol = new TableColumn<Encounter, Number>("Max Chance");
      maxChanceCol.setCellValueFactory(new PropertyValueFactory<Encounter, Number>("maxChance"));
      TableColumn<Encounter, MobPict> imgCol = new TableColumn<Encounter, MobPict>("Images");
      imgCol.setCellValueFactory(new PropertyValueFactory<Encounter, MobPict>("mobPicPath"));
      imgCol.setCellFactory(new Callback<TableColumn<Encounter,MobPict>,TableCell<Encounter,MobPict>>()
      @Override
      public TableCell<Encounter, MobPict> call(TableColumn<Encounter, MobPict> param)
      TableCell<Encounter, MobPict> cell = new TableCell<Encounter, MobPict>()
      @Override
      public void updateItem(MobPict item, boolean empty)
      //System.out.println("update Item called");
      //System.out.println(item.getMobName());
      if(item != null)
      VBox box;
      ImageView imgView;
      box= new VBox();
      box.setAlignment(Pos.CENTER);
      imgView = new ImageView();
      imgView.setFitHeight(100);
      imgView.setFitWidth(100);
      imgView.setImage(new Image(TestApp.class.getResource("img").toString()+"/"+item.getMobPicPath()));
      box.getChildren().add(imgView);
      setGraphic(box);
      return cell;
      imageTable.getColumns().addAll(minChanceCol,maxChanceCol, imgCol);
      imageTable.setItems(encounters);
      return imageTable;

    First paste in Number/Date format like:
    DOWNLOAD::::::
    and Apply Change
    after this you will see link BLOB Download Format Mask

  • Persistent Problems displaying images

    I thought I'd already managed to fix this problem but it doesn't seem to be the case. I have two tilelists that items can be dragged between and when each item is clicked the information and"largeImage" contained within it should display in the right hand panel however this works fine in previewing but when I actually change it into an air application and run it the images do not display in the right hand panel when each item within the tilelists is clicked.
    What changes would I need to make to this code to make it work correctly when changed into an AIR app?
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initprofile1NewsAndSportSO()">
    <mx:Script>
    <![CDATA[
    Bindable][
    Embed(source="assets/images/bbcnews_small.png")] 
    public var image1:Class; 
    Bindable][
    Embed(source="assets/images/itv_small.png")] 
    public var image2:Class; 
    Bindable][
    Embed(source="assets/images/skynews_small.png")] 
    public var image3:Class; 
    ]]>
    </mx:Script>
    <mx:Script>
    <![CDATA[
    import mx.collections.*; 
    import flash.net.SharedObject; 
    public var profile1NewsAndSportSO:SharedObject; 
    private var profile1NewsAndSportaddLinksFullAC:ArrayCollection = new ArrayCollection([{link:
    "www.bbcnews.com", label:"BBC News", icon:"image1", largeImage:"assets/images/bbcnews_small.png", title:"BBC News", description:"BBC News description will go here"},{link:
    "www.itv.com/", label:"ITV", icon:"image2", largeImage:"assets/images/itv_small.png", title:"ITV", description:"ITV Description will go here"},{link:
    "www.skynews.com", label:"Sky News", icon:"image3", largeImage:"assets/images/skynews_small.png", title:"Sky News", description:"Sky News Description will go here"}]);
    private var profile1NewsAndSportaddLinksAC:ArrayCollection = new ArrayCollection([{link:
    "www.bbcnews.com", label:"BBC News", icon:"image1", largeImage:"assets/images/bbcnews_small.png", title:"BBC News", description:"BBC News description will go here"},{link:
    "www.itv.com/", label:"ITV", icon:"image2", largeImage:"assets/images/itv_small.png", title:"ITV", description:"ITV Description will go here"},{link:
    "www.skynews.com", label:"Sky News", icon:"image3", largeImage:"assets/images/skynews_small.png", title:"Sky News", description:"Sky News Description will go here"}]);
    private function profile1NewsAndSportReset():void{resetprofile1NewsAndSportAC();
    profile1NewsAndSportAddLinksTilelist.dataProvider
    = profile1NewsAndSportaddLinksAC;
    profile1NewsAndSportLinkChoice.dataProvider =
    new ArrayCollection([]);}
    private function resetprofile1NewsAndSportAC():void{profile1NewsAndSportaddLinksAC.removeAll();
    for each(var obj:Object in profile1NewsAndSportaddLinksFullAC){profile1NewsAndSportaddLinksAC.addItem(obj);
    private function initprofile1NewsAndSportSO():void{profile1NewsAndSportSO = SharedObject.getLocal(
    "profile1NewsAndSport"); 
    if(profile1NewsAndSportSO.size > 0){ 
    if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList){ 
    if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList != "empty"){ 
    var profile1NewsAndSportaddList:Array = profile1NewsAndSportSO.data.profile1NewsAndSportaddList.split(","); 
    var profile1NewsAndSporttempAC1:ArrayCollection = new ArrayCollection(); 
    for each(var str:String in profile1NewsAndSportaddList){ 
    for each(var obj1:Object in profile1NewsAndSportaddLinksAC){ 
    if(str == obj1.label){profile1NewsAndSporttempAC1.addItem(obj1);
    continue;}
    if(profile1NewsAndSporttempAC1.length > 0){profile1NewsAndSportAddLinksTilelist.dataProvider = profile1NewsAndSporttempAC1;
    if(profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList){ 
    var profile1NewsAndSportchoiceList:Array = profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList.split(","); 
    var profile1NewsAndSporttempAC2:ArrayCollection = new ArrayCollection(); 
    for each(var str2:String in profile1NewsAndSportchoiceList){ 
    for each(var obj2:Object in profile1NewsAndSportaddLinksAC){ 
    if(str2 == obj2.label){profile1NewsAndSporttempAC2.addItem(obj2);
    continue;}
    if(profile1NewsAndSporttempAC2.length > 0){profile1NewsAndSportLinkChoice.dataProvider = profile1NewsAndSporttempAC2;
    else{profile1NewsAndSportReset();
    private function saveprofile1NewsAndSport(event:MouseEvent):void{ 
    var profile1NewsAndSportaddList:String = ""; 
    if(profile1NewsAndSportAddLinksTilelist.dataProvider){ 
    if(ArrayCollection(profile1NewsAndSportAddLinksTilelist.dataProvider).length > 0){ 
    for each(var obj1:Object inprofile1NewsAndSportAddLinksTilelist.dataProvider){
    profile1NewsAndSportaddList += obj1.label +
    else{profile1NewsAndSportaddList =
    "empty";}
    profile1NewsAndSportSO.data.profile1NewsAndSportaddList = profile1NewsAndSportaddList;
    var profile1NewsAndSportchoiceList:String = ""; 
    for each(var obj2:Object inprofile1NewsAndSportLinkChoice.dataProvider){
    profile1NewsAndSportchoiceList += obj2.label +
    profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList = profile1NewsAndSportchoiceList;
    profile1NewsAndSportSO.flush();
    ]]>
    </mx:Script>
    <mx:TileList id="profile1NewsAndSportAddLinksTilelist" fontWeight="bold" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="292" width="650" left="21" columnCount="5" rowHeight="145" columnWidth="125" itemClick="titleLabel.text=profile1NewsAndSportAddLinksTilelist.selectedItem.title; websiteLinkLabel.text=profile1NewsAndSportAddLinksTilelist.selectedItem.link; descLabel.text=profile1NewsAndSportAddLinksTilelist.selectedItem.description; linkImage.source=profile1NewsAndSportAddLinksTilelist.selectedItem.largeImage;" itemDoubleClick="{navigateToURL(new URLRequest('http://' + profile1NewsAndSportAddLinksTilelist.selectedItem.link))}" doubleClickEnabled="true" backgroundColor="#000000" borderColor="#FFFFFF" color="#FFFFFF" borderSides="top right left" y="25"/> 
    <mx:Canvas id="SitePreviewArea" y="10" width="453" height="540" backgroundColor="#545050" cornerRadius="20" borderStyle="solid" x="692" borderThickness="2" dropShadowEnabled="true" borderColor="#000000">
    <mx:Label x="45" y="309" text="Website Name:" width="150" height="52" fontSize="14" fontWeight="bold" color="#FFFFFF" left="10"/>  
    <mx:Label x="150.5" y="309" id="titleLabel" width="282.5" height="24" fontWeight="bold" fontSize="14" color="#FCFF00"/>
    <mx:Label x="124.5" y="385" text="Website Description:" width="200" height="24" fontSize="14" fontWeight="bold" color="#FFFFFF" textAlign="center"/>  
    <mx:TextArea x="16" y="417" id="descLabel" width="421" height="69" textAlign="left" color="#FCFF00" borderThickness="0" backgroundColor="#545050" editable="false" enabled="true" disabledColor="#FFFFFF" backgroundDisabledColor="#545050" fontWeight="bold" fontSize="12"/>
    <mx:Label x="61" y="342" text="Website Link:" width="150" height="52" fontSize="14" fontWeight="bold" color="#FFFFFF" left="10"/>
    <mx:TextArea x="150.5" y="343" id="websiteLinkLabel" width="282.5" height="33" fontWeight="bold" fontSize="12" color="#FCFF00" borderThickness="0" backgroundColor="#545050" editable="false" enabled="true" disabledColor="#FCFF00" backgroundDisabledColor="#545050"/>
    <mx:Button id="goToSiteButton" top="494" left="168" label="VISIT SITE" fontWeight="bold" fontSize="14" color="#000000" click="{navigateToURL(new URLRequest('http://' + websiteLinkLabel.text))}" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #DCDCDC]" borderColor="#000000"/>
    <mx:Canvas x="99.5" y="51" width="250" height="250" backgroundColor="#FFFFFF">
    <mx:Image id="linkImage" click="{navigateToURL(new URLRequest('http://' + websiteLinkLabel.text))}" width="250" height="250" x="0" y="0" scaleContent="true" top="2" right="2" left="2" bottom="2"/>
     

    No thats not what I meant sorry. I have two versions with the same code. One a regular Flex app and one an AIR version but the code is of course exactly the same except for the WindowedApplication part. I only posted the flex app version code incase someone could take a look at it and modify it for me. It's just that the application needs to use the shared object method like in that code but it also needs to display the relevant image on the right hand panel when the app is installed on a user's machine.
    Here's the code for the AIR version:-
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initprofile1NewsAndSportSO()" viewSourceURL="srcview/index.html">
    <mx:Script>
    <![CDATA[
    Bindable][
    Embed(source="assets/images/bbcnews_small.png")] 
    public var image1:Class; 
    Bindable][
    Embed(source="assets/images/itv_small.png")] 
    public var image2:Class; 
    Bindable][
    Embed(source="assets/images/skynews_small.png")] 
    public var image3:Class; 
    ]]>
    </mx:Script>
    <mx:Script>
    <![CDATA[
    import mx.collections.*; 
    import flash.net.SharedObject; 
    public var profile1NewsAndSportSO:SharedObject; 
    private var profile1NewsAndSportaddLinksFullAC:ArrayCollection = new ArrayCollection([{link:
    "www.bbcnews.com", label:"BBC News", icon:"image1", largeImage:"assets/images/bbcnews_small.png", title:"BBC News", description:"BBC News description will go here"},{link:
    "www.itv.com/", label:"ITV", icon:"image2", largeImage:"assets/images/itv_small.png", title:"ITV", description:"ITV Description will go here"},{link:
    "www.skynews.com", label:"Sky News", icon:"image3", largeImage:"assets/images/skynews_small.png", title:"Sky News", description:"Sky News Description will go here"}]);
    private var profile1NewsAndSportaddLinksAC:ArrayCollection = new ArrayCollection([{link:
    "www.bbcnews.com", label:"BBC News", icon:"image1", largeImage:"assets/images/bbcnews_small.png", title:"BBC News", description:"BBC News description will go here"},{link:
    "www.itv.com/", label:"ITV", icon:"image2", largeImage:"assets/images/itv_small.png", title:"ITV", description:"ITV Description will go here"},{link:
    "www.skynews.com", label:"Sky News", icon:"image3", largeImage:"assets/images/skynews_small.png", title:"Sky News", description:"Sky News Description will go here"}]);
    private function profile1NewsAndSportReset():void{resetprofile1NewsAndSportAC();
    profile1NewsAndSportAddLinksTilelist.dataProvider
    = profile1NewsAndSportaddLinksAC;
    profile1NewsAndSportLinkChoice.dataProvider =
    new ArrayCollection([]);}
    private function resetprofile1NewsAndSportAC():void{profile1NewsAndSportaddLinksAC.removeAll();
    for each(var obj:Object in profile1NewsAndSportaddLinksFullAC){profile1NewsAndSportaddLinksAC.addItem(obj);
    private function initprofile1NewsAndSportSO():void{profile1NewsAndSportSO = SharedObject.getLocal(
    "profile1NewsAndSport"); 
    if(profile1NewsAndSportSO.size > 0){ 
    if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList){ 
    if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList != "empty"){ 
    var profile1NewsAndSportaddList:Array = profile1NewsAndSportSO.data.profile1NewsAndSportaddList.split(","); 
    var profile1NewsAndSporttempAC1:ArrayCollection = new ArrayCollection(); 
    for each(var str:String in profile1NewsAndSportaddList){ 
    for each(var obj1:Object in profile1NewsAndSportaddLinksAC){ 
    if(str == obj1.label){profile1NewsAndSporttempAC1.addItem(obj1);
    continue;}
    if(profile1NewsAndSporttempAC1.length > 0){profile1NewsAndSportAddLinksTilelist.dataProvider = profile1NewsAndSporttempAC1;
    if(profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList){ 
    var profile1NewsAndSportchoiceList:Array = profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList.split(","); 
    var profile1NewsAndSporttempAC2:ArrayCollection = new ArrayCollection(); 
    for each(var str2:String in profile1NewsAndSportchoiceList){ 
    for each(var obj2:Object in profile1NewsAndSportaddLinksAC){ 
    if(str2 == obj2.label){profile1NewsAndSporttempAC2.addItem(obj2);
    continue;}
    if(profile1NewsAndSporttempAC2.length > 0){profile1NewsAndSportLinkChoice.dataProvider = profile1NewsAndSporttempAC2;
    else{profile1NewsAndSportReset();
    private function saveprofile1NewsAndSport(event:MouseEvent):void{ 
    var profile1NewsAndSportaddList:String = ""; 
    if(profile1NewsAndSportAddLinksTilelist.dataProvider){ 
    if(ArrayCollection(profile1NewsAndSportAddLinksTilelist.dataProvider).length > 0){ 
    for each(var obj1:Object inprofile1NewsAndSportAddLinksTilelist.dataProvider){
    profile1NewsAndSportaddList += obj1.label +
    else{profile1NewsAndSportaddList =
    "empty";}
    profile1NewsAndSportSO.data.profile1NewsAndSportaddList = profile1NewsAndSportaddList;
    var profile1NewsAndSportchoiceList:String = ""; 
    for each(var obj2:Object inprofile1NewsAndSportLinkChoice.dataProvider){
    profile1NewsAndSportchoiceList += obj2.label +
    profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList = profile1NewsAndSportchoiceList;
    profile1NewsAndSportSO.flush();
    ]]>
    </mx:Script>
    <mx:TileList id="profile1NewsAndSportAddLinksTilelist" fontWeight="bold" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="292" width="650" left="21" columnCount="5" rowHeight="145" columnWidth="125" itemClick="titleLabel.text=profile1NewsAndSportAddLinksTilelist.selectedItem.title; websiteLinkLabel.text=profile1NewsAndSportAddLinksTilelist.selectedItem.link; descLabel.text=profile1NewsAndSportAddLinksTilelist.selectedItem.description; linkImage.source=profile1NewsAndSportAddLinksTilelist.selectedItem.largeImage;" itemDoubleClick="{navigateToURL(new URLRequest('http://' + profile1NewsAndSportAddLinksTilelist.selectedItem.link))}" doubleClickEnabled="true" backgroundColor="#000000" borderColor="#FFFFFF" color="#FFFFFF" borderSides="top right left" y="25"/> 
    <mx:Canvas id="SitePreviewArea" y="10" width="453" height="540" backgroundColor="#545050" cornerRadius="20" borderStyle="solid" x="692" borderThickness="2" dropShadowEnabled="true" borderColor="#000000">
    <mx:Label x="45" y="309" text="Website Name:" width="150" height="52" fontSize="14" fontWeight="bold" color="#FFFFFF" left="10"/>  
    <mx:Label x="150.5" y="309" id="titleLabel" width="282.5" height="24" fontWeight="bold" fontSize="14" color="#FCFF00"/>
    <mx:Label x="124.5" y="385" text="Website Description:" width="200" height="24" fontSize="14" fontWeight="bold" color="#FFFFFF" textAlign="center"/>  
    <mx:TextArea x="16" y="417" id="descLabel" width="421" height="69" textAlign="left" color="#FCFF00" borderThickness="0" backgroundColor="#545050" editable="false" enabled="true" disabledColor="#FFFFFF" backgroundDisabledColor="#545050" fontWeight="bold" fontSize="12"/>
    <mx:Label x="61" y="342" text="Website Link:" width="150" height="52" fontSize="14" fontWeight="bold" color="#FFFFFF" left="10"/>
    <mx:TextArea x="150.5" y="343" id="websiteLinkLabel" width="282.5" height="33" fontWeight="bold" fontSize="12" color="#FCFF00" borderThickness="0" backgroundColor="#545050" editable="false" enabled="true" disabledColor="#FCFF00" backgroundDisabledColor="#545050"/>
    <mx:Button id="goToSiteButton" top="494" left="168" label="VISIT SITE" fontWeight="bold" fontSize="14" color="#000000" click="{navigateToURL(new URLRequest('http://' + websiteLinkLabel.text))}" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #DCDCDC]" borderColor="#000000"/>
    <mx:Canvas x="99.5" y="51" width="250" height="250" backgroundColor="#FFFFFF">
    <mx:Image id="linkImage" click="{navigateToURL(new URLRequest('http://' + websiteLinkLabel.text))}" width="250" height="250" x="0" y="0" scaleContent="true" top="2" right="2" left="2" bottom="2"

  • Help with SWFObject2, problem with display of alternate image

    I'm trying to use SWFObject2 dynamic publishing version to test the visitors browser for flash pluggin and the version.
    I want to only show my flash image if the browser finds the flash plug in and it supports the correct version of flash for my banner, otherwise I want to display a jpeg image in its place.
    When flash support is available in my browser the flash image is displayed, no problems. But when Javascript or flash plugin support is not available and my alternate image jpeg is displayed something wierd happens and i would appreciate any help on this:
    The image is displayed but is pushed to the right of the screen and it seems to have a box behind the image, the edge of the box is only visable and changes colour on rollove like it wants to be clicked, obviously i cannot see what the box is because the image covers it. There is nothing wrong with my image, i put that in place first and tested it loaded ok before i added the SWFObject code and file.
    My code is below:
    <script type="text/javascript" src="Scripts/swfobject.js"></script>
    <script type="text/javascript">
    swfobject.embedSWF("advertise_banner.swf", "altContent", "468", "60", "6.0.0", "expressinstall.swf");
    </script>
    </head>
    <body>
    <div id="wrapAltContent">
    <div id="altContent">
    <a href="advertise_banner.php?ad=y">
    <img src="Images/advertise_banner.jpg" alt="Image linking to information on  advertising a banner ad on Choose Almeria" />
    </a>
    </div>
    </div>
    Looking forward to replies.

    Hi,
    Is this your question still relevant? If yes, did you study already this for example?
    http://code.google.com/p/swfobject/wiki/documentation
    Hans-G.

  • Problem with animated gif image getting displayed

    My problem is that my animated image does not get displayed properly. I am extending JButton and the button already contains a static image. I want to display the animated image over the static one for some reason. If I replace the animated image with a static gif, then there is no problem.
    Here is the code that I am using
    Icon anim = new ImageIcon((new ImageLoader()).getImage("/graphics/busy.gif"));
    // thread to call displayAnim method
    class ColorThread extends Thread {
    ColorThread() {
    public void run() {
    while (AnimFlag) {
    try {
    displayAnim();
    Thread.sleep(400);
    } catch (InterruptedException e) {
    public void displayAnim()
    repaint();
    public void paint(Graphics g)
    super.paint(g);
    int x=5;
    int y=0;
    if ( AnimFlag) {
    anim.paintIcon(this,g,x,y);

    This code is working fine for JRE 1.2 and the animation is displayed. The problem is with JRE 1.3. when there is no animation, neither is there any image getting displayed.

  • Problem Displaying images

    Hi I am trying to make a mud and the one thing I wanted to make different was an actual image map. My code reads the map from a text file and then places it into an array which then is displayed using diffent images for different characters. I wanted to start out by reading in the map and displaying it. So far so good considering that the code works while running in the applet viewer in PCGrasp, but the problem comes in when the html is run. Is there anything that I need to add to the code to display the map. The textbox and the background display but nothing else. Maybe my background is being placed on top of my images? Well here is the code so far:
    import java.applet.*;
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    public class ImageEx extends Applet implements Runnable
    // Initialisierung der Variablen
    int x_pos = 30;               // x - Position des Balles
    int y_pos = 100;          // y - Position des Balles
    int x_speed = 1;          // Geschwindigkeit des Balles in x - Richtung
    int radius = 20;          // Radius des Balles
    int appletsize_x = 300; // Gr��e des Applets in x - Richtung
    int appletsize_y = 300;     // Gr��e des Applets in y - Richtung
    // Variablen f�r die Doppelpufferung
    private Image dbImage;
    private Graphics dbg;
    private TextField commandLine;
    // Bildvariable f�r den Hintergrund
    Image Character;
    Image backImage;
    char array[][];
    MediaTracker mt;
    URL base;
    public void init()
    mt = new MediaTracker(this);
    setBackground(Color.blue);
    // Laden der Bilddatei
    backImage = getImage(getDocumentBase(), "desert.gif");
    Character = getImage(getDocumentBase(), "Test_Char.gif");
    commandLine = new TextField(50);
    add(commandLine,"South");
    try
    base = getDocumentBase();
    TextReader textReader = new TextReader ("First Map.txt");
    String s = textReader.readLine();
    String t = textReader.readLine();
    int z = Integer.parseInt(s);
    int y = Integer.parseInt(t);
    int x = 0, d = 0, c = 0;
    String map[] = new String[z];
    for(int j = 0; j < z; j++)
    map[j] = textReader.readLine();
    ++x;
    array = new char[z][y];
    for(int a = 0; a < array.length; a++)
    for(int b = 0; b < array[0].length; b++)
    array[a] = map[d].charAt(c);
    if(c != 21)
    ++c;
    else
    c = 0;
    ++d;
    //System.out.print(array[0][3]);
    catch (Exception e)
    System.out.println(e.toString());
    mt.addImage(backImage,1);
    mt.addImage(Character,2);
    // now tell the mediaTracker to stop the applet execution
    // (in this example don't paint) until the images are fully loaded.
    // must be in a try catch block.
    try
    mt.waitForAll();
    catch (InterruptedException e)
    public void start ()
    // Schaffen eines neuen Threads, in dem das Spiel l�uft
    Thread th = new Thread(this);
    // Starten des Threads
    th.start();
    public void stop()
    public void run ()
    // Erniedrigen der ThreadPriority um zeichnen zu erleichtern
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    // Solange true ist l�uft der Thread weiter
    while(true)
    // Wenn der Ball den rechten Rand ber�hrt, dann prallt er ab
    if(x_pos > appletsize_x - radius)
    // �ndern der Richtung des Balles
    x_speed = -1;
    // Ball br�hrt linken Rand und prallt ab
    else if(x_pos < radius)
    // �ndern der Richtung des Balles
    x_speed = +1;
    // Ver�ndern der x- Koordinate
    x_pos += x_speed;
    // Neuzeichnen des Applets
    repaint();
    try
    // Stoppen des Threads f�r in Klammern angegebene Millisekunden
    Thread.sleep (20);
    catch(InterruptedException ex)
    // do nothing
    // Zur�cksetzen der ThreadPriority auf Maximalwert
    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    /** Update - Methode, Realisierung der Doppelpufferung zur Reduzierung des Bildschirmflackerns */
    public void update(Graphics g)
    // Initialisierung des DoubleBuffers
    if(dbImage == null)
    dbImage = createImage(this.getSize().width, this.getSize().height);
    dbg = dbImage.getGraphics();
    // Bildschirm im Hintergrund l�schen
    dbg.setColor(getBackground ());
    dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
    // Auf gel�schten Hintergrund Vordergrund zeichnen
    dbg.setColor(getForeground());
    paint(dbg);
    // Nun fertig gezeichnetes Bild Offscreen auf dem richtigen Bildschirm anzeigen
    g.drawImage(dbImage, 0, 0, this);
    public void paint (Graphics g)
    mapDraw(g);
    g.setColor (Color.red);
    g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
    public void mapDraw(Graphics c)
    int x_loc = 0;
    int y_loc = 0;
    for(int x = 0; x < array.length; x++)
    for(int y = 0; y < array[0].length; y++)
    switch(array[x][y])
    case 'x': backImage = getImage(getDocumentBase(), "grass_dark.gif");
    break;
    case 'E': backImage = getImage(getDocumentBase(), "dungeon_door.jpg");
    break;
    case '#': backImage = getImage(getDocumentBase(), "desert.gif");
    break;
    case 'H': backImage = getImage(getDocumentBase(),"house.gif");
    break;
    case 'U': backImage = getImage(getDocumentBase(),"house.gif");
    break;
    c.drawImage(backImage, x_loc, y_loc,16,16, this);
    x_loc += 16;
    y_loc += 16;
    x_loc = 0;
    c.drawImage(Character,64, 32,16,16, this);
    any help or constructive criticism would be greatly appreciated

    sorry for not having the code tags I had to copy and paste and the tags didn't copy over! :-(

  • Some JPG images, stored in DB, do not display on screen/image item.

    Hi friends,
    I have a form to save and retrieve images (JPG, GIF, TIF) to and from DB, using WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB and CLIENT_IMAGE.WRITE_IMAGE_FILE respectively.
    It’s working fine, but with few JPG images, it stores in DB but do not display on screen/image item.
    Secondly, if I try to retrieve and write this JPG to OS (using CLIENT_IMAGE.WRITE_IMAGE_FILE), it prompts error “FRM-47101: Cannot write image file”.
    Environment:
    Forms [32 Bit] Version 10.1.2.0.2
    OS XP Pro 2002 SP3
    Oracle DB 11g Enterprise Edition Rel. 11.1.0.7.0 - 64bit
    Any help will be highly appreciated.

    Hi,
    I have done a workaround here, which worked for me.
    My requirement is to direct save images in DB. So my system was just saving images without knowing if picture would display on form or not later.
    I created a (non-DB) image item on form and added a code (CLIENT_IMAGE.READ_IMAGE_FILE) to place image in this image item, if it successfully display image then save image directly in DB using code (WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB).
    Note: - If CLIENT_IMAGE.READ_IMAGE_FILE fails it raises exception and it means image has invalid format/internal data header and system does not save image in DB.
    Now I have a kind of a filter to stop saving pictures which do not display later on form. :)
    Edited by: user12173428 on 29/09/2011 16:38

  • JAI - problem displaying additional pages from multi-page image

    Hi,
    I have 10 page multipage tiff images. And i would like to show the images one-by-one on a ScrollingImagePanel.
    I have a Main frame with two panels. Panel1 which shows the ScrollingImagePanel.
    And Panel2 has two buttons. LOAD Button show the 1st page on the ScrollingImagePanel.
    And NEXT button is suppose to show the 2nd page and continue until the end of the multipage images.
    I am having problem with the NEXT button. I wrote a program that show the page number and page height
    on the output screen. It shows the page# and different heights. But it would not show the images on the ScrollingImagePanel.
    It just shows the 1st page. I would appreciate if you can help me out with this problom.
    Please find the code which is written in JBuilder.
    // Main class
    package untitled1;
    import java.awt.*;
    import javax.swing.UIManager;
    import java.awt.*;
    import java.io.File;
    import java.io.IOException;
    import java.awt.Frame;
    import java.awt.image.RenderedImage;
    import javax.media.jai.widget.ScrollingImagePanel;
    import javax.media.jai.NullOpImage;
    import javax.media.jai.OpImage;
    import com.sun.media.jai.codec.SeekableStream;
    import com.sun.media.jai.codec.FileSeekableStream;
    import com.sun.media.jai.codec.TIFFDecodeParam;
    import com.sun.media.jai.codec.ImageDecoder;
    import com.sun.media.jai.codec.ImageCodec;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class Application1 {
    boolean packFrame = false;
    //Construct the application
    public Application1() {
    Frame2 frame = new Frame2();
    frame.setSize(820,700);
    //Validate frames that have preset sizes
    //Pack frames that have useful preferred size info, e.g. from their layout
    if (packFrame) {
    frame.pack();
    else {
    frame.validate();
    //Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height) {
    frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width) {
    frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setVisible(true);
    //Main method
    public static void main(String[] args) {
    new Application1();
    // Frame2 Class
    package untitled1;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.UIManager;
    import java.io.File;
    import java.io.IOException;
    import java.awt.Frame;
    import java.awt.image.RenderedImage;
    import javax.media.jai.widget.ScrollingImagePanel;
    import javax.media.jai.NullOpImage;
    import javax.media.jai.OpImage;
    import com.sun.media.jai.codec.SeekableStream;
    import com.sun.media.jai.codec.FileSeekableStream;
    import com.sun.media.jai.codec.TIFFDecodeParam;
    import com.sun.media.jai.codec.ImageDecoder;
    import com.sun.media.jai.codec.ImageCodec;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.*;
    import java.awt.image.renderable.ParameterBlock;
    import javax.media.jai.*;
    import javax.media.jai.widget.*;
    import com.sun.media.jai.codec.*;
    import java.util.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class Frame2 extends Frame {
    JPanel jPanel1 = new JPanel();
    JPanel jPanel2 = new JPanel();
    JButton loadButton = new JButton();
    public static ScrollingImagePanel panel, panels;
    JButton nextButton = new JButton();
    public String filename= "144.tif";
    public File file;
    public SeekableStream s;
    public ImageDecoder dec;
    protected int imageWidth, imageHeight;
    public int nextpage = 1;
    public RenderedOp image2 = null;
    public RenderedImage op = null;
    //Frame Constructor
    public Frame2() {
    try {
    jbInit();
    catch(IOException e) {
    e.printStackTrace();
    private void jbInit() throws IOException {
    this.setLayout(null);
    this.addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    this_windowClosing(e);
    jPanel1.setBackground(Color.white);
    jPanel1.setBorder(BorderFactory.createLineBorder(Color.black));
    jPanel1.setBounds(new Rectangle(1, 7, 816, 648));
    jPanel1.setLayout(null);
    jPanel2.setBackground(Color.lightGray);
    jPanel2.setBorder(BorderFactory.createLineBorder(Color.black));
    jPanel2.setBounds(new Rectangle(1, 657, 816, 42));
    loadButton.setText("Load");
    loadButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    try{                          
    loadButton_actionPerformed(e);
    catch(IOException IOE){
    System.out.println(IOE);
    nextButton.setText("Next");
    nextButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    try {
    nextButton_actionPerformed(e);
    catch(IOException IOE){
    System.out.println(IOE);
    this.setResizable(false);
    this.add(jPanel1, null);
    this.add(jPanel2, null);
    jPanel2.add(loadButton, null);
    jPanel2.add(nextButton, null);
    void this_windowClosing(WindowEvent e) {
    System.exit(0);
    //Load Image Button
    void loadButton_actionPerformed(ActionEvent e) throws IOException { 
    file = new File(filename);
    s = new FileSeekableStream(file);
    dec = ImageCodec.createImageDecoder("tiff", s, null);
    RenderedImage op =
    new NullOpImage(dec.decodeAsRenderedImage(),
    null,
    OpImage.OP_IO_BOUND,
    null);
    Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
    ParameterBlock params = new ParameterBlock();
    params.addSource(op);
    params.add(0.55F); // x scale factor
    params.add(0.335F); // y scale factor
    params.add(0.00F); // x translate
    params.add(0.00F); // y translate
    params.add(interp); // interpolation method
    image2 = JAI.create("scale", params);
    int width = (int)(image2.getWidth() * .73);
    int height = (int)(image2.getHeight() * .73);
    panel = new ScrollingImagePanel(image2, 819, 648);
    jPanel1.add(panel);
    this.setVisible(true);
    //Next Image Button
    void nextButton_actionPerformed(ActionEvent e) throws IOException {
    TIFFDecodeParam param = null;
    file = new File(filename);
    s = new FileSeekableStream(file);
    dec = ImageCodec.createImageDecoder("tiff", s, param);
    nextpage++;
    System.out.println(nextpage);
    RenderedImage op1 =
    new NullOpImage(dec.decodeAsRenderedImage(nextpage),
    null,
    OpImage.OP_IO_BOUND,
    null);
    Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
    ParameterBlock params = new ParameterBlock();
    params.addSource(op1);
    params.add(0.55F); // x scale factor
    params.add(0.335F); // y scale factor
    params.add(0.00F); // x translate
    params.add(0.00F); // y translate
    params.add(interp); // interpolation method
    image2 = JAI.create("scale", params);
    int width = (int)(image2.getWidth() * .73); //1.03);
    int height = (int)(image2.getHeight() * .73); //1.03);
    panels = new ScrollingImagePanel(image2, width, height);
    System.out.println(op1.getHeight());
    jPanel1.add(panels);
    this.setVisible(true);
    thanks in advance

    Take a look at this code.
    //Search the Policynumber
    void searchButton_actionPerformed(ActionEvent e) {
    try{
    nextButton.setEnabled(false);
    previousButton.setEnabled(false);
    String query = "SELECT * FROM PINFO WHERE POLICYNUMBER = '" +
    searchTextfield.getText().toUpperCase() + "'";
    ResultSet rs = Application1.stmt.executeQuery(query);
    while(rs.next()){
    pid = (rs.getInt("PID"));
    policynumber = rs.getString("POLICYNUMBER");
    firstName = rs.getString("FIRSTNAME");
    lastName = rs.getString("LASTNAME");
    jLabel2.setText(policynumber);
    jLabel3.setText(firstName);
    jLabel4.setText(lastName);
    catch(SQLException ex){
    System.err.println("SQLException: " + ex.getMessage());
    try{
    String query = "SELECT * FROM (UNMATCH U LEFT JOIN DOCUMENTTYPE D ON U.DOCUMENTTYPE=D.DOCNUMBER) WHERE PID = '" + pid + "' ORDER BY D.DOCUMENTCODE";
    ResultSet rs1 = Application1.stmt.executeQuery(query);
    clearJList();
    v.removeAllElements();
    jList1.setListData(v);
    v1.clear();
    while(rs1.next()){
    documentcode = rs1.getString("DOCUMENTCODE");
    uindex = rs1.getString("UINDEX");
    v.add(documentcode);
    v1.add(uindex);
    jList1.setListData(v);
    clearTextfield();
    catch(SQLException s){
    System.err.println("SQLException: " + s.getMessage());
    public void clearJList(){
    jList1.setListData(v);
    public void clearTextfield(){
    searchTextfield.setText("");
    // ****** Loads the selected Image
    void jList1_mouseClicked(MouseEvent e){
    try{
    vector.clear();
    nextpage = 1;
    currentpage = 1;
    nextButton.setEnabled(true);
    previousButton.setEnabled(false);
    if (spane != null)
    jPanel1.removeAll();
    seek = null;
    String query1 = "SELECT * FROM UNMATCH WHERE UINDEX = '" + v1.get(jList1.getSelectedIndex()).toString() + "'";
    rs2 = Application1.stmt.executeQuery(query1);
    while (rs2.next()){
    stream = rs2.getBinaryStream("IMAGE");
    seek = new MemoryCacheSeekableStream(stream);
    TIFFDecodeParam param = null;
    dec = ImageCodec.createImageDecoder("tiff", seek, param);
    try{
    totalPages = dec.getNumPages();
    jLabel1.setText("Page 1 of "+totalPages);
    if (nextpage==totalPages)
    nextButton.setEnabled(false);
    op1 =
    new NullOpImage(dec.decodeAsRenderedImage(nextpage-1),
    null,
    OpImage.OP_IO_BOUND,
    null);
    vector.addElement(op1);
    // ParameterBlock params = new ParameterBlock();
    // params.addSource(op1);
    // panel = new DisplayJAI(op1);
    panel = new DisplayJAI((RenderedImage)vector.elementAt(0));
    spane = new JScrollPane(panel);
    jPanel1.add(spane);
    jPanel1.validate();
    this.setVisible(true);
    catch(IOException dfs){
    } // while
    } // try
    catch(SQLException s){
    System.err.println("SQLException: " + s.getMessage());
    // Next Image
    void nextButton_actionPerformed(ActionEvent e) {
    try{
    if (spane != null)
    jPanel1.removeAll();
    ++nextpage;
    if (nextpage==totalPages)
    nextButton.setEnabled(false);
    previousButton.setEnabled(true);
    jLabel1.setText("Page " + nextpage +" of "+totalPages);
    TIFFDecodeParam param = null;
    dec = ImageCodec.createImageDecoder("tiff", seek, param);
    currentpage = nextpage;
    ParameterBlock paramblock = new ParameterBlock();
    paramblock.addSource(op1);
    vector.addElement(new NullOpImage(dec.decodeAsRenderedImage(nextpage-1),
    null,
    OpImage.OP_IO_BOUND,
    null));
    panel = new DisplayJAI((RenderedImage)vector.elementAt(currentpage-1));
    // panel = new DisplayJAI(op1);
    spane = new JScrollPane(panel);
    jPanel1.add(spane);
    setVisible(true);
    catch(IOException o){
    System.out.println(o);
    finally{
    // PreviousButton
    void previousButton_actionPerformed(ActionEvent e) {
    try{
    if (spane != null)
    jPanel1.removeAll();
    --nextpage;
    if (nextpage==1)
    previousButton.setEnabled(false);
    nextButton.setEnabled(true);
    jLabel1.setText("Page " + nextpage +" of "+totalPages);
    TIFFDecodeParam param = null;
    dec = ImageCodec.createImageDecoder("tiff", seek, param);
    currentpage = nextpage;
    vector.addElement(new NullOpImage(dec.decodeAsRenderedImage(nextpage-1),
    null,
    OpImage.OP_IO_BOUND,
    null));
    panel = new DisplayJAI((RenderedImage)vector.elementAt(currentpage-1));
    spane = new JScrollPane(panel);
    jPanel1.add(spane);
    setVisible(true);
    catch(IOException o){
    System.out.println(o);
    // Zoom ComboBox Item Select
    void jComboBox1_itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.DESELECTED)
    if (spane != null)
    jPanel1.removeAll();
    Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BICUBIC);
    ParameterBlock params = new ParameterBlock();
    params.addSource(op1);
    params.add(Float.valueOf(jComboBox1.getSelectedItem().toString()).floatValue()/100.0f);
    params.add(Float.valueOf(jComboBox1.getSelectedItem().toString()).floatValue()/100.0f);
    params.add(0.0F);
    params.add(0.0F);
    params.add(interp);
    // image2 = JAI.create("scale",params);
    vector.add(currentpage-1,JAI.create("scale",params));
    panel = new DisplayJAI((RenderedOp)vector.elementAt(currentpage-1));
    spane = new JScrollPane(panel);
    jPanel1.add(spane);
    jPanel1.validate();
    this.setVisible(true);
    repaint();
    // Rotate ComboBox Item Select
    void jComboBox2_itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.DESELECTED)
    if (spane != null)
    jPanel1.removeAll();
    type =null;
    type = transposeTypes[jComboBox2.getSelectedIndex()];
    ParameterBlock pb = new ParameterBlock();
    pb.addSource((RenderedImage)vector.elementAt(currentpage-1));
    pb.add(type);
    PlanarImage im2 = JAI.create("transpose", pb, renderHints);
    vector.add(currentpage-1,im2);
    panel = new DisplayJAI((RenderedOp)vector.elementAt(currentpage-1));
    spane = new JScrollPane(panel);
    jPanel1.add(spane);
    jPanel1.validate();
    this.setVisible(true);
    void printButton_actionPerformed(ActionEvent e) {
    print();
    protected void print() {
    PrinterJob pj = PrinterJob.getPrinterJob();
    pj.setPrintable(this);
    // PageFormat format = pj.pageDialog(pj.defaultPage());
    // Book bk = new Book();
    // bk.append(this,pj.defaultPage());
    // pj.setPageable(bk);
    if(pj.printDialog()){
    try{
    pj.print();
    catch(Exception e){
    System.out.println(e);
    else{
    System.out.println("Did Not Print Any Pages");
    public int print(Graphics g, PageFormat f, int pageIndex){
    if(pageIndex >= 1){
    return Printable.NO_SUCH_PAGE;
    Graphics2D g2d = (Graphics2D) g;
    g2d.translate(f.getImageableX(), f.getImageableY());
    if(op1 != null){
    double scales = Math.min(f.getImageableWidth()/ op1.getWidth(), f.getImageableHeight()/ op1.getHeight());
    g2d.scale(scales,scales);
    printImage(g2d, op1);
    return Printable.PAGE_EXISTS;
    else{
    return Printable.NO_SUCH_PAGE;
    public void printImage(Graphics2D g2d, RenderedImage image){
    if((image == null)|| (g2d == null)) return;
    int x = printLoc.x;
    int y = printLoc.y;
    AffineTransform at = new AffineTransform();
    at.translate(x,y);
    g2d.drawRenderedImage(image,at);
    public void setPrintLocation(Point d) {
    printLoc = d;
    public Point getPrintLocation() {
    return printLoc;

  • Please help-image problem (display)

    Can someone please help with this?
    I keep receiving an error (below) while trying to execute the code...
    2001-07-19 11:55:02 - Ctx( /dev ): IOException in: R( /dev + /servlet/getImage + null) Connection reset by peer: socket write error
    My setup is Tomcat 3.2
    JDBC: Oracle's classes12.zip
    JDK: Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
    Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
    I have copied my simple code below for review:
    package lmmfcd.images;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import org.apache.jasper.runtime.*;
    import java.beans.*;
    import org.apache.jasper.JasperException;
    public class getImages extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException
              //Grabs and assigns the PageContext
                   JspFactory _jspxFactory = null;
                   PageContext pageContext = null;
                   Object page = this;
                   _jspxFactory = JspFactory.getDefaultFactory();
                   pageContext = _jspxFactory.getPageContext(this, request, response,
                        "", true, 8192, true);
              //End of the PageContext Stuff
              Connection conn = (Connection)pageContext.findAttribute("conn");
                   try
                        ResultSet rset = null;
                        String queryCmd =
                                  "SELECT     image "+
                                  "FROM          sgps.images "+
                                  "WHERE          pn = '13507028' "+
                                  " AND          pic_num = '1' ";
                        Statement stmt = conn.createStatement();
                        rset = stmt.executeQuery(queryCmd);
                        rset.next();
                        Blob blob = null;
                        blob = rset.getBlob("image");
                        response.setContentType("image/jpeg");
                        byte[] ba = blob.getBytes(1, (int)blob.length());
                        System.out.println("just above OutputStream");
                        response.getOutputStream().write(ba, 0, ba.length);
                        response.getOutputStream().flush();
                        response.getOutputStream().close();                    
                   catch(SQLException e)
                        throw new ServletException("Problem");
    }

    It compiled okay, but still displayed the broken image as the result....
              if (rset != null)
                   try
                        BLOB blob = null;
                        blob = (BLOB)rset.getObject("image");
                        response.setContentType("image/jpeg");
                        InputStream in = rset.getBinaryStream("image");
                        //Have also used:
                        //InputStream in = blob.getBinaryStream();
                        OutputStream out = response.getOutputStream();
                        byte b;
                        while ((b = (byte)in.read()) != 1)
                             out.write(b);
                        in.close();
                        out.flush();
                        out.close();
                   catch(SQLException e)
                        throw new ServletException("Problem");
              }

  • Wallpaper problem with newly imported images. 1680x1050 displaying @840x525

    Hello,
    I imported some new images into Aperture and I want to use them as Desktop wallpapers for my computer. The images original size are 1680x1050 and they appear to retain they're size upon import.
    I then go to System Preferences -> Desktop and ScreenSaver and find my images in the project I placed them in. All my previous imported images that were imported many months ago still display fine however these new images are displaying 840x525! I know the exact size because after selecting the image I can drag its thumbnail view from the preview area.
    I then tried just specifying the folder in my hard drive where the images are located and the Desktop and Screensaver applet had no problem displaying the images at their original size 1680x1050 so I don't believe anything is wrong with them.
    I tried looking throughout Aperture if there was an import setting that could be affecting this but I didn't find anything. The only thing I've done recently was upgrade my system to 10.5.4 with the Software Update tool. Is there anything else that can be wrong here?
    Note: I tried using this wallpaper as well as still have the same issue, http://ironmanmovie.marvel.com/downloads/desktops/images/desk03_1680.jpg
    I would appreciate any insight to what can be causing my images to display smaller than they really are on my wallpaper. When viewing them in Aperture they are the correct size.
    Thanks,
    - Jake

    bump

  • Problem setting a new image to be displayed in JScrollPane

    Hi everyone,
    I'm having a problem with an image retrieval application I'm developing and basically the problem is when I run the application and search for an image, the image is found and displayed fine on screen using an instance of DisplayJAI (from the JAI packages). However, when I search for another image it clears the old image fine but doesn't display the new one. I though it might be a repaint issue because the SQL is correct but it simply clears the scrollPane of content and doesn't update it with the new image. Has anyone ever come across this problem before or have any ideas? Any help would be much appreciated, thanks.

    This is fixed by turning off the optimization..

  • Image is NULL exception, problems displaying a png file

    Hi people,
    I want to display a simple image using j2me on my siemens sl45i emu.
    I'm using the following code to load my png 8x8(created with photoshop, 2bpp) image:
    public void load()
    try
    testImage = Image.createImage("res/enemy1.png");
    catch (Exception e)
    System.err.print("Ladefehler: " + e);
    when I want to display the image using the follwing code:
    private void render(Graphics g)
    g.drawImage(testImage,0,0,0);
    g.drawString("**** you!", 0, 0, Graphics.TOP|Graphics.LEFT);
    I'm getting the following exception:
    java.lang.NullPointerException: Image is null.
    Why do I get this exception when I want to display the image and not when I'm loading the image(something like "couldn't load image..." )....
    I've placed enemy1.png in a folder called "res" in my jar file. Displaying text does work so I don't understand why I can't display an image...
    Any help would be great!
    Thanx in advance, alex

    This can't be possible!
    private void load()
         GameGraphics.getInstance().load();
         Player.getInstance().load();
    I'm printing debug messages in both load()-methods and I'm getting an exception in the player class because gamegraphics didn't finish loading (I can see it from the debugging messages)

  • Problems displaying an image on Adobe Reader 8.1.2

    Hi guys,
    We are trying to display a JPG image in an InteractiveForm. So, we set an Image (StaticImage) to be loaded using the following Formcalc script on Page Initialize event:
    StaticImage1.value.image.href = $record.ImageURL
    On our last project, we could display a JPG image with Adobe Reader 6 (with some alert messages), 7 and 8 (7 and 8 fully functional). But in this one, the same solution doesn't work. The unique difference between both solutions is the URL format. Last project displays an image based on a normal URL ("http://app.client.com/photo/1234.jpg"), and in the current project we create a PNG or JPG image based on a JFreeChart, generating an URL to access it ("http://server1:54321/webdynpro/resources/vendor.com/..(long)../graph43211234.jpg").
    When we load it using a computer with Adobe Reader 7.0.x installed, the bellow message is displayed requesting an action:
    "Acrobat is attempting to connect to the site:
    http://server1:54321/webdynpro/resources/vendor.com/..(long)../graph43211234.jpg
    If you trust the site click "Allow", otherwise click "Block".
    Possible actions: Block, Allow and a check "Remember my action for the site: server1"
    Allowing the connection, the images are displayed. But, in a machine with Adobe Reader 8.1.2 installed, sometimes it asks for permission to access the URL, sometimes not. And, in both cases, in this version it doesn't display the images...
    Can anyone shed any light on this? Also, is there a way to block this annoying message?
    Regards,
    Douglas Frankenberger
    P.S.:
    1 - The Image is not marked as Embedded. This option don't seems to make any difference, as on our last project the StaticImage was not flaged as Embed, but the JPG file was embeded in the PDF anyway...
    2 - Interactive Form display type: native. Mode: updateDataInPDF
    3 - In current project, when we set the same image the we had set on the old project, it loads successfully. Also, the generated JFreeChart image is fully accessible when displayed directly in IE using its URL.
    4 - Versions:
      - Client: Windows XP Professional
      - NWDS 7.0.10
      - Adobe Livecycle 7.0.50519.0
      - Adobe Reader: 7.0.8, 7.0.9 and 8.1.2

    Hi Amita.
    We already tried it (checked / unchecked), but it seems to make no difference. There is a strange behavion on this:
    - When I set it checked, on a computer disconnected from the web and running Adobe Reader 7.0.9, it asks for permission to access a resource (as I said before). In this case, even disconnected, it shows up my image independent of allowing/blocking the access to the external resource. In other words, it is embedded (I think...), but continues asking for access anyway.
    - The same scenery above, but using Adobe Reader 8.1.2 instead of 7.0.9.... sometimes it asks for permission, sometimes not. But in both cases, it doesn't display the images...
    Regards,
    Douglas Frankenberger

Maybe you are looking for

  • Switching a projector between mac monitor and blank screen...

    is it possible to switch the image projected by a digital projector between the screen i am seeing on my ibook and a blank/no-input style screen? i always used to be able to do this with a pc laptop. just so i can hide the screen from the audience te

  • Bug in SQL*Plus 9.2.0.1.0 with 8.1.6 instance.

    WARNING !!!! I just installed the client 9.2.0.1.0 but we are still using 8.1.6.3.8 databases on NT. There is a major BUG in SQL*Plus 9.2.0.1.0. If you do a select on a sys table that have a LONG column, SQL*Plus exits immediately !!! For example if

  • OS X LION and Time Capsule

    I have a 2TB Time Capsule (wi-fi), and cannot use it with OS X Lion!  It says the airport utility is not compatible with my operating system.  What do I do now?  Is there a solution to this issue?

  • Can i play dota 2 on macbook pro 13 inch?

    Hi im just wondering if i could play dota 2 on macbook pro 13 inch? Specs : ( my specs is just the default specs when i bought the laptop. Nothing has been chaged) 2.5 GHz Dual core i5 4gb ram 500 gb sata Another side question: What products at the a

  • Using iCloud on my work and home computer

    I'm loving the features of iCloud on Mountain Lion. What I would like to do is sign in on my work computer once I upgrade it to Mountain Lion as well so I can keep my safari tabs, reminders, messages etc synced. The only thing I'm worried about is wh