Can i18n ever be in-built in Java

Does anyone see this happening in the standard Java library :
String toPrint = "Easy access to Yahoo! services like Address Book and Calendar";
System.out.println(toPrint);
==================================
On a en_us PC it will print the following on the console :
"Easy access to Yahoo! services like Address Book and Calendar"
On a fr_FR PC it will print the following on the console :
"Un acc�s direct � votre carnet d'adresses"
Coder will write the error message in English only, but based on the System's locale, java's System.out.println will magically translate it correctly to say french and print - will take away a hell of a lot of i18n worries while coding !!! - Just a thought.

Yeah the idea is not very interesting as you said, but I was just thinking along the following lines :
1. Some sort of basic framework could be developed within the JDK to allow you to hook in you custom Languate-to-Language translator libraries. The framework could be just a Factory which could get you the appropriate translator if it exists (otherwise use a default do-nothing translator), and use it for printing localised messages.
2. Like Java is platform independent, so also, it could claim to be "Language independent"...
3. It might save a lot of Development $$$ for product based companies who need to ship it to various countries across the globe.
4. The initial crop of translators might be a little crude and not very capable, but it could evolve and ultimately become the "Babel Fish" of the galaxy ;-)
Regards,
Vivek.

Similar Messages

  • How can i built a java application using java debug class on Log4J

    Hi,
    As java API support the MethodEntryEvent, using which I can get the automatic logging statements when the method is entered or exited as HelloExample.main(with argument type).
    Where HelloExample is the class name.
    Main is the method entered with its argument types.
    In some cases I have the o/p as
    -- VM Started --
    ====== main ======
    main -- HelloExample
    callerMethod -- HelloExample
    ====== main end ======
    -- The application exited --
    By using Log4J is there any possibility of getting these sort of o/p along with the loggers supported by Log4J. i mean to say can i built an java application which supports the MethodEntryEvent and MethodExitEvent from java API and also uses the Log4J debugging. I took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
    jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the com/sun/tools/example/trace/Trace.java and passed the class constructed with logger taken from Log4J. In this case the logging message is displayed on the console. As per the requirement i need to transfer the whole o/p to an output file along with Log4J logger statements. in this case i should not give any command in the cosule except compiling and executing the programme. the programm also should able to run without the main() as i need to integrate Log4J with an application and the code must me application server independent. i need the output as i got using MethodEnteryEvent (shown as above) in case of java application built using Log4J.
    Can any one help me in this regard. can any one give me some suggestion or any programme of this sort. All suggestions are welcomed.
    Thanks & Regards,

    hi,
    can someone help me how to implement logging for method entry parameters and
    method exit return value.
    can someone help me how to use log4j and integrate it to the method entry
    logging and method exit logging.
    Here what i need is without writing the log statements for the method entry and
    method exit i need to log it to the file
    along with other log4j debug statements i provide in the file.I should be able
    to configure whether to enable/disable the logging
    for method entry and method exit. In method entry i should be able to log the
    parameters the method take and in method exit
    i should be able to log te return value to the log file, before the method is
    returned to the callee.
    i hope i am clear
    Thanks in advance.

  • Installing programs built with Java

    I have a client who installed programs [applications] we built in Java. One person has no problem installing and running the programs. Another can install and run two of the three programs. The third program does not open a dialog box for them to register the program with us. The third person can open one program [the second installs with the first but will not open]; and the third program does not install at all. They all use Windows 2000 5.00.2195 with Service Pack 3. For the program that will not install the task manager indicates that 100% cpu processing time is involved. For the other programs that will not run, they get the javaw.exe error message. A fourth person with Service Pack 4 cannot install any of the programs and gets the wjview.exe generated error and the computer shuts down. This represents money to us if we can solve this problem. I would appreciate any help or suggestions.
    Thanks
    Donna

    * You ship your own JRE for your app
    * You get errors from wjview.exe
    Based on these 2 evidences, your app is not launched
    with your shipped JRE correctly. Perhaps it is
    launching the default java and not the full path to
    your JRE location? That is at least one of your
    problem you need to fix there.
    I suggest two probabilities
    1) As lichudang says above, launching is not correct. wjview.exe is a component of MS Java, not Sun Java.
    2) Possibly these client machines have acquired spyware/adware/viruses. Using wjview to launch these buggers is somewhat common.
    Take a look at this thread http://forum.java.sun.com/wireless/thread.jsp?forum=8&thread=351762&start=30&range=15&tstart=0&trange=15 which talks about (2) above.
    This Google search turns up quite a few references, try refining it with additional terms
    http://www.google.com/search?num=100&hl=en&lr=lang_en&ie=UTF-8&c2coff=1&q=%22wjview.exe&btnG=Search

  • How to parse a string in CVP 7.0(1). Is there a built-in java class, other?

    Hi,
    I need to parse,in CVP 7.0(1), the BAAccountNumber variable passed by the ICM dialer.  Is there a built-in java class or other function that would help me do this?
    Our BAAccountNumber variable looks something like this: 321|XXX12345678|1901|M. In IP IVR I use the "Get ICM Data" object to read the BAAccountNumber variable from ICM and then I use the "token index" feature to parse the variable (picture below).
    Alternately, IP IVR also has a Java class that allows me to do this; the class is "java.lang.String" and the method is "public int indexOf(String,int)"
    Is there something equivalent in CVP 7.0(1)?
    thanks

    Thanks again for your help.  This is what I ended up doing:
    This configurable action element takes a string seperated by two "|" (123|123456789|12)
    and returns 3 string variables.
    you can add more output variables by adding to the Setting array below.
    // These classes are used by custom configurable elements.
    import com.audium.server.session.ActionElementData;
    import com.audium.server.voiceElement.ActionElementBase;
    import com.audium.server.voiceElement.ElementData;
    import com.audium.server.voiceElement.ElementException;
    import com.audium.server.voiceElement.ElementInterface;
    import com.audium.server.voiceElement.Setting;
    import com.audium.server.xml.ActionElementConfig;
    public class SOMENAMEHERE extends ActionElementBase implements ElementInterface
         * This method is run when the action is visited. From the ActionElementData
         * object, the configuration can be obtained.
        public void doAction(String name, ActionElementData actionData) throws ElementException
            try {
                // Get the configuration
                ActionElementConfig config = actionData.getActionElementConfig();
                //now retrieve each setting value using its 'real' name as defined in the getSettings method above
                //each setting is returned as a String type, but can be converted.
                String input = config.getSettingValue("input",actionData);
                String resultType = config.getSettingValue("resultType",actionData);
                String resultEntityID = config.getSettingValue("resultEntityID",actionData);
                String resultMemberID = config.getSettingValue("resultMemberID",actionData);
                String resultTFNType = config.getSettingValue("resultTFNType",actionData);
                //get the substring
                //String sub = input.substring(startPos,startPos+numChars);
                String[] BAAcctresults = input.split("\\|");
                //Now store the substring into either Element or Session data as requested
                //and store it into the variable name requested by the Studio developer
                if(resultType.equals("Element")){
                    actionData.setElementData(resultEntityID,BAAcctresults[0]);
                    actionData.setElementData(resultMemberID,BAAcctresults[1]);
                    actionData.setElementData(resultTFNType,BAAcctresults[2]);
                } else {
                    actionData.setSessionData(resultEntityID,BAAcctresults[0]);
                    actionData.setSessionData(resultMemberID,BAAcctresults[1]);
                    actionData.setSessionData(resultTFNType,BAAcctresults[2]);
                actionData.setElementData("status","success");
            } catch (Exception e) {
                //If anything goes wrong, create Element data 'status' with the value 'failure'
                //and return an empty string into the variable requested by the caller
                e.printStackTrace();
                actionData.setElementData("status","failure");
        public String getElementName()
            return "MEDDOC PARSER";
        public String getDisplayFolderName()
            return "SSC Custom";
        public String getDescription()
            return "This class breaks down the BAAccountNumber";
        public Setting[] getSettings() throws ElementException
             //You must define the number of settings here
             Setting[] settingArray = new Setting[5];
              //each setting must specify: real name, display name, description,
              //is it required?, can it only appear once?, does it allow substitution?,
              //and the type of entry allowed
            settingArray[0] = new Setting("input", "Original String",
                       "This is the string from which to grab a substring.",
                       true,   // It is required
                       true,   // It appears only once
                       true,   // It allows substitution
                       Setting.STRING);
            settingArray[1] = new Setting("resultType", "Result Type",
                    "Choose where to store result \n" +
                    "into Element or Session data",
                    true,   // It is required
                    true,   // It appears only once
                    false,  // It does NOT allow substitution
                    new String[]{"Element","Session"});//pull-down menu
            settingArray[1].setDefaultValue("Session");
            settingArray[2] = new Setting("resultEntityID", "EntityID",
              "Name of variable to hold the result.",
              true,   // It is required
              true,   // It appears only once
              true,   // It allows substitution
              Setting.STRING);  
            settingArray[2].setDefaultValue("EntityID");
            settingArray[3] = new Setting("resultMemberID", "MemberID",
                    "Name of variable to hold the result.",
                    true,   // It is required
                    true,   // It appears only once
                    true,   // It allows substitution
                    Setting.STRING);  
            settingArray[3].setDefaultValue("MemberID");
            settingArray[4] = new Setting("resultTFNType", "TFNType",
                      "Name of variable to hold the result.",
                      true,   // It is required
                      true,   // It appears only once
                      true,   // It allows substitution
                      Setting.STRING);  
            settingArray[4].setDefaultValue("TFNType");    
    return settingArray;
        public ElementData[] getElementData() throws ElementException
            return null;

  • External SOAP client Accessing Webservice using built in Java Data type

    We have built a webservice and deployed it on WLS. We accessed this from a swing
    client it works fine.The webservice methods uses non-built in JAVA data types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass to the
    webservice. We dont want to go by this way.Is there anyway were in we can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net client )
    will be able to exceute my webservice (i.e., passing the required Object which
    the method is expecting)?

    Hi Anish,
    Well first off, your web service doesn't send or receive "objects". It only sends
    and recieves XML, which is in turn converted to/from Java objects at invocation
    time. Second, a .NET (or Perl, or Python, or C++) client will be able to call
    your web service, because the wsdl.exe tool (for .NET) will generate "programming
    language specific" objects from the <types><schema> elements, in the WSDL of your
    web service :-) The wsdl.exe tool will create C# objects from the WSDL, that will
    convert XML to/from C# when your web service is called. That's the beauty of XML
    schema - it's a "universal typing system", so it's not tied to a particular programming
    language. The only issue is whether or not the web services platform vendor's
    XML Schema/WSDL processor, can successfully process the WSDL. Some vendors have
    more complete implementations of the WSDL and XML Schema specs than others, so
    expect varying success here. The one in WLS 7.0 is pretty good, so you shouldn't
    have too many problems consuming WSDL generated by .NET tools (or any other tool
    for that matter).
    Regards,
    Mike Wooten
    "Anish" <[email protected]> wrote:
    >
    We have built a webservice and deployed it on WLS. We accessed this from
    a swing
    client it works fine.The webservice methods uses non-built in JAVA data
    types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value
    objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass
    to the
    webservice. We dont want to go by this way.Is there anyway were in we
    can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net
    client )
    will be able to exceute my webservice (i.e., passing the required Object
    which
    the method is expecting)?

  • CommunityDiscussion/Forum built in Java......

    Good Afternoon,
    I need a tool for creating community discussions and searched google, sourceforge, etc for one built in Java. I found the one used here called Jive that was originally an open source project. The Jive open source page was moved to the jivesoftware site where you can buy it. I like what is offered by Jive and would not mind paying the $1500 bucks or so for the license. But, if there is open source I would much rather contribute source code contributions than bucks.
    Does anyone know of a similar tool written in Java and open source? Or not open source? One key feature is allowing a user to see only those forums they are authorized to see.
    Many Thanks!
    Al

    Hi Kevin,
    Unfortunately, no. I found a few and most were in early stages of development with really basic features. There are some good ones, but not in Java.
    We have settled on Jive and will be coughing up the bucks. It seems to be worth it.
    Al

  • How can i get the source code from java concurrent program in R12

    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    Zulqarnain

    user570667 wrote:
    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Is there any way I can recover deleted pictures from Camera Roll and iCloud? Please please help me. All of my precious pictures are gone that I can never EVER get back. I dont have any iCloud or Camera Roll backup; and my PC can't download more software.

    Hi everyone! I'm in need of extreme help. You see, today, two months ago I went out of the country from the United States of America. I took about 1500 pictures ONLY on my iPod touch. When I returned to the United States to my home, I accidentally deleted a little more than 100 pictures. Then, thinking I could get ALL of the pictures back at once, I restored my iPod touch from an iCloud backup I had a couple of days before. Instead of getting all of my pics back, they all got erased. The pictures that I did delete were deleted from Camera Roll AND Photo Stream (iCloud). Then, I was only able to get about 500 pictures back from iCloud. So about 1000 are still gone. When i did the restore, I thought all my pictures would be there, but they weren't and I couldn't possibly figure out why; because a restore from iTunes or iCloud is supposed to restore your device to the settings of the time you backed up your device. All of my other settings were just the way they were supposed tone for the time being, all except my pictures, which contained not one picture in any folder. So EVERYTHING from Cameta Roll was gone, and only about 500 pictures survived. I kept retoring and restoring, hoping they would come back but unfortunately they didn't. Then one time a restored again, I saw all of them back!! But then, within a blink of an eye, they disappeared as soon as I tapped on one picture. Then, I knew they were still in reach, but I just had to find them. Where could those 1000 pictures go? I looked up how to recover deleted photos, but I have to install a software. My computer CANNOT possibly take anymore software on it, my PC is very sensitive and I cannot delete anything off of it. Please please help me. What can I do to get my pictures back? They are memories that I can never EVER EVER get back. Thank you so much.

    Please please help me, if you know how.

  • How do I delete my old iPhone backup since I can not back up my new phone.  Will I lose any pictures?  Can you ever see what is actually on the cloud? Last, how do I delete the old iPhone back up.  Thanks, been trying to do this for a long time.

    I want to delete my old iPhone backup since I can not back up my new phone.  Will I lose any pictures?  Can you ever see what is actually on the cloud? Last, how do I delete the old iPhone back up.  Thanks, been trying to do this for a long time.

    Deleting the backup only permanently deletes the backup from iCloud.  It doesn't do anything to the data currently in your account or on your devices.  To delete it, go to Settings>iCloud>Storage & Backup>Manage Storage, tap the name of the device that you want to delete the backup for, then tap Delete Backup.
    You can't see anything in an iCloud backup, if that's want you're asking.  You can only restore it to your device.  You can, of course, see your other iCloud data.

  • NewBie Question: Can you make a website completely with Java?

    Greetings my new Fellow Java programmers. My name is Jason and I am a computer programmer and web developer. I am verse in the following:
    1. HTML/XHTML
    2. CSS
    3. Asp.net
    4. VB.Net
    5. SQL
    I want to expand my skills to include:
    1.JAVA
    2. Action Script
    3. Java Script
    4. Ajax
    I have always wanted to learn Java and now I think it is the right time. So my question is can you create a site complete with Java or have a majority of the site functions and look attributed to Java? Is it similar to creating a site with vb.net and asp.net which utilizes html as well? Please explain. I am eager to learn this language. Thank you.
    -RomDog
    ...ROOOOOF!

    RomDog wrote:
    Is it similar to creating a site with vb.net and asp.net which utilizes html as well? Please explain. I am eager to learn this language. Thank you.
    I find it strange that you have to ask this. Of course the end result will be HTML/XHTML, that's what the browsers want. I would think that if you know the .NET side of web development, these concepts (client/server technologies) should already be clear to you.
    The short answer is yes it is possible. However if you want to learn Ajax/Javascript/Actionscript, I would learn those technologies before you learn Java web development as they are completely unrelated. You know that Javascript is not Java, right? You can implement javascript/Ajax in your .NET web applications already.
    Before you want to learn Java web development, learn Java. Seriously, learn basic Java first. It will be a great deal harder (and ultimately a lot more frustrating) to jump directly into the web development side of Java without knowing any of the basics. One of the biggest differences between .NET and Java platforms is that Microsoft basically holds your hand when it comes to making decision about which APIs to use and how to attack a problem; Java leaves you to the wolves to select from a gigantic amount of APIs and tools available that can each solve a problem in their very own way. Freedom is great, but it can be very daunting when you are just beginning.
    So before you even think about web development, I suggest you explore the java tutorial and see if you can get to grips with the language and the tool set.
    [http://java.sun.com/docs/books/tutorial/|http://java.sun.com/docs/books/tutorial/]
    When you are comfortable with the Java language and you are sure that Java web/enterprise development is still something for you, then come back and ask the question again.

  • How can I use XStream to persist complicated Java Object  to XML & backward

    Dear Sir:
    I met a problem as demo in my code below when i use XTream to persist my Java Object;
    How can I use XStream to persist complicated Java Object to XML & backward??
    See
    [1] main code
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.ArrayList;
    import com.thoughtworks.xstream.XStream;
    import com.thoughtworks.xstream.io.xml.DomDriver;
    public class PhoneList {
         ArrayList<PhoneNumber> phones;
         ArrayList<Person> person;
         private PhoneList myphonelist ;
         private LocationTest location;
         private PhoneList(String name) {
         phones = new ArrayList<PhoneNumber>();
         person = new ArrayList<Person>();
         public ArrayList<PhoneNumber> getphones() {
              return phones;
         public ArrayList<Person> getperson() {
              return person;
         public void addPhoneNumber(PhoneNumber b1) {
              this.phones.add(b1);
         public void removePhoneNumber(PhoneNumber b1) {
              this.phones.remove(b1);
         public void addPerson(Person p1) {
              this.person.add(p1);
         public void removePerson(Person p1) {
              this.person.remove(p1);
         public void BuildList(){
              location = new LocationTest();
              XStream xstream = new XStream();
              myphonelist = new PhoneList("PhoneList");
              Person joe = new Person("Joe, Wallace");
              joe.setPhone(new PhoneNumber(123, "1234-456"));
              joe.setFax(new PhoneNumber(123, "9999-999"));
              Person geo= new Person("George Nixson");
              geo.setPhone(new PhoneNumber(925, "228-9999"));
              geo.getPhone().setLocationTest(location);          
              myphonelist.addPerson(joe);
              myphonelist.addPerson(geo);
         public PhoneList(){
              XStream xstream = new XStream();
              BuildList();
              saveStringToFile("C:\\temp\\test\\PhoneList.xml",convertToXML(myphonelist));
         public void saveStringToFile(String fileName, String saveString) {
              BufferedWriter bw = null;
              try {
                   bw = new BufferedWriter(
                             new FileWriter(fileName));
                   try {
                        bw.write(saveString);
                   finally {
                        bw.close();
              catch (IOException ex) {
                   ex.printStackTrace();
              //return saved;
         public String getStringFromFile(String fileName) {
              BufferedReader br = null;
              StringBuilder sb = new StringBuilder();
              try {
                   br = new BufferedReader(
                             new FileReader(fileName));
                   try {
                        String s;
                        while ((s = br.readLine()) != null) {
                             // add linefeed (\n) back since stripped by readline()
                             sb.append(s + "\n");
                   finally {
                        br.close();
              catch (Exception ex) {
                   ex.printStackTrace();
              return sb.toString();
         public  String convertToXML(PhoneList phonelist) {
              XStream xstream = new  XStream(new DomDriver());
              xstream.setMode(xstream.ID_REFERENCES) ;
              return xstream.toXML(phonelist);
         public static void main(String[] args) {
              new PhoneList();
    }[2].
    import java.io.Serializable;
    import javax.swing.JFrame;
    public class PhoneNumber implements Serializable{
           private      String      phone;
           private      String      fax;
           private      int      code;
           private      String      number;
           private      String      address;
           private      String      school;
           private      LocationTest      location;
           public PhoneNumber(int i, String str) {
                setCode(i);
                setNumber(str);
                address = "4256, Washington DC, USA";
                school = "Washington State University";
         public Object getPerson() {
              return null;
         public void setPhone(String phone) {
              this.phone = phone;
         public String getPhone() {
              return phone;
         public void setFax(String fax) {
              this.fax = fax;
         public String getFax() {
              return fax;
         public void setCode(int code) {
              this.code = code;
         public int getCode() {
              return code;
         public void setNumber(String number) {
              this.number = number;
         public String getNumber() {
              return number;
         public void setLocationTest(LocationTest bd) {
              this.location = bd;
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(location);
            f.getContentPane().add(location.getControls(), "Last");
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
         public LocationTest getLocationTest() {
              return location;
         }[3].
    package test.temp;
    import java.io.Serializable;
    public class Person implements Serializable{
         private String           fullname;
           @SuppressWarnings("unused")
         private PhoneNumber      phone;
           @SuppressWarnings("unused")
         private PhoneNumber      fax;
         public Person(){
         public Person(String fname){
                fullname=fname;           
         public void setPhone(PhoneNumber phoneNumber) {
              phone = phoneNumber;
         public void setFax(PhoneNumber phoneNumber) {
              fax = phoneNumber;
         public PhoneNumber getPhone() {
              return phone ;
         public PhoneNumber getFax() {
              return fax;
        public String getName() {
            return fullname ;
        public void setName(String name) {
            this.fullname      = name;
        public String toString() {
            return getName();
    }[4]. LocationTest.java
    package test.temp;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class LocationTest extends JPanel implements ChangeListener
        Ellipse2D.Double ball;
        Line2D.Double    line;
        JSlider          translate;
        double           lastTheta = 0;
        public void stateChanged(ChangeEvent e)
            JSlider slider = (JSlider)e.getSource();
            String name = slider.getName();
            int value = slider.getValue();
            if(name.equals("rotation"))
                tilt(Math.toRadians(value));
            else if(name.equals("translate"))
                moveBall(value);
            repaint();
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(ball == null)
                initGeom();
            g2.setPaint(Color.green.darker());
            g2.draw(line);
            g2.setPaint(Color.red);
            g2.fill(ball);
        private void initGeom()
            int w = getWidth();
            int h = getHeight();
            int DIA = 30;
            int padFromEnd = 5;
            line = new Line2D.Double(w/4, h*15/16, w*3/4, h*15/16);
            double x = line.x2 - padFromEnd - DIA;
            double y = line.y2 - DIA;
            ball = new Ellipse2D.Double(x, y, DIA, DIA);
            // update translate slider values
            int max = (int)line.getP1().distance(line.getP2());
            translate.setMaximum(max);
            translate.setValue(max-padFromEnd);
        private void tilt(double theta)
            // rotate line from left end
            Point2D pivot = line.getP1();
            double lineLength = pivot.distance(line.getP2());
            Point2D.Double p2 = new Point2D.Double();
            p2.x = pivot.getX() + lineLength*Math.cos(theta);
            p2.y = pivot.getY() + lineLength*Math.sin(theta);
            line.setLine(pivot, p2);
            // find angle from pivot to ball center relative to line
            // ie, ball center -> pivot -> line end
            double cx = ball.getCenterX();
            double cy = ball.getCenterY();
            double pivotToCenter = pivot.distance(cx, cy);
            // angle of ball to horizon
            double dy = cy - pivot.getY();
            double dx = cx - pivot.getX();
            // relative angle phi = ball_to_horizon - last line_to_horizon
            double phi = Math.atan2(dy, dx) - lastTheta;
            // rotate ball from pivot
            double x = pivot.getX() + pivotToCenter*Math.cos(theta+phi);
            double y = pivot.getY() + pivotToCenter*Math.sin(theta+phi);
            ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
            lastTheta = theta;  // save theta for next time
        private void moveBall(int distance)
            Point2D pivot = line.getP1();
            // ball touches line at distance from pivot
            double contactX = pivot.getX() + distance*Math.cos(lastTheta);
            double contactY = pivot.getY() + distance*Math.sin(lastTheta);
            // find new center location of ball
            // angle lambda = lastTheta - 90 degrees (anti-clockwise)
            double lambda = lastTheta - Math.PI/2;
            double x = contactX + (ball.width/2)*Math.cos(lambda);
            double y = contactY + (ball.height/2)*Math.sin(lambda);
            ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
        JPanel getControls()
            JSlider rotate = getSlider("rotation angle", "rotation", -90, 0, 0, 5, 15);
            translate = getSlider("distance from end",  "translate", 0, 100, 100,25, 50);
            JPanel panel = new JPanel(new GridLayout(0,1));
            panel.add(rotate);
            panel.add(translate);
            return panel;
        private JSlider getSlider(String title, String name, int min, int max,
                                  int value, int minorSpace, int majorSpace)
            JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
            slider.setBorder(BorderFactory.createTitledBorder(title));
            slider.setName(name);
            slider.setPaintTicks(true);
            slider.setMinorTickSpacing(minorSpace);
            slider.setMajorTickSpacing(majorSpace);
            slider.setPaintLabels(true);
            slider.addChangeListener(this);
            return slider;
    }OK, My questions are:
    [1]. what I generated XML by XSTream is very complicated, especially for object LocationTest, Can we make it as simple as others such as Person object??
    [2]. after I run it, LocationTest will popup and a red ball in a panel will dsiplay, after I change red ball's position, I hope to persist it to xml, then when I read it back, I hope to get same picture, ie, red ball stiil in old position, How to do that??
    Thanks a lot!!

    Positive feedback? Then please take this in a positive way: if you want to work on persisting Java objects into XML, then GUI programming is irrelevant to that goal. The 1,000 lines of code you posted there appeared to me to have a whole lot of GUI code in it. You should produce a smaller (much smaller) example of what you want to do. Calling the working code from your GUI program should come later.

  • Can someone pleas tell me about abap, java and xslt mappings

    Hi,
    can someone please tell me about abap, java and xslt mappings.
    Thanks,
    Bernard.

    HI,
    JAVA mapping
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping sample code for java mapping blog=/pub/wlg/4143 tutorial sax and dom
    ABAP mapping
    ABAP mappings run on ABAP Stack and are developed in the ABAP workbench of the Integration Server.
    You normally do not need to use the ABAP mappings and is preferable for someone with ABAP programming background. I should say JAVA functions would suffice any complex scenarios.
    refer step by step guides for ABAP Mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    ABAP Mapping
    /people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
    https://websmp101.sap-ag.de/~sapdownload/011000358700003082332004E/HowToABAPMapping.pdf
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    /people/r.eijpe/blog
    ABAP Mapping Vs Java Mapping.
    Re: Message Mapping of type ABAP Class not being shown
    Re: Performance of mappings (JAVA, XSLT, ABAP)
    XSLT Mapping
    XSLT stands for EXtensible Stylesheet Language Transformations. It is an XML based language for transforming XML documents into any other formats suitable for browser to display, on the basis of set of well-defined rules.
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
    /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=xslt+mapping&adv=false&sortby=cm_rnd_rankvalue#
    Steps required for developing XSLT Mapping
    u2022 Create a source data type and a target data type
    u2022 Create Message types for the source and target data types.
    u2022 Create Message Interfaces includes Inbound Message interface and Outbound Message interface.
    u2022 XSLT Mapping does not require creation of Message mapping, so donu2019t create any Message mapping.
    u2022 Create an .XSL file which converts source data type into target data type.
    u2022 Zip that .xsl file and import it into Integration Repository under Imported Archives.
    u2022 In Interface Mapping choose mapping program as XSL and specify this zip program. (Through search help you will get XSL Mapping programs that you imported under Imported Archives, select your corresponding XSL Program)
    u2022 Test this mapping program by navigating to Test tab.
    By having look at above steps you can easily find out that this mapping is no where different from other mapping programs, here the challenging lies in creating an XSLT file. If you spend couple of minutes in studying XPATH tutorial you would be in ideal position to create an XSL Transformation (.xsl extension).
    If you still find difficulties in generating XSL Transformation, then you can make use of a tool u201CAltova MapForceu201D which will create XSL file for you.
    Steps for creating XSL file using this tool:
    1. Open the Alto MapForce, import the source .xml and .xsd file in it
    2. Similarly import the target .xml and .xsd in MapForce.
    3. These two data files should match with source and target data types in Integration Repository.
    4. Complete the graphical mapping using extensive list of XSLT functions available there.
    5. Save the mapping file.
    6. Click the XSLT tab. You will have the entire xslt logic there.
    7. Copy that content and save it as .xsl file.
    8. Zip above .xsl file and import the same into IR under Imported Archives.
    Hope this clears your doubts
    Thanks
    Saiyog

  • How can I run Runtime.exec command in Java To invoke several other javas?

    Dear Friends:
    I met a problem when I want to use a Java program to run other java processes by Runtime.exec command,
    How can I run Runtime.exec command in Java To invoke several other java processes??
    see code below,
    I want to use HelloHappyCall to call both HappyHoliday.java and HellowWorld.java,
    [1]. main program,
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloHappyCall
         public static void main(String[] args){
              try
                   Runtime.getRuntime().exec("java  -version");
                   Runtime.getRuntime().exec("cmd /c java  HelloWorld "); // here start will create a new process..
                   System.out.println("Never mind abt the bach file execution...");
              catch(Exception ex)
                   System.out.println("Exception occured: " + ex);
    } [2]. sub 1 program
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloWorld
         public static void main(String[] args){
         System.out.println("Hellow World");
    } [3]. Sub 2 program:
    package abc;
    import java.util.*;
    import java.io.*;
    class HappyHoliday
         public static void main(String[] args){
         System.out.println("Happy Holiday!!");
    } When I run, I got following:
    Never mind abt the bach file execution...
    I cannot see both Java version and Hellow World print, what is wrong??
    I use eclipse3.2
    Thanks a lot..

    sunnymanman wrote:
    Thanks,
    But How can I see both programs printout
    "Happy Holiday"
    and
    "Hello World"
    ??First of all, you're not even calling the Happy Holiday one. If you want it to do something, you have to invoke it.
    And by the way, in your comments, you mention that in one case, a new process is created. Actually, new processes are created each time you call Runtime.exec.
    Anyway, if you want the output from the processes, you read it using getInputStream from the Process class. In fact, you really should read that stream anyway (read that URL I sent you to find out why).
    If you want to print that output to the screen, then do so as you'd print anything to the screen.
    in notepad HelloWorld.java, I can see it is opened,
    but in Java, not.I have no idea what you're saying here. It's not relevant whether a source code file is opened in Notepad, when running a program.

  • Please can someone help,my in built camera on my Macbook Pro is not working what can i do to activate it back.

    Please can somone help my in built cameral on my MacBook Pro is not working, the green light does not show again and the camera is not working . what can i do to active it back.
    Semako

    Yuu can try to reactivate your iSight camera by opening up iMessage.. navigate to Preferences/Audio Video,and then click on Camera. IT shoudl be grayed-out if you only have one camera hooked up to your machine. If you have an external camera, then disconnect it from your machine. 

  • I can't open or save file with Java Web Start

    Hi,
    i can't open or save file with Java Web Start:
    import java.io.*;
    import java.util.*;
    public class MetaDataFileCreator {
    public String fileNameSpace = null;
    public String fileName = null;
    protected Properties file = null;
    public MetaDataFileCreator(String fileNameSpace, String fileName) {
    this.fileNameSpace = fileNameSpace;
    this.fileName = fileName;
    public void createMetaDataFile() {
    try {
    System.out.println("file METADATA");
    ClassLoader cl = this.getClass().getClassLoader();
    String nameFileMetaData = fileNameSpace + fileName + ".txt";
    FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
    file = new Properties();
    file.setProperty("aaaaa", "aaaa");
    file.store(fileOS, "");
    fileOS.close();
    } catch (Exception e) {
    System.out.println("Error writing metadata-file: " + e);
    System.exit(1);
    e.printStackTrace();
    I have try also to open a file like this:
    ClassLoader cl = this.getClass().getClassLoader();
    file.load(cl.getResourceAsStream(nameFile));
    also like this:
    try {
    fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
    fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
    } catch (UnavailableServiceException e) {
    fss = null;
    fos = null;
    System.out.println("Error with JNLP");
    System.exit(1);
    if (fss != null && fos != null) {
    try {
    // get a FileContents object to work with from the
    // FileOpenService
    FileContents fc = fos.openFileDialog(null, null);
    //FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
    // get the OutputStream and write the file back out
    if (fc.canWrite()) {
    // don't append
    os = fc.getOutputStream(false);
    } catch (Exception e) {
    e.printStackTrace();
    also like this:
    File f = new File((System.getProperty("user.home")+"x.txt").toString());
    FileOutputStream fileX = new FileOutputStream(f);
    OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
    OutputX.println(....
    but it doesn't work with Java Web Start.
    Can someone help me?
    How can I open or save file?
    thank you.
    Sebastiano

    Did you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?

Maybe you are looking for

  • BPM Design using sync-async  bridge

    Hi Arpit, Below mentioned is an overview of the process flow which we are trying to implement. 1. A synchronous interface takes in the request 2. After the mapping, a file is created 3. Another file adapter reads this file and sends a message back to

  • Tell me Logic for search for duplicate words(or strings) in a large file.

    Search for duplicate words (or strings) in a text file containing one word per line. For each word that occurs more than once in the flat file output should be as follows <word> <number of occurrences> <line numbers in the file where the word occurs>

  • Register email not working for PSA SE 3.0

    my trial ended. and when i click the button to register for Photoshop Album Starter Edition 3.0 to register and email for this, it says "send failed" now i cant see the pictures that were on there. any advice?

  • Finder Picture Background Not Working?

    Hi everyone, I'm trying to set a photo background to a few folders in finder, but it isn't working.  The background remains white when I try to enable a picture background.  The color backgrounds work fine, but the picture background simply refuse to

  • How to pass one JSP form to next JSP ?

    i am using the two JSPs. i want to pass the form name of the first JSP to the second JSP and then assign the form name to second JSP form