Plz Help me in Image & BufferedImage conversion

Hello Every One,
I want to convert a Image object to one of its subclass BufferImage
Direct conversion is not allowed.
Image i;//
BufferedImage bi;
bi = (BufferedImage)i;
This is run time exception.
Please Tell me how can i perform this conversion.
Thanx in Advance.

As this FS seems to be for lingerie company "Victoria's Secret" could points be converted to underwear instead of t-shirts?
Tip: If you're going to post an entire spec you may want to remove the customer's name first.

Similar Messages

  • Conversion Routine... plz help

    Dear Gurus,
    There is a text field in R3 called as SGTXT related to some finance table... some of the records in this field directly start with '#' character and then the details.. Well here is the problem.. I m loading to ODS 0FIAR_O04 and it ends up in error due to the above mentioned problem.. the infoobject which carry the data from SGTXT field is 0POSTXT...
    I decided to go for a conversion routive in transfer rule for this field.. but i dont know how to write routines.. can you plz help me with the steps as well as the code to remove '#' from SGTXT.... Thanks.
    For more help i m attaching the conversion routine with is automatically generated by system... only i hv to add code to remove '#' character... kindly go thru it and suggest me where to add and what to add...
    here it is
    PROGRAM CONVERSION_ROUTINE.
    Type pools used by conversion program
    TYPE-POOLS: RS, RSARC, RSARR, SBIWA, RSSM.
    Declaration of transfer structure (selected fields only)
    TYPES: BEGIN OF TRANSFER_STRUCTURE ,
    InfoObject 0POSTXT: CHAR - 000050
    SGTXT(000050) TYPE C,
    END OF TRANSFER_STRUCTURE .
    Global code used by conversion rules
    $$ begin of global - insert your declaration only below this line -
    TABLES: ...
    DATA: ...
    $$ end of global - insert your declaration only before this line -
    FORM COMPUTE_POSTXT
    Compute value of InfoObject 0POSTXT
    in communication structure /BIC/CS0FI_AR_4
    Technical properties:
    field name = POSTXT
    data element = /BI0/OIPOSTXT
    data type = CHAR
    length = 000060
    decimals = 000000
    ABAP type = C
    ABAP length = 000120
    reference field =
    Parameters:
    --> RECORD_NO Record number
    --> TRAN_STRUCTURE Transfer structure
    <-- RESULT Return value of InfoObject
    <-> G_T_ERRORLOG Error log
    <-- RETURNCODE Return code (to skip one record)
    <-- ABORT Abort code (to skip whole data package)
    FORM COMPUTE_POSTXT
    USING RECORD_NO LIKE SY-TABIX
    TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
    G_S_MINFO TYPE RSSM_S_MINFO
    CHANGING RESULT TYPE /BI0/OIPOSTXT
    G_T_ERRORLOG TYPE rssm_t_errorlog_int
    RETURNCODE LIKE SY-SUBRC
    ABORT LIKE SY-SUBRC. "set ABORT 0 to cancel datapackage
    $$ begin of routine - insert your code only below this line -
    DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
    RESULT = .
    returncode 0 means skip this record
    RETURNCODE = 0.
    abort 0 means skip whole data package !!!
    ABORT = 0.
    $$ end of routine - insert your code only before this line -
    ENDFORM.
    FORM INVERT_POSTXT
    Inversion of selection criteria for InfoObject 0POSTXT
    This subroutine needs to be implemented only for SAP RemoteCubes
    (for better performance) and for the Report/Report Interface
    (drill through).
    --> I_RT_CHAVL_CS Ranges table for current InfoObject
    --> I_THX_SELECTION_CS Selection criteria for all other InfoObjects
    <-- C_T_SELECTION Selection criteria for fields of
    transfer structure
    <-- E_EXACT Flag: Inversion was exact
    FORM INVERT_POSTXT
    USING I_RT_CHAVL_CS TYPE RSARC_RT_CHAVL
    I_THX_SELECTION_CS TYPE RSARC_THX_SELCS
    CHANGING C_T_SELECTION TYPE SBIWA_T_SELECT
    E_EXACT TYPE RS_BOOL.
    $$ begin of inverse routine - insert your code only below this line-
    DATA:
    L_S_SELECTION LIKE LINE OF C_T_SELECTION.
    An empty selection means all values
    CLEAR C_T_SELECTION.
    L_S_SELECTION-FIELDNM = 'SGTXT'.
    Selection of all values may be not exact
    E_EXACT = RS_C_FALSE.
    $$ end of inverse routine - insert your code only before this line -
    ENDFORM.

    It has been solved.. thanks everyone for inputs.. points awarded to concerened.. thanks.

  • Sir plz help me..i want to make colag..i hv edited multiple images individually..but unable to merge

    sir plz help me..i want to make colag..i hv edited multiple images individually..but unable to merge these photos into one common window in order to make colage..rply please..

    If you want to make the same type of collage using templates and scripts work very well Documentation and Examples
    For example:

  • Plz help me with displaying image.....

    hai friends,
    i am doin a simple project for my school in jsp and servlets.... actually my problem is very simple i tink ...but am unable to track out....and am new to jsp...actually i want to insert an image near my text...but am unable to display image...i simple get an ' X ' mark and the alternate text instead of the image ...is it tat my browser is unable to display images?? can i change the settings of my browser?? plz tell me how to do it ?? i hav pasted my code also....
    <tr>
                   <td valign=top width=100>
                   <img src="/images/icon.bmp" align=left width=30 height=30 alt="image"><a href="/project/servlet/SubforumviewServlet?name=<%= forname %>"><%= forname %></a>
                   </td>
              </tr>
    that forname is the name of my link..
    i hav another doubt also...is CSS like a template?? do we need to write the code or we can just include it to our jsp?? cos i need to enhance my jsp page to look more professional lik websites... sorry if my question is really childish.....plz help me !!!! thanx in advance..

    Hi...
    I tried your code and its working fine..I think the problem is with the location of your image. In the src attribute, give the correct location of the image. If you are giving /images/im.bmp, the folder images should be in the same directory as your jsp. Hope it help.
    Regards,
    Cochu.

  • Urgent plz help in currency conversions

    hi to all
             wrbtr = sum of dmbtr
    wrbtr = document currency
    dmbtr = local currency
    how can i match these
    there is any function module to convert one to other.
    plz help me in this issue
    take example wrbtr = 20,000
    sum of dmbtr =200
    i am not understanding does i should use a fm or some other to make
    wrbtr = sum of dmbtr
    does the local currency and document currencies r same.
    plz helpme
    Message was edited by: kranthi reddy

    Hi,
      Local currency & document currencies need not be same, and that is the reason function modules are used ( Convert_to_local_currency & Convert_to_foreign_currency ) to convert the amount either to your Local or to Document currency, if they are same there is no need for conversions,
      Can you elaborate on your query related to summing up the values as it is not clear,
    Rgds,

  • How to print text/data in flex 3 using printer???Plz help...

       Hi,
              plz tell me the way to print text/data using printer in flex.  I tried the FlexPrintJob class. but it takes object of a container to be printed & prints the visible content of that container(along with scrollbars), bt i want to print all contents of the container(including invisible).
          I have tried to print bitmap image through FlexPrintJob but it takes lot of time for spooling... So plz help me out in printing(fast with all content) in flash
    I am using flex 3 (flex Builder 3 IDE).
      Thanks in advance!!!

    Hi Sagar,
    Don't worry You can use the below work around to print all the contents of the Container including the invisible contents under scrolll with out scroll bar..
    So what the idea here is we are seeting the container height to full size with out scrolls before sending the container object to printer and as soon as you print the object you are restoring it to the original height with scrolls...so that you can print the full contents without scrolls...
    You may have doubt that by chnaging and restoring the size the user may see momentary resize of the container but it is not so as it is a fraction of a second and user cannot notice this change... Give it a try ..I had already run into this problem recently and I have found a work around for this which is as below:
    // Here mainContainer is the container or box id the contents of which you want to print
       private function doPrintContainer():void
        var printJob:FlexPrintJob = new FlexPrintJob();
        if(printJob.start() != true) return;
        try
         var mainContainerHeight:int = mainContainer.height;
         //Increasing the height of the desired component to be printed.
         mainContainer.height = mainContainer.measuredMinHeight;
         mainContainer.verticalScrollPolicy = "off";
         //Adding the resized Component to our FlexPrintjob and then sending the print request
         printJob.addObject(this,FlexPrintJobScaleType.MATCH_WIDTH);    
         printJob.send();
         //Resizing the component back to normal size
         mainContainer.height = mainContainerHeight;
         mainContainer.verticalScrollPolicy = "auto";    
        catch(error:Error)
                     trace("Error : " + error.message);
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • I restored my Macbook Pro and now I can't log in as Admin - it says there is an error with FileVault and I don't have access - plz help!  thank you.

    I had to restore my Macbook Pro from Time Capsule yesterday and now when I go to log in as my usual Admin, it says there is a FileVault error and my access is denied.  I created another temporary Admin acct, but everything I had on my desktop, etc is "gone"  I can look up the "drive' or wahtever it's called, but I can't access any of it.  All I want to do is log back in as my usual self (the regular Admin) - plz help!  Thanks.   p.s. I"m (obviously) not that computer savvy!

    Triple-click the line below to select it:
    /System/Library/CoreServices/Directory Utility.app
    Rght-click or control-click the highlighted text and select
    Services ▹ Open
    from the contextual menu.* The application Directory Utility will open.
    In the Directory Utility window, click the lock icon and authenticate. Select the Directory Editor tool in the toolbar. Select Users from the Viewing menu in the toolbar, if not already selected. Select the affected user account in the list. On the right is a list of properties and values. Select the property "HomeDirectory" and delete it by clicking the minus-sign icon directly below the property list. There are two such icons in the window. You want the one on the right, not the one on the left.
    CAUTION: Do not click the minus-sign icon on the left, below the user list.
    Then click the Save button in the lower right corner of the window. Quit Directory Utility.
    CAUTION: There is no "undo" in Directory Utility. If you make a mistake and delete something in the Directory Editor that should not have been deleted, restore your whole system from a backup and start over. I have no other help to offer in that case.
    Try again to log in as the affected user. If you can log in, you should find a file in the home folder with the name of the user and the filename extension "sparseimage" or "sparsebundle". Double-click that file. A disk image should open. Copy your files from that disk image to restore them.
    I strongly suggest that you deactivate legacy FileVault in the Security & Privacy preference pane, then log out and log back in. Consider activating FileVault 2 if you want that kind of security.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

  • How to get a string or byte array representation of an Image/BufferedImage?

    I have a java.awt.Image object that I want to transfer to a server application (.NET) through a http post request.
    To do that I would like to encode the Image to jpeg format and convert it to a string or byte array to be able to send it in a way that the receiver application (.NET) could handle. So, I've tried to do like this.
    private void send(Image image) {
        int width = image.getWidth(null);
        int height = image.getHeight(null);
        try {
            BufferedImage buffImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            ImageIcon imageIcon = new ImageIcon(image);
            ImageObserver observer = imageIcon.getImageObserver();
            buffImage.getGraphics().setColor(new Color(255, 255, 255));
            buffImage.getGraphics().fillRect(0, 0, width, height);
            buffImage.getGraphics().drawImage(imageIcon.getImage(), 0, 0, observer);
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(stream);
            jpeg.encode(buffImage);
            URL url = new URL(/* my url... */);
            URLConnection connection = url.openConnection();
            String boundary = "--------" + Long.toHexString(System.currentTimeMillis());
            connection.setRequestProperty("method", "POST");
            connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
            String output = "--" + boundary + "\r\n"
                          + "Content-Disposition: form-data; name=\"myImage\"; filename=\"myFilename.jpg\"\r\n"
                          + "Content-Type: image/jpeg\r\n"
                          + "Content-Transfer-Encoding: base64\r\n\r\n"
                          + new String(stream.toByteArray())
                          + "\r\n--" + boundary + "--\r\n";
            connection.setDoOutput(true);
            connection.getOutputStream().write(output.getBytes());
            connection.connect();
        } catch {
    }This code works, but the image I get when I save it from the receiver application is distorted. The width and height is correct, but the content and colors are really weird. I tried to set different image types (first line inside the try-block), and this gave me different distorsions, but no image type gave me the correct image.
    Maybe I should say that I can display the original Image object on screen correctly.
    I also realized that the Image object is an instance of BufferedImage, so I thought I could skip the first six lines inside the try-block, but that doesn't help. This way I don't have to set the image type in the constructor, but the result still is color distorted.
    Any ideas on how to get from an Image/BufferedImage to a string or byte array representation of the image in jpeg format?

    Here you go:
      private static void send(BufferedImage image) throws Exception
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        ImageIO.write(image, "jpeg", byteArrayOutputStream);
        byte[] imageByteArray = byteArrayOutputStream.toByteArray();
        URL url = new URL("http://<host>:<port>");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setDoOutput(true);
        connection.setRequestMethod("POST");
        OutputStream outputStream = connection.getOutputStream();
        outputStream.write(imageByteArray, 0, imageByteArray.length);
        outputStream.close();
        connection.connect();
        // alternative to connect is to get & close the input stream
        // connection.getInputStream().close();
      }

  • CS5 Styles not Showing up in LIVE VIEW PLZ HELP

    i looked at every other forum and cant find the anwser to my questions!!!! the styles show up until i click live view then they disappear!!!???? plz help
    <link href="css/print.css" rel="stylesheet" type="text/css" media="print">
        <link href="css/styles.css" rel="stylesheet" type="text/css" media="screen">
    those are the style links
    let me know what you need to help me!!!! plz

    let me know what you need to help me!!!! plz
    98% of layout/display problems are caused by malformed code.
    1) Ensure that your code is valid (error free).
         Code Validation Tools
         CSS - http://jigsaw.w3.org/css-validator/
         HTML - http://validator.w3.org/
    2) Check that all paths to images, external style sheets and scripts are correctly pointing to your site folder and not to a file:/// on your local hard drive.
    3) If that doesn't help, upload your problem page to a remote server space and provide us with a link so we can see it in our browsers.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • J2Me game programming plz help

    Helo everyone,
    I am working in j2me game programming plz if
    any one know how make image as small as possible
    in our game program.?
    I am using *.png format of image which is working well
    in game but my game size is very big so plz help me to get
    out of this problem
    Thank u
    Aman Gautam

    I solved the same problem by using indexed color images instead of true color.
    So, for example, if you have a colorful background you can convert it to a 256 color image.
    Depending on your specific image and the devices you'll see it on you may or may not notice the difference, but the file size is generally smaller.
    Then you can push further for smaller elements, like, say, a moving object like a pointer or a starship, you can reduce it to 60 or 30 colors, or even less.
    Another technique is to use tiles to build up the background instead of big images. With MIDP2.0 there's the TiledLayer, but you can implement the same with some code also on MIDP1.0 if backward compatibility is of concern.

  • AddChild function in another Class. plz help!

    Hi,
    I am trying to pull a funtion that adds a child to a container. This function gets pulled in another class. All the traces do work by the child doesn't show.
    pulling the function from StickerBook_Class
    public static var stickBook_Class:StickerBook_Class = new StickerBook_Class  ;
    public var stickBook:stickerBook = new stickerBook  ;
    stickBook_Class.addSticker(stickBook);
    function in StickerBook_Class
    public function addSticker(bg:MovieClip):void
    trace("sticker in album");
    stickBook.addChild(stick1)
    stick1.x = 673
    stick1.y = 80
    any ideas what im doing wrong? the trace deos show by no image is visible.
    plz help me
    Thx
    pavel

    Hi Pavel,
    isn't your method supposed to be similar to below one?
    public function addSticker(sticker:MovieClip):void
         trace("sticker in album");
         stickBook.addChild(sticker);
         sticker.x = 673;
         sticker.y = 80;
    it looks like you want to pass reference to movie clip in your method definition - but within method body you're using variables defined outside of method (so that is hard to other people to see what could be wrong with your code).
    If you are comfortable with your IDE debugging tool just place break-point in e.g. stickBook.addChild(stick) and see what is value of *stick* object during code execution,
    regards,
    Peter

  • I don't have any photos in my macbook but when i check the storage there it shows almost 1gb storage occupied by only photos. plz help!!!

    I don't have any photos in my mac at all yet here it's show i have almost 1 gb of photos how? i don't understand i tried looking for it yet i couldn't find it anywhere.
    Having a 128gb mac space is a big issue for me and all these are uselessly taking so much space.
    plz help
    Thanks in Advance

    <sigh>
    What part of "Ignore" is not clear? No you shouldn't worry about it.
    You have loads of photos on your Mac - things like icons and other interface elements, screenshots in Help files and such things.
    Really. You don't have a problem. You can remove all those images files if you want, it's just that your Mac won;t work if you do.

  • I have iPhone 4s but not show face time logo on my home screen and my settings.. Plz help me..

    my face time app is not waiting and not show in my iPhone 4s and in settings.. What can I do ... Plz help me

    Do as the image on the screen suggests, connect the device to a computer running iTunes and restore.

  • Problm with tiledlayer object not showing on screen!! plz help

    im making a small chess game my chess board is made of Tiledlayer and my chess elements are also Tiledlayer wheneever a move is made i have to make changes to my chess elements cells. but i make changes and they appear on my tiledlayer object but dont show on screen...
    when during game when i press FIRE_KEY first time my code goes to a thread and starts a rectangle which blinks and when i press fire again the tiled_layer is updated such that my chess element is moved from selected position to desired position.... but i dont c the change on screen....
    here is the complete code of chess board class...
    * @(#)ChessCanvas.java
    * @author Aaqib
    * @version 1.00 1007/9/19
    import javax.microedition.lcdui.*;
    import javax.microedition.lcdui.game.*;
    public class ChessCanvas extends GameCanvas implements Runnable{
         private  final int SCREEN_X = getWidth();
         private  final int SCREEN_Y = getHeight();
         private int boardSize = 128;
         // starting point of our chess game
         private int startX = (SCREEN_X - boardSize)/2;
         private int startY = (SCREEN_Y - boardSize)/2;
         // create bounding rectangle to know the end of chess board;
         private int endX = startX + boardSize;
         private int endY = startY + boardSize;
         private static final byte BOARD_COLUMN = 8;
         private static final byte BOARD_ROWS = 8;
         private static final byte TILE_DIMENSION = 16;
         // current X, Y position of cursor
         private byte currentCursorRow;
         private byte currentCursorColumn;
         // the row column which r selected
         private byte selectedRow;
         private byte selectedColumn;
         // the current pixel lcoations
         private int currentPixelX;
         private int currentPixelY;     
         // check if selected. convert curser to red
         private boolean selected = false;
         // background color
         private int white = 0xFCFCFC;
         // the chess board tiled Layer
         private TiledLayer tiledLayer;
         // the chess elements
         private TiledLayer chessElements;
         // layer Manager to add tiles and sprites;
         private LayerManager layerManager;
         // the cursor which selects and moves the objects
         private Sprite cursor;
         // matrix representing the chess board;
         private final byte chkBoard[][] ={
                                       {2,1,2,1,2,1,2,1},
                                       {1,2,1,2,1,2,1,2},
                                       {2,1,2,1,2,1,2,1},
                                       {1,2,1,2,1,2,1,2},
                                       {2,1,2,1,2,1,2,1},
                                       {1,2,1,2,1,2,1,2},
                                       {2,1,2,1,2,1,2,1},
                                       {1,2,1,2,1,2,1,2},
         private final byte elements[][] = {
                                              {6,2,5,4,3,5,2,6},
                                              {1,1,1,1,1,1,1,1},
                                              {0,0,0,0,0,0,0,0},
                                              {0,0,0,0,0,0,0,0},     
                                              {0,0,0,0,0,0,0,0},
                                              {0,0,0,0,0,0,0,0},
                                              {7,7,7,7,7,7,7,7},
                                              {12,8,11,10,9,11,8,12}          
         private Graphics g;
         // main constructor
        public ChessCanvas() {
             super(true);
                  setFullScreenMode(true);
                  init();
         * Initialize all GUI components
        public void init(){
          try{
                 Image spriteImg = Image.createImage("/cursor.png");
                 cursor = new Sprite(spriteImg,15,15);
                 cursor.setRefPixelPosition(startX - TILE_DIMENSION, startY - TILE_DIMENSION);
                Image img = Image.createImage("/board.png");
                Image elmt = Image.createImage("/chess.png");
                tiledLayer = new TiledLayer(BOARD_COLUMN, BOARD_ROWS, img, TILE_DIMENSION, TILE_DIMENSION);
                chessElements = new TiledLayer(BOARD_COLUMN, BOARD_ROWS, elmt,16,16);
                layerManager = new LayerManager();           
                currentCursorRow = 5;
                currentCursorColumn = 6;
                for (int y = 0; y < BOARD_COLUMN; y++){
                     for (int x = 0; x < BOARD_ROWS; x++){
                          int grid = chkBoard[y][x];
                          int data = elements[y][x];
                          tiledLayer.setCell(x,y, grid);
                          chessElements.setCell(x,y,data);
                g = getGraphics();
                // sets the position of chess board in center
                tiledLayer.move(startX, startY);
                chessElements.move(startX,startY);
                layerManager.append(cursor);
                layerManager.append(chessElements);
                layerManager.append(tiledLayer);
                moveCursor(currentCursorColumn * TILE_DIMENSION, currentCursorRow * TILE_DIMENSION );
          catch(Exception exception ){
                 System.out.println("exception in init method  --  "+exception.toString() );
        public void start(){
             Thread thread = new Thread(this);
             thread.start();         
        public void run(){
             while (true){
                  // check game state;
                  //checkState();
                  // check the userinput
                  checkUserInput();              
                  updateScreen(g);
                  flushGraphics();
                  try{
                       Thread.currentThread().sleep(300);
                  }catch(Exception exception){}
        private void checkUserInput(){
             int keyState = getKeyStates();
             switch(keyState){
                  case FIRE_PRESSED:
                       if (selected){
                            selected = false;
                            // make the move
                            logging ("selected >>  row  "+selectedRow+"  column   >>  "+selectedColumn +"\n");
                            logging ("current >>  row   "+currentCursorRow+"  column   >>  "+currentCursorColumn +"\n");
                             int selectedItem = chessElements.getCell(selectedRow,selectedColumn);
                             logging("selected item  >>  "+selectedItem+"\n");
                             chessElements.setCell(currentCursorRow,currentCursorColumn,selectedItem);
                             chessElements.setCell(selectedRow,selectedColumn,0);
                             chessElements.setCell(6,6,7);
                             logging ("selected >>  row  "+selectedRow+"  column   >>  "+selectedColumn +"\n");
                            moveCursor(0,0);
                       }else{
                            selected = true;
                            selectedRow = currentCursorRow;
                            selectedColumn = currentCursorColumn;
                            chessElements.setCell(6,6,7);
                       animateSelectedItem();
                  break;
                  case UP_PRESSED:
                       if (!cursor.isVisible())
                            cursor.setVisible(true);          
                       if (currentCursorRow == 1){
                            if (currentCursorColumn == 8){
                                 currentCursorColumn =1;
                                 currentCursorRow = 8;
                                 currentPixelX = -112;
                                 currentPixelY = 112;
                                 //moveCursor(-112,112);
                            }else{
                                 currentCursorColumn++;
                                 currentCursorRow = 8;
                                 currentPixelX = TILE_DIMENSION;
                                 currentPixelY = 112;
                                 //moveCursor(TILE_DIMENSION,112);
                       else{
                            currentCursorRow--;
                            currentPixelX = 0;
                            currentPixelY = -TILE_DIMENSION;
                            //moveCursor(0,-TILE_DIMENSION);
                       moveCursor(currentPixelX,currentPixelY);
                  break;
                  case DOWN_PRESSED:
                       if (!cursor.isVisible())
                            cursor.setVisible(true);
                       if (currentCursorRow == 8){
                            if (currentCursorColumn == 8){
                                 currentCursorColumn =1;
                                 currentCursorRow = 1;
                                 currentPixelX = -112;
                                 currentPixelY = -112;
                                 //moveCursor(-112,-112);
                            }else{
                                 currentCursorColumn++;
                                 currentCursorRow = 1;
                                 currentPixelX = TILE_DIMENSION;
                                 currentPixelY = -112;
                                 //moveCursor(TILE_DIMENSION,-112);
                       else{
                            currentCursorRow++;
                            currentPixelX = 0;
                            currentPixelY = TILE_DIMENSION;
                            //moveCursor(0,TILE_DIMENSION);
                       moveCursor(currentPixelX, currentPixelY);
                  break;
                  case LEFT_PRESSED:
                       if (!cursor.isVisible())
                           cursor.setVisible(true);
                       if (currentCursorColumn == 1){
                            if (currentCursorRow == 1){
                                 currentCursorColumn =8;
                                 currentCursorRow = 8;
                                 currentPixelX = 112;
                                 currentPixelY = 112;
                                 //moveCursor(112,112);
                            }else{
                                 currentCursorColumn = 8;
                                 currentCursorRow--;
                                 currentPixelX = 112;
                                 currentPixelY = -TILE_DIMENSION;                       
                                 //moveCursor(112,-TILE_DIMENSION);
                       else{
                            currentCursorColumn--;
                            currentPixelX = -TILE_DIMENSION;
                            currentPixelY = 0;
                            //moveCursor(-TILE_DIMENSION,0);
                            moveCursor(currentPixelX, currentPixelY);
                  break;
                  case RIGHT_PRESSED:
                       if (!cursor.isVisible())
                           cursor.setVisible(true);
                       if (currentCursorColumn == 8){
                            if (currentCursorRow == 8){
                                 currentCursorColumn =1;
                                 currentCursorRow = 1;
                                 currentPixelX = -112;
                                 currentPixelY = -112;
                                 //moveCursor(-112,-112);
                            }else{
                                 currentCursorColumn = 1;
                                 currentCursorRow++;
                                 currentPixelX = -112;
                                 currentPixelY = TILE_DIMENSION;
                                 //moveCursor(-112,TILE_DIMENSION);
                       else{
                            currentCursorColumn++;
                            currentPixelX = TILE_DIMENSION;
                            currentPixelY = 0;
                            //moveCursor(TILE_DIMENSION,0);
                       moveCursor(currentPixelX,currentPixelY);
                  break;
        public void updateScreen(Graphics g){
             g = getGraphics();
             // set the background color
             g.setColor(white);
             g.fillRect(0, 0, getWidth(), getHeight());
              // draw the board         
             tiledLayer.paint(g);
             // paint the cursor
             cursor.paint(g);
             // chess elements
             chessElements.paint(g);
        private void moveCursor(int x , int y){
             //logging(" cursor  >>   "+cursor.getFrame());
             // red cursor selected
             if (selected){
                  //logging("red");
                  cursor.setFrame(1);
             }else{
                  // normal green cursor moving
                  //logging("green");
                  cursor.setFrame(0);
             cursor.move(x,y);
         * Animate the selected Item. runs a saperate thread;
        private void animateSelectedItem(){
             cursor.setVisible(false);
             new Thread(new Runnable() {
                  Graphics g = getGraphics();
                  public void run(){
                           while(selected){
                            try{
                                 Thread.currentThread().sleep(600);
                            }catch(Exception exception){
                                 System.out.println("exception in animating sprite");
                             g.setColor(0xF71302);
                             g.drawRect((startX+ (selectedColumn * TILE_DIMENSION))-16,
                                            (startY+ (selectedRow * TILE_DIMENSION))-16, 14, 14 );
                            flushGraphics();
             }).start();
        private void logging (String str){
             System.out.print(str);
    }plz help me....
    thanks :(

    {color:#000080}I don't know whether that's the only thing wrong here, but I see 3 calls to getGraphics(). The documentation for javax.microedition.lcdui.game.GameCanvas.getGraphics() says:{color}
    A new Graphics object is created and returned each time this method is called; therefore, the needed Graphics object(s) should be obtained before the game starts then re-used while the game is running.
    {color:#000080}-- Your call to getGraphics() in updateScreen(Graphics g) will return the reference to the local variable represented by the parameter g, which will be out of scope as soon as the method returns.
    -- Your call to getGraphics() in animateSelectedItem() assigns the reference to a newly declared local variable, which too will be out of scope when the method returns. (But this method includes flushGraphics() so just possibly this g is flushed to the display.)
    db{color}

  • Type on a path problem...plz plz plz help!!!!

    This is the image that I have created:-
    I want to make the text 'Circle' be upside down i.e diaplay from left to right in the circle. But I am not able to do that. Plz help. Thanks in advance!
    P

    ScottWeichert wrote:
    You need two paths.. one for the top text, and one for the bottom text. Adjusting the Type on a Path Options for the path witht he bottom text will allow you to move it to the outside and right reading.
    Not really!
    1 Create your text on a path as you have already done
    2 but type the word circle backward "elcriC"
    3 select the backward type word circle with the text tool
    4. go to the character panel and type 180 in the character rotate input field and hit return
    That should do it. That is what I did here and it is all on one path. You can also give it a baseline shift to get it to align better with the path itself.

Maybe you are looking for