Problem of create an Image object ?

Dear all :
the following code does not work when i use it in the application rather than in the applet :
Image img = createImage(new MemoryImageSource(org_width,org_height,palette,0,org_width));
where org_width , org_height is an int , while palette is an int[] that contain the pixels data in an application .
So i then tried to create the ImageProducer object :
ImageProducer ip = new MemoryImageSource(org_width,org_height,palette,0,org_width);
But how can i create an Image object using the ImageProducer in an application ? Or any ways to create an Image object using the int [] pixel data in an application ?

Hi
I don't know if this is what your looking for, but I had the same problem, and it helped me, so why not try looking at it
http://forum.java.sun.com/thread.jsp?forum=31&thread=167305
Aagaard

Similar Messages

  • Problem in creating 1 image using differnt images

    Dear Fellows I want to create an image by using different images in byte array format. Images may be transparent or normal images. I want final result in byte array. I am using the following technique which is working fine but the problem with this technique is that it takes too much time to create an image. This is because I am using MediaTraker. If I delete the code of MediaTracker then program have undeterministic behavior i.e, sometimes it create the final image properly and sometimes nothing is displayed in final image.
    I need some help from you. If anyone of you know the technique to draw image using different images without using mediaTracker kindly let me know.
    Early replies will be appreciated
    // here is the sample code which i m using for creating image
    byte[] backgroundImage= // read 800 X 600 image from disk and convert it in to byte array
    byte[] image1 = // read 200 X 200 image from disk and convert it in to byte array
    byte[] transparentImage // read 300 X 300 transparent image from disk and convert it in to byte array
    Image img=null;
    Frame frame =new Frame();
    frame.addNotify();
    //creating BufferedImage object to store Final image
    BufferedImage requiredImage= new BufferedImage(800,600,BufferedImage.SCALE_SMOOTH);
    //get Graphics of BufferedImage created above
    Graphics2D g=(Graphics2D) requiredImage.getGraphics();
    ///// begin draw back ground image
    img=Toolkit.getDefaultToolkit().createImage(backgroundImage);
    try
    MediaTracker mt = new MediaTracker(frame);
    mt.addImage(img, 0); // adds image with ID 0
    mt.waitForID(0);
    }catch(Exception myex)
    myex.printStackTrace();
    //draw background starting from x=0, y=0 with 800 X 600 dimentions
    g.drawImage(img,0,0,800,600,null);
    ////////// end draw background image
    ////////// begin draw image1
    img=Toolkit.getDefaultToolkit().createImage(image1);
    try
    MediaTracker mt = new MediaTracker(frame);
    mt.addImage(img, 0); // adds image with ID 0
    mt.waitForID(0);
    }catch(Exception myex)
    myex.printStackTrace();
    //draw image1 starting from x=10, y=10 with 200 X 200 dimentions
    g.drawImage(img,10,10,200,200,null);
    //////////// end draw image1
    //////begin transparentImage
    img=Toolkit.getDefaultToolkit().createImage(backData);
    try
    MediaTracker mt = new MediaTracker(frame);
    mt.addImage(img, 0); // adds image with ID 0
    mt.waitForID(0);
    }catch(Exception myex)
    myex.printStackTrace();
    //draw transparentImage starting from x=400, y=0 with 300 X 300 dimentions
    g.drawImage(img,400,0,300,300,null);
    ///end draw transparent image
    byte []finalResult = //convert requiredImage into byte array;
    you can mail me the solution on my email address [email protected]
    thanks with best regards
    and waiting for someone to reply
    kamran zameer

    is there anyone on this forum to help me??????
    regards,
    kamran zameer

  • Problem in creating a callable object of type Business Logic

    Hi SDN,
    I am trying to create a callable object of type Business Logic in CE.
    When I give all information and click Next, I get this error message.
    Error while loading configuration dialog: Failed to create delegate for component com.sap.caf.eu.gp.ui.co.CExpConfig. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
    Can anybody help me out with this problem.
    Regards,
    Sumangala

    Hi.
    I'm having the same problem as Senthil in NW2004s SP15 with my application service and methods not showing up in the Callable Object wizard for Composite Application Services after I choose the Endpoint.  The only application name that shows up in the wizard is caf.tc, and the only service names that show up for it are LDDataAccessor, Metadata, and PropPermissionService.
    My IDE is on one machine and the application server I deploy to is located on a different machine.  My endpoint to the remote application server looks to be correctly configured.  The Composite Application Service seems to be deployed properly as I'm able to see it and test that it works in the Web Services Navigator <http://remotehost:50000/wsnavigator/>
    My deployed application service is a remote enabled service and is also web services enabled as well.
    I'm not sure if this is relevant, but I noticed that the generated Java code does not create any remote EJB interfaces (only home and local interfaces were generated).
    Something else I noticed is that when I proceed to the External Service Configuration -> Business Entities screen <http://remotehost:50000/webdynpro/dispatcher/sap.com/cafUIconfiguration>, I only see three business entities displayed, and the following error message is displayed: "Corrupt metadata has been detected. This may prevent some objects from being displayed. Check the server log for more details."  I was unable to find anything in the instance log files.  Is the error message indicative of the problem?
    I am developing locally without a NetWeaver Development Infrastructure (NWDI) in place.
    I'm wondering if the credentials specified in the endpoint require any special roles or privileges.
    Senthil, do any of these additional descriptions apply to you as well?
    Edited by: Ric Leeds on Jun 20, 2008 4:37 PM

  • VBA: problems in creating and storing objects in array with loop

    I created a Class named Issue. Then I created a function that creates Issue objects, set their properties with data from a worksheet and store them into a variant array through a loop. the problem is that everytime that the loops runs it overwrites the properties
    of the same object instead of creating a new object, setting its properties. Would anyone know how to solve that? The loop code goes below:
     'Stores all the Issues objects in an Array
    Function StoreAllIssues() As Variant
    Dim IssuesSheet As Worksheet
    Set IssuesSheet = Sheet1
    Dim intLastRow As Integer
    intLastRow = Uteis_Jorge.LastRowFunc(IssuesSheet, 1)
    Dim IssuesArray() As New Issue: ReDim IssuesArray(0)
    For i = 2 To intLastRow
        Dim MyIssue As New Issue
        MyIssue.IssueName = IssuesSheet.Cells(i, 1)
        MyIssue.Suggestion = IssuesSheet.Cells(i, 2)
        MyIssue.Priority = IssuesSheet.Cells(i, 3)
        MyIssue.Resolution = IssuesSheet.Cells(i, 4)
        MyIssue.JobStatus = IssuesSheet.Cells(i, 5)
        MyIssue.AssignedTo = IssuesSheet.Cells(i, 6)
        Set IssuesArray(i - 2) = MyIssue
        ReDim Preserve IssuesArray(i - 1)
    Next i
    ReDim Preserve IssuesArray(i - 3)
    StoreAllIssues = IssuesArray
    End Function
    Jorge Barbi Martins ([email protected])

    Hi Jorge,
    You can set the MyIssue to Nothing every time you don't use the MyIssue object, in this way, the array will properly store the new MyIssue object:
    For i = 2 To intLastRow
    Dim MyIssue As New Issue
    MyIssue.IssueName=IssuesSheet.Cells(i,1)
    Set IssuesArray(i - 2) = MyIssue
    ReDim Preserve IssuesArray(i - 1)
    Set MyIssue = Nothing
    Next i
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problem in creating No. Range Object

    HI All,
    I have one ztable ZDESIGN having fields
    NFDESIGN
    DEPT
    MACH_TYPE
    MATNR
    CODE
    CUST_NM
    MACH_NO
    MAKTX
    NETWORK_NO
    QTY
    MOD_CODE
    STATUS
    DVER
    IMPL
    PART_ST
    RELBY
    RELDT
    i want to store the number in code field on save. but i want to add many records at one time.
    while creating number range object(SNRO) , foll error is coming
    Table ZDESIGN may have only the no.range el.field and the subobject as a key
    how create number range object.
    Thanks

    Hi Kushi,
    Number ranges are not meant for initialization.
    you need to use subobjects which allows you to create number range values for example based on the month.
    you need not to increase the number every time.
    the FM gives you increased number every time.
    as i said earlier create entries in SCARR table. carrid values like 01 02 03 04 -- 10 11 12 ETC.
    12 sub objects for 12 months.
    then go to SNRO tcode and create the values for each month.
    in the program
    data date type sy-datum.
    month(2)  type c.
    month = sy-datum+3(2) will give you the current month.
    pass this to the FM NUMBER_GET_NEXT
    along with other parameters.
    hope this is clear to you.
    regards
    Ramchander Rao.K

  • Having problems burning/creating disc image in iDVD 6

    I am currently experience new problems trying to burn or create a disc image in iDVD 6. I have successfully burned iDVD projects in the past with the same computer/iDVD 6. The iDVD project looks like it is processing normally, even creates a labled disc image- but when you click on it, it reads "My Great DVD", and the video and audio files are also unreadable or absent- the error message for the VIDEO_TS.VOB file I pulled up read, "There is no default application specified to open the document "VIDEO_TS.VOB".
    My older son just got Toast 7 Titanium for me, so I have that resource. I also just bought extra memory to bring me up to 1.25 GB, and an external hard drive with 320 GB. I have a younger son and a friend who will need me to make a dance audition DVD for a CA college dance department that must be in So Cal by 1-19-07, so you can imagine I'm getting a bit nervous about this. I have verified permissions, reinstalled iDVD from the original, and re-done the original iMovie/iDVD project that first caused the problems- a 12.8 GB project (but have not re-done things since I got more memory on my computer). I don't know how big the audition DVD's will be, but estimate they won't be that big (hopefully), but will consist of many short clips/chapter headings. I know just enough about computers to know what I don't know, so would really, really appreciate some basic help!

    My Great DVD", and the video and audio files are also unreadable or absent- the error message for the VIDEO_TS.VOB file I pulled up read, "There is no default application specified to open the document "VIDEO_TS.VOB".
    I don't know what you expect. You're looking for a problem where there isn't one.
    The AUDIO_TS folder SHOULD be empty and (unless you've installed spercial software) you WON'T have any application to open the VIDEO_TS.VOB.
    If you want to play the disk image, open Apple's DVD player application and then use it to open the VIDEO_TS folder.
    This Burning a disk image file on a CD or DVD in Mac OS X at http://docs.info.apple.com/article.html?artnum=93006 is how you burn the disk image you have to writable media.

  • Problem in creating time series objects for a planning area

    Hi Friends,
    I am working on SCM 4.0 APO. I am trying to create the time  series objects for a  'Z'planning area which i have created. This Planning area is linked to a planning object structure which contains only three characteristics 9amatnr,9alocno & zplnpart. But the creation of time series objects is taking a long time. the screen just remains the same.
    Can anybody encountered such a problem any time?
    request you all to put some light as what could be wrong or causing the delay in creating them???
    All helpfull answers will be suitably rewarded.
    Thanks
    mvd

    Hi mv d,
    I have a couple of questions:
    1) how many Key Figures does your planning area have?
    2) what is the length of your time series horizon?
    3) how many characteristic combinations are currently in the Planning Object Structure? and how many newly character
    I am asking because these aspects might affect the running time of the time series creation. Have you also tried creating the time series in the background? How long did it take there?

  • Problems With Creating Group of Objects from a Collection

    Hi, please kindly help.
    I have a Collection. Its name is "activities". It is a collection of the Activity object with "color" as one of the attributes. I am writing a method and takes "activities" as a parameter (see below). The method is supposed to group "activities" by "color" and return a Collection called "activitiesGroups". And I have created an "activitiesGroup" (note: singular not plural) class with the getters and setters of all its attributes.
    I first sorted the "activities" by color. So far so good. Thereafter, I am iterating through this sorted list. If activity.getColor().trim() is tested different, I know that a new group, i.e., activitiesGroup, should be created and I should code activitiesGroups.add( activitiesGroup );Problems are:
    1. If I am at the first record of the sorted collection while iterating, I do not what to add a new group to the returned List activitiesGroups. I want to greate a new group only.
    Because "colorString" is initialized as a blank, when I code activitiesGroups.add( activitiesGroup );, I depend on that I am not at the first record of the sorted collection by testing if colorString.length(); is not a zero. I do not think it is the correct way to do it.
    What is the proper way of knowing I am at the first record of the sorted collection while iterating?
    2. I have to sum up two of the attributes of the ActivitiesGroup object: increaseToValue and decreaseToValue. While iterating, I repeat for each record within a group:
    aGroup.setIncreaseToValue( increase );
    aGroup.setDecreaseToValue( decrease ); How do I avoid the repetition?
         private Comparator colorComparator;
         private List activitiesGroups;
         private ActivitiesGroup aGroup;
         private String colorString = "";
         private String nextColorString = "";
         private BigDecimal increase;
         private BigDecimal decrease;               
         public List groupingByColor( List activities ) {
              if ( activities == null) {
                   return new ArrayList(0);
              if ( !activities.isEmpty() ) {
                   Collections.sort( activities, colorComparator);  // It works.
                   activitiesGroups = new ArrayList();
                   Iterator it = activities.iterator();
                   while ( it.hasNext() ) {
                        Activity activity = ( Activity )it.next();
                        nextColorString = activity.getColor().trim();                    
                        if ( !nextColorString.equalsIgnoreCase( colorString.trim() ) ) {
                             int length = colorString.length();
                             if ( length != 0 ) { activitiesGroups.add( aGroup ); } // Problem # 1
                             aGroup = new ActivitiesGroup();
                                                              aGroup.setColor( activity.getColor() );
                             increase = increase.add( activity.getIncreaseToValue() );
                             decrease = decrease.add( activity.getDecreaseToValue() );
                             aGroup.setIncreaseToValue( increase ); // Problem #2: repeated for every record in a group
                             aGroup.setDecreaseToValue( decrease ); // Problem #2: repeated for every record in a group
                        } else {
                            increase = increase.add( activity.getIncreaseToValue() );
                            decrease = decrease.add( activity.getDecreaseToValue() );
                            aGroup.setIncreaseToValue( increase ); // Problem #2: repeated for every record in a group
                            aGroup.setDecreaseToValue( decrease );      // Problem #2: repeated for every record in a group                         
                                                                    colorString = nextColorString;
              return activitiesGroups;
         }

    I first sorted the "activities" by color. So far so good. Thereafter, I am iterating through this sorted list. If activity.getColor().trim() is So in fact you are not dealing with an arbitrary Collection (as you stated in the first place), you are dealing with a List.
    You should know that there is a way to do this just with an iterator on an arbitrary collection - without needing to sort your list, and do it in O(n) time.

  • How to create a Image object from action script

    I need to set the back ground of charting dynamically, thus I need to create Image from a png/gif files. I have wrritten following code, but doesn't work.
    public function addBackground():void
        var cbg:ChartBackground=new ChartBackground();
        var bgs:Array=new Array();
        bgs.push(cbg);
        lineChart.backgroundElements=bgs;     
    package arubaUI
        import mx.controls.Image;
        [Embed(source="../assets/chart_16.png")]   
        public class ChartBackground extends Image
    Does any one knows how to do that?
    Thanks!

    I put the code like and got compile error:
    public class ArubaLinePanel extends Panel
      private var lineChart:LineChart;
      private var lineData:ArrayCollection=new ArrayCollection( [
                { Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 },
                { Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 },
                { Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 },
                { Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 },
                { Month: "May", Profit: 2400, Expenses: 575, Amount: 500 } ]);
      public function ArubaLinePanel()
            super();           
            lineChart=new LineChart();
            lineChart.dataProvider=lineData;
            lineChart.showDataTips=true;
            var axisX:CategoryAxis=new CategoryAxis()
            axisX.categoryField="Month";
            lineChart.horizontalAxis=axisX;
            var seriesArray:Array = new Array();
            var ls:LineSeries=new LineSeries();
            ls.yField="Profit";
            ls.displayName="Profit";
            seriesArray.push(ls);
            lineChart.series=seriesArray;
            this.addChild(lineChart);
            var legend:Legend=new Legend();
            legend.dataProvider=lineChart;
            this.addChild(legend);       
            addBackground();
    public function addBackground():void
        var cbg:ChartBackground=new ChartBackground();
        var bgs:Array=new Array();
        bgs.push(cbg);
        lineChart.backgroundElements=bgs;     
    Another method I tried:
    package arubaUI
        import mx.controls.Image;
        [Embed(source="../assets/chart_16.png")]   
        public class ChartBackground extends Image
    There is no compile error, but image is not show on screen,
    Thanks!
    April

  • Problem with creating a new object

    It's my stupid simple code:
    class Readers {
         int i, a;
    public     Readers(int i, int a){
    public static void main(String[] args) {
    Readers[] d = new Readers[5];
    d[4] = new Readers(2,2);
    System.out.println(+d[4].i);
    Why do I get the answer 0, instead of 2?

    See the comments in your code:
    class Readers {
        int i, a; // the global variables 'i' and 'a' are both initialized with zero
        public Readers(int i, int a){
            // the local values 'i' and 'a' are lost: you don't do anything with them!
        public static void main(String[] args) {
            Readers[] d = new Readers[5];
            d[4] = new Readers(2,2);
            System.out.println(d[4].i);
    } // note that you don't need semi-colons after a '}'

  • Problems to create new object!

    Hello,
    I have a problem to create a new object in OracleLite 9i.
    I'm using okapi to do this, but the value of the numeric fields isn't the expected.
    In msql the field is number(10,0). I'm trying to insert a ok4B.
    Anybody can help me?

    I found the problem.
    It occurs when I use a number(x,y), where x &gt; 9 or Y &gt; 0.
    I made a workaround to solve this problem. This is simple, I just convert the field number to char in the Snapshot of the Wtgpack

  • From an image field to an image object...?

    Hello everyone,
    Since the image field will always be in the front I have a problem. I want the user to choose an image. This image should be in the background but after having chosen the image it appears in the front covering every other object.
    So what I'm thinking about is creating an image object for the background and a small image field where the users choses his image. The chosen image should then appear in the image object in the background.
    I tried it with javascript but it didn't work. I had success with textfields trying something similar, but now I have no clue about it.
    Does anybody know how to realize this?
    Thanks, Knud

    Hi Stefan,<br /><br />Thanks for responding to my last mail. I am talking about the XFA(xml form architecture). Actuallly i am working on Picture form field in PDF which Adobe has newly introduced. In this type of form field , user can add an image. But i am not able to differentiate between the "Picture form field" and "push button". The only thing i have found that the picture form field entry exist in dataset but not the Push button.<br /><br />29 0 obj<br /><<<br />/Length 13533<br />>><br />stream<br /><xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><xfa:data><form1><IMAGE href="" xfa:contentType="image/jpg"></IMAGE></form1></xfa:data></xfa:datasets><br />endstream<br />endobj<br /><br />In the above case the "Image" is a picture form field.<br /><br />Another difference i found between "push Button" and "Picture Form Field" is the MK dictionary as below.<br /><br />Pushbutton<br />-----------<br />/MK <<<br />/BG [ 0.831375 0.815689 0.784317 ]<br />/CA (Print Form)<br />/BC [ 0 0 0 ]<br />>><br /><br />Picture form Field<br />-------------------<br />/MK <<<br />/TP 1<br />/I 17 0 R<br />>><br /><br />But i want to find the exact difference. May be some bit in Form Field Flag(ff) signify the picture form field. It will be very helpful to me if you could tell me the exact difference.<br /><br />Kind Regards,<br />Shekhar Kumar Keshri

  • Load jpg in image object

    Hi, i'm trying to create an image object from a jpg file:
    public static void main(String[] args)
    Image img;
    Toolkit t;
    t = Toolkit.getDefaultToolkit();
    img = t.getImage("C:\\Documents and Settings\\m.lipreri\\Desktop\\ciao.jpg");
    System.out.println("img: "+img.toString());
    Frame f = new Frame("Es1_Im");
    ImageFrame IM = new ImageFrame(f,img);
    IM.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e){
    System.exit(0);
    IM.setSize(500,400);
    IM.setVisible(true);
    class ImageFrame extends Frame{
    Frame f;
    Image im;
    //costruttore
    ImageFrame(Frame f,Image im){
    this.f = f;
    this.im = im;
    public void paint(Graphics g){
    g.drawImage(im,0,0,this);
    }but this code doesn't show me anithing in the applet, the image path is right, i've tried to past the path in my browser and i can see the image.
    thnx

    Images get loaded asynchronously, so the image
    probably isn't loaded completely when you try to
    display it. See java.awt.MediaTracker or use
    javax.swing.ImageIcon for loading.I could be wrong, but isn't that the ancient way of doing it? I haven't used MediaTracker in ages. Just use ImageIcon. It's the easist way I know to work with images.

  • Script to Assign an image to an image object

    Hi,
    I am using FormCalc and and created an image object in my form to which I would like to assign an image based on a user selection in another drop down field. In other words, a script is attached to the drop down field that selects (perhapse using file location) the image that is displayed in the image object based on the user selection. I would greatly appreciate help on the FormCalc syntax to achieve this. Thanks

    You might want to ask this in the LiveCycle Designer forum here, if you haven't already.

  • UNC path on creating Image object

    If I have an image file on a share of another computer such as \\machine\share\image.jpg and I want to use
    Image img = toolkit.getImage(???);
    to get the file, what should I put in?
    Thanks
    Andy

    Bear in mind that '\' denotes an escape sequence, so a backslash character in a String/char literal becomes "\\". If you're having problems getting getImage(String) to work, try creating a File object (you can check if you can access the resource using File.exists()), then get a URL from that.

Maybe you are looking for

  • Chars in columns for Input Ready query

    Hi Hope every body is just doing fine. I am puzzled with following doubt when compare BPS layout builder to IP input ready report. Please help me to clear some smoke here. We have a simple input ready query to enter some values in the key figure for

  • Normal Save As Window

    It's kind of a pain to have to hit browse every time just to get to the normal windows Save As window. In this particular instance, I'm working on a daily radio show and I would normally Save As and just start typing the date for the name (201111 wou

  • Siebel 7.8 Windows 2008 Server

    All, I am trying to install Siebel 7.8 on Windows 2008 server with SQL 2008 DB. I looked up the compatibility and it says something about Binary Compatibility Support: [http://download.oracle.com/docs/cd/E11886_01/V7/CORE/SRSP_78/SRSP78_ServerEnv3.ht

  • Do you need to have Adobe Acrobat X or XI in order to use FormsCentral?  Can FormsCentral be used without Acrobat to create and modify forms?

    Do you need to have Adobe Acrobat X or XI in order to use FormsCentral?  Can FormsCentral be used without Acrobat to create and modify forms?

  • Iphone sdk 3.2 wont download after 2.35 gb

    hi i am downloading iphone sdk 3.2 it says 3hours and 20 minutes required to complete 2.31 gb but downloads get beyond 2.31 gb to 2.35 gb and after that it hangs and when i stopped it and resume it again then it says no server connection for that,the