Oval draws differently. Why?

Hi, I'm writing a rather simple program for my course at the moment that uses a class called DrawingCanvas. I find DrawingCanvas a pain in the behind to use, so I just make my classes extend JComponent, and have a BufferedImage and associated Graphics object to store the image.
paintComponent just draws the image.
When I run my code, I get rather horrible looking ovals, but when I run the same code, using DrawingCanvas they look fine.
I've looked in the code for drawing canvas and I can't see anything that would make a difference...
Excerpts from my code:
private BufferedImage image;
private Graphics graphics;
image = new BufferedImage(600, 400, BufferedImage.TYPE_INT_RGB);
graphics = image.createGraphics();
public void paintComponent(Graphics g) {
     g.drawImage(image, 0, 0, this);
graphics.fillOval(x, y, width, width / 4);
...The code for DrawingCanvas can be found at [http://ecs.victoria.ac.nz/twiki/pub/Courses/COMP102_2009T2/JavaResources/DrawingCanvas.java]
An image of the ovals (my code, then DrawingCanvas) can be found at [http://i30.tinypic.com/rvlhcg.png]

Which version of jdk did you use?
If it's jdk6, you might want to try
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);to change behavior of rendering algorithms in software rendering pipeline that is used in BufferedImage.

Similar Messages

  • Drawing different geometric shapes in flex

    Hi
    Can I know how to draw different geometric shapes(like square, polygon,rhombus) in flex and I should be able to calculate its x,y co-ordinates...
    Let me know if any examples are there...
    Thanks n Regards
    Aruna.S.N.

    Rob
    1. The Shapes menu is on the toolbar.
    Pull down the menu and choose the pentagon shape. That has a sliding controller that lets you choose the number of sides.
    2. 30°? which is +option shift 8+
    Peter

  • Why are the interfaces of PRO APPLICATIONS different, Why not fixed in FCS3

    From someone who has been working on macs since 1984, and making my living as a video producer/editor since 1991 using mac:
    Back in the first two decades of Apple's existence, all apps had "Universal Tools & Interfaces". An arrow, a crosshair, a timeline.... You get the picture. LiveType, Motion, Soundtrack Pro, Logic, WaveBurner, and DVD Studio ALL have different looking and acting tools and timelines. This unnecessary mess of differing type tools and interfaces goes against the one thing that makes Macs Macs.
    My limited mind can only store so much. It can hold LT, FCP, and Logic interfaces, norms, key commands, timeline behaviors. I don't have any more mind space for yet another app's. I got completely confused in SoundTrack today.... Oh that's the fourth App I had to use.... I got an error message "There's not enough brain matter to continue, you can cry, spend an hour re-learning, or just edit the 15 tracks of audio in FCP"
    I can't believe it's just me who feels this way. They sell us suite of products, all with differing interfaces and key based tools. You would have thought by this third version they'd make A = pointer or B= Blade or 0 = Rewind in at least two apps.... I hope someone at Apple is trying to fix this horrible situation. I can only hope.... I hope they will still "support" LiveType in the Next Upgrade or I'll freak out.
    Someone tell me why they are still all different, please?

    Buying all the software (except Motion) from other companies results in what you see in Studio. They did this because it was their interest to do so. Apple bought FCP, originally written for PC's, in what amounted to a fire sale for example.
    Would you spend the money (and we're talking a LOT of money) to make them all share a similar UI if you didn't have to? It can be argued that corporate law in this country dictates that Apple cannot spend that dough. How about that notion? LOL...
    True, it's tougher to learn Studio because of the different UI's each app has. Development of that might happen as they rewrite all the code. However the cost of doing that in any app at one time is high enough that I can understand why it remains the way it is.
    Further, Apple has been and will continue to sell the software anyway, as most users believe it's superior to it's direct competitors in power, stability and in value. Apple won the NLE the unit sales wars a long time ago in any event. Since the market is saturated with FCS users apparently loath to learn (poor souls) a new app, let alone a new suite, there is even less incentive for Apple to spend the dough to do what you'd like to see.
    As mentioned above, you can give feedback to Apple. The development teams do read that feedback. I've met some of the folks who cull it inside Apple in fact.
    Jerry

  • Fonts that are the same look different why?

    These 2 images (the copy text within the image) are the same in every way, yet when saved as .jpg look different. Why does this happen?
    I have tried saving at 100% instead of the 60%, and this helps make them a bit clearer, but still not as crisp as the image beside it.  Please help.  Thanks
    It is always the left side images that are blurrier as well...what is up with that  lol  See my page
    http://www.partsconnexion.com/t/eblast/bbb/bb.html

    It's rather fine text, and when you save it as an image, it's alignment to the "pixel grid" may differ (from the same type/size text in similar images) by a fraction of a pixel.
    Fonts have a built-in parameter called "hinting" which helps ensure that varying proximity to the pixel grid doesn't distort the glyphs of live type while they're displayed on-screen. It's a scientifically grizzly little property that dictates which portions of a glyph are always black, versus the portions that are subject to "anti-aliasing." When you rasterize the text as you have, it loses its hinting and becomes subject to "accident" in terms of pixel grid alignment, anti-aliasing, and subsequent perceptual rendering on-screen.
    Considering the above, rasterizing text is somewhat of a crap-shoot and should be avoided. Your layouts could be composed with live text; and should be. Methods might differ depending on whether the end-product is an "email blast" or something that's always and only ever rendered in a browser.

  • Drawing Automation: Why is it moving to the left of where I draw???

    Hey everybody!
    OOOOK. I've run into a problem in 8 that I also had with LP7. It's pretty simple to explain (I think). When I draw in automation using the Marquee tool and then drag the automation up or down, Logic slides the automation information over to the left. For example, when I am editing Volume Automation, I drag the marquee over all of bar 5 and pull that automation down a few dB, but Logic then moves the automation to bar 4 beat three to bar 5 beat three. It works like that everywhere in my session. Another example: I highlight pan automation using the marquee tool from bar 6 beat 1 to bar 6 beat 3 and pull it up (which would mean left with panning) and Logic will move that automation info to bar 5 beat 4 to bar 6 beat 2.
    If that doesn't make sense I'd be happy to try and clarify further.
    What's going on here? Anybody know? Is this particular session just corrupt? Anyone who can shed some light on this would be much appreciated! The marquee tool is a really great and convenient tool but when it's not working the way it's supposed to it's very frustrating.
    THANKS!!

    Great idea, but no...it didn't correct the problem. I did try it though.
    Here's a weird observation: The only time I've had corrupt Logic files in the past month is when I assign a different icon than the default to any of the tracks. And I'm not using my own icons...I'm using the icons that come with Logic and show up in the menu. I don't have time to test this some more at the moment but might do it some more soon to see if that's in fact what's causing things to go crazy.
    Any other experiences similar to my own?

  • My Firefox page does not look like yours...I do not hava a fox in the corner to click on,,,,the whole page looks different why?

    I am trying to delete history and it says that I should click on the fox in the upper left corner? I have no fox and also, the whole page seems different than the one you show...why?

    WinXP versions of Firefox don't have the Firefox button like with Windows Vista and WIn7, because with XP the default is to show the Menu Bar. The Firefox button appears when the Menu Bar is not being shown.
    Right-click a blank spot on the Menu Bar ''(to the right of Help)'', and de-select Menu Bar by clicking on that contextual menu item.

  • Device time and Network time are different - why?

    My Device Time and network time are different by a couple of minutes. My friends BB is different by about 1 hour.
    - Why is that?
    - How do we fix it?
    Solved!
    Go to Solution.

    The device does not automatically update its time.
    What are you time settings? Network or BlackBerry?
    While in the Date/Time settings > Menu > Update time and it will update the time according to the network.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • "can't move objects because they would fall off the drawing area" Why?!

    Hi, I'm trying to move a pdf object exported from vectorworks and i get the following error message: "Can't move the objects. The following transformation would make some objects fall completely off the drawing area."
    It's not the first time this has happened to me but I usually find a way to get around it. I tried increasing the page size, pasting it into a new bigger document, am i missing something?
    thanks!

    The drawing area is the entire surface available for drawing, and is much larger than the artboard. There are probably objects or unlocked guides that run to the edge of the drawing area.
    Unlock all objects and layers, then select all. Turn on Show Bounding Box and zoom out. The edge of the bounding box show the edge of the selected objects Explore the perimeter and delete anything at the edges that's causing the problem.

  • Album order on ipod differs--why?

    I have my photos organized nice on iPhoto, in albums by year and month, but the order is shuffled on the iPod. Why? Any solutions? Replies would be greatly appreciated.

    I have ensured that all the details of each song in the album match up completely, i.e. the same year, artist, composer etc.
    So when you checked the "details" with the Get Info window for the song, did you look in the Info tab to verify that the +Track Number+, 1 of 11, 2 of 11, etc... was entered correctly for each song in the album set?

  • Setting Fonts and In Conversation Fonts different - why?

    Hi there,
    I am wondering why, when I am in a conversation, I am able to choose a font (like Kalinga, for example) that when I try and change it in my Lync settings as a default - does not exist as a choice.
    I don't understand how Kalinga (and other fonts) are not available from the Options menu in Lync, but can be selected from the font options when I'm actually in a conversation with someone. Any idea why this is the case? Can you import other fonts into Lync?
    Thanks!

    I tested with Lync 2010, I have the same behavior.
    With Lync 2013, I can choose the font Kalinga and other fonts in Lync setting.
    Lisa Zheng
    TechNet Community Support

  • Externa HD icon sometimes appears different, why?

    Hi,
    I have noticed that sometimes my external HDs appear as an silver HD looking icon and sometimes it is a yellow rectangular icon.
    What does the difference in appearance mean?

    HI,
    That's interesting. Go to ~/Library/Preferences and move the com.apple.finder.plist file to the Trash.
    Restart your Mac. See if that makes a difference.
    Carolyn

  • Saving a rectangle ROI in a txt and it restores me an oval, why?

    Hi !
    First all, thanks for reading me.
    I've got a problem with LabView Vision.
    I needed to find the center of a circle area, so I started using the oval function to draw and wanted to extract the center of it, but I was not able to get the coordinates of the ROI, because I didn't find something like "ROI To Oval" but I was able to save the "Oval" drawed in a txt and file and get it restored after I wanted to do it again.
    Then, I changed it to an Annulus, and was able to extract the center of it, but I was not anymore able to restore it from the txt in which coordinates are saved.
    Later on, I changed it to a Rectangle, I was also able to extract the center, but the saved ROI from the txt file is working but drawing me an OVAL and not a RECTANGLE. The coordinates are corrects, but I really wonder what I missed.
    I tried a lot of solutions, but none worked atm, that's why I'm posting here.
    A part of my code is attached.
    Can anyone help me?
    Thank you very much,
    Sébastien
    Attachments:
    SaveROI.png ‏34 KB

    Hi,
    Sorry for my late reply.
    I can't join the whole VI for professionals reasons, but I created two which contain my problem.
    You need the 2 following VI, and start SaveROItoTXTasRectangle.vi
    1) Select a video in the path system (.avi would be better I think)
    2) Draw a rectangle
    3) Save it as default area when it's asked.
    4) Lauch again the program
    5) The default area will have the same coordinates but it will suggest an Oval and not a rectangle as I wished
    I don't know what I have to change, even if I have an idea that problem is that I don't define the type to "Rectangle - Rotated", but no idea how to set it differently.
    Thank you,
    Regards,
    Sébastien.
    Attachments:
    LoadROI.vi ‏25 KB
    SaveROItoTXTasRectangle.vi ‏21 KB

  • Why is the PAPER SIZE pull down list different between my 2 identical MFPs?

    Indesign 6 - Toshiba MFPs with PS3 Drivers.
    I have 2 of the same models Toshiba MFPs - 5560c, and using the Universal PS3 Driver under Windows 7 PC.
    Why is my Paper Size pull down list different between to the 2 MFPs?  The main reason I ask; I don't leave it on "Defined by Driver" because that affects full bleed with crop mark printing, so I setup the driver first (say 12x18), then come back to the InDesign dialog and select a paper size.
    For my scenario I need 12x18 - which shows in one list but not the other. Aside from that the lists are totally different - why is that?  How can I manage that list?
    Thanks,
    Pat

    Sorry same screenshot

  • How to draw images at a particular spot in a subview

    When you load an image into a UIImageView:
    {CODE}
    UIImageView* page1 = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"page1.jpg"]];
    [myparentview addSubView:page1];
    {CODE}
    That works fine, and you get an UIImageView object with the picture at (0,0).
    If you add another UIImageView to the parent UIView object, then when that UIView is drawn you get the picture at 0,0 again, and it overwrites the first picture. I want to draw a series of sub-picutures into a giant view. When you add a subview is there any coordinate translation that happens, I tried zapping the frame() or bounds() variables of the subview to make it draw differently but that doesn't seem to change anything.

    Do this:
    UIImageView *page1 = [[UImageView alloc] initWithImage:[UIImage imageNamed:@"page1.jpg"]];
    CGRect frame = page1.frame;
    frame.origin.x = newX;
    frame.origin.y = newY;
    page1.frame = frame;
    [myParentView addSubView:page1];
    And use {code}, not {CODE}

  • PDFs display differently in Internet Explorer 9 versus FireFox

    We use Adobe Reader X in all cases (10.4.1)
    On old computer, we have a website we go to using Internet Explorer (version 8.x on XP) where we ope/save & print to a PDF file. The information on the PDF prints vaules in a certain order - for example:   A,B, C    --works great--this is what we want it to do.
    We buy a new computer, Windows 7 with IE9, and the PDF displays with the same values in this order:  C,B, A  -   not good, do not want that.
    We try FireFox on the new computer  -- works great --just like it did on the old computer.
    What setting in IE9 is causing this PDF to display differently than in FireFox (or IE8)?
    UPDATE:  We did load IE8 on Windows 7 (by uninstalling IE9) and the PDF works fine --so it's not just something unique to FireFox. IE9 is displaying information in this PDF differently--why?

    Add/update these params in your web.xml and redeploy so the style class names are not optimized and client debugging is easier.
    <context-param>
        <param-name>org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>
        <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
        <param-value>true</param-value>
      </context-param>

