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. ?

Similar Messages

  • 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.

  • Help with JComboBox-JTable

    Hi there!
    I'll try to explain my problem the best I can, I hope you can understand me so you may get to help me, I'd really appreciate it. I'm trying to make a JTable to render a cell as a JComboBox, that's ok and it's working fine. The problem comes when I try to change the combo value. The itemStateChanged method is supposed to get some values from a database, if the first is bigger than the second it shows an alert, else it makes an update to the database. Now, the problem is that, if the combobox default value is blank (""), it works fine, but if it's filled with something as a name ("anything") it automatically shows the alert, even if I'm not changing the combo value. The second problem is that it shows the alert twice, I'll try to explain with code:
    class Cambia_Cita extends javax.swing.AbstractCellEditor implements javax.swing.table.TableCellEditor ,java.awt.event.ItemListener{
        protected EventListenerList listenerList = new EventListenerList();
        protected ChangeEvent changeEvent = new ChangeEvent(this);   
        protected javax.swing.JComboBox combo = new javax.swing.JComboBox();
        int i;
        String valor = "";
        int j;
        javax.swing.JTable tabla = new javax.swing.JTable();
        public Cambia_Cita() {
            super();
            combo.addItemListener(this);
            Base base = new Base();
            Statement sta = base.conectar();
            try {
                ResultSet rs = sta.executeQuery("SELECT DISTINCT Nombre_Completo FROM Pacientes WHERE Alta = 'n'");
                combo.addItem("");
                while(rs.next())
                    combo.addItem(rs.getString("Nombre_Completo"));
            }catch(SQLException e) {
                System.out.println (e.getMessage());
            } finally {
                base.cerrar(sta);
            combo.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    System.out.println("algo");
                    tabla.setValueAt(valor,i,j);
        public Object getCellEditorValue() {
            return(combo.getSelectedItem());
        public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, Object value, boolean isSelected, int row, int column) {
            i = row;
            j = column;
            tabla = table;
            valor = value.toString();
            combo.setSelectedItem(tabla.getValueAt(i,j));
            System.out.println (i + "," + j);
            java.awt.Component c = table.getDefaultRenderer(String.class).getTableCellRendererComponent(table, value, isSelected, false, row, column);
            if (c != null) {
                combo.setBackground(c.getBackground());
            return combo;
        public void itemStateChanged(java.awt.event.ItemEvent e) {
            Base base = new Base();
            Statement sta = base.conectar();
            try {
                String asist;
                if (tabla.getValueAt(i,3).equals(new Boolean(true))) {
                    asist = "s";
                } else {
                    asist = "n";
                ResultSet rs = sta.executeQuery("SELECT COUNT(ID_Cita) FROM Cita JOIN Pacientes ON Cita.RFC_Paciente " +
                        "= Pacientes.RFC_Paciente WHERE Nombre_Completo = '" + combo.getSelectedItem() + "'");
                rs.next();
                int result = rs.getInt("COUNT(ID_Cita)");
                rs = sta.executeQuery("SELECT Consultas FROM Ciclo JOIN Pacientes ON Ciclo.RFC_Paciente = Pacientes." +
                        "RFC_Paciente WHERE Nombre_Completo = '"+ combo.getSelectedItem() +"' AND Ciclo.Numero_Ciclo = " +
                        "Pacientes.Ciclo");
                rs.next();
                int maximo = rs.getInt("Consultas");
                /* if maximo is bigger than result plus 1, then it shows the alert, but it is shown even if I don't change the combo value!!!, this part only works if the default value of the combo is blank */
                if (maximo >= result +1 ) {
                    sta.executeUpdate("UPDATE Cita,Pacientes SET Cita.RFC_Paciente = Pacientes.RFC_Paciente WHERE " +
                            "Nombre_Completo = '" + combo.getSelectedItem() + "' AND ID_Cita = " + tabla.getValueAt(i,0));
                }else
                    javax.swing.JOptionPane.showMessageDialog(null,"No se puede agregar otra cita...");
            }catch (ArrayIndexOutOfBoundsException ex) {
                System.out.println (ex.getMessage());
            } catch (SQLException ex) {
                System.out.println (ex.getMessage());
            } finally {
                base.cerrar(sta);
    }So, I'd like to know why the alert appears twice when it works and why it appears even if the combo value ain't changed. I really hope anyone can help me. Thank you!

    if the first is bigger than the second it shows an alertIf you want to know when data is changed in the table then you use a TableModelListener, not an ItemListener. Here is a simple example:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=566133
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Hi, I really need help with Adobe Bridge and am under a deadline (of course!)

    Adobe Bridge is refusing to open for me. I've been using the CC for over a year now and have had no problems. I'm using it on a Mac Book Pro OS X 10.9.3.
    I'm working in Indesign and no matter I tried Bridge would not open. I've tried force quitting it and restarting, checking for updates but nothing has worked so far.
    Please can anyone help, I'm really under pressure to meet a print deadline?
    Many thanks,
    Sarah

    Hi Omke,
    Thanks for your help. I really appreciate you taking the time. Unfortunately it didn't solve my problem, however I was chatting with customer support and they were able to see it is a technical issue, so now its just a matter of contacting the technical support office when it opens.

  • Need help with advanced JTable

    The application I am converting to Java has a string grid (table) with special behavior that I need to be able to bring to the Java version. It let's users filter the column data (that I know how to do) using a locked first row (just below the column header) that always stays in place and that shows what filter is applied to each column (by showing a combo box).
    I usually write server apps and have only been trying to grasp Swing for about a week, and I find myself stuck :(
    Is this at all possible in Java? If not, can I make the header respond to mouse events and show a popup menu for each column? If so how?
    Please help!

    I have made an attempt as follows (to show where I am stuck).
    I have two TableModels that contain rows and data;
    a) the grid data that's coming from our EJB session facade
    b) the filter settings (a String[] with initially empty strings) which show what filter is used for each column.
    The two table models are shown in two tables that share a common TableColumnModel so that whenever i move or resize a column both tables are updated.
    The filter table shows it's header and the row of empty cells. The Table Model I've used for it is ripped from the Sorted Table example from Sun, so that I can capture mouse events, set the sort order for each column and notify the grid table that it needs to update accordingly.
    I attempted to use the filter table as a header view in a JScrollPane, which would keep it in place all the time while the user would be able to scroll and resize the grid table.
    This is where I fail - I can't even get it to show up in the header. And if I only put the two tables on a JPanel it seems impossible to get them to stick together when the pane is resized (aside from the fact that I no longer can capture the mouse events).
    I'd be happy to send someone the code fragments if you think you have a solution to this - that will allow users to resize, edit and move columns in a table where you initially have no clue as to how many columns it will contain.
    Please please continue to help me :)

  • 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 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 uneditable JTable - frustrated

    can someone please give me WORKING code (not, oh it is easy do this and that) to make the whole JTable uneditable? if you give me the abstract model with cell renderer, i will put in the JTable using the:
    JTable (yourAbstractModel)
    my JTable is 100 percent purely DYNAMIC. i will have no idea how many columns there may be until after the user chooses the columns to see (which i have working).
    when a user selects a row, i will set the column to a
    light gray .
    after a day, i was able to get the columns to stop shrinking and let the scoll bars work on the scroll pane (after going to some 20 web sites looking at code). i am very frustrated.
    i do need to get the value of a cell to determine which record they are going to edit.
    THANKS FOR ANY HELP!!!!!

    SORRY
    this >
    when a user selects a row, i will set the column to a
    light gray .
    should READ >
    when a user selects a row, i will set the ROW to a
    light gray .

  • 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

  • Need help with basic user events in Queued state machine example

    I have written a little queued state machine example to try to teach myself about creating and using user events.  The objective of the machine is to periodically choose a number (I'm doing it now with a control instead of a random number generator for troubleshooting), and compare that number with the number I have set in a control.  When they match, I want to cause an event to fire so I can do something about having found a match.  The examples in the LV Help file references show the events within the event structure, but I want to reach out of a state and cause an event ....
    Can someone point me in the right direction here?
    Thanks
    Hummer1
    Solved!
    Go to Solution.
    Attachments:
    User Event Generator Example01 snip.png ‏102 KB

    Yep....That was it...I had tried to do that but got fouled up with the variant definition...so defined the user event using a boolian and did the same in the case structure where I wanted to create the event and it worked great...
    Thanks.
    Here is the final version...not bulletproof, but does have a queued state machine using a user event to cause an event to fire.
    Hope you find it useful.
    Hummer1
    Attachments:
    User Event Generator Example01.vi ‏45 KB
    Operating States Enum Example01.ctl ‏5 KB

  • 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]

  • Hi, i need help with a jtable

    hi, iam new here, i try to read an excel file, and put the rows and columns in a jtable, i dont have the code exactly but maybe someone can help me.

    You can use this
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //String myDB ="myExcel";
    String myDB =  "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=c:/book.xls;"
        + "DriverID=22;READONLY=false";
    //con=DriverManager.getConnection("jdbc:odbc:myExcel");
    con=DriverManager.getConnection(myDB,"","");
    dbmd=con.getMetaData();
    stat=con.createStatement();
    rs=stat.executeQuery("Select * from `Sheet1$`");//[Sheet1$]
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    while (rs.next()) {
    for (int i = 1; i <= numberOfColumns; i++) {
    if (i > 1) System.out.print(", ");
    String columnValue = rs.getString(i);
    System.out.print(columnValue);
    System.out.println("");
    for (int j = 1; j <= numberOfColumns; j++)
      System.out.println(rsmd.getColumnName(j));
    rsTable=dbmd.getTables(null,null,"%",null);
    while (rsTable.next())
    //String tableCatalog = rsTable.getString(1);
    //String tableSchema = rsTable.getString(2);
    System.out.println("Table Name "+rsTable.getString(3)+" Table catalog "+rsTable.getString(1)+" Table Schema "+rsTable.getString(2));
    rsTable.close();You can store Column Names,data in the String Array.
    To generate a JTable with this check this
    http://www.codetoad.com/java_JTable.asp.
    There at method createBlankElement()
    put values from the data array or if you want, from the database.
    For the Columns, pass columnNames array to addColumns method.

  • 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.

  • HT3529 Help with multiple e-mail addresses under one Apple ID

    My 3 kids each have their own e-mail addresses under my Apple ID for the iMessage feature on their iPod Touch's.  Just recently I began receiving their iMessages on my iPhone despite the fact that each device has only its own email address selected.  Also, when I send messages to certain people, it goes out as one of my children's messages.  When I send my children a message, it goes to them as well as comes back to me from myself.  We have never had an issue with this until about 2 weeks ago.  Has anyone ever experienced this, or do you have suggestions on how to fix the problem?
    Thank you in advance!
    Sincerely,
    Melissa

    To make it simple, you can use your purchasing Apple ID on all your family devices in Settings > iTunes & App Stores > Apple ID. That allows you to share your Apps, Books and Music purchases from Apple iTunes Store, iBooks Store and Apps Store.
    For all other Apple services like Game Center, iMessages, FaceTime, etc. you should get each of your children their own Apple ID (using their valid e-mail addresses)
    https://appleid.apple.com

  • Help with TableRowSorter , JTable and JList

    Hello,
    I�m developing an application in which I�m using a Jtable and Jlist to display data from a database. Jtable and Jlist share the same model.
    public class DBSharedModel extends DefaultListModel implements TableModelFor the Jtable I set a sorter and an filter
    DBSharedModel dataModel = new DBSharedModel();
    Jtable jTable = new JTable(dataModel) ;
    jTable.createDefaultColumnsFromModel();
    jTable.setRowSelectionAllowed(true);
    TableRowSorter<DBSharedModel> sorter = new TableRowSorter <DBSharedModel> (dataModel);
    jTable.setRowSorter(sorter);From what I read until now JavaSE 6 has NOT a sorter for JList (like one for JTable).
    So, I am using one from a this article http://java.sun.com/developer/technicalArticles/J2SE/Desktop/sorted_jlist/index.html
    When I sort the data from the table, I need to sort the data from the list, too.
    My ideea is to make the Jlist an Observer for the Jtable.
    My questions are:
    1.     How can I find if the sorter makes an ASCENDING or DESCENDING ordering?
    2.     How can I find what the column that is ordered?
    Or if you have any idea on how can I do the ordering on Jlist to be simultaneous to Jtable .
    Please help!
    Thank you

    Oh what the hell:
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java. This one has been getting a lot of very positive comments lately.

Maybe you are looking for

  • Page is jumbled

    I just made a change to a page in my muse site and when viewed in the browser it is all over the place. Preview works fine but the live version is a mess. I accepted the latest update from muse. I'm on a mac, I saved the site, exported to html and us

  • (Grub) Dual booting with XP on sdb

    My goal is to be able to dual boot with two hard drives: Arch on sda and Windows XP on sdb.  With help in the #archlinux IRC I've managed to get Windows XP to boot by getting the menu.lst correct but when I click "Start Windows Normally", or "Start i

  • Date Format Mask On Unbound Item

    Hello everyone! I have a module with some unbound items. One of them is date_completed. I gave the item datatype DATE and formatmask "DD-MM-RRRR". But in the application, when I type 290108, I get FRM-50026 "date must be entered like : DD-MM-YYYY. Bu

  • Ipad Camera connection kit problem with SD card

    I have a gen3 ipad and have the camera connection kit which consists of 2 connectors. 1 is usb and the other is SD card. The usb when hooked to camera works just fine but the SD adater does not see any sd card I put in.

  • What is better for AEFX CS3 to run unbelievably?

    I'm looking at buying a new PC to run After Effects CS3 better and I was wondering what is the best route to go.  Should I get a machine with more processors or should I get more Ram.  Would a graphics card make a huge difference and which is a bette