Data conversion for communication between Java and C/C++ program

The real problem, i guess, is about data type conversion between Java and C programs. For instance, and int is supposed to be 4 bytes in Java, and also in C/C++. But, as far as I know, the size of and int in C depends on the processors architecture, so if it were a 64 bit arch., size of and int, double, etc. in C, would change. The real scenario would be a communication between a 32 bit machine (Java) and a 64 bit machine (C/C++).
First of all, is this assumption correct?
If so,
how is it possible to deal with this problem in Java?
Is there any way to know 'type length' automatically? or
would it be necessary to modify the Java program to work with a C program in 32-bit or 64-bit arch?
thx in advance

cotton.m wrote:
Yes you should develop the C part of the protocol first and then build from there.
See http://forum.java.sun.com/thread.jspa?threadID=5243547 for a previous discussion of this topic.
I understand what you mean, also the topic you referenced. I will explain the situation a bit more. The protocol is already defined: (16 bits message size, 16 message id, 32 bit time, etc.); it is also defined in C (structures and so on). So it would be easy to write my Java code using the specified protocol in bytes, and C types wouldn't be necessary to be considered. But, let's say that the C code can't be modified, and I thought (and don't know yet if its correct), that size of C types CAN changed depending on architecture. So if size changes for C types (code is specified in short, int, etc, and not in bit format), it all would be a mess, if I don't implement something in my Java code.
cotton.m wrote:
I don't believe that 32 or 64 bit enters the equation here at all.Maybe 32 o 64 doesn't mind, but sparc or PC could take a point here. Communication would be between a sun solaris sparc and windows x86 PC. But if type size in C/C++ does not change, I wouldn't really have any problem then...
The situation is not ideal, I know, but is what I have; and I think I could have problems if I run the C program in other machines; so I would have to try to solve it whithin my Java Program.
I hope it is clear now what I need.
thx
Edited by: MGasa on Jan 16, 2008 1:51 AM

