Changing size of the image

I am trying to change the size of an image using setPreferredSize(int width, int height)
The API says that if the size specified is less than the minimum width and height, the minimum width and height is used. But they have told that if the width and height specified is more than the minimum it would be accepted.
I wrote this program. I am using the heart image in this forum as the picture. But the size isn't getting changed. I am trying to scale the image.
Here is the code. I am using ImageItem.setPreferredSize( )
* CanvasGraphics.java
* Created on August 12, 2007, 4:31 PM
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
import java.io.*;
* @author  quest
* @version
public class ImagePortability extends MIDlet implements CommandListener
    private Command exitCommand;
    private Display display;
    private SSCanvas screen;
    public ImagePortability()
        display = Display.getDisplay(this);
        exitCommand = new Command("Exit", Command.EXIT, 2);
        screen = new SSCanvas();
        screen.addCommand(exitCommand);
        screen.setCommandListener(this);
    public void startApp()
        display.setCurrent(screen);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction(Command c, Displayable d)
        if(c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
class SSCanvas extends Canvas
    private Image slides;
    private String captions = "One";
    private int curSlide = 0;
    private ImageItem imageItem;
    public SSCanvas()
        try
            slides = Image.createImage("/favorite.gif");
            imageItem = new ImageItem("",slides,Item.LAYOUT_CENTER,"");
            imageItem.setPreferredSize(100, 100);
            slides = imageItem.getImage();
        catch(IOException e)
            System.err.println("Failed loading images");
    public void keyPressed(int keyCode)
        int action = getGameAction(keyCode);
        switch(action)
            case LEFT:
                repaint();
                break;
            case RIGHT:
                repaint();
                break;
     /** Creates a new instance of OlympicsCanvas */
     public void paint(Graphics g)
        //g.setColor(255, 255, 255);
        //g.fillRect(0, 0, getWidth(), getHeight());
        g.drawImage(slides,getWidth()/2, getHeight()/2, Graphics.HCENTER | Graphics.VCENTER);
        //Font f = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
        //g.setFont(f);
        //g.setColor(0, 0, 0);
        //g.drawString(captions[curSlide], getWidth()/2, 0, Graphics.HCENTER | Graphics.TOP);
}

I changed my code to this and still it isn't working
* CanvasGraphics.java
* Created on August 12, 2007, 4:31 PM
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
import java.io.*;
* @author  t_anoop
* @version
public class ImagePortability extends MIDlet implements CommandListener
    private Command exitCommand;
    private Display display;
    Image slides;
    ImageItem imageItem;
    Form screen = new Form("");
    public ImagePortability()throws IOException
        display = Display.getDisplay(this);
        exitCommand = new Command("Exit", Command.EXIT, 2);
       // screen = new SSCanvas();
        screen.addCommand(exitCommand);
        screen.setCommandListener(this);
        slides = Image.createImage("/favorite.gif");
        imageItem = new ImageItem("",slides,Item.LAYOUT_CENTER,"");
        imageItem.setPreferredSize(200, 200);
        screen.append(imageItem);
        slides = imageItem.getImage();
    public void startApp()
        display.setCurrentItem(imageItem);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction(Command c, Displayable d)
        if(c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
}

