Sprite rotation... help someone just entering the fray of java 2D!

Okay, so I'm basically having a crash course in the usage of sprites, and it seems to me the easiest way to rotate them is via AffineTransform.
Now, from what I understand, this is used to rotate an entire graphics context, but I don't want to rotate the entire thing, just a ball. Now to do this, I either need another method, or a way to draw a graphics context on another one, that is, have a ball be the entirety of a graphics context, and draw that on top of the graphics context I already have. Any help on performing this last action would be cool, or if anyone had a better suggestion, I would enjoy that as well.

This might help
package forums;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import java.awt.Font;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GradientPaint;
import java.awt.RenderingHints;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.geom.AffineTransform;
import com.sun.awt.AWTUtilities;
public class SplashPortalPanel5 extends JPanel
    private static final long serialVersionUID = 1L;
    private static final char[] MESSAGE = "  SplashPortal.net".toCharArray();
    private static final double R90 = Math.toRadians(90);
    private static final double R_90 = Math.toRadians(-90);
    private AffineTransform cumalativeRotation = new AffineTransform();
    private double rotation = Math.toRadians(360.0 / MESSAGE.length);
    private Font font = new Font("Impact",Font.ITALIC,40);
    private final Timer timer = new Timer(1000/76, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            repaint();//just repaint
    public SplashPortalPanel5() {
      setPreferredSize(new java.awt.Dimension(600, 600));
      setOpaque(false);
    //This method is called when the panel is connected to a native
    //screen resource.  It's an indication we can now start painting.
    public void addNotify() {
        super.addNotify();
        timer.start();
    public void removeNotify() {
        super.removeNotify();
        timer.stop();
    private static final GradientPaint gradient = new GradientPaint(0F, 0F, Color.BLUE, 5F, 10F, Color.CYAN, true);
    private static final int x = 0, y = 0, w = 100, h = 100;
    public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        g2.setFont(font);
        g2.translate( getWidth()/2, getHeight()/2 );
        cumalativeRotation.rotate(rotation/50);
        g2.transform( cumalativeRotation );
        for(int i = 0; i < MESSAGE.length; i++) {
            // fill the rectangle
            g2.translate(250, 0);
            g2.rotate(R90);
            g2.setColor(Color.BLACK);
            g2.fillRect(x,y,w,h);
            // draw the border
            g2.setColor(Color.WHITE);
            g2.drawRect(x,y,w,h);
            // draw the character
            g2.setPaint(gradient);
            g2.drawChars(MESSAGE,i, 1, x+30, y+50);
            g2.rotate(R_90);
            g2.translate(-250, 0);
            g2.rotate(rotation);
    public static void createAndShowSplashScreen() {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setUndecorated(true);
        frame.setContentPane(new SplashPortalPanel5());
        frame.pack();
        frame.setLocationRelativeTo(null);
        AWTUtilities.setWindowOpaque(frame, false);
        //frame.setAlwaysOnTop(true);
        frame.setVisible(true);
    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                createAndShowSplashScreen();
}... not my code, but I did contribute "some stuff" ...

Similar Messages

  • Help!  Just did the Update (ML 10.8.4) after receiving a new HD since mine crashed last week, and now my Mac won't let me past the log in screen even with correct password.

    Help!  Just did the Update (ML 10.8.4) after receiving a new HD since mine crashed last week and the shop didn't update it back to Mavricks which I had previously done...and now my Mac won't let me past the log in screen even with correct password entered. It just spins like I'm logging in and then goes back to the user log in screen.  I did the process where I restarted and pressed control S and created a new user and password, but once created same issue and can't get passed that screen.
    Super frustrated and any help is appreciated!

    I have decided to dedicate this thread to the wonderful errors of Lion OSX. Each time I find a huge problem with Lion I will make note of it here.
    Today I discovered a new treasure of doggie poop in Lion. No Save As......
    I repeat. No Save As. In text editor I couldn't save the file with a new extension. I finally accomplished this oh so majorly difficult task (because we all know how difficult it should be to save a file with a new extension) by pressing duplicate and then saving a copy of the file with a new extension. Yet then I had to delete the first copy and send it to trash. And of course then I have to secure empty trash because if I have to do this the rest of my mac's life I will be taking up a quarter of percentage of space with duplicate files. So this is the real reason they got rid of Save As: so that it would garble up some extra GB on the ole hard disk.
    So about 20 minutes of my time were wasted while doing my homework and studying for an exam because I had to look up "how to save a file with a new extension in  mac Lion" and then wasted time sitting here and ranting on this forum until someone over at Apple wakes up from their OSX-coma.
    are you freaking kidding me Apple? I mean REALLY?!!!! who the heck designed this?!!! I want to know. I want his or her name and I want to sit down with them and have a long chat. and then I'd probably splash cold water on their face to wake them up.
    I am starting to believe that Apple is Satan.

  • Help. Just got the latest and greatest ipod touch.  When trying to setup icloud, my email address is verified but when I touch settings, icloud, account tries unsuccessfully to verify account.

    Help. Just got the latest and greatest ipod touch.  When trying to setup icloud, my email address is verified but when I touch settings, icloud, account tries unsuccessfully to verify account.

    Why am I sometimes asked to verify my Apple ID by email?
    When you create a new Apple ID or make certain changes to your account, Apple will require you to sign in by following the link in a verification email. This is to help protect your identity and keep your account secure. Some Apple services, such as FaceTime and GameCenter, require email validation.
    How do I verify my Apple ID by email?
    Simply follow the link in the verification email that says "Verify Now." Sign in with your current Apple ID and password, then click Verify Address. You can also verify by signing in at My Apple ID. You'll receive an email prompting you to verify.

  • I'm having 10.8.3 and today 17-Apr I had installed latest java 7 update. Now when ever I test java page it just redirects the page to Java download on both Firefox and safari. I tried deleting the cache from Java Sec Panel - temp ile but still same proble

    I'm having 10.8.3 and today 18-Apr Thursday I had installed latest java 7 update. Now when ever I test java page it just redirects the page to Java download on both Firefox and safari. I tried deleting the cache from Java Sec Panel - temp ile but still same prob.

    Make sure that the plugin is not automatically disabled in Firefox:
    Clinton

  • Help I just installed the latest update on my IPhone4 and now I can't open any of my stored podcasts. When I hit the podcast icon, the screen goes white for a second and the goes back to the opening page with all the icons. What happened?

    Help! I just installed the latest update on my IPhone 4 and now I can't access my podcasts. When I hit the podcast I on, the screen goes blank for a second and then opens to the home screen with all my icons. What happened?

    Try a reset which is similar to a computer restart and is done by pressing and holding the home button and the sleep/wake or on/off button simultaneously you see the Apple logo and then release.

  • Just entering the site name doesn't work anymore in Safari

    Before I upgraded to Leopard I was always able to just enter something like "cnn" into the URL field and Safari and Firefox would take me to that website. Now if I do that both browsers take me to a search page, my ISPs search page. Now I'm not sure if it's something with the new OS and I can change a setting or if it has something to do with Time Capsule. I added that to my network around the same time so I can't know for sure which it is. Does anyone know what's going on?
    Thanks,
    -M

    This happens to me and it's very annoying. I don't know why, but it doesn't happen every single time. I'd say only 5% of the time I'm able to type in the site name and hit enter without an error popping up.
    This was one of the things I loved about using Mac over Windows.

  • Where can I download photoshop cs 8.0  I have the serial number from the case but I can't find the Cd that came with it.  I can't find where to download the software for it so I can just enter the serial number and download the program.

    I am trying to find at least the trial version so that I can enter the serial number that I have on the back of the case and activate the full version so I can get some work I need to get done finished.  My laptop was thrown away after a flood in my basement and I believe the cd was still in it.  I don't recall ever taking it out.

    Forget your existing disc and serial number. They won't work.
    Download the new non-activation version of CS2 (applies to CS owners as well) from
    Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3
    Install then enter the new serial number provided at that link.

  • Pls help   how to check the condition in java server faces.....???

    Hi All
    I have strucked with code pls help....
    How can i check the codition in java server faces.....?
    like in my Application when user provides the in put like some state name in the next page i have to display some url for that state .......if he provide some other state name it will be different url .....pls help me how can i do that,,,,,,???
    thanks in advance..

    There are certainly ways to do that. E.g. using the rendered attribute, using conditional statements in EL, using a specialized getter for that (lazily loaded if necessary), etcetera. But your functional requirement is unclear, so I can't go in detail with that.
    In the future, please try to write normal English sentences. Don't write like SMS talk and save the periods and commas. The more effort you put in your question, the more chance you will be taken for serious and the more effort others will post in their answers.
    Also, in the future, JSF related questions should be posted in the JSF forum.
    Edited by: BalusC on 12-aug-2008 7:47

  • Help needed in learning the basics of Java Smart Card and implementation?

    Hello every body,
    I am trying to develop the applications on java contactless smart cards technology.
    Can any body give me the details like how to start?
    What are the required softwares and installation procedure and path settings and etc.?
    I am the beginner in java smart card application development.
    plz help me out

    Dear Friend,
    I would advice to divide learning into two main parts: JavaCard technology and contactless RFID cards. For JavaCard technology you can find useful articles on Sun web-site (developers.sun.com/mobility/javacard/articles/javacard1/). For contactless RFID you can find few useful books at Amazon. Regarding software you need JC development kit. How to install it there is an instrunction in JCDK user guide.
    If it is not a secret what a javacard contactless card you are going to use in your work?
    Yours
    Dmitri

  • Help me sort out the problems with Java 2 SDK SE

    I install Java SDK 2 standard Eddition version 1.4 in my computer (Window NT4). When I test the installation by typing in "java -version", it displays the following message.
    C:\JavaPractice>java -version
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
    But, When I compile a simple programme, it doesn't work and displays the following message.
    C:\JavaPractice>javac HelloDan.java
    The name specified is not recognized as an
    internal or external command, operable program or batch file.
    Could anybody help me sort out the problem, Please?

    i might guess that you have j2sdk1.4.0\jre\bin on your PATH, but not j2sdk1.4.0\bin ...
    Larry

  • HELP - I just downloaded the update, and now all my keynote slide shows have ugly symbols (sort of a black box with an O in the middle) wherever I clicked 'return' to go down a bullet or to edit text.  It does not let me delete these marks

    this is what it looks like

    Interesting, Have you tried selecting the text elements and then formatting them so that they are not bulleted? And then reformatting them with a different style bullet so you can see if the black boxes come back with a different style of bullet?
    I just made a few small test lists with bullets in Keynote and I have no issues.

  • Can you please direct me how to download Firefox 3.6.13 again? I updated to 8.0.1 and hate it. Please help. Just want the old one again.

    I have a power book mac version 10.6.8 Mac Os X.

    You hate it Why ?? See the following article if you need help regarding the switch from Firefox 3.6 to 9.0.1
    * [[Common questions after upgrading from Firefox 3.6]]
    -> Update Firefox to the latest version
    * http://www.mozilla.com/en-US/firefox/new/
    Starting with the release of Firefox 9, the previous versions of Firefox (4.0.x, 5.0.x, 6.0.x, 7.0.x, 8.0.x) are no longer maintained with Security and Stability updates. Firefox 3.6 is the last previous Firefox version that is still being maintained.
    Firefox versions 4.0.x, 5.0.x, 6.0.x, 7.0.x, 8.0.x contain Security Vulnerabilities that are known and could be exploited by some websites to gain unauthorized access to information or to disrupt critical processing. Only the Latest version 9.0.1 and an Older version 3.6.25 of Firefox are secure against these known vulnerabilities.
    * http://en.wikipedia.org/wiki/Vulnerability_%28computing%29#Vulnerability_consequences
    * http://www.mozilla.org/security/known-vulnerabilities/firefox.html#firefox9
    If you opt-out of Updating to the latest Firefox version, you will not receive Critical Security Updates that may keep you Safe Online.
    -> '''10 Reasons to Upgrade to the Latest Firefox Version'''
    * http://blog.mozilla.com/theden/2011/12/01/10-reasons-to-upgrade-to-the-latest-firefox-version/

  • I just entered the podcast world. I am having trouble with my rss code. This is the error i recieve from itunes when trying to submit the url. Error Parsing Feed: invalid XML:Error line 64:XML documents must start and end within the same entity

    <?xml version="1.0"?>
    <rss xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd"
    Verson="2.0">
    <channel>
    <title>KPNC Regional Toxcast</title>
    <link>http://kpssctoxicology.org/edu.htm</link>
    <description>KP Toxcast test podcast</description>
    <webMaster>[email protected]</webMaster>
    <managingEditor>[email protected]</managingEditor>
    <pubDate>Tue, 27 Sep 2011 14:21:32 PST</pubDate>
    <category>Science & Medicine</category>
      <image>
       <url>http://kpssctoxicology.org/images/kp tox logo.jpg</url>
       <width>100</width>
       <height>100</height>
       <title>KPNC Regional Toxcast</title>
      </image>
    <copyright>Copyright 2011 Kaiser Permanente. All Rights Reserved.</copyright>
    <language>en-us</language>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <!-- iTunes specific namespace channel elements -->
    <itunes:subtitle>The Kaiser Permanente Northern California (KPNC) Regional Toxicology Service                  Podcast</itunes:subtitle>
    <itunes:summary>This is the podcast (toxcast) of the KPNC Regional Toxicology Service. Providing                 Kaiser and non-Kaiser physicians with anything toxworthy</itunes:summary>
    <itunes:owner>
       <itunes:email>[email protected]</itunes:email>
       <itunes:name>G. Patrick Daubert, MD</itunes:name>
    </itunes:owner>
    <itunes:author>G. Patrick Daubert, MD</itunes:author>
    <itunes:category text="Science & Medicine"></itunes:category>
    <itunes:link rel="image" type="video/jpeg" href="http://kpssctoxicology.org/images/kp tox                   logo.jpg">KPNC Toxcast</itunes:link>
    <itunes:explicit>no</itunes:explicit>
    <item>
       <title>KPNC Regional Toxcast Sample File</title>
       <link>http://kpssctoxicology.org/edu.htm</link>
       <comments>http://kpssctoxicology.org#comments</comments>
       <description>This is the podcast (toxcast) of the KPNC Regional Toxicology Service. Providing                Kaiser and non-Kaiser physicians with anything toxworthy</description>
       <guid isPermalink="false">1808@http://kpssctoxicology.org/Podcast/</guid>
       <pubDate>Tue, 27 Sep 2011 14:21:32 PST</pubDate>
       <category>Science & Medicine</category>
       <author>[email protected]</author>
       <enclosure url="http://kpssctoxicology.org/podcast/kptoxcast_test_092711.mp3" length="367000"                   type="audio/mpeg" />
       <!-- RDF 1.0 specific namespace item attribute -->
       <content:encoded><![CDATA[<p><strong>Show Notes</strong></p>
       <p><a href="KPNC" _mce_href="http://kpssctoxicology.org/">KPNC">http://kpssctoxicology.org/">KPNC Regional Toxicology Service</a> is comprised of               Steve Offerman, MD; Michael Young, MD; Patrick Whitely; and G. Patrick Daubert, MD.               Awesome team!
       <p>Download <a href="KPNC" _mce_href="http://kpssctoxicology.org/podcast/kptoxcast_test_092711.mp3">KPNC"> http://kpssctoxicology.org/podcast/kptoxcast_test_092711.mp3">KPNC Sample               Toxcast</a></p>]]</content:encoded>
       <!-- iTunes specific namespace channel elements -->
       <itunes:author>G. Patrick Daubert, MD</itunes:author>
       <itunes:subtitle>The Kaiser Permanente Northern California (KPNC) Regional Toxicology Service                    Podcast</itunes:subtitle>
       <itunes:summary>This is the podcast (toxcast) of the KPNC Regional Toxicology Service.                   Providing Kaiser and non-Kaiser physicians with anything
                       toxworthy </itunes:summary>
       <itunes:category text="Medicine"></itunes:category>
       <itunes:duration>00:00:18</itunes:duration>
       <itunes:explicit>no</itunes:explicit>
       <itunes:keywords>daubert,toxicology,toxcast</itunes:keywords>
      </item>
    </channel>
    </rss>

    Please when you have a query post the URL of your feed, not its contents.  Is this your feed? -
    http://kpssctoxicology.org/Podcast/kptoxcast_test_rss_092711.xml
    You have a number of cases of a string of spaces in titles: you also have one in a URL which will render that link invalid.
    But what is rendering the whole feed unreadable is your category link:
    <category>Science & Medicine</category>
    The presence of an ampersand ('&') by itself indicates the start of a code sequence, and in the absence of one, and its closing character, invalidates everything which follows, and thus the entire feed. You must replace the ampersand with the code
    &amp;
    Additionally, your opening lines should read thus:
    <?xml version="1.0" encoding="UTF-8"?>
    <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
    (with the 'purl.org' line if you like).
    If you are going to submit a feed to iTunes you might want to reconsider have 'test' in the filename: apart from the Store having a tendency to reject obvious test podcasts which may not reflect the finished version, you will be stuck with this URL and though you can change the feed URL it's an additional hassle.

  • Help someone must know the answer

    I've udated itunes 10.3.1 and since then i've had no sound at all and itunes won't even play the songs tried deleteing quick time and re-installing but to no use.

    2 things to check.
    Make sure all songs have checkmark in front of the name.
    Make sure the songs are not set to Skip when shuffling. Select the songs, right click - get info. On the Options tab, uncheck *Skip when shuffling*.

  • Did someone just reset the all time statistics on Leaderboards?

    Hi,
    As the title says, seems all the old information from the "All Time" statistics of "Leaderboards" have gotten wiped for both internal and external users while the "Current Month" statistics have stayed intact.
    -  Jouni

    I thought everyone wouldn't mind if we started from scratch again   We will try and reset the leaderboard cache this evening and hope it will fix the issue.  If that doesn't work we'll investigate further.  Not to worry though if you look in your profile all points are still accounted for.
    Cheers,
    Dan

Maybe you are looking for