Similar Messages

  • Communication between java and c++, help!

    i am c++ programmer and newly to java.
    now i am developping a client/server app. i use java transfers data (socket) between client and server, and use c++ to create user interfaces because c++ is easier for interfaces.
    my question is:
    in a single PC, java needs to tell c++ what info was read from socket and c++ needs to tell java what info will be written to socket.
    i want to use 2 files (read and write) as media between java and c++. that is: java writes data to a file and c++ reads from the file, and vice versa.
    i know it's not efficient. could you tell me better way to do?
    thanks in advance.

    thanks for reply.
    my problem is: socket is fare in java, not fare in c++
    (win/nt). could u use server in a non nt-server
    machine with c++?I'm not sure what you mean "fair". NT-Server is just a version of NT that Microsoft adds their server products to. Most of which you don't want to use because they are a security nightmare. I think what your asking is can you do the equivalent of Java's ServerSocket in C++. Sure, the socket libraries in Windows (at least last time I checked) were based off the BSD socket libraries. So you would basically do something like:
    // Open socket
    ss=socket(AF_INET, SOCK_STREAM, 0);
    if(ss==-1)
      cerr<<"Error opening socket."<<endl;
      return 0;
    // Fill in address
    struct sockaddr_in server;
    server.sin_family=AF_INET;
    server.sin_port=htons((unsigned short)port);
    server.sin_addr.s_addr=INADDR_ANY;
    // Bind to port
    if(bind(ss, (struct sockaddr *)&server, sizeof(server))==-1)
      cerr<<"Could not bind to port "<<port<<"."<<endl;
      return 0;
    // Ready to accept connections
    if(listen(ss, 5)==-1)
      cerr<<"Could not listen."<<endl;
      return 0;
    // Loop to accept connections
    while(/* some condition */)
      // Accept a connection
      int s=accept(ss, 0, 0);
    }This should work on any version of windows as long as you have winsock. The example code might need to be changed a little though since I copied it from a Linux program I had.

  • Data Inconsistency for 0EMPLOYEE between ECC and BI

    Hi,
    We do a full load to 0EMPLOYEE using 0EMPLOYEE_ATTR from ECC. There were records deleted for lot of employees (some action types) in ECC. This has caused data inconsistency for 0EMPLOYEE master data (time-dependent) between ECC and BI. In BI we have more records for these employees (Additional records have time-dependent range that were deleted from ECC but still exist in BI). These employee records are already being used in lot of InfoProviders. Is there an efficient way to fix this issue? One of the solution is to delete data from all InfoProviders and then delete from Master data for 0EMPLOYEE, but the deletion of employee records can happen quite often, so we don't want to take this route. Also, I tried to re-organize master data attributes for 0EMPLOYEE through process chain, but that didn't work either.
    Message was edited by:
            Ripel Desai

    Hi Ripel,
    I share your pain. This is one of the real pains of Time-Dependant master data in BW. I have been in your exact position and the only way round the issue for me was to clear out all the cubes that used 0EMPLOYEE and then delete and re-load 0EMPLOYEE data.
    I know this responce doesn't help you but at least you are not alone.
    Regards,
    Pete
    http://www.teklink.co.uk

  • Document for difference between java and c++ ?

    I want to know if there is a document that lists the difference between the features and syntax of java and c++ online. If somebody knows, please let me know.

    I want to know if there is a document that lists the
    difference between the features and syntax of java and
    c++ online. If somebody knows, please let me know.The difference is, there is no similarity. Don't even try to think of Java in relation to c++, you'll only end up confusing yourself.
    It's like trying to compare Windows and Linux, sure they do the same sort of thing, and some of the commands appear the same, but they really are completely different things.

  • SAProuter for Jco between Java and ABAP stack

    When configuring Jco at Java only, there is an option to use SAProuter.
    This is not for SMP download or OSS support.
    So is there any document for this kind of SAProuter usage?
    Thanks!

    I don't quite understand why you need SAProuter between 2 SAP instances, which means they locate in 2 different network segments and cannot communicate each other directly. But let's assume this scenario:
    1. ECC in network A, IP 10.10.10.1;
    2. Portal in network B, IP 192.168.1.1;
    3. SAProuter has 2 adapters, IP 10.10.10.2 and 192.168.1.2.
    Make sure all message server and dispatch info are maintained correctly in service file (or corresponding file on other platform) on all 3 hosts, and then when you configure Portal Jco connection routestring you need is /H/<SAProuter IP>/S/3299 to enable them communicate each other. Usually this is for security purpose of potential network attack to SAP hosts from user IP, for instance:
    4. All public users in network C, IP 172...*, then you need a SAProuter which has 3 adapters.
    Regards,
    Effan

  • Adobe AIR - is what I need for communication between C++ and Flash?

    Hello,
    We currently have a C++ desktop application running on Windows and Mac. We want to support web-enabled (launching from the web browser) and moving UI into Flash. I am looking for a communication package that can use with VC++ 6.0 and CodeWarrior 8.0 (Xcode later). This communication package will handle messages between C/C++ app (process) and Flash. The communication need to execute fast (no delay).
    I searched online about this and came across LocalConnection class and Adobe AIR but not getting enough info to have an answer. I am hoping posting this message will get more information.
    Thanks,
    -Thanh

    Thanks Kalisto for a kind offer. We are using old compilers, CodeWarrior 8.0 compiler on the Mac and VC++ 6.0 in Windows. It is nice if I can find a package that will work with both compilers (platforms). Since we want to communicate in realtime, AIR is probably a best option to go for Windows. I am still looking for the answer on the Mac side of how to communicate from C++ to Flash. I'll ask for your help on AIR when time come.
    Again, thanks.
    -Thanh

  • Communication between java and c++ app

    I have a java app and a c++ app, and I would like theese to exchange information, how do I do that? I know one way would be to open a socket in each app and write/read from that, but that seems really unneccessary since both apps will probably be running on the same computer. It has to be a better way...

    You can use the local file to exchange data or use JNI to invoke the C++ application method.

  • Interprocess socket communication between Java and C

    Hello,
    I have opened a socket to C-process listening at predefined port.
    The C rpogram requires data to be send sandwiched between
    "@BEGMSG\n" "@ENDMSG\n"
    WHen the C program encounters \n it understands it is end of line and returns "\0"
    kkSocket = new Socket("abcd",12013);                    
    out = new PrintWriter(kkSocket.getOutputStream(), true);
    is = new DataInputStream(kkSocket.getInputStream());
    out.println("@BEGMSG@\n");
    ibyteread = is.read();
    System.out.println("Server 1 ::"+ibyteread);
    out.println("INIT\tIMISFS11\timisdiag\tdamnyas1\tllgyZux8Mt2Qs\n");
    ibyteread = is.read();
    System.out.println("Server 1 ::"+ibyteread);
    out.println("@ENDMSG@\n");
    ibyteread = is.read();
    System.out.println("Server 1 ::"+ibyteread);
    My problem is the C-program gives error while reading the "@ENDMSG@";
    Can any one tell the problem

    Hello,
    I have taken care of that,
    Also i am writing as bytes
    as shown below
    fromUser= "@BEGMSG@\n";
    String data = "\0INIT\tIMISFS11\timisdiag\tdamnyas1\tllgyZux8Mt2Qs\n";
    String endmsg = "@ENDMSG@\n";
    os.writeBytes(fromUser);
    in.read();
    os.flush();
    os.writeBytes(data);
    in.read();
    os.flush();
    os.writeBytes(endmsg);
    ibyteread=in.read();
    os.flush();
    Now teh C-program reads the first two lines, but gets third line as empty or -1
    Also i have to read the stream after every write, other wise my data is not written to C-program.
    Some how my third statement which @ENDMSG@ is getting converted to empty string of length <=-1,
    If i don;t read after os.writeBytes(data);
    That line is ignored and C-program directly jumps on "@ENDMSG@\n";
    and reads it.
    Can any one tell this funny behaviour
    Thanks

  • Udp communication between java and c?

    Dear all,
    I am currently trying to write a C udp client to communicate with a Java udp server.
    for Java, this is a brief section of code I am using:
    DatagramSocket serverSocket = new DatagramSocket(portNum);
    DatagramPacket receivedPacket = new DatagramPacket(buffer,buffer.length);
    serverSocket.receive(receivedPacket);
    for C i am trying to use the windows socket api Winsock.
    the results:..... the programs can not even connect.
    does anybody know any workarounds ar any possible implemetations, i would really appreciate your help
    thanks
    ceemzek

    This should work. What exactly do you mean by 'cannot connect', and what exceptions or incorrect behaviour are you seeing?

  • Communication between Java and C++, IDL/CORBA

    I have not been working with CORBA before.... but as far as I know the server and client has to be prepared for CORBA during the developpenent. Am I wrong? Or is this only the case for IDL?
    Is it possible to add CORBA/IDL to an already developped c++ server without modifying it?

    You are correct.
    CORBA is the architecture for one program to call another. Some changes will be needed to an existing program. The change might be small, but you will need access to the source.

  • Communication between Java and Oracle

    Hello,
    I have replicated databases running 9iR2.
    Once insert/update/delete transaction is commited
    by replication(master site, backend server),
    notification needs to be sent to front end server
    (eg rowid and tran type update/delete/insert)
    Upon insert/delete/update java stored procedure needs
    to open a socket to frontend server and pass the
    message (rowid and tran type update/delete/insert)
    How can this be accomplished?
    I believe this can be accomplished using Java stored
    procedure. Can someone explain how?
    Thanks.
    Oracop

    If you go up to Search, and enter "JMS", you'll get loads of documentation. http://tahiti.oracle.com will also have plenty of documentation. http://java.sun.com will also have lots of documentation and sample code.
    Justin

  • Socket communication between Java and Python aplications.

    I'm try to connect a pyhton client to a Java server through Socket. The problem is that the python client never receive anything. I'm using a ObjectOutputStream to send the msgs. Does anyone have any idea how make this works?!

    RicardoS wrote:
    So how do you do it?! What do you use?!Bytes! Normally I generate the bytes from XML.
    Edited by: sabre150 on Mar 24, 2008 5:10 PM

  • Short dump Error during VM container communication between ABAP and JAVA.

    Hello All,
    Can anybody please help with resolving the following issue:
    Short dump is displayed, when I try to insert CRM product (type: material) in the document (opportunity). This CRM product was created in CRM directly.
    When I try to insert ECC migrated material, everything works fine.
    Here is the details of dump:
    Short text
        Error during VM container communication between ABAP and JAVA
    Information on where terminated
        Termination occurred in the ABAP program "SAPLPRC_INT" - in "GET_PRICING_PROCEDURE_INFO".
        The main program was "SAPMHTTP ". In the source code you have the termination point in line 100 of the (Include) program "LPRC_INTF35".
    Thank you!

    hi Willie,
         this is the dump, and i have used the t-code sm52 . the VMC is not active.
    |Short Text                                                                                        |
    |    Error during VM Container communication between ABAP and JAVA.                                |
    |What happened?                                                                                    |
    |    The current program had to be terminated because of an                                        |
    |    error when installing the R/3 System.                                                         |
    |    Error in the RFC layer.                                                                       |
    |What can you do?                                                                                  |
    |    Note which actions and entries caused the error to occur.                                     |
    |                                                                                                  |
    |    Consult your SAP administrator.                                                               |
    |                                                                                                  |
    |    Using transaction ST22 for ABAP dump analysis, you can view, manage,                          |
    |    and retain termination messages for longer periods.                                           |
    |Error analysis                                                                                    |
    |    An error has occurred in the RFC layer during communication between                           |
    |    JAVA and the ABAP stack. This prevents data from being passed correctly                       |
    |    between the two stacks.                                                                       |
    |                                                                                                  |
    |    Message    = TH_VMC_SERV_NOT_ACTIVE                                                           |
    |    Return code = -1007                                                                           |
    |    Pointer    = "000007DD348F6138"                                                               |
    |How to correct the error                                                                          |
    |    Check whether the VMC is active on your application server. To do this,                       |
    |    run transaction SM52. If the VMC is not active, contact your SAP                              |
    |    administrator.                                                                                |
    Regards
    Charles

  • Socket communication between client and server

    Hi all,
    I am doing an assignment for communication between java client and java server using sockets. This communication is in the form of XML documents. I am facing a problem in this communication.
    Actually at Server side I'm creating an XML document(Document type object) using DocumentBuilderFactory in javax.xml.parsers package and transforming this Document into a stream using StreamResult.
    My code is :
    Transformer xmlTransformer = TransformerFactory.newInstance().newTransformer();
    StreamResult xmlString = new StreamResult(currentClientHandler.getSocketOutputStream());
    DOMSource xmlDocSource = new DOMSource(xmlDocument); // xmlDocument is Document type reference
    xmlTransformer.transform(xmlDocSource, xmlString);
    so, this xmlString(i.e. StreamResult) is passed directly into the output stream. Here I need to close() output stream after transform() call to help SAX parser to know about end of stream.
    Now at Client side, I am parsing this stream using SAX parser. It parses this correctly. But when sending some another data back to Server when client opens output stream, it given Socket closed exception. I know that closing input or output stream closes socket. But in my problem, I have to send data in streams and not by using files or byte[] etc.
    So what is nearest solution to problem ??
    Plz help me. Any kind of help will be greatly appreciated.

    hi
    thanks for ur reply.
    I didnt get any error msg while getting the back the datas.
    Actually i divided my application into two parts.
    My application will act as both server and client.
    server ll get the browser request and send to the client and the client will send that data to the c++ server.
    Im able to do that.and unable to get the data from server.
    Didnt get any error.
    can u tell me how to make an application to act as both client and server.
    I think im wrong in that part.
    thanks a lot

  • COMMUNICATION BETWEEN JAVASCRIPT AND JAVA APPLET: US$20 AWARD FOR SOLUTION!

    COMMUNICATION BETWEEN JAVASCRIPT AND JAVA APPLET PROBLEM (Easy Filter Java Applet) -
    US$20 TO ANYONE WHO CAN RESOLVE THE PROBLEM
    To forum visitors:
    I am prepared to pay a standard shareware fee of US$20 to a user who can resolve this technical problem.
    If your advice resolves the problem, I'll forward the payment to your postal address (include your
    address with your reply, and also your email address)
    I am attempting to enable a HTML button (using Javascript's onClick command) to directly input a number into one of the parameter text boxes in the Easy Filter Java applet (ie, enter a new color value number in the text field of the standard Colors Multiplicator Filter interface).
    The applet is Freeware and can be downloaded at: http://www.javazoom.net/applets/easyfilter10/EasyFilter10.html
    (It is a very effective bitmap display and editing utility)
    To achieve this, I am trying to access the part of the applet that defines and sets the textbox. The text box is defined in the .class file by accessing the parameter details in the genericfilter.txt file (accompanies the .class files). I need to access 'private String appletInitialize()' and then one of the 'textFieldParameters' which sets the textbox.
    I understand the basic syntax for referencing the applet:
    document.appletname.setString("An example"). However, accessing the text fields in this applet is more complex!!
    Please can you recommend the correct Javascript syntax to achieve communication with the applet.
    Thank you for your kind assistance.
    JM Graham
    [email protected]
    The Java source code for the applet: EasyFilter.class
    # Easy Filter - E.B/JavaZOOM 1999 #
    # Contact: [email protected] #
    # http://javazoom.hypermart.net #
    /* Originally compiled from EasyFilter.java */
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    import java.applet.Applet;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.image.MemoryImageSource;
    import java.awt.image.PixelGrabber;
    import java.util.Vector;
    public synchronized class EasyFilter extends Applet implements KeyListener
    private String paramFileName;
    private Color bgColor;
    private Color fgColor;
    private Color parColor;
    private Color sepColor;
    private Color titleColor;
    private Color helpColor;
    private int WinWidth;
    private int WinHeight;
    private String title;
    private String logoFileName;
    private String originalImageFileName;
    private String filteredCaption;
    private String originalCaption;
    private Vector paramsName;
    private Vector paramsValue;
    private Vector paramsComment;
    private Panel panelParameters[];
    private Label labelParameters[];
    private TextField textFieldParameters[];
    private Label labelComments[];
    private int nbParameters;
    private ScrollPane scrollPaneParams;
    private Panel panelParams;
    private Image theLogo;
    private Image theOriginalImage;
    private Image theFilteredImage;
    private int theOriginalPixelArray[];
    private int logoWidth;
    private int logoHeight;
    private int imageWidth;
    private int imageHeight;
    private drawCanvas canvasTitle;
    private Panel panelTitle;
    private Label labelTitle;
    private Panel panelImages;
    private Panel panelOriginalImage;
    private drawCanvas canvasOriginalImage;
    private Label labelOriginalImage;
    private Panel panelFilteredImage;
    private drawCanvas canvasFilteredImage;
    private Label labelFilteredImage;
    private Panel panelHelp;
    private Label labelHelp;
    private int Yspc;
    private FilterImplementation theFilter;
    public void init()
    String string = null;
    string = appletInitialize();
    setBackground(bgColor);
    if (string != null)
    removeAll();
    setBackground(Color.white);
    setForeground(Color.black);
    Label label = new Label(new StringBuffer("Error: ").append(string).toString(), 1);
    Panel panel = new Panel();
    panel.add(label);
    add(panel);
    setLayout(new FlowLayout(1, 5, Yspc));
    public void keyPressed(KeyEvent keyEvent)
    panelHelp.removeAll();
    boolean flag = true;
    if (KeyEvent.getKeyText(keyEvent.getKeyCode()).equals("Enter"))
    for (int i = 0; i < nbParameters; )
    try
    paramsValue.setElementAt(new Double(textFieldParameters.getText()), i);
    i++;
    catch (NumberFormatException e)
    labelHelp.setText(labelParameters[i].getText() + ": Not a Number");
    flag = false;
    break;
    if (flag == 1)
    labelHelp.setText(" .... Running, please wait .... ");
    labelHelp.setAlignment(1);
    panelHelp.add(labelHelp);
    panelHelp.doLayout();
    theFilter.updateParameters(paramsValue);
    theFilter.computeFilter();
    theFilteredImage = createImage(new MemoryImageSource(theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight(), theFilter.getFinalImageBuffer(), 0, theFilter.getFinalImageWidth()));
    canvasFilteredImage.setImage(theFilteredImage);
    canvasFilteredImage.setBounds(0, 0, theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight());
    canvasFilteredImage.repaint();
    panelHelp.removeAll();
    labelHelp.setText("- Done -");
    else
    labelHelp.setText("- Press Enter to run the Filter -");
    labelHelp.setAlignment(1);
    panelHelp.add(labelHelp);
    panelHelp.doLayout();
    public void keyReleased(KeyEvent keyEvent)
    public void keyTyped(KeyEvent keyEvent)
    private String appletInitialize()
    WinWidth = size().width;
    WinHeight = size().height;
    if (getParameter("bgcolor") == null)
    bgColor = new Color(0, 0, 40);
    else
    bgColor = new Color(Integer.parseInt(getParameter("bgcolor"), 16));
    if (getParameter("fgcolor") == null)
    fgColor = new Color(255, 255, 255);
    else
    fgColor = new Color(Integer.parseInt(getParameter("fgcolor"), 16));
    if (getParameter("sepcolor") == null)
    sepColor = new Color(158, 128, 128);
    else
    sepColor = new Color(Integer.parseInt(getParameter("sepcolor"), 16));
    if (getParameter("parcolor") == null)
    parColor = new Color(24, 24, 24);
    else
    parColor = new Color(Integer.parseInt(getParameter("parcolor"), 16));
    if (getParameter("titlecolor") == null)
    titleColor = new Color(255, 255, 0);
    else
    titleColor = new Color(Integer.parseInt(getParameter("titlecolor"), 16));
    if (getParameter("helpcolor") == null)
    helpColor = new Color(0, 255, 255);
    else
    helpColor = new Color(Integer.parseInt(getParameter("helpcolor"), 16));
    paramsName = new Vector();
    paramsValue = new Vector();
    paramsComment = new Vector();
    paramFileName = getParameter("paramfile");
    String string = readParams(paramFileName);
    if (string != null)
    return string;
    MediaTracker mediaTracker = new MediaTracker(this);
    theOriginalImage = getImage(getDocumentBase(), originalImageFileName);
    mediaTracker.addImage(theOriginalImage, 0);
    if (logoFileName != null)
    theLogo = getImage(getDocumentBase(), logoFileName);
    mediaTracker.addImage(theLogo, 1);
    try
    mediaTracker.waitForAll();
    catch (InterruptedException e1)
    return "Error while loading image";
    if (mediaTracker.isErrorAny())
    return "Error while loading image";
    if (logoFileName != null)
    logoWidth = theLogo.getWidth(this);
    logoHeight = theLogo.getHeight(this);
    imageWidth = theOriginalImage.getWidth(this);
    imageHeight = theOriginalImage.getHeight(this);
    theOriginalPixelArray = new int[imageWidth * imageHeight];
    PixelGrabber pixelGrabber = new PixelGrabber(theOriginalImage, 0, 0, imageWidth, imageHeight, theOriginalPixelArray, 0, imageWidth);
    try
    pixelGrabber.grabPixels();
    panelTitle = new Panel();
    canvasTitle = new drawCanvas();
    labelTitle = new Label();
    panelTitle.setLayout(new FlowLayout(1, 10, Yspc));
    add(panelTitle);
    panelTitle.setBackground(bgColor);
    panelTitle.add(canvasTitle);
    canvasTitle.setImage(theLogo);
    canvasTitle.setBounds(0, 0, logoWidth, logoHeight);
    labelTitle.setText(title);
    catch (InterruptedException e2)
    return "Internal Error, Try RELOAD !";
    if (title != null)
    panelTitle.add(labelTitle);
    labelTitle.setForeground(titleColor);
    labelTitle.setFont(new Font("Dialog", 1, 14));
    panelImages = new Panel();
    panelOriginalImage = new Panel();
    canvasOriginalImage = new drawCanvas();
    labelOriginalImage = new Label();
    panelFilteredImage = new Panel();
    canvasFilteredImage = new drawCanvas();
    labelFilteredImage = new Label();
    panelImages.setLayout(new FlowLayout(1, 10, Yspc));
    add(panelImages);
    panelImages.setBackground(bgColor);
    panelOriginalImage.setLayout(new BorderLayout(0, 2));
    panelImages.add(panelOriginalImage);
    panelOriginalImage.setBackground(Color.black);
    panelOriginalImage.add("Center", canvasOriginalImage);
    canvasOriginalImage.setImage(theOriginalImage);
    canvasOriginalImage.setBounds(0, 0, imageWidth, imageHeight);
    labelOriginalImage.setText(originalCaption);
    labelOriginalImage.setAlignment(1);
    panelOriginalImage.add("South", labelOriginalImage);
    labelOriginalImage.setBackground(Color.lightGray);
    labelOriginalImage.setForeground(Color.black);
    labelOriginalImage.setFont(new Font("SansSerif", 0, 10));
    panelFilteredImage.setLayout(new BorderLayout(0, 2));
    panelImages.add(panelFilteredImage);
    panelFilteredImage.setBackground(Color.black);
    panelFilteredImage.add("Center", canvasFilteredImage);
    theFilter = new FilterImplementation(paramsValue, theOriginalPixelArray, imageWidth, imageHeight);
    theFilter.computeFilter();
    theFilteredImage = createImage(new MemoryImageSource(theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight(), theFilter.getFinalImageBuffer(), 0, theFilter.getFinalImageWidth()));
    canvasFilteredImage.setImage(theFilteredImage);
    canvasFilteredImage.setBounds(0, 0, theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight());
    labelFilteredImage.setText(filteredCaption);
    labelFilteredImage.setAlignment(1);
    panelFilteredImage.add("South", labelFilteredImage);
    labelFilteredImage.setBackground(Color.lightGray);
    labelFilteredImage.setFont(new Font("SansSerif", 0, 10));
    scrollPaneParams = new ScrollPane(0);
    panelParams = new Panel();
    nbParameters = paramsName.size();
    int i = WinHeight - (33 + 7 * Yspc + logoHeight + imageHeight + 23);
    if (i < Yspc + 2 + 24)
    i = Yspc + 2 + 24;
    scrollPaneParams.setBounds(0, 0, WinWidth - 10, i);
    panelParams.setLayout(new GridLayout(nbParameters, 1, 5, Yspc / 2));
    scrollPaneParams.add(panelParams);
    panelParams.setBackground(sepColor);
    panelParameters = new Panel[nbParameters];
    labelParameters = new Label[nbParameters];
    textFieldParameters = new TextField[nbParameters];
    labelComments = new Label[nbParameters];
    for (int j = 0; j < nbParameters; j++)
    panelParameters[j] = new Panel();
    panelParameters[j].setLayout(new FlowLayout(0, 5, 1));
    panelParams.add(panelParameters[j]);
    panelParameters[j].setBackground(parColor);
    labelParameters[j] = new Label();
    labelParameters[j].setText((String)paramsName.elementAt(j));
    panelParameters[j].add(labelParameters[j]);
    labelParameters[j].setForeground(fgColor);
    labelParameters[j].setFont(new Font("Dialog", 1, 12));
    textFieldParameters[j] = new TextField(8);
    textFieldParameters[j].setText(paramsValue.elementAt(j).toString());
    panelParameters[j].add(textFieldParameters[j]);
    textFieldParameters[j].setBackground(fgColor);
    textFieldParameters[j].addKeyListener(this);
    labelComments[j] = new Label();
    labelComments[j].setText((String)paramsComment.elementAt(j));
    panelParameters[j].add(labelComments[j]);
    labelComments[j].setForeground(fgColor);
    add(scrollPaneParams);
    panelHelp = new Panel();
    labelHelp = new Label();
    panelHelp.setLayout(new FlowLayout(1, 5, 0));
    add(panelHelp);
    panelHelp.setBackground(bgColor);
    labelHelp.setText(" Change colour values and press enter ");
    labelHelp.setAlignment(1);
    panelHelp.add(labelHelp);
    labelHelp.setForeground(helpColor);
    return null;
    private String readParams(String string1)
    Object object1;
    String string2;
    if (string1 == null)
    return "Filename of filter's parameters needed";
    try
    URL uRL = new URL(getDocumentBase(), string1);
    URLConnection uRLConnection = uRL.openConnection();
    uRLConnection.setDoInput(true);
    uRLConnection.setUseCaches(false);
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(uRLConnection.getInputStream()));
    string2 = null;
    catch ()
    return object1.getMessage();
    catch ()
    return object1.getMessage();
    catch ()
    return object1.getMessage();
    if (bufferedReader != null)
    Object object2;
    try
    for (object2 = bufferedReader.readLine(); object2 != null && string2 == null; object2 = bufferedReader.readLine())
    string2 = extractFormat(object2);
    catch ()
    string2 = object2.getMessage();
    finally
    bufferedReader.close();
    if (string2 != null)
    return string2;
    else
    return null;
    private String extractFormat(String string1)
    if (string1.length() == 0)
    return null;
    int i = 0;
    int j = string1.indexOf(" ", i);
    if (j == -1)
    return "Bad format error (space missing)";
    String string2 = string1.substring(i, j);
    if (string2.equals("TITLE"))
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in TITLE missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in TITLE missing)";
    title = string1.substring(i, j);
    return null;
    if (string2.equals("ORIGINALCAPTION"))
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in ORIGINALCAPTION missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in ORIGINALCAPTION missing)";
    originalCaption = string1.substring(i, j);
    return null;
    if (string2.equals("FILTEREDCAPTION"))
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in FILTEREDCAPTION missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in FILTEREDCAPTION missing)";
    filteredCaption = string1.substring(i, j);
    return null;
    if (string2.equals("LOGO"))
    i = j + 1;
    j = string1.length();
    logoFileName = string1.substring(i, j);
    return null;
    if (string2.equals("ORIGINALIMAGE"))
    i = j + 1;
    j = string1.length();
    originalImageFileName = string1.substring(i, j);
    return null;
    if (!string2.equals("PARAM"))
    return null;
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format in a PARAM line";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format in a PARAM line";
    paramsName.addElement(string1.substring(i, j));
    i = j + 2;
    j = string1.indexOf(32, i);
    if (j == -1)
    return "Bad format in a PARAM line";
    try
    paramsValue.addElement(new Double(string1.substring(i, j)));
    j = string1.indexOf(34, i);
    catch (NumberFormatException e)
    return "Bad format in a PARAM line";
    if (j == -1)
    return "Bad format (Double quote in PARAM comment missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in PARAM comment missing)";
    paramsComment.addElement(string1.substring(i, j));
    return null;
    public EasyFilter()
    logoHeight = 33;
    Yspc = 5;

    Addition to my above submission
    To clarify, I'll offer the US$20 to the FIRST person who offers me a workable solution to the problem, not to everyone!!!
    JMGRAHAM

Maybe you are looking for