Maybe you are looking for

  • Wifi for 2 houses separated by 270 meters

    Hello all, [sorry for my englsih] We need to have a Wifi access between 2 houses separated by 270 meters. We think to buy an Aironet 1240AG (AIR-LAP1242AG-E-K9) access point but we don't know which antenna to choose. I can install the antenna on the

  • Bitmapping Fonts and Graphics in Mountain Lion

    My fonts graphics are bitmapping whenever I use Adobe CS5 (specifically, Illustrator and Indesign). Then I noticed that fonts and graphics are bitmapping in Chrome as well. It seems to work fine in Safari, but I still see some bitmapping, such as the

  • PO Upload via LSMW

    Hi Experts, I created an LSMW for PO uploading. I used BAPI as my import method. When I run the LSMW, the values from the material master, vendor master, and inforecord OVERWRITE the values that I was passing from my upload text file. Is there a way

  • Phoronix: Is Arch Linux Really Faster Than Ubuntu?

    Hello I've just love that benchmarks. Here's the link to the article: http://www.phoronix.com/scan.php?page=a - ster&num=6 What do you think about this? (I don't want to start flamewar !) Thanks.

  • I've upgraded from iPhone 4 to 5, and can't upload from iCloud

    I've upgraded from iPhone 4 to 5, and I'm got as far as 'restore from iCloud'. And it says iOS 6.1.3. Required. So i went back to freshly backed up iPhone 4 and checked that it had iOS 6.1.3 all ready. There's no updates on settings  icon