Is it possible to mix animation methods?

I had originally begun my project using the javax.swing.Timer animation loop documented at http://java.sun.com/docs/books/tutorial/uiswing/painting/animLoop.html. My game has different difficulty levels--the higher the difficulty, the shorter the delay--and I had been setting this timer based on the difficulty level. However, I also want to have a custom time keeper (not to be confused with the other Timer classes) which keeps track of how much time the player has left to make a move. I want to display a panel that updates every 80 milliseconds or so, showing a horizontal bar that represents the amount of time left (this bar would shrink over time).
Because the time keeper is independent of the original Timer loop, I tried making the time keeper its own Runnable JPanel and wrapping a thread around it. (Examples for this method can be found at http://java.sun.com/docs/books/tutorial/applet/practical/threadExample.html among others.) This resulted in both the javax.swing.Timer (which is event-based, but must surely use an internal Thread implementation) and the new time keeper Thread being run simultaneously. It almost works... I can see the time keeper update and i can see the player move around the board in the animation loop, however it seems that somehow the player's movements are drawn in both the main board JPanel and the time keeper JPanel. This is naturally impossible, as a Component can only belong to one Container at a time.
So naturally something seems amiss.
Do I have to rely on only one method of animation? If so, which would you recommend? Is there another time keeper class I can use (sort of like a reverse progress bar) which can update itself independently of the animation loop? Any suggestions would be greatly appreciated.

i thought i'd throw a log on the fire and bump this up, see if anybody can take another crack at it.

Similar Messages

  • Is it possible to drop animated files from edge cc into premier pro cc ?

    is it possible to drop animated files from edge cc into premier pro cc ?

    Hi paddymaxg,
    As far as I know, there is no such workflow.
    Thanks,
    Preran

  • Solaris 10 u11 : Is it possible to mix IPMP with vertual network interface

    Hi
    I have a system with 4 Ethernet interfaces , I'd like to try to have virtual network interface on two of them . then configure IPMP between each two.
    - Is it possible to mix IPMP and VNIC ?
    - online , I found posts about having vnic on solaris by creating additional interface file (ex, /etc/hostname.bge0:1 ) and also the IPMP create such interface?
    - How can I know which IPMP version installed on the system ? and how to know I'm reading the right configuration guide?
    - on what basis should i choose the type of IPMP for my system (Link-based or Probe-based)
    Thanks in advance
    HEBA

    Hi.
    IPMP can coexist with VNIC.
    IPMP - part of Solaris. So you not need check version of IPMP. Just read Docs for Solaris.
    http://docs.oracle.com/cd/E23823_01/html/816-4554/ipmptm-1.html#scrolltoc
    It's not clear what Vnic you plan use. Is it VLAN or just additional IP on interface ?
    For test address of IPMP you should configure interface like bge0:1 with additional options.
    Regards.

  • Is it possible to mix italic and non-italic fonts in an axis label?

    Is it possible to mix italic and non-italic fonts in an axis label in diadem reports?

    No, there is no chance to do this.
    You can only use the "Textobjekt" to mix italic and non-italic fonts.
    Thanks
    Klaus D

  • Is it possible to add animation to your website?

    Is it possible to add animation to your website? I'd like to add navigation buttons down the side in the shape of books, and have them open when you scroll near them with the mouse. Is this possible?

    Not in iWeb itself. You have to find the code and paste it in a HTML snippet.
    Here's some demo :
    http://www.wyodor.net/_Demo/Hover/
    Study the source and the pictures
    http://www.wyodor.net/_Demo/Hover/duckassets/iWeb_1.png

  • Is it possible to mix down to a wav  file

    I only seem to be able to mix to an mp3.
    Thanks.

    dora jar wrote:
    Is it possible to mix down to a wav  file
    no, you have to convert the export:
    http://www.bulletsandbones.com/GB/GBFAQ.html#converttowav
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    (uncompressed would be best)

  • Using iTunes why can you not backup and save your voicemail?  Guide me through this step by step if possible.  If alternate method MUST be used then provide same.  Truly appreciate this.

    Using iTunes why can you not backup and save your voicemail?  Guide me through this step by step if possible.  If alternate method MUST be used then provide same.  Truly appreciate this.

    Create and delete iPhone, iPad, and iPod touch backups in iTunes - Apple Support  - link doesn't state that voicemail is part of the backup
    iCloud: iCloud storage and backup overview  states that VVM is part of the icloud backup.
    You can also contact your cell phone provider - as voicemail is a carrier feature.

  • Is it possible to call a method in a servlet from  a java script ?

    I need to do a dynamic html page . In the page i select some things and then these things must communicate whit a servlet because the servlet will do some DB querys and update the same webpage.
    So is it possible to actually call a method of a servlet from a java script? i want to do something that looks like this page:
    http://www.hebdo.net/v5/search/search.asp?rubno=4000&cregion=1011&sid=69DHOTQ30307151
    So when u select something in the first list the secodn list automaticly updates.
    thank you very much

    You can
    1. load all the options when loading the page and
    set second selection options when user selected
    the first; or
    2. reload the page when user select first selection
    by 'onChange' event; or
    3. using iframe so you only need to reload part of
    the page.

  • ADF: is it possible to call bean methods from a DataForwardAction?

    Hi,
    i have created an ADF data control from bean and I have some values bound and populated in a page. As part of the Action class i would like to execute one of the methods in the bean. Is this possible or am i taking the wrong approach?
    regards,
    Brenden

    Yes, there are a few ways of doing it, please see...
    http://www.ps-scripts.com/bb/viewtopic.php?t=3109

  • Possible to overwrite parse method in DOM with SAX Handler?

    Hi,
    Is it possible to overwrite the parse method within DOM?
    What a want to do is:
         private Node parseXml( String text ) throws SAXParseException, SAXException, IOException, ParserConfigurationException
              SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setNamespaceAware(true);
                   SAXParser parser = factory.newSAXParser();
                   TestHandler handler = new TestHandler();
                   // Parse the file
                   parser.parse(new InputSource(new StringReader(text)), handler);
              return (Node)handler.getRoot();
         } //end parseXml()The reason I want to use this is that within SAX I can write my own line counter so I keep a count of which node is on which line of text.
    What I was thinking is that I could use SAX to return DOM Nodes with the line number attached, possibly using the node.setUserData() method?!
    I have tried to play around with it and it doen't seem to work, can anyone help?
    Cheers Alex

    I have managaed to re-write my SAX parser to create a JTree, this works perfectly I can move through the tree and each line of text that corresponds to the node is highlighted.
    My problem is however that in my application I have used the DOM structure throughout so some of the functionality is lost.
    Is I understand that JAXP uses both SAX and DOM together, so I was wondering if it is possible to combine my sax parse method within the DOM?
    If anything is unclear please say and I will try and explain better. The main reason for doing this is that I want to keep a reference to which line of text each node of the dom tree represents. I have not been able to implemnet one in DOM however using SAX I have managed.
    Many thanks,
    Alex

  • Auto calculation row, work around for mixed calc methods?

    I have a problem with an auto calculation row. One of the columns in the report is a percentage so I want the total row to calculate using a column formula, instead of the Auto Calculation Row calculation method setting.
    We're using the auto calculation row as a way to churn through many Entity members, displaying financial totals for 4 Account category groupings for each Entity member.
    For each Entity, those 4 rows display the data they're supposed to, and the auto calc row generates the 'Total', which is the calculation method it is set to do.  With 2 columns in play, it works like this:
    A1 through A4 display data, and are summarised in [A][Total Row]
    B1 through B4 display data, and are summarized in [B][Total Row]
    An updated requirement for a % column came up, and now we're trying to get that to display properly in column [C]. 
    [C] is created as a formula column
    The formula is set to [B]/[A], and formatted to display 0.01 precision
    We expect each row to use this formula, and for rows 1 through 4 it does.
    However, for [Total Row], it does not calculate [B]/[A]... instead it calculates [C][1]+[C][2]+[C][3]+[C][4]
    This makes sense in terms of what the 'auto calculation row' is designed to do, or as to how it is explained in FR documentation.
    The calculation method is set to 'Total', so it just adds up all of the data.
    But we're looking for a combination of settings or a work-around that permits the Auto Calculation row feature to be used with mixed calculations as I've described.
    We're on FR 11.1.2.362
    Thanks
    Troy

    gofer wrote:
    Hi osgood, thanks for getting back, thanks for that suggestion, I think that's a nice way of going about it. The form is working great with the calculation but I still can't get it to work on the reply email back to the site.
    This is what I've used in the PHP form;
    $freight = $_POST['PROD_freight_1'];
    $totalcost = ($chardonnay_2011_bottles * 20 + $chardonnay_2011_cases * 204) + ($pino_gris_2011_bottles * 21 + $pino_gris_2011_cases * 228) + ($sauvigon_blanc_2011_bottles * 20 + $sauvigon_blanc_2011_cases * 204) + ($riesling_2012_bottles * 20 + $riesling_2012_cases * 204) + ($pinot_noir_2009_bottles * 25 + $pinot_noir_2009_cases * 250) + ($PROD_freight_1);
    This the code for the reply back to the site;
      \n selection \n $PROD_freight_1
    Cheers
    The variable should be:
    + ($freight);
    and
      \n selection \n $freight
    Does that work?

  • Question: Possible to assemble a method call within a program?

    I am writing an interpreter for a school project. I would like to read all instructions into an array in the format PC: Instruction: arg1: arg2: destination:
    My question is can I assemble from the Instruction name, for instance, "sqrt", a method call to public int[][] sqrt(int[][] varValue, int x, int d)? Is that even possible?
    The challenge for me is, after having written all opcode instructions as methods, how do I call them after I read a text string? Is this even a good approach to algorithm design?
    Thank you for your input.

    Ebodee wrote:
    My question is can I assemble from the Instruction name, for instance, "sqrt", a method call to public int[][] sqrt(int[][] varValue, int x, int d)? Is that even possible?Sure.
    The challenge for me is, after having written all opcode instructions as methods, how do I call them after I read a text string? So you have an array of instructions, and you have a bunch of methods that implement the instructions, right?
    (BTW, are the instructions really like sqrt? Because a more normal assignment would probably have you implement instructions like add, increment, store, etc.)
    You could use reflection to get the methods, but that's kind of a hack and a cheat (because it diverges even further from an emulation -- it's harder to map meaningfully to hardware. (This is just my opinion of course.))
    What I'd suggest is to create an Opcode interface, with a method like "void invoke(Object... args)". Then create an implementation of that for each opcode. Put objects of those methods into a Map<String, Opcode>. Then you can look them up by name.
    Is this even a good approach to algorithm design?You're not really designing an algorithm here. It sounds like you're building an virtual processor of some kind. Quicksort is an algorithm. A simulation of a computer is an application.
    Whether it's a good approach... it depends a lot on the assignment. At some point you're going to have to relinquish behavior from the emulation and let Java do some kind of bare computation. (You can't emulate everything; at some point lower-level software or hardware has to handle the semantics of what's going on.) The answer to your question depends on what level does the teacher want you to stay on. Can you write a sqrt function in Java and invoke it from your emulator, or do you have to write sqrt in the machine code of the emulator?

  • Is it possible to create findBy method for collection of ids?

    subj -
    I have a set of ids (HashSet of Integers).
    is it possible to create such findBy method which retrieves group of entity beans with ids specified in the set?

    You could do something like:
    PrimKeyBean
    public PrimKey ejbSelectPrimKey(Long key) throws FinderException;
    public Collection getPrimKeys(Collection keyset) {
      try{
        Vector output = new Vector();
        Iterator it = keyset.iterator();
        while(it.hasNext()){
          output.add(ejbSelectPrimKey((Long)it.Next()));
        return output;
      } catch (FinderException fe) {}
    ...deploymentdescriptor.ejb
    <query>
    <query-method>
    <method-name>ejbSelectPrimKey</method-name>
    </query-method>
    <ejb-ql>
    SELECT OBJECT(o) FROM pkTable o WHERE pkTablePK = ?1
    </ejb-ql>
    </query>
    ...client
    Collection c = primKey.getPrimKeys(keyset);
    ...

  • Possible to invoke a method from string

    I was just wondering if it is possible to have some sort of method that takes as its parameters a string ie: invokeStringMethod(strMethod);
    when String strMethod = "public void doSomething(){}";
    If it is possible to do something like this, could someone please lead me in the right direction, and if its not, well that kinda stinks, but thanks for the help. Thanks.

    I'm not completely sure what you're asking. One of these might be helpful:
    * Reflection, esp. java.lang.Method (obtained from java.lang.Class).
    http://java.sun.com/docs/books/tutorial/reflect/
    * Scripting, such as with beanhsell
    http://www.beanshell.org
    * An anonymos inner class: Runnable runnable = new Runnable() {
      public void run() {
        // do stuff
    };If you want the method name and parameters to be a string that's determined at runtime, look at the first two. If you want the method's implementation to occur inline, look at the third (and maybe the second, too, depending on what you're really trying to accomplish).

  • Is it possible to insert animated image in pdf?

    Hi All,
    I was wondering like in powerpoint one can insert the animated image ......is it possible to do the same in pdf?

    An animated GIF image, when converted to PDF, will not animate. You can implement animation effects using JavaScript, but it requires programming and is moderately complicated. You can also include an animation using Flash (RMA annotation), but you'd have to convert the animated GIF to Flash first.

Maybe you are looking for