Serializing object with its events

Hi..
I have serialized & de-serializaed a button in a Frame. The problem is after de-serialization, the events i defined on the button are not executed..Will you help me out on this problem? where am i making the mistake?
Thanks.

I have serialized & de-serializaed a button in a
Frame.Why?
The problem is after de-serialization, the
events i defined on the buttonYou mean the listeners don't work?
are not executed..Will
you help me out on this problem? where am i making
the mistake?You mean, besides not posting in the Swing forum? Not posting your code, I'd say.

Similar Messages

  • Serializing objects with the NIO API

    I try to use the new IO API to implement a non-blocking multi-threaded server that communicates with client applications by exchanging serialized objects. I started from the code in the JavaWorld article at http://www.javaworld.com/javaworld/jw-09-2001/jw-0907-merlin.html .
    With the new features of J2SDK 1.4.0, you don't have to create a separate thread per connected client. That is a big improvement.
    But when I read an object with ObjectInputStream, I get a java.nio.channels.IllegalBlockingModeException.
    Has anybody successfully implemented such a server since the release of the new io API?
    Thanks.
    Jean-Robert

    The ObjectStream code is basically incompatible with non blockin I/O since you must block on the stream until a whole Object is available. You could roll something like this yourself, by reading bytes until there are enough available to build the next object and then getting that Object from the buffer and shipping it to your client thread. All of this is far more trouble than just using the Stream oriented I/O.
    NIO and mutilple threads are a nightmare, the whole idea of non-blocking I/O is to avoid needing multiple threads. If you do use multiple threads you will need queues between them. See the Taming the NIO Circus topic for lots of discussion of NIO and its problems. The system seems more stable in JDK 1.5, but most people haven't even started using 1.4 for production yet.
    Personally I avoid ObjectStreams. They are only useful between Java applications, if I want that I just use RMI and let Java do ALL the hard work. When I write a Socket based app, its probably because the other end is a mainframe of a C program. For that reason I send data as bytes, packaged up in packets, and encode as XML or ASN.1 so the other end can interpret it.

  • Serializing objects with arrays - JDBC

    Hello,
    Are there any known issues with serializing arrays into Blobs with JDBC?
    I have an object with a complex array. It’s basically name/value pairs, but the values
    can be arrays as well. The type of the values array can be of different types, i.e. string, Boolean, int, etc. These arrays are a unioned, and a discriminator identifies what type of array I have.
    Array (name, value.discriminator, value) where the value is also an array of some type.
    An example of some data would be.
    Name = ‘Employee Name’ values = { ‘Fred’} discriminator = StringType
    Name = ‘address’ values = { ‘addr1’, ‘addr2’, ‘addr3’} discriminator = StringType
    Name = ‘Insured’ values = {true} discriminator = booleanType
    Name = ‘Some_Int_values’ values = {1,2,3,4} discriminator = IntegerType
    Name = ‘SomeOther_Int_values’ values = {1,2,3,4} discriminator = IntegerType
    It does not need to be that complex… it might just be
    Name = ‘Employee Name’ values = { ‘Fred’} discriminator = StringType
    The issues I’m having is before I serialize the object and write it into a blob, I can repeat through the length of the outer array and print the value arrays. After I read the object for the blob, I cannot do this. It seems to have a problem identifying the discriminator type.
    Thanks!

    421780,
    Sounds like a good candidate for XML. Have you considered that? Have you seen Oracle's XML Technology Center?
    Good Luck,
    Avi.

  • How to move an object with its animation path, without adding a new keyframe?

    Hi,
    If I create an object which has a keyframe animation, how can I change its location/scale without adding new keyframes? That is, I want to move the whole thing with all its animations & keyframes as a single entity.
    thanks
    Arun

    Hi,
    big thanks for that. Unless Im doing something stupid when I did that it made a new copy of the object but did allow me to place that new instance elsewhere.
    Is there any way just to move an object and its path without making a new copy?
    All the best
    Arun

  • RMI - Serializing Object with the right constructor..?

    Hello, I am trying to usr RMI to send an object that I serialized but I have further porblems than that. The Object that I am using is called FileLineReader and it Extends Buffered Reader. SInce Buffered Reader is not Serializable, I implemented Serializable within FileLineReader, so that I can send it through the RMI.
    package musr.client.dbreader;
    import java.io.*;
    public class FileLineReader extends BufferedReader
              implements LineReader, java.io.Serializable {
    String pattern; // The string we are going to be matching.
    * Constructor
    * Passes the stream to our superclass
    public FileLineReader(Reader in) { super(in); }
    * This is the filter: call our superclass's readLine() to get the
    * actual lines, but only return lines that contain the pattern.
    * When the superclass readLine() returns null (EOF), we return null.
    public String matchLine(String pattern) throws IOException {
    String line;
    do { line = super.readLine(); }
    while ((line != null) && line.indexOf(pattern) == -1);
    return line;
    When I use this object to send it through RMI to the Server,
    (FileLineReader)inFile = (FileLineReader) obj.senddbFile(openFileTextField1.getText(),openFileTextField2.getText());
    I get an exception:
    GUI_RMI exception, error unmarshalling return; nested exception is: java.io.InvalidClassException: musr.client.dbreader.FileLineReader; no valid constructor.
    I am not sure what the problem is and I have been struggling with it for a while now. The constructor of BufferedReader takes one argument in so I have to pass FileLineReader an argument when I construct it. I think the RMI needs a constructor that takes no arguments and that causes problems. Is that true? In that case, I can't extend my class with BufferedReader.
    Or maybe the problem is somthing quite different. Anyone has any suggestions or comments, I'd appreciate help. Thanks Ivan

    You will have to create your own stream. (RMI is just a way to call reemote methods; it knows nothing about files or I/O.)
    1. You need a RemoteReader. This object should probably have 3 or so methods:
    Open(filename) Opens the file
    read reads a block from the file and returns it as a byte array.
    close()
    2. You need a RemoteInputStream object.
    o Instantiated on the client.
    o Makes calls to the RemoteReader.
    o Has some read methods and a close method.
    o Implements InputStream.
    With these two objects, you have enough underpinnings top - for example - wrap the RemoteINputStream in a BufferedReader or whatever you need.

  • Encrytiong serialized object and seald object

    Hello,
    At the moment I'm writing some code using serialized object stream encrytion. But lately I dicovered sth like sealed objects. My question is what is the difference between creating a SealedObject and then writting it to a stream and encrypting the serialized object as a stream?
    1. What is the purpose for SealedObject regarding the possibility of encrypting serialized objects with streams?
    2. Are there any differences in use of those two ways of securing objects?*
    Thanks for Your replies in advance
    DT

    Read it but not shure wht exactly do U mean. It doesn't ansewer mys questions: of what is the reason for usinf sealedobject where we can encrypt the object with the CipherInputStream (which I have posted as question 1 in the 1st post) and what are the differences in idea of use meaning where should we use CipherInputStream and where Seald object?

  • With multiple events in a single event case, how to associate value with the correct object?

    I am playing with the template where an event structure takes note of user inputs and a main state machine is then used to respond to these inputs. When I only monitor one control I use the 'NewVal' output to read out the changed value. But when I monitor multiple objects with a single case I also have to associate the readout with the correct owner. After some tinkering I was able to extract the label property and use a case to assign them. Are there better ways of doing this? For example maybe there is a way to connect the label text directly to the 'bundle by name'?
    Also this should be easy to accomplish by simply creating local variables of the objects and read from them, but I got the impression that the use of global and local variables is now strongly discouraged?
    Thanks for any suggestions!
    Attachments:
    Untitled.png ‏39 KB

    Well, I don't really like these theroretical discussions. Can you attach a simplified version of some of your code?
    There are many other ways to identify the particular control. You could for example search an array of references for the value of the "ctlref" event data node. This would make the code much more robust (your code will fail for example if you (or some other programmer updating your code in a few years!) notices a mispelling and edits the label without also changing the case structure cases).
    LabVIEW Champion . Do more with less code and in less time .

  • Migration from Serial polling to Serial queue with event handler

    Hi, I am trying to migrate from classical serial polling communications to serial queue with "event handler" for the buttons pressed by the user. I have placed four while loops, one for the event handler, a second one for serial reading, a third one for serial writing (depending on what button was pressed) and the last one for processing what was read from the serial reading while loop, via a queue.
    My attached device reads the signals from 8 sensor ( 4 temperature and another 4 temperature plus humidity in the same sensor ) and send them via serial to Lavbiew.
    First of all, only once just after running the LV program, I must turn on my attached device with an ON command plus a carriage return after that the device will respond with the number of sensors plugged to it, disabling the corresponding buttons in the front panel. Then labview must wait until I pressed Acquire Button (event handler) and send a CF command plus what sensors to acquire plus a carriage return, then the device will respond continuously to labview with the sensor readings until I press the stop button (event handler), there is also another button to exit the program, also with event handler.
    I am having problems using the event handler and the queues because I am new using these structures, I have looked at  the LV examples but there is nothing concrete on using serial with event handler and queue.
    Take a look at my VI and you will soon notice what kind of problems I am having, any suggestions will welcome.
    Thank's in advance.
    Regards.
    Attachments:
    serial queue.zip ‏76 KB

    Hi Luisete,
    Maybe the problem arise because you are En- and DeQueue in parallel. You do a lot of things in parallel, that is nice if you are sure that one loop doesn't have to wait for another loop. Make sure you don't dequeue before enqueue.
    Hope this helps
    I never knew that the standard error cluster output could be wired directly to the loop control of a while loop.
    First time I see this

  • Opening files with serialized objects even if class definition has changed.

    Dear all,
    We are deploying an application wich saves serialized objects. But when changing something in the code and especially in the serialized classes we are not able to open files which have been saved with the old 'outfit' of the class.
    I think, that this is probably a common problem and therefore I am interested whether there exists also a common or practical solution.
    What is the direction I have to look in? XML, Serializable or is it something else?
    Thanks for a short answer,
    Axel

    If you add, remove or change a classes variables, then it will be serialized differently.
    Any fields which you do not need to be serialized, may be marked as transient, so you can add and remove them at will.
    In the longer term, you can override the readObject() / writeObject() methods and explicitely load/save what fields you want. This will also allow you to set intelligent defaults, if for example, you added a new field, but your old serialised classes do not have this field. You can also precede all serialised data with version numbers... might help a bit.
    So code ( psuedocode ) might look like this...
    private void readObject(java.io.ObjectInputStream in)
         throws IOException, ClassNotFoundException;
        int ver = in.readInt();
         classfield1 = in.readLong();
        if ( ver >= 2 )
            classfield2 = in.readLong();
        if ( ver >= 3 )
             classfield3 = in.readLong();
    }regards,
    Owen

  • Hello! I am attempting to register a product, my iPad, to my adobe products with its serial number and I am being told that the serial number is invalid. I am certain that the serial number is correct, and am unsure how to proceed.

    Hello! I am attempting to register a product, my iPad, to my adobe products with its serial number and I am being told that the serial number is invalid. I am certain that the serial number is correct, and am unsure how to proceed.

    apart from the fact there's no way I could have answered your question confidently, I was also not able to supply my non-answer within your very tight time constraints.
    what happened? how'd you get on?

  • Can lost ipod be traced with its serial number?

    can lost ipod be traced with its serial number?

    No.
    - If you previously turned on the FIndMyiPod feature and location service is on, and wifi is on and connected go to iCloud, sign in, and go to FindMyiPhone. It the iPod has been restored it will never show up.
    - Report to police and change the passwords fro all accounts used on the iPod.
    - Apple will not help
    Reporting a lost or stolen Apple product

  • Can I track a stolen iPod with its Serial Number when its being restored?

    Can I track a stolen iPod with its Serial Number when its being restored?

    CAN A IPAD BEING TRACK AFTER BE RESTORED

  • Read function block parameter with its object dictionary index in VC?

    How do I read  a function block parameter with its object dictionary index using NI-Fbus Communications Manager Programmer VC API?

    You can use  marco NIFB_INDEX(index) as parameter for nif_ReadObject function. The index is the relative index of the parameter in the block.
    nifError_t nifReadObject(nifDesc_t ud, NIFB_INDEX(uint32 idx), void *buffer, uint8 *length)
    Please also refer to 'NI-FBUS Hardware and Software User Manual' from Start->National Instruments->NI-FBUS->Manuals. Page 6-41 ~ Page 6-44 describe the detail information about nifReadObject() function.
    Page 6-51 ~ Page 6-52 explain the usage of marcos for processing index.
    Feilian (Vince) Shen

  • Problem with serialized objects and JWS

    My JWS launched application fails when loading a serialized object that has been instatiated from a class not contained in the signed jar-file. Does anyone know why this happens and if there is some workaround for the problem?

    Where is the class contained then?

  • Object with a mind of its own

    hi....
    i have two objects currently sharing a layer, and i have used various behaviours and filters on them already, separately as individual objects AND together as a layer. no problem UNTIL i tried to change the rotation of one of the objects in the properties tab of the inspector. the other object changed its position on the screen, without my assigning it to do so. according to ITS properties tab, it still has the same x and y coordinates as before......and its bounding box has not moved from the original position......but the object itself has definitely moved horizontally halfway across the screen. now why would it do that?
    i mac g5   Mac OS X (10.4.6)   motion 1, final cut pro 4.5

    On your Rotate behavior, do you have the "Affect Objects" checked or unchecked?
    Patrick

Maybe you are looking for

  • Online Backup of supported Linux VM on Hyper-V 2012 R2 / SC DPM 2012 R2

    Hi, I'm trying to set up a lab environment: Win 2012 R2 with Hyper-V running 2 Linux Machines: Linux2 - CentOS 6.4 with manually installed Linux Integration services 3.4 Linux3 - CentOS 6.4 without LIS (should be already included in CentOS) Another m

  • Adobe Acrobat 9 install for Mac

    How do I re-install Adobe 9 on my Mac? when I go to download it says not available for mac - it is however available for pc. How can I get my Acrobat 9 back?

  • How to display the Form output in multiple languages ? ------ Urgent

    How to display the Form output in multiple languages ? - Urgent

  • N96 Bugs I've noticed

    Generally pleased with my new N96 which replaces my ageing N95 but i have noticed two bugs. I am using a simfree, nokia shop purchased N96 update to SW v11.101.098.1. BUG 1: I've imported my contacts from my N95 and i cannot set defaults for email ad

  • DVCPro decks and FCP 5.1

    Are there any known issues with FCP v.5.1 and Panasonic DVCPro decks AJ-SD255. Specifically, batch digitizing and print/edit to tape? Thank you-- 2 x2.66 ghz dual-core intel xeon   Mac OS X (10.4.7)   1 gig 667 MHz