Help with my custom event

Hi all!
I've extended JTextField to add some custom features. They can add my custom event called ValueChangedListener which listens for change in my textfields. Theese changes is registered in my JFrame holding the textfields so I can determine whether or not to save data to file on exit.
My question is this:
Can I listen to my custom events in a global way in my JFrame? Instead of adding the listener to each and every custom textfield (JFlexTextField) I would like to add ONE listener in my JFrame by calling MyJFrame.addValueChangedListener(ValueChangedEvent vce). (The method addValueChangedListener is located in my custom textfields).
Thanks in advance.

You need some kind of glue between the object that creates the message and the listeners. When the events are generated by your textfields, then those textfields needs at least one "address" to send the events to. Obviously, if the listener list is stored in the JFrame, your textfields will have difficulties using it.
What you can do, which might help if you want to add several listeners to all the textfields, is:
- Add only the JFrame as a listener to the textfields
- Other listeners registers themselves with the JFrame
- The JFrame keeps track of all the other listeners,
- The 'valueChanged' method in the JFrame you forward the event to all the other listeners.
You still have to call addValueChangedListener once for every textfield, though.
You can also send a reference to the JFrame to the constructor for the textfields, and do the addValueChangedListener call in that constructor.

Similar Messages

  • Help with dispatching JTable event to underlying components in a cell.

    Hello..
    I have a JTable in which i show a panel with clickable labels.. I found that jTable by default doesnt dispatch or allow mouseevents to be caught by underlying elements..
    i need help with dispatching an event from jTable to a label on a panel in a jTable cell.. below is the code i have come up with after finding help with some websites. but i couldnt not get it right.. my dispatched event seems to go back to the jtable itself ..
    any help or suggestion is appreciated..
    Thanks
    'Harish.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.table.*;
    * @author  harish
    public class tableDemo extends javax.swing.JFrame {
        JTable jTable1;
        testpane dummyPane;
        /** Creates new form tableDemo */
        public tableDemo() {
            initComponents();
            //table settings
            String[] columnNames = {"Task", "Action"," "};
            Object[][] data = { };
            DefaultTableModel model = new DefaultTableModel(data, columnNames) {
              // This method returns the Class object of the first
              // cell in specified column in the table model.
            public Class getColumnClass(int mColIndex) {
                int rowIndex = 0;
                Object o = getValueAt(rowIndex, mColIndex);
                if (o == null)
                    return Object.class;
                } else
                    return o.getClass();
            jTable1 = new javax.swing.JTable(model);
            jTable1.addMouseListener(new MouseAdapter(){
              public void mouseClicked(MouseEvent e){
                  System.out.println("Clicked");
                  handleTableMouseEvents(e);
                 //invokeExternalApp("http://www.pixagogo.com");
              public void mouseEntered(MouseEvent e){
                  System.out.println("Entered");
                  //handleTableMouseEvents(e);
              public void mouseExited(MouseEvent e){
                  System.out.println("Exited");
                  //handleTableMouseEvents(e);
            jTable1.setRowHeight(100);
            jTable1.getTableHeader().setReorderingAllowed(false);
            jTable1.setBackground(new java.awt.Color(255, 255, 255));
            jTable1.setGridColor(new Color(250,250,250));
            jTable1.setShowGrid(true);
            jTable1.setShowVerticalLines(true);
            jTable1.setShowHorizontalLines(false);
            jTable1.setFont(new Font("Arial",0,11));
            jTable1.setMaximumSize(new java.awt.Dimension(32767, 32767));
            jTable1.setMinimumSize(new java.awt.Dimension(630, 255));
            jTable1.setPreferredSize(null);
            jTable1.setBackground(new Color(255,255,255));
            int vColIndex=0;
            TableColumn col = jTable1.getColumnModel().getColumn(vColIndex);
            int width = 100;
            col.setPreferredWidth(width);
            //add item to 2nd cell       
            Vector vec = new Vector();
            vec.addElement(null);
            dummyPane = new testpane();
            vec.addElement(dummyPane);
            ((DefaultTableModel)jTable1.getModel()).addRow(vec);
            jTable1.repaint();
            this.getContentPane().add(jTable1);
            jTable1.getColumn("Action").setCellRenderer(
              new MultiRenderer());
        protected void handleTableMouseEvents(MouseEvent e){
            TableColumnModel columnModel = jTable1.getColumnModel();
            int column = columnModel.getColumnIndexAtX(e.getX());
            int row    = e.getY() / jTable1.getRowHeight();
            testpane contentPane = (testpane)(jTable1.getModel().getValueAt(row, column));
            // get the mouse click point relative to the content pane
            Point containerPoint = SwingUtilities.convertPoint(jTable1, e.getPoint(),contentPane);
            if (column==1 && row==0)
            // so the user clicked on the cell that we are bothered about.         
            MouseEvent ev1 = (MouseEvent)SwingUtilities.convertMouseEvent(jTable1, e, contentPane);
            //once clicked on the cell.. we dispatch event to the object in that cell
         jTable1.dispatchEvent(ev1);
        private void initComponents() {
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-528)/2, (screenSize.height-423)/2, 528, 423);
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new tableDemo().show();
        // Variables declaration - do not modify
        // End of variables declaration
        class testpane extends JPanel{
            public testpane(){
            GridBagConstraints gridBagConstraints;
            JPanel testpane = new JPanel(new GridBagLayout());
            testpane.setBackground(Color.CYAN);
            JLabel lblTest = new JLabel("test");
            lblTest.addMouseListener(new MouseAdapter(){
              public void mouseClicked(MouseEvent e){
                  System.out.println("panelClicked");
              public void mouseEntered(MouseEvent e){
                  System.out.println("panelEntered");
              public void mouseExited(MouseEvent e){
                  System.out.println("panelExited");
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
            testpane.add(lblTest,gridBagConstraints);
            this.add(testpane);
    class MultiRenderer extends DefaultTableCellRenderer {
      JCheckBox checkBox = new JCheckBox();
      public Component getTableCellRendererComponent(
                         JTable table, Object value,
                         boolean isSelected, boolean hasFocus,
                         int row, int column) {
        if (value instanceof Boolean) {                    // Boolean
          checkBox.setSelected(((Boolean)value).booleanValue());
          checkBox.setHorizontalAlignment(JLabel.CENTER);
          return checkBox;
        String str = (value == null) ? "" : value.toString();
        return super.getTableCellRendererComponent(
             table,str,isSelected,hasFocus,row,column);
        return (testpane)value;
    class MultiEditor implements TableCellEditor {
      public MultiEditor() {
      public boolean isCellEditable(EventObject anEvent) {return false;}
      public boolean stopCellEditing() {return true;}
      public Object getCellEditorValue() {return null;} 
      public void cancelCellEditing() {}
      public boolean shouldSelectCell(EventObject anEvent) {return false;}
      public Component getTableCellEditorComponent(JTable table, Object value,
                  boolean isSelected, int row, int column) {
        if (value instanceof testpane) {                       // ComboString
          System.out.println("yes instance");
        return null;
      public void addCellEditorListener(javax.swing.event.CellEditorListener l) {
      public void removeCellEditorListener(javax.swing.event.CellEditorListener l) {
    }

    any help on this.. anybody. ?

  • Please Help me with my Custom Event

    I am new in java, please help me about my custom event
    I have a simple source code about custom event but it doesn't work like I want. This code generate result :
    start
    end
    but I want result :
    start
    my custom event (from aaa method)
    end
    Thank you
    package TestBean;
    class MyEvent extends java.util.EventObject {
    public MyEvent(Object source) {
    super(source);
    interface MyEventListener extends java.util.EventListener {
    public void myEventOccurred(MyEvent evt);
    class MyClass {
    protected javax.swing.event.EventListenerList listenerList =
    new javax.swing.event.EventListenerList();
    public void addMyEventListener(MyEventListener listener) {
    listenerList.add(MyEventListener.class, listener);
    public void removeMyEventListener(MyEventListener listener) {
    listenerList.remove(MyEventListener.class, listener);
    protected void fireMyEvent(MyEvent evt) {
    Object[] listeners = listenerList.getListenerList();
    for (int i=0; i<listeners.length; i+=2) {
    if (listeners==MyEventListener.class) {
    ((MyEventListener)listeners[i+1]).myEventOccurred(evt);
    public class BeanFrame extends javax.swing.JFrame {
    public BeanFrame() {
    initComponents();
    MyClass c = new MyClass();
    System.out.println("start");
    c.addMyEventListener(new MyEventListener()
    public void myEventOccurred(MyEvent evt)
    aaa(evt);
    System.out.println("end");
    private void aaa(MyEvent evt) {                    
    System.out.println("my custom event");
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 400, Short.MAX_VALUE)
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 300, Short.MAX_VALUE)
    pack();
    }// </editor-fold>
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new BeanFrame().setVisible(true);

    package TestBean;
    class MyEvent extends java.util.EventObject {
        public MyEvent(Object source) {
               super(source);
    interface MyEventListener extends java.util.EventListener {
        public void myEventOccurred(MyEvent evt);
    class MyClass {
        protected javax.swing.event.EventListenerList listenerList =
        new javax.swing.event.EventListenerList();
        public void addMyEventListener(MyEventListener listener) {
              listenerList.add(MyEventListener.class, listener);
        public void removeMyEventListener(MyEventListener listener) {
              listenerList.remove(MyEventListener.class, listener);
        protected void fireMyEvent(MyEvent evt) {
             Object[] listeners = listenerList.getListenerList();
             for (int i=0; i<listeners.length; i+=2) {
                    if (listeners==MyEventListener.class) {
                          ((MyEventListener)listeners[i+1]).myEventOccurred(evt);
    public class BeanFrame extends javax.swing.JFrame {
          public BeanFrame() {
                initComponents();
                MyClass c = new MyClass();
                System.out.println("start");
                c.addMyEventListener(new MyEventListener(){
                                  public void myEventOccurred(MyEvent evt){
                                              aaa(evt);
                System.out.println("end");
          private void aaa(MyEvent evt) {
                System.out.println("my custom event");
         // ><editor-fold defaultstate="collapsed" desc=" Generated Code ">
         private void initComponents() {
               setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
           javax.swing.GroupLayout layout = new 
           javax.swing.GroupLayout(getContentPane());
           getContentPane().setLayout(layout);
           layout.setHorizontalGroup(
           layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
           .addGap(0, 400, Short.MAX_VALUE)
           layout.setVerticalGroup(
           layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 300, Short.MAX_VALUE)
          pack();
    }// </editor-fold>
    public static void main(String args[]) {
             java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
                      new BeanFrame().setVisible(true);
    }just enclosed it with the code tags.

  • Need help with a customized interactive web application for  apparel

    Help!!!!
    Hi I am a web designer at beginners stage with web
    devlopment. I am seeking guidance on how to develop a customized
    interactive web application so that the end user can change color
    and patterns of apparel on vector images such as teamsports
    uniforms and tshirts. Once the design is customized to their liking
    they can save it with all of the spec information in a file to
    there desktop or to a database to send to the manufacturer.
    Also looking for a possible way to use a CMS so I can upload
    templates of the garment easily for the end user to customize
    online. Can this be done and if so how? This is an example the kind
    of application I am looking for:
    http://www.dynamicteamsports.com/elite/placeorder.jsp
    I am in desperate need of some brilliant developer to help
    with this.
    Thanks in advance for anyone who is willing to assist or give
    me guidance,
    Danka
    "Reap what you sew"

    some parts of that are doable using non-advanced skills, but
    will be difficult and unwieldly if there are more than a few
    colors/patterns.
    saving the image to the server is a bit more advanced and
    you're going to need some server-side scripting like php, perl, asp
    etc. in addition to some flash programming ability.

  • Frustrated and seeking help with a custom sort order...

    I created a family photo album and arranged all of the pictures in a specific order and sync'd them with my iPad, unfortunately the pictures do not stay in the custom sequence.
    I tried Batch renaming with a Custom Name and Index, but the renaming is applied to the pictures based on the date they were created and not by the way I have arranged them.
    Is there a solution to my problem?
    TIA

    I flagged fifty photos and from that selection I created an album. I went to the album and dragged the photos in to the order I wanted them to appear after selecting Manual. Each time I now choose the manual option it arranges the photos into the sequence I created.
    The problem I'm having is that when I synchronize my iPad with iTunes the photos revert back to their original sort order, which is the default date they were brought in to Aperture.
    As I said, I tried to give them new names and index numbers using a batch command AFTER I arranged them manually, which works, however the names are assigned to the photos sequentially starting with oldest photos and not to photos as I have arranged them.
    Honestly, it would be easier for me to create a slideshow using the timeline in FCP, but a video is not what I'm after.
    I hope I have answered your questions.
    TIA

  • Please help with a custom javascript

    Hello,
    I am a military instructor, and I am trying to create a grade report card with Acrobat X Pro.  So far I have made good progress with the help of the forum community (just searching through the pages and pages of posts), but I am stuck on this issue.
    Like I stated,  I am creating a report card (of sorts) where our other instructor staff can input student test grades into the fields as they [students] progress through training.  The form is showing the particular test with an input field for the grade.  Lastly, the student's overal GPA is displayed in percent format.
    My conundrum: I am trying to code a field that all a user [instructor] will have to input is a numerical value with or without a decmil, and the field will display it as a percentage. 
    If I use acrobats default percentage, the number entered into the field will be multiplied by 100 (i.e. I enter 90 and acrobat displays 9000% in the field).
    I would just like to be able to type in 90, and 90% be displayed; or type in 88.5, and 88.5% be displayed.
    With the scripts I have entered, no decmils can be displayed, and the overal score is multiplying the average by 100, thus if I entered the number 90 in the first exam, the average calculates to 9000%.
    I am assuming the custom format script and custom keystroke script made the average calculation script not work correctly.
    Thanks in advance.  Ryan
    I have entered the following javascripts:
    1.  Document Level Script
    // Document-level function
    function DigOnlyKS() {
        // Get all that is currently in the field
        var val = AFMergeChange(event);
        // Reject entry if anything but digits
        event.rc = AFExactMatch(/\d*/, val);
    2.  Custom Format Script
    // Custom Format script for text field
    if (event.value) event.value += "%";
    3.  Custom Keystroke Script
    // Custom Keystroke script
    DigOnlyKS();
    4.  Custom Calculation Script for an Overal Grade Average
    event.value = myAverageFunction(["pk1","pk2","pk3","pk4","pk5","pk6","pk7","pk8","pk9","pk10","pk11","p k12","pk13","pk14","pk15","pk16","pk17","pk18","pk19","pk20","pk21","pk22","pk23","pk24"," pk25"]);
    function myAverageFunction(aNames) {
        // n = number of fields that have a numerical value
        // sum = some of values for the named fields
        var n = 0;
        var sum = 0;
        var v;
        // loop through array of name strings
        for (i = 0; i < aNames.length; i++) {
          v = this.getField(aNames[i]).valueAsString;
          // check for not a null string and not a space  and not is Not a Number
          if (v != "" & v != " " & isNaN(v) == false) {
             n++; // increment count
             sum += Number(v); // add to sum
        return (n != 0) ? (sum / n): "";

    Try,
    I'm sorry for being so ignorant with javascript.
    I placed that code in the custom keystroke like you suggested, but it did not work.    Is there a specific way I need to input that code in the custom keystroke area?
    I then tried to put it in the document level code and replaced (/\d*/, val) with your code... that really screwed thing up.
    So now I am stuck where I was before.
    I will try and show you what I am trying to accomplish:
    Right now, this is what is happening
    Exam 1
    Exam 2
    Exam 3
    Final Average
    95.5%
    95.3%
    94.3%
    95.033333%
    What I would like to do is to limit each field to 2 decmil places.
    Each "exam field" has the following:
    The "final average" field has the following:
    and this is in the custom calculations area of the "final average" field:
    Finally, I have this in the Documet JavaScripts area:
    I have a feeling this is an easy fix, but I just cannot figure it out.
    Thanks,
    Ryan

  • SChannel - Help with Error # 20 (Event ID # 36888)

    Was hoping somebody could help me understand what's causing some SChannel error 20 events I'm seeing in system event logs.
    Running Server 2008 R2 as IIS web servers, have a commercial wildcard SSL certificate in use on multiple sites and we use IIS Crypto's "best practice" settings.
    Majority of our customers, monitoring apps and SSL labs report no issues with HTTPS, however we have one customer with a data-center hosted application which sometimes connects flawlessly, yet other times causes our server to generate fatal alert 20 and
    reset the connection before it even reaches IIS.
    Can't see any pattern to these issues and very little of the discussion online about error 20 seems to fit here as it mostly relates to invalid server certificates, low-level development with SSL or other "consistent HTTPS failure" scenarios while
    ours is more intermittent.
    Reading up on error 20 suggests it should be indicate a "bad record mac", where I'm reading the mac to be a checksum of the SSL message suggesting the message may be incomplete, altered or incorrectly signed -- but not being an expert on either
    schannel or crypto I could be misunderstanding what this means.
    Attempted to find more detail regarding the internal error state value, with very little luck.
    Tried enabling SChannel logging for errors and warnings (3), but that's not provided any more detail before or after this event.
    Right now I'm not entirely sure what's causing the problem which makes it even harder to look at solutions, so if you have any questions or need more detail let me know, will try and keep an eye on this for the next few days.
    - T
    Log Name: System
    Source: Schannel
    Date: [removed]
    Event ID: 36888
    Task Category: None
    Level: Error
    Keywords:
    User: SYSTEM
    Computer: [removed]
    Description:
    The following fatal alert was generated: 20. The internal error state is 960.

    Hi twrty,
    This error can caused by many reasons, typically reason I experienced such as ,Incorrect certificate bind with HTTPS Port 443, enabled Cert Authentication wrong certificate
    was used ,certificate on TMG server is revoked and has not validity, SSL handshake failures between client and server also can cause these events, please check all this above conditions and disable the port 443 related security of your firewall then monitor
    again.
    The similar thread:
    Certificate Services - can't connect using SSL
    https://social.technet.microsoft.com/forums/windowsserver/en-US/091a3222-641b-43a3-ae19-6cc238828950/certificate-services-cant-connect-using-ssl
    Error schannel
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/dc661a87-d78a-4398-96d8-e3659d26f282/error-schannel
    I’m glad to be of help to you!
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Help with JOptionPane - custom InputDialog

    I need a little help here because I am trying to build a custom JOptionPane that prompts the user to choose 3 values from 3 drop-down lists and then returns those three values in a string. Specifically, this dialog is a very simple date chooser (because I don't really want to use JDateChooser right now). How do I overwrite the showInputDialog() method or the paintComponent() method to make it display three drop-downs?

    Here's an example with multiple text fields. You should be able to modify it easily to use combo boxes:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class OptionPaneMultiple extends JFrame
         public OptionPaneMultiple()
              JTextField firstName = new JTextField(5);
              JTextField lastName = new JTextField(5);
              Object[] msg = {"First Name:", firstName, "Last Name:", lastName};
              Object[] options = {"Ok", "Cancel", "Whatever"};
              JOptionPane op = new JOptionPane(
                   msg,
                   JOptionPane.PLAIN_MESSAGE,
                   JOptionPane.OK_CANCEL_OPTION,
                   null,
                   options);
              JDialog dialog = op.createDialog(this, "Enter Name...");
              dialog.show();
              int result = JOptionPane.OK_OPTION;
              try {result = ((Integer)op.getValue()).intValue();}
              catch(Exception uninitializedValue){}
              if(result == JOptionPane.OK_OPTION)
                   System.out.println(firstName.getText() + " : " + lastName.getText());
              else
                   System.out.println("Canceled");
         public static void main(String[] args)
              JFrame frame = new OptionPaneMultiple();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }

  • Can anyone help with a custom trigger?

    Hi - I know this is a tough one and appreciate anyone's help!
    I'm trying to create a custom trigger that confirms 2 fields belong to the same record. If they do, proceed with insert transaction.
    I have gone through the tutorial (from the old Interakt Discussion Board tutorial at http://www.interaktonline.com/Documentation/MXKollection/075000_tutorialdiscussionboard.h tm) on how to create a custom trigger that checks to see whether a duplicate message and subject exist in the table and if so, stop the insert. I have this working fine, using my own table and fields.
    Can anyone help me to change the script here to confirm that both fields belong to the same record? Here is what I have right now:
    $query = "SELECT * FROM dan_camptrans_login_familyid_confirmid WHERE family_id = ".KT_escapeForSql($tNG->getColumnValue("family_id"),$tNG->getColumnType("family_id"))." AND confirm_id = ".KT_escapeForSql($tNG->getColumnValue("familyconfirm_id"),$tNG->getColumnType("familycon firm_id"));
    $result = $tNG->connection->Execute($query);
    if(!$result) {
    $error = new tNG_error("Could not access database!",array(),array());
    return $error;
    } else {
    if($numberOfRecords = $result->recordCount()) {
    $uniqueFailed = new tNG_error("There is already a message with the same subject and content!",array(),array());
    return $uniqueFailed;
    } else {
    return NULL;
    Any help would be SUPER appreciated!
    Dan

    Thank you very much Shane for responding.
    Right now, if I fill out the form and enter any numbers in the family_id and familyconfirm_id fields that are currently NOT in the dan_camptrans_login_familyid_confirmid table, the form submits fine. If however, both fields already exist within the same record, the error is returned.
    I guess what I am looking for is the opposite. When the form is submitted, the table dan_camptrans_login_familyid_confirmid is checked. If both field entries are not within the same record, return the error.
    Basically, I am sending out a user ID and confirmation number via mail to users. When they register they need to enter in both of these numbers and only if they match the records will the registration proceed.
    The main recordset/form that this custom trigger is attached to is one for my user registration table. This custom trigger and associated table is only to confirm the user registering has the correct information to register.
    Thanks again - I hope that I am explaining this clearly.
    Dan

  • Need Help with scope in event handlers in AS 2.0!

    I am trying to integrate an XML loading script into my FLA. I
    got the script from a book (I'm learning this) and it worked fine
    when in a timeline frame (loaded all perfectly well), but when I
    put it into an AS 2.0 class (which I'd been using with hardcoded
    data for testing) all fails miserably. I'm trying to get the loaded
    XML data processed with another class private function when the
    onLoad event comes from loading the XML, but this second
    function never gets called. All just fails silently. PLUS I'm
    trying to store the loaded data into two arrays which are class
    properties so that I can access the data later. They are not
    accessible. If this seems muddled it's only because I've been
    banging my head against this for 2 hours. I've read Moock, and then
    I went to Macromedia's online help -- and you will see in my code
    that I tried to set up an "owner" variable to clarify scope. It
    didn't.
    Basically: how does one handle scope of other class functions
    AND class properties from within an event handler in the class?
    As a very important bonus question: is there a way to set up
    eventListeners and callback functions
    between classes, or is this verboten?
    Please help if you can -- I know it's obvious to you, and
    soon perhaps to me --
    Thanks -- Robert
    (Code follows)

    Thanks -- indeed a crucial call might be missing. I was doing
    this until 3 yesterday morning.
    Would this be the correct sample code to use? :
    http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm ?context=Flash_MX_2004&file=00000846.html
    It seems to work (although someone cautions in the page
    comments that it doesn't).
    Part of my trouble in working with AS 2.0 is that I feel I
    shouldn't have to do such complicated things (Delegate classes,
    etc) in order to get simple things done (loading XML files). This
    is not a complaint per se -- rather I feel that I must be missing
    something, that it is my inexperience that is causing me to bend
    through so many hoops: programming "should" be elegant and simple.
    So, any links helpful. Thanks.

  • Need help with crazy custom calculations code in Acrobat XI pro

    Im trying to calculate some text feilds together and just cant figure it out.  I have two text feild boxes that I would input certain numbers to calculate in, Textfeild D5 and D6,  once the user supplies the numbers in the D5 and D6   I need a text feild (D9) to calculate and produce a number thats used in another calculation. Any help would be greatly appriciated. Im good at HTML and CSS but only begining with javascript. Im using acrobat XI pro and I put this code in the custom javascript area within the text feld "D9" properties.
    var Dsix = +getField("D6").value;
    var Dfive = +getFeild("D5").value;
    var B2 = 0.37;
    var B3 = 0.45;
    var B4 = 0.53;
    if (Dsix = 15){
    D9.value = B2*Dfive;
    if (Dsix = 30){
    D9.value = B3*Dfive;
    if (Dsix = 45){
    D9.value = B4*Dfive;

    Well thats makes since but unfortunitly it didnt work. The green text feild D9 is where im placing code at. they will be hiiden feilds. the red outlined text feilds are all input feilds. seconds is D6 and nozzels is D5.

  • Help with understanding key event propagation

    Hello,
    I am hoping someone can help me understand a few things which are not clear to me with respect to handling of key events by Swing components. My understanding is summarized as:
    (1) Components have 3 input maps which map keys to actions
    one for when they are the focused component
    one for when they are an ancestor of the focused component
    one for when they are in the same window as the focused component
    (2) Components have a single action map which contains actions to be fired by key events
    (3) Key events go to the currently focused component
    (4) Key events are consumed by the first matching action that is found
    (5) Key events are sent up the containment hierarchy up to the window (in which case components with a matching mapping in the WHEN_IN_FOCUSED_WINDOW map are searched for)
    (6) The first matching action handles the event which does not propagate further
    I have a test class (source below) and I obtained the following console output:
    Printing keyboard map for Cancel button
    Level 0
    Key: pressed C
    Key: released SPACE
    Key: pressed SPACE
    Level 1
    Key: pressed SPACE
    Key: released SPACE
    Printing keyboard map for Save button
    Level 0
    Key: pressed SPACE
    Key: released SPACE
    Level 1
    Key: pressed SPACE
    Key: released SPACE
    Printing keyboard map for Main panel
    Event: cancel // typed SPACE with Cancel button having focus
    Event: save // typed SPACE with Save button having focus
    Event: panel // typed 'C' with panel having focus
    Event: panel // typed 'C' with Cancel button having focus
    Event: panel // typed 'C' with Save button having focus
    I do not understand the following aspects of its behaviour (tested on MacOSX although I believe the behaviour is not platform dependent):
    (1) I assume that the actions are mapped to SPACE since the spacebar clicks the focused component but I don't explicitly set it?
    (2) assuming (1) is as I described why are there two mappings, one for key pressed and one for key released yet the 'C' key action only has a key pressed set?
    (3) assuming (1) and (2) are true then why don't I get the action fired twice when I typed the spacebar, once when I pressed SPACE and again when I released SPACE?
    (4) I read that adding a dummy action with the value "none" (i.e. the action is the string 'none') should hide the underlying mappings for the given key, 'C' the my example so why when I focus the Cancel button and press the 'C' key do I get a console message from the underlying panel action (the last but one line in the output)?
    Any help appreciated. The source is:
    import javax.swing.*;
    public class FocusTest extends JFrame {
         public FocusTest ()     {
              initComponents();
              setTitle ("FocusTest");
              setLocationRelativeTo (null);
              setSize(325, 160);
              setVisible (true);
         public static void main (String[] args) {
              new FocusTest();
    private void initComponents()
         JPanel panTop = new JPanel();
              panTop.setBackground (java.awt.Color.RED);
    JLabel lblBanner = new javax.swing.JLabel ("PROPERTY TABLE");
    lblBanner.setFont(new java.awt.Font ("Lucida Grande", 1, 14));
    lblBanner.setHorizontalAlignment (javax.swing.SwingConstants.CENTER);
              panTop.add (lblBanner);
              JPanel panMain = new JPanel ();
              JLabel lblKey = new JLabel ("Key:");
              lblKey.setFocusable (true);
              JLabel lblValue = new JLabel ("Value:");
    JTextField tfKey = new JTextField(20);
    JTextField tfValue = new JTextField(20);
    JButton btnCancel = new JButton (createAction("cancel"));     // Add a cancel action.
    JButton btnSave = new JButton (createAction("save"));          // Add a sve action.
              panMain.add (lblKey);
              panMain.add (tfKey);
              panMain.add (lblValue);
              panMain.add (tfValue);
              panMain.add (btnCancel);
              panMain.add (btnSave);
              add (panTop, java.awt.BorderLayout.NORTH);
              add (panMain, java.awt.BorderLayout.CENTER);
    setDefaultCloseOperation (javax.swing.WindowConstants.EXIT_ON_CLOSE);
    // Add an action to the panel for the C key.
              panMain.getInputMap (JComponent.WHEN_IN_FOCUSED_WINDOW).put (KeyStroke.getKeyStroke (java.awt.event.KeyEvent.VK_C, 0), "panel");
              panMain.getActionMap ().put ("panel", createAction("panel"));
              // FAILS ???
              // Add an empty action to the Cancel button to block the underlying panel C key action.
    btnCancel.getInputMap().put (KeyStroke.getKeyStroke (java.awt.event.KeyEvent.VK_C, 0), "none");
    // Print out the input map contents for the Cancel and Save buttons.
    System.out.println ("\nPrinting keyboard map for Cancel button");
    printInputMaps (btnCancel);
    System.out.println ("\nPrinting keyboard map for Save button");
    printInputMaps (btnSave);
              // FAILS NullPointer because the map contents are null ???
    System.out.println ("\nPrinting keyboard map for Main panel");
    // printInputMaps (panMain);
    private AbstractAction createAction (final String actionName) {
         return new AbstractAction (actionName) {
              public void actionPerformed (java.awt.event.ActionEvent evt) {
                   System.out.println ("Event: " + actionName);
    private void printInputMaps (JComponent comp) {
         InputMap map = comp.getInputMap();
         printInputMap (map, 0);
    private void printInputMap (InputMap map, int level) {
         System.out.println ("Level " + level);
         InputMap parent = map.getParent();
         Object[] keys = map.allKeys();
         for (Object key : keys) {
              if (key.equals (parent)) {
                   continue;
              System.out.println ("Key: " + key);
         if (parent != null) {
              level++;
              printInputMap (parent, level);
    Thanks,
    Tim Mowlem

    Use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.
    1) In the Metal LAF the space bar activates the button. In the Windows LAF the Enter key is used to activate the button. Therefore these bindings are added by the LAF.
    2) The pressed binding paints the button in its pressed state. The released binding paint the button in its normal state. Thats why the LAF adds two bindings.
    In your case you only added a single binding.
    3) The ActionEvent is only fired when the key is released. Same as a mouse click. You can hold the mouse down as long as you want and the ActionEvent isn't generated until you release the mouse. In fact, if you move the mouse off of the button before releasing the button, the ActionEvent isn't even fired at all. The mouse pressed/released my be generated by the same component.
    4) Read (or reread) the [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html#howto]How to Remove Key Bindings section. "none" is only used to override the default action of a component, it does not prevent the key stroke from being passed on to its parent.

  • Need help with Post Process Event

    Hi all:
    I need to implement user login generation thru a post process event. I read lots of posts about this and followed the steps described. So this is what I did:
    - Created a java class that implements PostProcessHandler and implemented the execute method. I added in both execute methods (EventResult and BulkEventResult) a statement to log message to a tmp file.
    - Created the plugin.xml
    - create a zip file with class and plugin.xml.
    - Put zip file in plugins directory.
    - Registered the plugin.
    - Created the EventHandler.xml file to define the postprocess event on User Entity CREATE operation.
    - Imported the Event metadata.
    Everything went well. Until I ran a reconciliation, and nothing is being called.
    Am I missing any steps?? I read that people successfully implemented this. Is there something I should do for lib folder or classpath...
    I cannot figure this out..
    Thank you

    I think this is what I am missing.
    I created my EventHandlers.xml in a temp folder with a space name:
    The temp folder: /tmp
    and under tmp folder I have the following:
    /metadata/user/custom/CustomPostProcessEvent/EventHandlers.xml
    I am going to change the EventHandlers.xml location:
    keep /tmp directory but
    Remove the metadata tree
    and create /db/EventHandlers.xml
    I will let you know...
    Thanks again for your feedback. It is very appreciated..

  • Help with saving custom stamps to SOAP repository.

    In my attempt to create a custom SOAP based comment repository i've found that i can save and retrieve all lightweight annotations perfectly except for any custom stamps that I've created (default stamps work great).  When i retreive the annotations from a different computer, it just displays a black box with a black x in the middle instead of actually displaying the stamp image.  My guess here is that I need to read the custom stamp image to a stream and then save it to the server along with the annotation data.  The problem is that I can't seem to get acrobat JS to detect and get the image (this.icon.length only counts default stamps).  I do have an AP property for the stamp which is the named appearance according to the documentation.  I just need some help now as to how i can retreive the stamp image data from the named appearance.
    Any help would be greatly appreciated.
    Thanks!

    Can anyone help me out with this?  I have a requirement to enable saving custom stamps to a central server but i can't seem to be able to retrieve the image data for storage.  Any leads would be greatly appreciated.
    Thanks!

  • Help with value change events

    I need to be able to use the value change event to handle sorting and control the properties of a multicolumn listbox. I have a slow loop that runs every 10 seconds and acquires new data if it's available. New data is appended directly to the list box. The event structure handles two events. One to change colors of the text when new data is added and another to sort the contents when a user clicks on the column header. The first event seems to work just fine. It only runs when new data is added. The second event is the problem. It runs every time the loop runs and ties up the user interface so that it does not respond.
    What am I doing wrong??
    By the way, it seems that whatever I am doing wrong crashes LabVIEW while I am
    editing the vi. Probably during a partial compile. LabVIEW crashed twice while I was creating this test vi and I don't normally have trouble with LabVIEW crashing. It has crashed in both the transact.cpp and panel.cpp.
    Thanks for any help or guidance you can offer.
    Attachments:
    Event_Handling_Test.vi ‏242 KB

    I have made a few quick modifications, see attached.
    -- The lower loop should probably be a plain loop, since the timing is done by the event structure.
    -- You cannot use a shift register in the upper loop if you want the acquired list to remain sorted.
    Sorry, I am on vacation in the middle of nowhere and only spend a few minutes on this. There are many improvements possible.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Event_Handling_TestMOD.vi ‏200 KB

Maybe you are looking for