Netbeans GUI editor: Add an action on exit?

Hello,
I have a GUI built using netbeans GUI editor and I would like to execute some code just before the program exits. Does anyone know of a decent way to do this?
Thanks,

Hi,
Just a remark. As a good practice, one should only extend Thread when one wants a Thread to have special capabilities.
Generally, one should create a new Thread with a Runnable. So you could enhance your code as follows:
public ShutdownRunner implements Runnable {
    @Override
    public void run() {
        USB_interface_K8055.JCloseDevice(); // Static JNI method
        System.out.println("Shutting down");
}and
// add shutdown hook for program
        Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownRunner());Glad to be of help,
Piet

Similar Messages

  • JSpinner in Forte 4.0 CE GUI Editor

    Is there any way to integrate a JSpinner in (NetBeans/Forte/)SunOne 4.0 GUI Editor ?
    The JSpinner class is in rt.jar, but is not visible as bean, and thus cannot be integrated in the GUI editor ?
    Any idea would be greatly appreciated.
    Thanks in advance.
    Lo�c QUERAN

    I just tried that and JSpinner isn't among the choices.
    Forte's help says:
    "If the beans you expect to see are not displayed, the required attribute Java-Bean: True is missing from the bean's entries in the JAR manifest."
    That means extracting/editing/replacing the manifest.mf file in rt.jar to add a section like:
    Name: javax/swing/JSpinner.class
    Java-Bean: True
    Anyway, what I've done in the past is design my Forte GUI with some other component in the JSpinner's place - I usually use a JComboBox. Then after Forte's initComponents() method has run replace it with mine.
    JSpinner spin = new JSpinner( someSpinModel );
    Container parent = placeHoldJCombo.getParent();
    parent.remove( placeHoldJCombo );
    parent.add( spin );Although I'll definitely try the manifest.mf edit step next time I need to use JSpinner. Thanks for pointing that out.

  • Netbeans GUI editing: insert image / icon

    Hi everybody,
    I have build my GUI using the NetBeans 5.0 GUI editor. Does anybody know how to insert an image or icon in my GUI using this editor?
    Best regards,
    Jethro

    I've only tinkered with netbeans for about 5 minutes, but it seemed easy enough -
    in design view add a label, highlight the label, go to the label properties window
    (bottom right corner), click the elipse next to icon, select the image file, OK out
    an image appears

  • Using the Netbeans GUI within a Project with existing Ant Script

    I cannot seem to figure out how to use the Netbeans GUI in my Project with existing Ant Script. Is this possible? I have no problem creating GUI interfaces in a java Application, but attempting to make a new JFrame Form gives the error: package org.jdesktop.layout does not exist, and I have not been able to find a way around this. Any suggestions? Thanks in advance.
    Chris Coulon

    OK, I think I am on the right track, but I don't understand why I am still getting this error:
    clean:
    compile:
    Copying 1 file to /Users/chris/**JavaProjects/Netbeans_ImageJ
    Created dir: /Users/chris/**JavaProjects/Netbeans_ImageJ/source/build
    Compiling 292 source files to /Users/chris/**JavaProjects/Netbeans_ImageJ/source/build
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:31: package org.jdesktop.layout does not exist
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:31: package org.jdesktop.layout does not exist
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:34: package org.jdesktop.layout does not exist
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:38: package org.jdesktop.layout does not exist
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    4 errors
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/build.xml:11: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 6 seconds)
    I no longer have the error in my java code in the Projects list, but I still cannot build the project. This is my current build.xml file:
    <!-- Ant makefile for ImageJ -->
    <project name="ImageJ" default="run">
      <target name="compile" description="Compile everything.">
          <!-- Copy the swing layout library into dist.lib -->
        <copy file="dist/lib/swing-layout-1.0.3.jar" todir=".." />
        <!-- First, ensure the build directory exists. -->
        <mkdir dir="build" />
        <!-- Build everything; add debug="on" to debug -->
        <javac srcdir="." destdir="build" optimize="on" source="1.4" target="1.4" debug="on">
          <!-- The plugins directory only needs to be
                 present at runtime, not at build time. -->
          <!-- exclude name="plugins/**"/-->
        </javac>
      </target>
      <target name="build" depends="compile" description="Build ij.jar.">
        <!-- Copy needed files into the build directory. -->
        <copy file="IJ_Props.txt" todir="build" />
        <copy file="images/microscope.gif" tofile="build/microscope.gif" />
        <copy file="images/about.jpg" tofile="build/about.jpg" />
         <copy file="plugins/MacAdapter.class" tofile="build/MacAdapter.class" />
        <copy todir="build/macros"><fileset dir="macros"/></copy>
        <!-- Build ij.jar. -->
        <jar jarfile="ij.jar" basedir="build"
             manifest="MANIFEST.MF" />
      </target>
      <target name="clean" description="Delete the build files.">
        <delete dir="build" />
        <delete file="ij.jar" />
      </target>
      <target name="run" depends="build" description="Build and run ImageJ.">
        <copy file="ij.jar" toDir=".." />
        <java maxmemory="640m" jar="ij.jar" fork="yes" />
      </target>
      <target name="run2" depends="build" description="Build and run ImageJ.">
        <!-- Run in ImageJ directory -->
        <copy file="ij.jar" toDir=".." />
        <java maxmemory="640m" dir=".." jar="ij.jar" fork="yes" />
      </target>
      <target name="zip" depends="clean" description="Build zrc.zip.">
        <zip zipfile="../src.zip"
           basedir=".."
           includes="source/**"
        />
      </target>
      <target name="javadocs" description="Build the JavaDocs.">
        <delete dir="../api" />
        <mkdir dir="../api" />
        <javadoc
               sourcepath="."
               packagenames="ij.*"
               destdir="../api"
               author="true"
               version="true"
               use="true"
               windowtitle="ImageJ API">
        </javadoc>
      </target>
       </project>notice I added this line: <copy file="dist/lib/swing-layout-1.0.3.jar" todir=".." />
    because the dir ".." is where the other jar files are placed, i.e.:
    [GAIAG:~/**JavaProjects/Netbeans_ImageJ/source] chris% ls ..
    PolarDisplay          ij.jar               swing-layout-1.0.3.jar
    TestFrames          myApp
    api               source
    So why is the build not able to see the package org.jdesktop.layout in the jar file?
    Chris

  • Gui editor in eclipse

    Hello,
    does anyone know whether eclipse has a gui editor - an editor like the one in netbeans(netbeans has palette)?
    thanks,
    manju

    check http://www.eclipse.org/vep/

  • The problem about drawing using netbean GUI?

    I am new to netbean gui,
    I creat the JFrame through netbent gui, but I do want to draw something in it, so I creat the WaveformPanel class, which extend the JPanel class,in which
    I will do some drawing, using paint method.
    so then I drag the button from the platte, and want to click the button, then the drawing will appear, in the actionperformed method, my code is
    JPanel wavepanel = new  WaveformPanel();
         super.setContentPane( wavepanel);
         super.setVisible(true);but in this way, the drawing will cover all the Frame, that is not what I want , how to draw it just in the right buttom, how to do it?
    I know for this code I have not drag the JPanel from the platte, I just do not know how to connect the JPanel from the platte and my created JPanel, any idea�H

    Andre_Uhres wrote:
    Do not use setContentPane. Try like this:
    getContentPane().setLayout(new BorderLayout());
    wavepanel.setPreferredSize(new Dimension(150, 0));
    getContentPane().add(wavepanel, BorderLayout.EAST);
    You may also want to read about [Using Layout Managers|http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html] .
    As has already been explained to Danielwang in his cross-post here: [http://forum.java.sun.com/thread.jspa?threadID=5296704|http://forum.java.sun.com/thread.jspa?threadID=5296704]
    Danielwang: when you cross-post like this, you waste both Andre's by having him answer questions already answered and you waste my time by making me feel like I spent time creating an answer that you never read and never responded to. If you keep doing this, you will likely be put on our lists of people not to help. Not a good way to start here.

  • NetBeans Form Editor/ Palette and Javabeans

    Hi all!
    Do you guys know if it is possible to use the NetBeans Form Editor and palette, without having to make all classes into javabeans? I am trying, but I can't see my components in the design window after I add them.
    Is there a way around making javabeans?
    Thanx :-)

    Bet you had errors during refactoring saying that the occurrence is in guarded section and can not be refactored.
    Try to replace old references in *.from/*.java files outside the IDE.

  • SAP GUI EDITOR issue

    Hello Experts,
    I am having some issue in the SAP GUI editor.
    Whenver I open the SCREEN painter. It opens in line editor with error "EU_SCRP_WN32 : timeout during allocate / CPIC-CALL: 'ThSAPCMRCV'"
    My graphic layout editor option is checked.
    The Component version is SAP EHP 1 for SAP Solution Manager 7.0
    GUI version is 640
    My other box whose component version ECC 6.0. There editor is opening in the Graphical format.
    kindly help.
    Regards,
    Hema

    Hello,
    This is version compatibility issue. You can talk to BASIS administrator and get the lastest SAP GUI installed.
    Thanks,
    Augustin.

  • How can i add field to screen exit ?

    ver 4.7
    trans.  me21n
    add field in screen exit .
    i implement screen exit MM06E005->SAPMM06E->0111
    in the layout i try to add field  by pressing
    button in the toolbar ( dictionary field window ) ,
    but when i press "save" in me21n  ,
    i get message "No data changed".
    i choose in the dialog window
    field from structure "ci_ekpodb" , field that i already
    been add  .
    thanks .

    Hi
    You have to implement the exit to import/export the data into/from screen-exit:
    EXIT_SAPMM06E_016 and EXIT_SAPMM06E_018
    Max

  • How to add table actions to an Advanced Table programmatically

    We have code in my CO which builds an advanced table dynamically and associates it with a VO. The table comes out looking good - the correct columns and data are displayed.
    I now want to add Table Actions for that particular dynamically created table.
    The code below builds the buttons correctly and they are built/rendered just fine.
    After adding this code to build the FlowLayout bean, add the buttons and associate the it to the TableActions of the advanced table bean, none of the buttons on the page work anymore. Each time I click any button (even if it's a page level button like 'Save' or 'Cancel'), I get the following error:
    +## Detail 0 ##+
    java.lang.NullPointerException
    +     at java.util.Hashtable.get(Hashtable.java:336)+
    I have added debug statements in by CO, but it is never even getting into the ProcessFormRequest
    Below is the code we are using. Can anyone suggest a way to have this flow layout created dynamically like this and not break all button functionality on the page?
    //Create the advanced table
    OAAdvancedTableBean tableBeanP1 = (OAAdvancedTableBean)createWebBean(pageContext, ADVANCED_TABLE_BEAN, null,"Proc1Tab");
    tableBeanP1.setViewUsageName("P100DetailsVO1");
    tableBeanP1.setNumberOfRowsDisplayed(10);
    //Create a new flow layout to be used as the table actions
    OAFlowLayoutBean tableActionBean = (OAFlowLayoutBean)createWebBean(pageContext, FLOW_LAYOUT_BEAN, null, "P1ButtonRegion");
    //Create the "Add Control Group" button for this table:
    OAButtonBean addButtonBean = (OAButtonBean)createWebBean(pageContext, BUTTON_BEAN, null, "P1AddCtrlGroup");
    FireAction FireActionAddGroup = new FireAction();
    FireActionAddGroup.setEvent("AddCtrlGroup");
    Parameter param = new Parameter();
    param.setKey("ProcedureIndex");
    param.setValue("1");
    Parameter[] params = {param};
    FireActionAddGroup.setParameters(params);
    addButtonBean.setPrimaryClientAction(FireActionAddGroup);
    addButtonBean.setText("Add Control Group");
    tableActionBean.addIndexedChild(addButtonBean);
    //Add the table actions bean to the table:
    tableBeanP1.setTableActions(tableActionBean);

    Hello Ashley,
    you are already close to the solution. In BADI QISR1 you simply fill the
    table SPECIAL_DATA e.g.like
      fieldindex = 1
      fieldname = 'FIELD1'
      fieldvalue = 'Value1'
      fieldindex = <n>
      fieldname = 'FIELD1'
      fieldvalue = 'VALUE<n>'
    Then on the Adobe form layout (Adobe Designer), you have to use the table control XFO from the standard library. Here you have to bind then the corresponding column to FIELD1.
    Best regards,
    Simon

  • Slide Action on Exit Cancelled by Length of Audio File

    Captivate 8.0
    Responsive Project
    Status:  Solution to problem works but makes no sense
    Problem:  Slide actions on exit designated in the Properties Inspector do not function.  Although the "jump to slide" action was selected, the transition at the end of the slide moves to the next slide. I encountered this problem as I was developing a series of slides that would supplement a single beginning slide.  Using click boxes I wanted the learner to be able to click on an item, go to a slide with more detail, then return to the original list on the starting slide.  I set the supplemental slides up in the Property Inspector--Actions to "Jump to slide" and selected the beginning slide number.  When I ran the project, the click boxes moved to the correct slides but the supplemental slides did not return to the beginning slide.  They only transitioned to the next slide.   
    Solution:  This makes no sense to me and is the source of my question.  I'm using text-to-speech as a temporary method of making a rough cut at timing while I am waiting on narration files.  The audio files created by text-to-speech usually run to the end of the slide and are exactly the same length as the slide.  Grabbing at straws to fix the problem, I added 0.2 secs to the slide length so the slide timing was slightly more than the audio file.  Voila!  The selected action (jump to slide X) functions as expected.  I made the same change on the balance of seven slides and the entire routine works as designed.  I have not tested slides using imported narration or narration recorded within Captivate to see if the same problem presents. 
    Why would this be?  Why would the length of an audio file prevent an exit action from functioning? 

    Lilybiri answered this on another question discussion 
    "Slide on exit action conflicts with button action in Captivate 5.5"

  • How to add the custom help exit to search help in SE11

    Hi All,
    I am trying to add the ZF4IF_SHLP_EXIT_EXAMPLE to search help exit in SE11 for search help LART . But system is asking for the access key.
    Is there any way we can achieve this with out using access key?
    Please suggest me.
    Regards
    Subhaskar

    Hi,
         To add a Search help exit goto SE11 -> in Search help option enter 'LART' -> click on display.
    once you have entered in you will have to click on change button. This will give on information message first, then it will ask if you have to maintain in the original language itself(only if you have logged in with any language other than DE). You can select your option in that then you will be able to view the same in EDIT mode. now you can go ahead and add your search help exit.
    Hope it helps.
    Thanks & Regards,
    Praveenkumar T.

  • Forte For Java GUI Editor

    Hi everyone,
    I've been trying to switch usage between Forte for Java running on 2 platforms (Win NT and Solaris 8). For this reason, I want to try to use the GUI Editor in each. But when I tried copying the same .class file from one platform to another and running opening the file under Forte for Java, the GUI Editor doesn't show up the form and Component Editor. Is there a way to make Forte for Java able to recognize the GUI components in a class file not creatd in Forte or not in that version of Forte? Thank you for any help!
    Bob

    Hi,
    this happens not just with class file but also with .java
    file. I created a GUI with Forte ( on windows ) and because I did not jave runtime setup on windows, I copied, java file that was created to the unix env. Then added some code to it and copied back to the windows.
    After that, GUI editor never came up. I lost all that I did
    to create a GUI. Now I can modify GUI only manually.
    I you have found answer to this, please let meknow
    at [email protected]
    rgds,
    sam

  • Creating Web Services using Netbeans GUI only

    Hi all,
    Creating, deploying & testing simple web-services through Netbeans point-n-click interface is quite simple (demo at: http://download.java.net/javaee5/screencasts/hello-simple-glassfish/). The demo shows a very simple service creation scenario, accepting and returning String types only. The service can easily be tested using the GUI option 'Test Web Service', which simply test the service through a simple web page at http://localhost:8080/MyWebApplication/MyWebService?Tester
    In a similar manner, I am trying to implement a web service (a little complex one, accepting and returning custom types) using Netbeans GUI only. Versioning information I am using are as follows:
    NetBeans IDE 6.1
    Sun Java System Application Server 9.1_02 (build b04-fcs)
    JAX-WS 2.1.3.1
    Roughly speaking, the service's method signature I am using is shown below:
    public abstract myclass.X MyService.serviceMethod( myclass.X )
    Since it uses a custom type in parameter and return-types, the web-based test doesn't work any more. I wrote a separate client class to invoke the service using client-side stub classes (suppose to be generated by JAX-WS generated classes). The client code looks like as follows:
    public class ServiceClient {
         public static void main(String[] args) {
              MyService srv = new MyService ().getMyServicePort();
              X xin= new X();
              X xout= srv.serviceMethod( xin );
              System.out.println( "Result: "+ xout.toString());
    Netbeans shows a compiler error on "MyService srv = new MyService ().getMyServicePort();
    Is it possible to get it resolved without making use of ant scripts for generating client-side artifacts (stubs etc.)?
    Thanks,
    irfan

    Hello Sandy,
    Have you installed the Sun Java System App Server or JWSDP? If so, please make sure that one of the libraries in your Netbeans project contains the jaxrpc-api and jaxrpc-impl jars (which seem to be necessary to run wscompile).
    Netbeans ("standalone") doesn't seem to install the jaxrpx libraries and other jars required to compile and run webservices.
    Regards,
    Jonatan

  • 11g dashboard prompt - anyway to add an action to apply to open another tab

    I have a requirement to show the prompt for a particular dashboard on one tab and the reports on another. Is there anyway to add an action to the apply button so it applies the filter and opens another tab?
    Thanks

    Hi,
    Use the Action Link
    ie Add Action link to your dashboard page which is placed with in the prompt and
    goto Properties of Action Link -> Type your report name in Link Text -> New Action - Navigate to BI Content and browse the Report -> click OK.
    Note: Don't forget to give the filter option - is prompted in your report.
    Thanks,
    Balaa...

Maybe you are looking for

  • How to load data into an ods from multiple info sources.

    hi all... i am given a task to load data into an ods from 3 infosources ... can someone plz give me the flow . thank u in advance..

  • Output Message for Purchase order not being created Automatically

    Hi all, I created a Condition type for Purchase order in MN04 with key combination "Doc.Type/Purch.Org/Vendor". The problem arises when i delete this condition record. After deletion when i create purchase order in me21n for that condition type, the

  • How to get name of ValueBinding?

    I want to create child components of my UIData dynamically, and give each of them a ValueBinding referring a property of the data model bound to the UIData. There may be other, better, solutions to this, but I my first attempt is to use the actual st

  • How to preserve manual icon arrangements in a folder?

    Ever since I upgraded to Mountain Lion I notice that if I log out without selecting "reopen windows when logging back in," when I do log back in the contents of my downloads folder are rearranged and sorted.   View settings for this window have Arran

  • Tough SQL query

    I have below like data in a table id     po_date     Bill_date     vali_uo_to     inv_type 1     1/1/2010     5/1/2010     15/3/2010     40 1     2/1/2010     5/1/2010     10/3/2010     30 1     1/1/2010     6/1/2010     25/3/2010     10 4     1/1/20