Similar Messages

  • Graphic resizing function has changed, now crops the image, why?

    I must have, without knowing it, changed some setting. Until now whenever I bring in graphic, like a png or jpg, I can resize it by using the selection tool (arrow) and at one corner of the image I click, hold down shift/command (Mac) and then reduce or enlarge the size proportionally. What has changed is that now the image does not respond like that but rather the same maneuver crops the image in the sense that, like using a mask function, the image does not change size but the border of it changes and part of the image left non-visible. I assume there is a setting I don't know that does this but so far have not been able to figure it out. Does anyone know?
    Any answer appreciated as very frustrating.
    Thanks,
    — Richard

    Yes, I see the difference. I tried the sequence you suggested and is working, but also had gone back and forth on the menu choices before doing this and it seemed to change things as well, so not sure what did it. Appreciate your help. Will follow up if problem not fixed.
    — Richard

  • I'm using iphone 5 but its camera is not properly working. all the images i'm clicking are of dimension 600X800 and the size of the image is just 60-70 kb. now please tell me how to increase the dimension of images and its size.

    i'm using iphone 5 but its camera is not properly working. all the images i'm clicking are of dimension 600X800 and the size of the image is just 60-70 kb. now please tell me how to increase the dimension of images and its size.

    ''rojere [[#question-1055991|said]]''
    <blockquote>
    i try to keep my thumb palms off the mouse pad when i am typing but every now and then my screen resizes larger or smaller until i take my left palm off the keyboard base its only when my left palm is resting on the base next to the touch pad. i type pretty fast so it gets annoying and yes it also jumps screens or reverts back to previous message and i have to choose ctrl z to undo and get back to my message i was typing... it also switches tabs on me as well... not sure why my palm being on the left of the keypad on the base should effect anything but it does after a while. and i have to stop what i am doing...and go to the firefox menu and change the screen size back down to 100% sometimes it goes up to 200-300 other times it goes down to 70-80% i find it annoying i i wish there was a way to turn off the screen resize in the setup panel. if its just left to be 100% i am happy with that... i don't need it to be bigger or smaller... there should be a way to LOCK it down... i understand that there are people out there with eye problems and needs to have the screen size increase using the + or - but there should be a lock so it just stays no matter what is happening on my keypad or touch pad or base of the pad... that screen size will not increase or decrease. unless i turn off the lock... perhaps this is something they can implement in the next version or do a quick update of the browser
    </blockquote>
    sorry that is all greek to me thanks for attempting to explain what you were trying to explain sorry i just not tech person to be able to understand or where to begin ... have good day and thanks for again trying

  • Checking the size of the image..

    Hi All,
    i have attached am image from using attachments functionality from Purchasing module.
    the image get stored in table fnd_lobs..
    Now i want to know the size of the image..
    whether it is 30kb or 1MB..
    Is there any function in Oracle to calculate the image size..
    We are on 11.5.10.2
    and 11g DB.
    Regards,
    Jana

    Pl see MOS Doc 401094.1 (How To Determine The Size of a File In Table FND_LOBS?)
    HTH
    Srini

  • Maximum  size of the image for uploading.

    Dear All,
    I wrote an image upload program for uploading Color images. I need to know the maximum size of the image to be uploaded.
    I am using the class cl_gui_frontend_services=>gui_upload for uploading the image.
    Regards,
    Rahul R

    you will be converting the image into 'TIFF' or 'BMP' to be uploaded through GUI_UPLOAD.
    i think you can do it for large size also, and for any problem you will get the exceptions :
    DP_OUT_OF_MEMORY     : Not Enough Memory in Data Provider
    DISK_FULL                        : Storage Medium full.
    so try and see.

  • How to change size of the fonts in report

    Hello:
    How to change size of the fonts in report for when I print it?
    Thank's

    Hi..,
    You cannot do that with REPORTS.., With scripts or smartforms u can do that !!
    plz do remember to close the thread, when your problem is solved !!
    reward if it helps u..
    sai ramesh

  • What is happening when I change the size of the image in the program sequence window?

    I noticed that I can change the image size of my exported file. I imported a 720 x 480 DV file into CS5.5. I went to my program sequence window and changed the settings to show the smallest image in that window. I then clicked on the image and used the handles that appear to make that small image large enough to nearly fill the screen. When I exported my final file and played the resulting WMV, the image on my screen was nearly twice as large as it would have been if I had not previously altered the image size in the program sequence window. I had to do this alteration for each clip in my timeline, or the unaltered ones would stay at the smaller size. The quality did not seem to be significantly impaired. I learned about this on a youtube video. The person who did the video claimed that this was a simple and quick way to upgrade standard video to HD. Of course this is not true. He was only changing the size of the resulting video. Does anyone know what is really happing when you do this procedure and why it changes the size of the exported  video?

    The size (resolution) of the exported video is not affected by anything you do while editing.  It is dependant solely on the resolution set in the export settings.
    Ideally you want to edit in an sequence that matches your media\, which will be the same size or larger than the required export.  In other words, the same or smaller is OK.  Making things bigger in post is not the best option.  If you need things bigger, shoot them bigger.

  • How do I change the size of the images in a slideshow?

    I want to build a slideshow with images that are 150 pixels square, but Muse seems to keep a white space all around the photo. It's the same size as the dummy slide show that you start with when you first use the widget. The original images are built to 150 pixels square.
    In preview mode, the big white space sometimes obscures other elements on the page and sometimes it seems to affect the position of the slide show.
    I've tried all combinations of Fill Frame Proportionally and Fill Content Proportionally in all five types of slide show.
    How do I get rid of the white space around the slideshow?

    I figured out how to eliminate the problem I was having. I had the slide show on the front layer, so it obscured everything behind it, even elements that were in the white space around the slide. By sending the slide show to the back, the problem was solved.

  • How to change the size of the image view

    I recently upgraded to CS5.1 from CS3. In CS3 there was an icon in the panel on the right side of the screen (I don't know the name of those panels) that had the option of zooming in on the image, and another icon for zooming out.
    I can't find this capability in CS5... Could someone please tell me how to activate it?
    Thanks!

    Edit
    Are you talking about Window > Navigator?
    Other than that zooming with command-space-click-and-drag and the keyboard shortcuts are options.

  • Open an image to the size of the image.

    I know this is hard to describe. I have a new iMac 27"
    Each time I open an image in Fireworks it opens with a big gray background which doesn't allow me to see my desktop or other programs like Dreamweaver. When you open an image in Photoshop it opens to the exact size of the imagem left hand corner and size it but is there a more efficient way?
    I know I can manually grab the botton
    Can this preference be set in Fireworks.
    I have enclosed a reduced size of my screen to let you see what I mean.
    Thank you...

    Hi
    Sorry, that didn't work.... With these new big <AC screens it is a pain to have to grab the corner of each each I work on to resize and I was hoping that I could get Fireworks to open the images that I work on without all that grey area..... like Photoshop does.
    Ciao
    Austen
    AustenLennon
    SpiderwebZ
    Web Design & Maintenance
    Contact | [email protected]   |  Telephone - 077 4547 8938   |   Skype - austenlennon
    26 Victoria Road, Bangor. County Down BT20 5EX

  • I need to submit a 300 dpi image under 3 megabytes where does it tell me the megabyte size of the image

    I need to adjust an image in photoshop that is 300 dpi and under 3 megabytes. Where in the image size window are the megabytes listed. What is the abbreviation for megabytes?

    Tim,
    In simple terms, the bootldr file is the helper file to load the IOS.
    The BOOTLDR environment variable specifies the  Flash file system and filename that contains the boot loader image  required to load system software.
    The variable defines the primary Cisco  IOS image that will load the final image from another source.
    we need to set the BOOTLDR environment variable to specify  the Flash device and filename of the boot loader image.
    For Old version of IOS, there is a requirement of boot loader image to boot up the IOS image.
    But for the latest version of IOS, no need for boot loader image.
    Below are few things happen when the device boots:-
    1. The router initially boots into ROMMON (this is your bootstrap code, which you can see in the show version command).
    2. Then the router loads into the bootloader code (this is the bootloadr code, which you see in show version). This bootloader code is just an intermediate step between the ROMMON mode and the IOS mode.
    3. The router then boots into the IOS mode from the bootloadr mode.
    So if you do not mention the bootloadr specifically by giving the "boot bootloadr" command, the router will assume the bootloadr to be in bootflash of the device and try to boot it from there. If you mention the "boot bootloadr flash:...." command, then the router will look for the bootloadr in the flash (instead of the bootflash). Thats the only difference.
    However, in both cases, if you have a valid IOS to boot into, then the router will come up without a problem, irrespective of the fact whether bootloadr image is in bootflash or flash.
    HTH
    REgards
    Inayath
    *Plz dont forget to rate if this info is helpfull.

  • How can I increase the size of the images in the media gallery?

    I'm a novice.  I would like to see larger images in the media gallery.  Is there a weay to increase their size?

    Sadly no.
    You can give a comment to Apple and they might change this in future versions:
    http://www.apple.com/feedback/imovie_iOS.html

  • IMac 5.5, OS 10.6.8 During startup, the screen aspect changes so that the image is larger than the screen; I have to scroll to find top, bottom, left, right extremes.

    Screen display aspect ration suddenly changed while I was online so that I have to scroll to see the edges of the display: up, down, left, right.  I rebooted the computer and the problem persists.

    System Preferences->Displays->Display and reset resolution to desired size. Don't know of anything that would change that except possibly a failing graphics card.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • After Effects change size of the Movie after rendering mp4

    Hi,
    I created a new composition and wanted to render it as an mp4 file. The composition has a size of 1500px x 1000px, after rendering, the mp4 file has a size of 750px x 576px - everthing is distorted. I don't know what happened, because everything was prechecked because the size matters.
    Is someone know what happend and what I can do, to prevent such a mistake? (it is my first After Effects project ever - I'm a nube)
    Thank you Dan

    mp4 is a compression format based on specific blocks of pixels and the legal sizes are set by the codec, there is nothing you can do except pick another codec if you must have 1500 X 1000 as a final size. Why did you pick that size? If you must deliver an mp4 then you should be working with standard sizes for your compositions and they should be square pixels... Always square pixels for mp4.

  • Why do my folders in my finder keep changing size and the way I set them up ....??!?!?!?!

    I cant seem to post a picture here but they are dis proprtionate to each other and ALL over the place, I set them up to be set up a certain way and it keeps changing. It is really getting me angry!!!! Any help??

    Good grief!!!!  I see what you mean now.
    Hold down the option key>Finder>Go>Library>Preferences.  Trash the com.apple.finder.plist file, repair permissions and restart your computer.   Empty the trash. 
    Open up your messed up document folder and click on the gear like icon in its menu>Arrange by - select your arrangement>Show View Options.  Click the Use As Default button.  Your arraingements should now stick.

Maybe you are looking for

  • Error in displaying date time value in Thai Windows OS browser.

    Hi, I have a problem displaying date time in the browser which is installed with Thai Windows OS. The time portion (the subset of datetime) does seemed to show correctly. Initially i am suspecting the virtual machine problem but i tried on bith java

  • Rfc sender - text file

    I have a interface using rfc sender. When it's executed, a file is created. When the format is a XML, the file is created, but, when I use "File Content Conversion" in "File Adatper" to convert the data in text format, the file is not created. The st

  • Account Dimension Properties

    Hi, I have some questions concerning Account dimension properties: 1. "EnableCustom1Aggr"--->Whether aggregation is enabled for intersections of the Account and Custom dimensions This attribute is used for special totals, not summing. Specify Y if th

  • T430s with Win 8, how can I activate the GPS?

    I have T430s with Win 8 64-bit, with embedded mobile broadband module. The WAN is working just fine, and the GPS is seen when I explore the (wireless) tab under Settings, but .. I can not use it, Google earth can not see it and I don't have any softw

  • Macbook Pro 13 i5 2.5ghz upgrading to 16gb

    Hi! I'm trying to upgrade from 4gb to 16gb on a macbook pro 13 non retina(mid 2012 version)  2.5ghz. It says on the apple website that it will only accept 8gb but many people on the web say it can handle 16gb Im trying with this kit of 2 x 8GB http:/