Is there a way to know if the program is an applet?

Hi all,
I'm developping a Swing project that can be run or not as an applet. Some of my components need to know in which mode the program is running, since some workarounds are necessary to avoid a few swing bugs.
Of course I can ask the main frame if it is an applet or not, but I have written some generic components that do not have any reference to it.
Any ideas?

Hi,
IMHO testing for an instance of Applet will not solve the problem because it seems that godbert has an (J)Applet including a main method which can be started as application and as applet.
One solution for solving the problem could be to store at startup if the program was started as applet or application. Storing this in the system properties makes it available for other components, too.
class MyApplet extends JApplet {
  static {
    System.setProperty( "startedAsApplet", Boolean.TRUE.toString() );
  private boolean isStartedAsApplet() {
    return ( Boolean.getBoolean( "startedAsApplet" ) );
  private void setStartedAsApplet( boolean startedAsApplet ) {
    System.setProperty( "startedAsApplet", new Boolean( startedAsApplet ).toString() );
  public void startLikeApplet() {
    setStartedAsApplet( false );
    init();
    start();
    stop();
  public static void main( String[] args ) {
    MyApplet myA = new MyApplet();
    myA.startLikeApplet();
}Hope that helps,
Alex

Similar Messages

  • Is there any way to know that the UI has been updated due to a bind change?

    Hi
    For the given code snippet
    var c=Circle{
      centerX:10  
      centerY:10
      fill:Color.YELLOW
      onMouseClicked:function(event){
          c.fill=Color.RED;
    printNodeAsImage(filename) //to a file
    }

    Oops..Got posted before I could finish the query
    Hi
    For the given code snippet
    var c=Circle{
      centerX:10  
      centerY:10
      fill:Color.YELLOW
      onMouseClicked:function(event){
          c.fill=Color.RED;
          printNodeAsImage(c, filename) //to a file
    }Let us assume that printNodeAsImage(c,filename) saves the circle node with the current color to a file. See http://rakeshmenonp.wordpress.com/2010/04/26/javafx-1-3-save-as-image/ for a implementation of this function
    What we notice instead is that printNodeAsImage(c, filename) actually saves the node with the color YELLOW instead of RED. Is there any way to know deterministically when the UI has been updated due to a variable value change (or because of binding). (In this case the transition from Yellow to Red) So that we can perform other operations on the UI state - like saving it to a file
    Regards,
    Dhruva Ray

  • Using the warp tool I'm stabilizing  my video and getting rid of the edge artifacts. Analyizing is clear on how long the process will take, but when it stabilizes I only get three moving dots. I there a way to know when the process will stop? Thanks.

    I am using the warp tool to stabilize my video and get rid of the edge artifacts.  The program is very clear about how long it will take to analyze, but there is nothing about how long the stabilization will take nor when I know when it is complete.   Thanks ahead of time.

    Warp Stabilising is a two part process.
    Analysis and Stabilising.
    Both have a banner across the Program Monitor during the process ( unless you have turned that off.
    Analysis start automatically on forst application...but you can rock in there and start adjusting the parameters.
    You may need to hit "Analyse" Button again.
    You should see the number of frames and the estimated duration during this process.

  • Is there a way of knowing what the distance of Space Designer reverbs are?

    Just wondering, but is there a way to see or calculate what the distance is in the reverbs in Space Designer? For example this reverb:
    It says it's a 1.3s reverb (is this 1.3 second?)
    What would be the distance from me to for example a musician who is playing?

    Hi Andreas
    I think you might be missing the point here slightly - reverb time is not a measurement of how far away from the listener a sound source is.  It is a measurement (put very simply) of how long a sound takes to die away to silence in an enclosed space  (see http://http://en.wikipedia.org/wiki/Reverberation for a fuller description).
    Of course, you can use reverb to simulate the effect of a musician being situated closer or further away from a listener, but the best way to judge that is simply to use your ears and see how it sounds to you.

  • Is there a way to only have the program download new photos ?

    The SD card has hundreds and the program is always attempting to download all images each connection.

      Open the Organizer and on the top menu click:
    Edit >> Preferences >> Camera or Card Reader
    Make sure you check the box - Copy New Files Only (Ignore Already Imported)

  • Is there a way to know whether the 4.3 software update has taken?  Just did it on my IPhone 4 but went to download an app I wanted and it says I need the update to do it??

    Just updated Iphone 4 to the 4.3 software update yet when I tried to download an app that requires the upgrade-it says I have to do the upgrade?

    Verizon iPhone 4 cannot update to Firmware 4.3 yet. Currently it is at 4.2.8 so you are up to date.

  • I am using the PCI-6110E/​6111E with the NI-DAQ software version6.7​.Is there a way to record at the same time analog and digital channels?I​f,ye

    s can I have timestamps for each sample?I mean,is there a notion of time information on this board?Finally,is there a way to know ,in the double buffer's case,the number of samples in the halfbuffer which is not full if the acquisition stops by a trigger?.I am using the PCI-6110E/6111E with the NI-DAQ software version6.7.Is there a way to record at the same time analog and digital channels?If,yes can I have timestamps for each sample?I mean,is there a notion of time information on this board?Finally,is there a way to know ,in the double buffer's case,the number of samples in the halfbuffer which is not full if the acquisition
    stops by a trigger?.
    Thank you for your interest in advance

    s can I have timestamps for each sample?I mean,is there a notion of time information on this board?Finally,is there a way to know ,in the double buffer's case,the number of samples in the halfbuffer which is not full if the acquisition stops by a trigger?.PALE wrote:
    >
    > I am using the PCI-6110E/6111E with the NI-DAQ software version6.7.Is
    > there a way to record at the same time analog and digital
    > channels?If,yes can I have timestamps for each sample?I mean,is there
    > a notion of time information on this board?Finally,is there a way to
    > know ,in the double buffer's case,the number of samples in the
    > halfbuffer which is not full if the acquisition stops by a trigger?.
    Start by looking around the examples that ship with LabVIEW (if you are
    using LabVIEW).
    Also look around zone.ni.com for general data acquisition information &
    examples. A good site.
    Mark

  • Any way to know if the "Remember" option of the Security panel is active or inactive?

    Hello, is there any way to know if the "Remember" checkbox of the Security panel is active or inactive? I just need this for a "local" domain application that access to the camera and the microphone. The camera.muted property es not enough because I need a permanent access, and if the "Allow" option is active but the "Remember" option is not active, I have no way to know if I have full access to the camera and microphone.
    Regards.

    Hi,
    IMHO testing for an instance of Applet will not solve the problem because it seems that godbert has an (J)Applet including a main method which can be started as application and as applet.
    One solution for solving the problem could be to store at startup if the program was started as applet or application. Storing this in the system properties makes it available for other components, too.
    class MyApplet extends JApplet {
      static {
        System.setProperty( "startedAsApplet", Boolean.TRUE.toString() );
      private boolean isStartedAsApplet() {
        return ( Boolean.getBoolean( "startedAsApplet" ) );
      private void setStartedAsApplet( boolean startedAsApplet ) {
        System.setProperty( "startedAsApplet", new Boolean( startedAsApplet ).toString() );
      public void startLikeApplet() {
        setStartedAsApplet( false );
        init();
        start();
        stop();
      public static void main( String[] args ) {
        MyApplet myA = new MyApplet();
        myA.startLikeApplet();
    }Hope that helps,
    Alex

  • I have downloaded a Audio Book from Itunes Store, but rencently i have had to reinstall windows, is there any way to re-download the audio book from Itunes, i know that the audio books are one time downloads, but is there any way to get the audio book

    I have downloaded a Audio Book from Itunes Store, but rencently i have had to reinstall windows, is there any way to re-download the audio book from Itunes, i know that the audio books are one time downloads, but is there any way to get the audio book back as i have already paid for it once and i would not like to pay for it twice.

    If you haven't got a backup copy and if it's still in the store then you can try contacting iTunes support and see if they will grant you a re-download (there is no guarantee that they will) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • Is there a way to know what uses the 3gdata in my iphone? ex:  what app or ios fonction...

    i have 21474k on my bill frequently, sometime when i sleep my data is unsed like this and i cant find where it come from.  is it an app? is it ios6?  is there a way to know how our data is used?

    Hi answeet,
    Welcome to the Support Communities!
    The article below may be able to help you with this:
    iOS: About cellular data usage
    http://support.apple.com/kb/HT4146
    Cheers,
    - Judy

  • Lost my iphone dont know my IMEI number tried to get it from ituens about and clicking the Control key but there is one imei and i have 2 phones backed up on my ituens is there a way to know which one is the right one?

    Lost my iphone dont know my IMEI number tried to get it from itunesby clicking about and the Control key but there is one imei and i have 2 phones backed up on my itunes is there a way to know which one is the right one? and is there another way to find my phone and its offline so i cant use find my phone! Help

    Other ways? Check the box? Call your carrier?

  • On the 652X, is there a way to know which port/line caused the change detection w/o checking each individual line?

    On the 652X, is there a way to know which port/line caused the change detection w/o checking each individual line? This question relates to creating an interrupt handler when there are many events that cause an interrupt.

    No. Read the User Manual, CH4, Change Notification.

  • Is there a way to know the qualifier or qualifers that were applied

    Hi All,
    If I have a promotion like this Buy2 get 2 is there a way to know the qualifier or qualifiers that were applied?
    I will end up by having 4 commerce Items and two will be free with an adjustment of the promotion that was applied, but I do not know which items were the ones that make that possible
    is there a way to know that?
    Which items were used to get a BOGO or BuyXGetY?
    Regards,
    Obed

    Hi All,
    If someone needs to know this in the future
    findQualifyingItems() is the one in charge of knowing which items had promotions and it calls a method called evaluateQualifier wihch "can" contain a List of items that are the ones that were used to apply a promotion like BOGO or BuyXGetY.
    Basically the solution for me was override QualifierService and
    @Override
         public Collection findQualifyingItems(PricingContext pPricingContext,
                   Map pExtraParametersMap)
    In order to save the info in a Map I am using CommerceItemMarkers http://docs.oracle.com/cd/E35318_02/Platform.10-1-1/ATGCommStoreGuide/html/s1401usingorderandcommerceitemmarkers01.html
    And now I have my business requirement covered thanks to this.
    Regards,
    Obed
    Edited by: obedmhg on May 17, 2013 2:53 PM

  • Is there any way I can cancel the update to ios 8? My iphone is in the stage of having to connect to iTunes to finish the update. I don't have iTunes on a computer so I could never back my phone up which I didn't know you had to. Help!

    Is there any way I can cancel the update to ios 8? My iphone is in the stage of having to connect to iTunes to finish the update. I don't have iTunes on a computer so I could never back my phone up which I didn't know you had to. Help!

    If your phone is in recovery mode (You see the iTunes graphic on the phone), you MUST connect the device to a computer and restore the operating system.  There is no supported way to get around it.  The device had a problem installing the update and it crashed.  Sorry.

  • Is there any way to know when (and/or whether) a particular tv season will be available for purchase on itunes.  i'm particularly interested in the 2nd season of "homeland," the 5th season of "damages" and the 7th season of "dexter."  thanks.

    is there any way to know when (and/or whether) a particular tv season will be available for purchase on itunes.  i'm particularly interested in:
         the 2nd season of "homeland,"
         the 5th season of "damages"
         the 7th season of "dexter."
    thanks.

    Thanks. But the disc inspector only appears to let me change things like where the title menu button takes you, not detailed user operations. I have pretty much given up on this being anything other than a giant hassle, but if anybody knows whether a script could do this, I would be eternally grateful.

Maybe you are looking for