Class WritableRaster setPixels

i read the explanations give in the docs for setPixels in WritableRaster class
i could not understand iArray?
what is the use of it?
public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      int[] iArray)this is wat given in doc :
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
iArray - The input int pixel array.

to set a pixel its enough if we have the location of that pixel (x,y)
here a rectangle of size (w *h) located  at x,y
what does this mean : "Sets all samples for a rectangle of pixels from an int array containing one sample per array element."
http://java.sun.com/javase/6/docs/api/java/awt/image/WritableRaster.html#setPixels(int,%20int,%20int,%20int,%20int[])

Similar Messages

  • Image resize after form upload

    I've a form where it's possible to upload an image.
    Now I want to resize that image to a particular size.
    I can do the job at command line, but when I use that code into my jsp, it doesn't work!
    For Example:
    <%@ page import="java.awt.*" %>
    <%@ page import="java.awt.image.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="com.sun.image.codec.jpeg.*" %>
    <%
    String imageFrom = request.getParameter("from");
    String imageTo = request.getParameter("to");
    int finalwidth = 100;
    int finalheight = 140;
    Image img = getToolkit().getImage(originalImage);
    %>
    this is the error, 'cause it can't find the getToolkit() function:
    [ Method getToolkit() not found in class etc etc ]
    Any suggestion?

    Thanks for the post. I have tried what you suggested, and I am getting an error:
    java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
         at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:813)
         at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
         at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2135)
         at image0test_0process__jsp._jspService(/test.jsp:42)
    and line 42 corresponds to:
    float imgW = imgOp.getWidth() + 0.0f;
    and the server's system.out has:
    java.lang.ArrayIndexOutOfBoundsException
    at java.awt.image.SinglePixelPackedSampleModel.setPixels(SinglePixelPackedSampleModel.java:602)
    at java.awt.image.WritableRaster.setPixels(WritableRaster.java:445)
    at java.awt.image.WritableRaster.setRect(WritableRaster.java:367)
    at java.awt.image.WritableRaster.setRect(WritableRaster.java:321)
    at com.sun.media.jai.codecimpl.JPEGImage.<init>(JPEGImageDecoder.java:146)
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:51)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:89)
    at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:52)
    at java.lang.reflect.Method.invoke(Native Method)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1669)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:104)
    at java.lang.reflect.Method.invoke(Native Method)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1669)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:109)
    at java.lang.reflect.Method.invoke(Native Method)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1669)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:805)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
    at image0test_0process__jsp._jspService(_test__jsp.java:74)
    java.lang.reflect.InvocationTargetException: java.lang.RuntimeException: Unable to process image stream, incorrect format.
    at com.sun.media.jai.codecimpl.JPEGImage.<init>(JPEGImageDecoder.java:114)
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:51)
    at com.sun.media.jai.codec.ImageDecoderImpl.decodeAsRenderedImage(ImageDecoderImpl.java:148)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:135)
    at java.lang.reflect.Method.invoke(Native Method)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1669)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:109)
    at java.lang.reflect.Method.invoke(Native Method)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1669)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:481)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:805)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
    at image0test_0process__jsp._jspService(_test__jsp.java:74)
    Looking at that I would guess that the image is in the wrong format, but I have tried it with many different jpg files that otherwise work fine. Is there something missing from the code?
    Thanks.

  • Monitoring progress when performing filter operations on images

    Hi,
    I am working on Java2D and making some image filters using classes like ImageFilter etc. Now For simple filters I want to get the progress status while the filteting is in progress, so that I can show a progress bar in the GUI.
    For this I do not have much idea. I think we can use the ImageConsumer interface, so that if the class implementing that interface list itself as an image consumer with the filter operation. Here is two way I have tried implanting this:
    1st way:
    Class MyConsumer implements ImageConsumer
    int width,height;
    int percentProgress;
    Public image processImage(Image srcImage, ImageFilter filter){
    FilteredImageSource fis: new FilteredImageSource(srcImage.getSource(),filter());
    //should we do this?
    fis.addConsumer(this);
    //or this?
    srcimage.addConsumer(this)
    Image destImage = this.createImage(fis);
    return destImage;
    //implementing methods of imageConsumer
    //we get the width and height of the new destImage (or do we get the dimension of the srcImage here??)
    public void setDimensions(int width, int height){
    this.width=width;
    this.height=height;
    public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize){
    // Is this the correct way of obtaining the progress????
    progressPercent=(y*100)/height;
    //We also have empty implementation of other ImageConsumer methods after this
    --------------------------------------------------------------2nd way, let?s say we use a smooth filter and replace the processImage(..) method above with the one below (the other methods being same):
    Public image processImage(Image srcImage){
    float[] SHARPEN3x3 = {      0.f, -1.f, 0.f,
                                -1.f, 5.0f, -1.f,
                                0.f, -1.f, 0.f};
    BufferedImage dstbimg = new
                  BufferedImage(iw,ih,BufferedImage.TYPE_INT_RGB);
    Kernel kernel = new Kernel(3,3,SHARPEN3x3);
    ConvolveOp cop = new ConvolveOp(kernel,
                                    ConvolveOp.EDGE_NO_OP,
                                    null);
    //should we do this?
    dst.addConsumer(this);
    //or this?
    srcImage.addConsumer(this);
    cop.filter(srcImage,destImage);
    return destImage;
    }Now I do get a progressPercent. But when the percent is 100%, the destimage does not return, that means the operation is not yet complete.
    So is this the correctw ay, or is there any other way to know the progress of the flter operation.
    Also I extended the ImageFilter class and overrode its setPixel method as:
    public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize){
    int progressPercent=(y*100)/height;
    System.out.println("progress in image filter:"+progressPercent);
    //I simply print out the progress and let the super perform the filter operation
    super.setPixels(x, y,w, h, model, pixels, off, scansize);
    //should I do this below? This calls the imageconsumer's setpixels
    //that I implement in the MyConsumer class
    consumer. setPixels(x, y,w, h, model, pixels, off, scansize);
    }I observe that the setPixel method of MyImageFilter is called several times even for the same scan lines, and even after percentProgress is 100%, the process runs again for 2-4 times. So the filtering operation scans the lines several times to finally perform the filtering, and as such the percentProgress is incorrect.
    Can anybody guide me. Is this approach okay and needs to be modified a bit, or there is a different approach to obtain the progress from a filter operation?
    I would finally want the same progress from other operations like LookupOp, ConvolveOp, AffineTransformOp, ColorConvertOp, RescaleOp.
    Thanks in advance
    Tanveer
    DrLaszloJamf, are you there? I am sure you are one of them who can help me in this.
    anyone can send me a private message too at [email protected]

    Please somebody let me know how to get the progress of imagefilter operation using convolveOp.filter(...) or Filteredimagesource. I waant to display the progress i a JProgressbar.

  • Problem using byte indexed pixel format in setPixels method of PixelWriter

    I try to construct a byte array and set it to a WritableImage using PixelWriter's setPixels method.
    If I use an RGB pixel format, it works. If I use a byte-indexed pixel format, I get an NPE.
    The stride etc should be fine if I'm not mistaken.
    java.lang.NullPointerException
         at com.sun.javafx.image.impl.BaseByteToByteConverter.<init>(BaseByteToByteConverter.java:45)
         at com.sun.javafx.image.impl.General$ByteToByteGeneralConverter.<init>(General.java:69)
         at com.sun.javafx.image.impl.General.create(General.java:44)
         at com.sun.javafx.image.PixelUtils.getB2BConverter(PixelUtils.java:223)
         at com.sun.prism.Image$ByteAccess.setPixels(Image.java:770)
         at com.sun.prism.Image.setPixels(Image.java:606)
         at javafx.scene.image.WritableImage$2.setPixels(WritableImage.java:199)
    Short, self-contained example here:
    import java.nio.ByteBuffer;
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.image.ImageView;
    import javafx.scene.image.PixelFormat;
    import javafx.scene.image.WritableImage;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    public class IndexedColorTestApp extends Application {
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage primaryStage) {
            BorderPane borderPane = new BorderPane();
            Scene scene = new Scene(borderPane, 600, 1100);
            primaryStage.setScene(scene);
            ImageView imageView = new ImageView();
            borderPane.setCenter(imageView);
            primaryStage.show();
            int imageWidth = 200;
            int imageHeight = 200;
            WritableImage writableImage = new WritableImage(imageWidth, imageHeight);
            // this works
            byte[] rgbBytePixels = new byte[imageWidth * imageHeight * 3];
            PixelFormat<ByteBuffer> byteRgbFormat = PixelFormat.getByteRgbInstance();
            writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
                                                     byteRgbFormat, rgbBytePixels, 0, imageWidth * 3);
            imageView.setImage(writableImage);
            // this throws an NPE in setPixels()
            byte[] indexedBytePixels = new byte[imageWidth * imageHeight];
            int[] colorPalette = new int[256];
            PixelFormat<ByteBuffer> byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
            writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
                                                     byteIndexedFormat, indexedBytePixels, 0, imageWidth);
            imageView.setImage(writableImage);
    }If there's no solution, maybe someone knows a workaround? We chose to use indexed format because of data size / performance reasons.
    Edited by: Andipa on 01.03.2013 10:52

    You have found a platform bug, file it against the Runtime project at => http://javafx-jira.kenai.com with your sample code and a link back to this forum question.
    Byte indexed pixel formats seem like a feature which was never completely (or perhaps even hardly at all) implemented to me.
    The PixelFormat type your failed case is using is (PixelFormat.Type.BYTE_INDEXED):
    PixelFormat<ByteBuffer> byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
    System.out.println(byteIndexedFormat.getType());These are the valid PixelFormat types =>
    http://docs.oracle.com/javafx/2/api/javafx/scene/image/PixelFormat.Type.html
    BYTE_BGRA
    The pixels are stored in adjacent bytes with the non-premultiplied components stored in order of increasing index: blue, green, red, alpha.
    BYTE_BGRA_PRE
    The pixels are stored in adjacent bytes with the premultiplied components stored in order of increasing index: blue, green, red, alpha.
    BYTE_INDEXED
    The pixel colors are referenced by byte indices stored in the pixel array, with the byte interpreted as an unsigned index into a list of colors provided by the PixelFormat object.
    BYTE_RGB
    The opaque pixels are stored in adjacent bytes with the color components stored in order of increasing index: red, green, blue.
    INT_ARGB
    The pixels are stored in 32-bit integers with the non-premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.
    INT_ARGB_PRE
    The pixels are stored in 32-bit integers with the premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.As the native pixel format for a WritableImage is not the same as the pixel format you are using, the JavaFX platform needs to do a conversion by reading the pixels in one format and writing them in another format. To do this it must be able to determine a PixelGetter for your PixelFormat (the PixelGetter is an internal thing, not public API).
    And here is the source the determines the PixelGetter for a given PixelFormat type:
    http://hg.openjdk.java.net/openjfx/8/master/rt/file/06afa65a1aa3/javafx-ui-common/src/com/sun/javafx/image/PixelUtils.java
    119     public static <T extends Buffer> PixelGetter<T> getGetter(PixelFormat<T> pf) {
    120         switch (pf.getType()) {
    121             case BYTE_BGRA:
    122                 return (PixelGetter<T>) ByteBgra.getter;
    123             case BYTE_BGRA_PRE:
    124                 return (PixelGetter<T>) ByteBgraPre.getter;
    125             case INT_ARGB:
    126                 return (PixelGetter<T>) IntArgb.getter;
    127             case INT_ARGB_PRE:
    128                 return (PixelGetter<T>) IntArgbPre.getter;
    129             case BYTE_RGB:
    130                 return (PixelGetter<T>) ByteRgb.getter;
    131         }
    132         return null;
    133     }As you can see, the BYTE_INDEXED format is not handled and null is returned instead . . . this is the source of your NullPointerException.

  • ByteBuffer to BufferedImage over WritableRaster: Image is upside down

    Hey all!
    I have a native Buffer containing RGB-Values (3 bytes per Pixel). I found a Code-Sample in this Forum which works fine for me:
    [http://forums.sun.com/thread.jspa?messageID=10784665#10784665]
    The thing is, the BufferedImage is "Upside down". Is there a simple way to tell the Raster (or whatever) in which direction the buffer should be read?
    I don't wan't to use image transformation because of the time needed by CPU for the transformation.
    Best regards,
    Billie

    The BufferedImage is stored in a File (JPEG).
    The callback-Function is called from JNI and the ByteBuffer contains the RGB value's. This code creates my BufferedImage:
        private ByteBuffer buffer = null;
        private int[] bOffs = { 0, 1, 2 };
        private ColorModel colorModel =
            new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                new int[] { 8, 8, 8 },
                false,
                false,
                Transparency.TRANSLUCENT,
                DataBuffer.TYPE_BYTE);
         * Called within JNI
         * @param byteBuffer the native memory buffer
         * @param width the image with in pixels
         * @param height the image height in pixels
         * @param bitCount the number of bits per pixel
        protected synchronized void callback(ByteBuffer byteBuffer, int width, int height, int bitCount) {
            String method = "callback(ByteBuffer, int, int, int)";
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug(method, "byteBuffer="
                    + byteBuffer
                    + ",width="
                    + width
                    + ",height="
                    + height
                    + ",bitCount="
                    + bitCount);
            try {
                if (buffer == null) {
                    buffer = ByteBuffer.allocate(byteBuffer.capacity());
                buffer.position(0);
                buffer.put(byteBuffer);
                WritableRaster raster =
                    Raster.createInterleavedRaster(new DataBufferByte(buffer.array(), buffer.capacity()),
                        width,
                        height,
                        width * 3,
                        3,
                        bOffs,
                        null);
                bfImage = new BufferedImage(colorModel, raster, false, null);
            } catch (Exception e) {
                LOGGER.error(method, "Error createing BufferedImage", e);
            notify();
        }And this code stores the image on disk:
            ImageWriterSpi imageWriterSpi = (ImageWriterSpi) IIORegistry
                .getDefaultInstance()
                .getServiceProviderByClass(Class.forName(properties.getProperty(KEY_IMAGE_SPI))); // com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi
            imageWriter = imageWriterSpi.createWriterInstance();
                        imageWriter.reset();
                        imageWriter.setOutput(ImageIO.createImageOutputStream(new FileOutputStream(new File(
                            directory,
                            fileName + ".jpg"))));
                        imageWriter.write(null, new IIOImage(bufferedImage, null, null), imageWriteParam);The BufferedImage isn't touched between this two parts.

  • Class with param

    I have this code attach to Tree's iconfunction:
    private function treeIconFunction(item:Object):Class {
    return MyIconClass;
    package
    import mx.controls.Image;
    import flash.display.Sprite;
    import mx.core.BitmapAsset;
    import mx.core.*;
    public class MyIconClass extends Image
    [Bindable]
    [Embed(source="../../assets/icon.png")]
    public var icon0:Class
    public function MyIconClass():void {
    var color:int=0
    var i:BitmapAsset= new icon0() as BitmapAsset;
    for (var y:uint = 3; y < 6; y++) {
    for (var x:uint = 4; x < 9; x++)
    i.bitmapData.setPixel(x, y, color);
    this.source=i;
    My question is:
    How can send param (item) from treeIconFunction to
    MyIconClass?

    quote:
    Originally posted by:
    ntsiii
    I think you can send and argument through the constructor,
    but I don't think that is what you want.
    but when i do this:
    return MyIconClass(item.icon);
    i get: : Implicit coercion of a value of type MyIconClass to
    an unrelated type Class.
    quote:
    static function getIcon(whatever:somedatatype):Image?Class
    What mean this question mark? it is a bug?

  • Very strange behaviour of RGBImageFilter class

    Hi!
    I found very strange behaviour of RGBImageFilter class and problem is
    that I need to solve that problem :/ So, situation is next:
    I decided to use filtering process for collecting information about
    image. So, I extended my own class from RGBImageFilter and overwrite
    filterRGB( ... ) method ( everything is absolutely the same as in
    documentation ) and also added my own code for 'no matter what'.
    This code changes some class variable and my idea was to read those
    variables after filtering process end, but... Suddenly I realized that
    those variables, many times changed while filtering were performed
    ( I checked it ) after filtering gave the same value as in constructor!
    The only one clue and idea about what happened is that class instance
    were cloned and then executed, but thats not a functionality I was
    searching. :/ I made some example of that 'effect'.
    Image file name goes in command line.
    Please pay attention on -3 value on exit: Filtering works, count growing
    ( just uncomment setPixels() method to see it ) but, but...
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    class ToForum
         public static void main( String[] args )
              try
                   JFrame frame = new JFrame( "now i beleave in x-files!" );
                   frame.setDefaultCloseOperation( frame.DISPOSE_ON_CLOSE );
                   Toolkit kit = Toolkit.getDefaultToolkit();
                   Image origin = kit.getImage( args[0] );
                   RedBlueSwapFilter filter = new RedBlueSwapFilter();
                   Image filtered = frame.createImage( new FilteredImageSource( origin.getSource(), filter ) );
                   MediaTracker tracker = new MediaTracker( frame );
                   tracker.addImage( filtered, 1 );
                   tracker.waitForAll();
                   System.out.println( "AND WE GOT: "+filter.getCount()+" !!!" );
                   Container content = frame.getContentPane();
                   content.setLayout( new FlowLayout() );
                   JLabel label = new JLabel( new ImageIcon( filtered ) );
                   content.add( label );
                   frame.pack();
                   frame.setVisible( true );
              catch( Exception ex )
                   System.out.println( "Exception in main():\n"+ex );
    class RedBlueSwapFilter extends RGBImageFilter
         private int count=-5;
         public RedBlueSwapFilter()
              count = -3;
              canFilterIndexColorModel = true;
         // uncommenting this function will show that filterRGB method IS calling !!!
         // so, why then AFTER filtering count is still ( or again ??? ) equals to 0 ?
         public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
              System.out.println( "on entering in setPixels count="+count );
              super.setPixels( x, y, w, h, model, pixels, off, scansize );
              System.out.println( "on exiting from setPixels count="+count );
         public int filterRGB( int x, int y, int rgb )
              count++;
              return ( (rgb&0xff00ff00) | ((rgb&0xff0000) >> 16) | ((rgb&0xff) << 16) );
         public int getCount()
              return count;

    Cliff, Hi. I'm curious because this can't work. I have no problem synching with the exchange - as long as i accept the message that the certificate of the exchange (which is not the certificate of the exchange but the certificate of dig @reighthandsideofmailadress) is not valid (expired, wrong common name etc).

  • How do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA certfificate i can't open web pages with this, how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC CA certfificate i can't open web pages with this

    how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA ?

    Hi
    I am not suprised no one answered your questions, there are simply to many of them. Can I suggest you read the faq on 'how to get help quickly at - http://forums.adobe.com/thread/470404.
    Especially the section Don't which says -
    DON'T
    Don't post a series of questions in  a single post. Splitting them into separate threads increases your  chances of a quick answer.
    PZ
    www.pziecina.com

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

  • Previewing an image before uploading it using the FileReference class in flex 3

    Previewing an image before uploading it using the FileReference class in flex 3 ?

    hai,
              when this code is used in my application ,i got the name of image and new frame is added each time .But image is not displayed.....
    The code  starts like this
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()"   backgroundColor="white" width="100%" height="100%">
        <fx:Script>
    <![CDATA[ 
                    import mx.controls.Alert;
                    import mx.messaging.Channel;
                    import mx.messaging.ChannelSet;
                    import mx.messaging.channels.AMFChannel;
                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Image;
                    import spark.events.IndexChangeEvent;
                    import mx.managers.DragManager;
      <mx:DataGridColumn headerText="Dimension Value"  width="10" dataField="dimensionValue"/>
                                                   <mx:DataGridColumn headerText="Unit Nmae"  width="10" dataField="dimensionUnitName"/>
                                                   </mx:columns>
                                           </mx:DataGrid>
                                           <mx:Spacer width="2%"/>
                                       </mx:HDividedBox>
                                       </mx:VBox>
                   <mx:Spacer height="0"/>
                <mx:VBox width="100%">
                    <s:HGroup height="90" top="0" left="0" right="0" verticalAlign="justify" gap="10" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5">
                        <s:Button id="btn_loader" top="5" bottom="24" width="100" label="load" click="loadImages()"/>
                        <s:Group width="100%">
                            <s:Group name="cl" top="0" left="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/left.jpg')" top="0" left="0" bottom="0" right="0" fillMode="scale"/>   
                            </s:Group>
                            <s:List id="imgList" skinClass="skins.ListSkin" top="-3" left="27" right="28" bottom="10"
                                    dataProvider="{ImageCollection}" itemRenderer="Image_Render">
                                <s:layout>
                                    <s:HorizontalLayout gap="0"/>
                                </s:layout>
                            </s:List>
                            <s:Group name="cr" top="0" right="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/right.jpg')" top="-1" left="0" bottom="0" right="0" fillMode="scale"/>
                            </s:Group>
                        </s:Group>
                    </s:HGroup>
                    <s:SkinnableContainer id="dropCanvas" top="100" left="5" right="5" bottom="5" backgroundAlpha="1.0" alpha="1.0"
                                          dragEnter="dropCanvas_dragEnterHandler(event)"
                                          dragDrop="dropCanvas_dragDropHandler(event)" contentBackgroundColor="#914E4E" backgroundColor="#F7F7F7">
                    </s:SkinnableContainer>
                </mx:VBox>
                <mx:Spacer height="5"/>
                                      </mx:VDividedBox>
        </mx:Panel>
    </mx:Canvas>

  • Get the values from the bean class?

    Hi Praveen and all can u please suggest in this,
    I have developped an application In that Create One java class that Extends PageProcesscomponenet and utilizing the Bean That have the Connetion method and retriving the query Based on the Logon customer and spoof customer.
    this functionality I have developped in Pageprocessor component.
    The same functinality I am utilizing another java Class that Extends AbstractPortalcomponent  and utilizing the same Bean.
    But the problem both java classes for I used one Jsp only Dynmic spoof customer will come from the JSP Input filed.
    In the new Java Class How can I capture the Event When I click the Buttong the InputField value capturing into the AbstractPortalcomponent Class.
    I tried like this but It comes as Null Value.
    Event event = myContext.getCurrentEvent();
                              if(event!=null)
                                  InputField ip= (InputField) myContext.getComponentForId("spoofCust");
                                  String spoofCust=ip.getValue().toString();
    Please suggest me in this.
    What is wrong with this.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

    Lohitha,
    Try replacing your two lines of code:
    InputField ip= (InputField) myContext.getComponentForId("spoofCust");
    String spoofCust=ip.getValue().toString();
    with:
    InputField ip = (InputField) getComponentByName("spoofCust");     
    String spoofCust = ip.getValueAsDataType().toString();
    Let me know how that works for you.
    -John

  • Get the values from Exception class

    Hi all ..
    In class i have raised one exception
    when i catch this exception in my program i m able to get the
    error message but i need to get all the parameters that i pass
    when i raise the exception ...
    i have raised like this
          RAISE EXCEPTION TYPE cx_bapi_error
            EXPORTING
              textid = cx_bapi_error=>cx_bo_error
              class_name = 'ZHS_'
              log_no = wa_bapi_return-log_no
              log_msg_no = wa_bapi_return-log_msg_no
              t100_msgid = wa_bapi_return-id
              t100_msgno = wa_bapi_return-number
              t100_msgv1 = wa_bapi_return-message_v1
              t100_msgv2 = wa_bapi_return-message_v2
              t100_msgv3 = wa_bapi_return-message_v3
              t100_msgv4 = wa_bapi_return-message_v4
              STATUS = lt_status
    and caught the exception like this in my program
        CATCH cx_bapi_error INTO go_error.
          gd_text = go_error->get_text( ).
          EXIT.
      ENDTRY.
    in this i m just getting the class name which i have passed in exception
    i need all other parameters that i have passed ..
    if u have any idea pls let me know ..
    Thanks in advance ...

    Hello Jayakumar
    Usually the attributes of standard exception classes are defines as <b>public</b> and <b>read-only</b>. Thus, you should be able to use the following coding:
    DATA:
      go_error   TYPE REF TO cx_bapi_error.  " specific exception class !!!
    TRY.
    RAISE EXCEPTION TYPE cx_bapi_error
    EXPORTING
    textid = cx_bapi_error=>cx_bo_error
    class_name = 'ZHS_'
    log_no = wa_bapi_return-log_no
    log_msg_no = wa_bapi_return-log_msg_no
    t100_msgid = wa_bapi_return-id
    t100_msgno = wa_bapi_return-number
    t100_msgv1 = wa_bapi_return-message_v1
    t100_msgv2 = wa_bapi_return-message_v2
    t100_msgv3 = wa_bapi_return-message_v3
    t100_msgv4 = wa_bapi_return-message_v4
    STATUS = lt_status.
    CATCH cx_bapi_error INTO go_error.
    gd_text = go_error->get_text( ).
    WRITE: go_error->t100_msgid,  " perhaps the attributes have different name
                go_error->t100_msgno, " check attribute names in SE24
    EXIT.
    ENDTRY.
    Regards
      Uwe

  • Problem with setContentPane() in JFrame class

    I recently discovered a problem with the setContentPane method in the JFrame class. When I use setContentPane(Container ..), the previously existing contentPane remains in the stack. I have tried nullifying getContentPane(), and all manner of things, but, each time I use setContentPane, I have another instance of a JPanel in the stack.
    I'm using code similar to setContentPane(new CustomJPanel()); and each time the user changes screens, and a similar call to that is made, the old CustomJPanel instance remains in the stack. Can anyone suggest a way around this? On their own the panels do not take up very much memory, but after several hours of usage, they will build up.

    I tried what you suggested; it only resulted in a huge performance decrease. The problem with memory allocation is still there.
    Here is the method I use to switch screens in my app:
    public static void changeScreen (JPanel panel){
              try{
                   appFrame.setTitle("Wordinary : \""+getTitle()+"\"");
                   appFrame.setContentPane(panel);
                   appFrame.setSize(appFrame.getContentPane().getPreferredSize());     
                   appFrame.getContentPane().setBackground(backColour);
                   for (int i = 0; i < appFrame.getContentPane().getComponents().length; i++)
                        appFrame.getContentPane().getComponents().setForeground(textColour);
                   //System.out.println("Background colour set to "+backColour+" text colour set to "+textColour);
                   appFrame.validate();
              catch (Exception e){
                   //System.out.println("change");
                   e.printStackTrace();
    And it is called like this:
    changeScreen(new AddWordPanel());The instantiation of the new instance is what is causing the memory problems, but I can't think of a way around it.

  • Problem with Outer and Inner Classes....or better way?

    Right now I'm trying to create an Inner class.
    My .java file compiles ok, and I create my jar file too.
    But when I try to instantiate the Inner class, it fails:
    java.lang.NoClassDefFoundError: com/myco/vlXML/vlXML$vlDocument.
    Here's the class code:
    public class vlXML{
        private ArrayList myDocList=new ArrayList(); //holds documents
        public vlXML(){
        private class vlDocument{
            public vlDocument(){
            //stuff goes here
        public vlDocument vlDOC(){
            return new vlDocument();
        public void addDocument(){
            vlXML xxx=new vlXML();
            vlDocument myDoc=xxx.vlDOC();
            myDocList.add(myDoc);
        public int getNumDocs(){
            return myDocList.size();
    }Then, from a jsp page, I call:
    vlXML junk1=new vlXML();
    junk1.addDocument();...and get the error...
    Can someone help me figure out why it's failing?
    Thanks....

    You nailed it - thanks....(duh!)
    While I have your attention, if you don't mind, I have another question.
    I'm creating a Class (outer) that allows my users to write a specific XML file (according to my own schema).
    Within the XML file, they can have multiple instances of certain tags, like "Document". "Document"s can have multiple fields.
    Since I don't know how many "Documents" they may want, I was planning on using an Inner Class of "Document", and then simply letting them "add" as many as necessary (thus the original code posted here).
    Does that seem like an efficient (logical/reasonable) methodology,
    or is there there something better?
    Thanks Again...

  • JBO:33001 bc4j.xcfg file not found in class path

    Hi,
    I am yet another victim of the age-old error JBO:33001 bc4j.xcfg file not found in class path, When i have my BC4JApp.jar in Tomcat Web-inf/lib directory. All the other jar files and class files in my webserver-application web-inf classes and lib directory works.
    But Tomcat server is not able to read this bc4j.xcfg file. I can see in my jar file that this bc4j.xcfg exists and in the specified package directory. still the problem persists. My BC4JApp.jar is perfectly working when i use JDeveloper. but not when i use tomcat4.0 and call a JSP using BC4JApp.jar from browser (My environment is Jdeveloper3.2, Tomcat4.0+IIS in middle tier and oracle 8i as DB, everything on windows2k)
    I have gone through almost all the threads possible that relates to this error in this form. None of them have a answer except to say "put the file in classpath". and last reply is "will fix in jDeveloper 9i. So what happens to us who are working in Jdeveloper 3.2?
    1. I have this file in my jar file.
    2. I also tried creating a seperate directory manually, with the same name as my package under web-inf/classes, web-inf/lib , just under web-inf directory and atlast under approot directory also. I tried having my package directory containing bc4j.xcfg in these folders one at a time and also tried having this directory in all these folders at the same time.
    Still no solution.
    Itz frustrating that neither proper documentation nor a right url page nor i am aware of available addressing this. page links given in above threads only gives me the wonderful page of ie's "Page cannot be displayed".
    Is there a answer to this error and my problem. If this doesn't work, then i have to all the way develop from scratch creating my jsp using JDBC calls and Stored packages etc.
    I don't want to give up on this Jdeveloper at this final moment because if this bc4j.xcfg file is found, my application will work perfectly. on these final moments, if this doesn't work, i am frightened to imagine to develop my application in standard way. Atlast, if thatz the option left,we have to do that bcos our production date is close by.
    Please can some one in this forum or Jdeveloper help me to solve this problem. I am desperate and very urgent.
    Waiting for a reply from Jdev team very much...
    ( I just posted in the other thread which is pretty old, dated backto May 2001, which was relevant to this error. Just to make sure it is noticed, I am posting it seperately too)
    Thanks
    Hari(2/3/02)

    Hi All,
    For those who are following this thread, I got a solution for this error with the help of Jdev Team.
    This solution may work, if you have deployed your application in Tomcat4.0.1. This is the environment in which I work and tested.
    As you may be aware, Tomcat ignores value in CLASSPATH variable.
    To see any files that are existing or newly deployed, it has it own way of detecting it.
    Addition information on Tomcat working, you can follow this link,
    http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html
    Coming to point, Tomcat has got five classloaders and each classloader invoked, looks in their related directories for files in following order.
    1. /WEB-INF/classes of your web-application
    2. /WEB-INF/lib/*.jar of your web application
    3. BootStrap classes of your JVM (Tomcat's $JAVA_HOME/jre/lib/ext)
    4. System class loader classes($CATALINA_HOME/bin/bootstrap.jar,CATALINA_HOME/lib/tools.jar)
    5. $CATALINA_HOME/common/classes
    6. $CATALINA_HOME/common/lib/*.jar
    7. $CATALINA_HOME//classes
    8. $CATALINA_HOME/lib/*.jar
    So All your individual application related files should be deployed in your application's WEB-INF/classes or WEB-INF/lib directory accordingly.
    If your application files are unpacked, they should be deployed or copied under WEB-INF/classes directory
    if the files are within a jar, they should be under WEB-INF/lib directory.
    If your Jar-files contains bc4j components, then those jar files should be deployed under WEB-INF/lib directory. Also,do the next step to copy all relavant BC4J runtime libraries under lib directory.
    IMPORTANT: Please remember to copy and paste all the required BC4j runtime libraries in the Same WEB-INF/lib directory along with your application jar files. This is the real reason which can solve this JBO:33001 to disappear. It worked for me.
    To configure your directory for tag-lib uri's, use web.xml to set the taglib-uri attribute.
    Put your web.xml and DataTags.tld in the WEB-INF directory.
    Your simple web.xml may look like as follows.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
         <taglib>
              <taglib-uri>
                   /webapp/DataTags.tld
              </taglib-uri>
              <taglib-location>
                   /WEB-INF/DataTags.tld
              </taglib-location>
         </taglib>
    </web-app>
    You may then modify this web.xml to suit further requirements of your application.
    Remember to stop and restart the Tomcat Server (service) by using shutdown and startup scripts after updating any jar files/class files/ JSP or source files deployed in Tomcat.
    Sometimes, only this helps even though your context's reloadable attribute is set to true in Tomcat Server's server.xml file.
    Hope this above information helps you to solve this error in Tomcat environment. My Sincere thanks once again to Juan and Jdev team for their help and efforts to solve this problem.
    Thanks
    Hari

Maybe you are looking for