Migrate .Net Windows Forms to Java using CodePorting App

Discussion in 'Programming' started by zarfishsn, Oct 2, 2012.

  1. #1
    CodePorting Application is always making efforts to improve its features list to make it the best online C# to Java conversion service for developers. One of such feature is converting C# windows forms to Java.

    This is a great feature that will reduce the cost and effort to convert C# Windows form application to java. CodePorting Engineers are currently upgrading C#2Java engine to take this idea further and make this feature more powerful for future desktop application. To start this feature CodePorting has successfully ported simple desktop application to java.

    Desktop-Application-Porting-2.jpg

    CodePorting is using Swing components instead of AWT to convert .Net forms to Java because it is easily convertible and provide wide range of features such as icons, pop-ups, tool-tips, and its plug-able look & feel makes it fit in any OS environment. C#2Java engine also converts form events to java. To accommodate this new feature, codeporting has enhanced the core, created some new Java library classes and updated the mappings files.

    Below Example shows the conversion of C# Windows form to Java.

    C# Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace CsPorter.Tests.Convert.Forms
    {
    public class Test2 : Form
    {
    public Test2()
    {
    initUI();
    }

    public void initUI ()
    {
    Panel panel = new Panel ();
    panel.Location = new System.Drawing.Point (-1, 0);
    //panel.SuspendLayout();
    panel.Size = new System.Drawing.Size (285, 261);

    TextBox text1 = new TextBox ();
    text1.Location = new System.Drawing.Point (25, 25);
    text1.Text = "Autoported using C#2Java";
    text1.Size = new System.Drawing.Size (150, 25);

    Label label1 = new Label ();
    label1.Location = new System.Drawing.Point (25, 50);
    label1.Text = "label1";

    Button button1;
    button1 = new Button ();
    button1.Location = new System.Drawing.Point (25, 75);
    button1.Name = "button name";
    button1.Text = "button 1";
    button1.Size = new System.Drawing.Size (75, 23);

    button1.Click += new System.EventHandler (button1_Click);

    panel.Controls.Add (label1);
    panel.Controls.Add (text1);
    panel.Controls.Add (button1);
    button1.Visible = true;
    Controls.Add (panel);

    Size = new System.Drawing.Size (300, 290);
    }

    private void button1_Click (object sender, EventArgs e)
    {
    MessageBox.Show ("Autoported using C#2Java");
    }

    public static void main(String[] args)
    {

    }
    }
    }



    Java Code:
    package CsPorter.Tests.Convert.Forms;

    // ********* THIS CODE IS AUTO PORTED FROM C# TO JAVA USING CODEPORTING.COM TECHNOLOGY *********

    import com.codeporting.csharp2java.System.Windows.Forms.Form;
    import com.codeporting.csharp2java.System.Windows.Forms.Panel;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    import com.codeporting.csharp2java.System.Windows.Forms.Button;
    import java.awt.event.ActionEvent;
    import com.codeporting.csharp2java.System.Windows.Forms.MessageBox;

    public class Test2 extends Form
    {
    public Test2()
    {
    initUI();
    }

    public void initUI ()
    {
    Panel panel = new Panel ();
    panel.setLocation(new com.codeporting.csharp2java.System.Drawing.Point (-1, 0));
    //panel.SuspendLayout();
    panel.setSize(new com.codeporting.csharp2java.System.Drawing.Size (285, 261));

    JTextField text1 = new JTextField ();
    text1.setLocation(new com.codeporting.csharp2java.System.Drawing.Point (25, 25));
    text1.setText("Autoported using C#2Java");
    text1.setSize(new com.codeporting.csharp2java.System.Drawing.Size (150, 25));

    JLabel label1 = new JLabel ();
    label1.setLocation(new com.codeporting.csharp2java.System.Drawing.Point (25, 50));
    label1.setText("label1");

    Button button1;
    button1 = new Button ();
    button1.setLocation(new com.codeporting.csharp2java.System.Drawing.Point (25, 75));
    button1.setName("button name");
    button1.setText("button 1");
    button1.setSize(new com.codeporting.csharp2java.System.Drawing.Size (75, 23));

    button1.setClick(new com.codeporting.csharp2java.System.Windows.Forms.EventHandler (this,"button1_Click"));

    panel.getControls().add (label1);
    panel.getControls().add (text1);
    panel.getControls().add (button1);
    button1.setVisible(true);
    getControls().add (panel);

    setSize(new com.codeporting.csharp2java.System.Drawing.Size (300, 290));
    }
    public void button1_Click (Object sender, ActionEvent e)
    {
    MessageBox.show ("Autoported using C#2Java");
    }

    public static void main(String[] args)
    {

    }
    }

    Newly added articles and documentation pages

    - Migrate .Net Windows Forms to Java using CodePorting App
    - Indisputable Advantages of CodePorting C#2Java App
    - Convert C# is Operator to instanceof Operator in Java
    - List of Conversions Supported by CodePorting C#2Java Engine

    About CodePorting C#2Java App

    CodePorting helps you make your .NET applications cross platform compatible and allows migrating your .NET solutions, projects and files into Java in the cloud. Other than speed and accuracy of conversion; port your C# code directly either by uploading .cs files contained in a .zip file or import directly from popular version control repositories like GIT, Mercurial HG and SubVersion. You can also download a Microsoft Visual Studio plugin and convert C# code in the real time without leaving the development environment. You may also build your own customized code conversion applications using CodePorting APIs.

    [h=3]Read more about CodePorting [/h]
    - Start converting C# Apps and source code to Java
    - CodePorting Homepage
    - CodePorting C#2Java Homepage
    - CodePorting http://codeporting.com/wiki/dashboard.action] Documentation [/url]
    - Watch out CodePorting introductory video


    Contact Us

    Suite 163, 79 Longueville Road
    Lane Cove, NSW 2066, Australia
    Codeporting – Your CodePorting Experts
    Skype Name: CodePorting
    Email: support [@] codeporting [dot] com
     

    Attached Files:

    zarfishsn, Oct 2, 2012 IP