Results 1 to 4 of 4
  1. #1
    realahmed8 is offline Member
    Join Date
    Jun 2008
    Posts
    13
    Rep Power
    0

    Question Help in converting Java application to desktop application in Netbeans

    Hello,
    I hardly need a help in converting java application to desktop application , it's about connecting the java class to desktop components.
    The desktop interface and the java application are ready and just need to connect them.

    Here's the java application code


    import java.io.*;

    class process
    {
    String name;
    int burst;
    int priority;

    process(String x, int y, int z)
    {
    name=x;
    burst=y;
    priority=z;
    }
    }

    class use
    {

    public static void main(String args[])throws Exception
    {
    BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter no. of processes: ");
    int n=Integer.parseInt(br.readLine());
    process a[]=new process[n];

    for(int i=0;i<n;i++)
    {
    System.out.println("Enter name: ");
    String name=br.readLine();

    System.out.println("Enter burst time: ");
    int time=Integer.parseInt(br.readLine());

    System.out.println("Enter priority (greater is higher)");
    int pr=Integer.parseInt(br.readLine());

    a[i]=new process(name,time,pr);
    }

    for(int i=0;i<n-1;i++)
    {
    for(int j=0;j<n-1;j++)
    {
    if(a[j].priority<a[j+1].priority)
    {
    process temp=a[j];
    a[j]=a[j+1];
    a[j+1]=temp;
    }
    }
    }

    System.out.println("Gantt chart: ");

    for(int m=0;m<a.length;m++)
    {
    System.out.print(a[m].name+ " || ");
    }

    System.out.println();

    int wt=0;

    for(int i=0;i<a.length;i++)
    {
    wt+=(a.length-1-i)*a[i].burst;
    }

    System.out.println("Total waiting time: "+ wt);
    System.out.println("Avg waiting time: "+((float)wt/a.length));

    int bt=0;

    for(int j=0;j<a.length;j++)
    {
    bt+=a[j].burst;
    }

    System.out.println("Total turnaround time: "+(wt+bt));
    System.out.println("Average turnaround time: "+((wt+bt)/(float)a.length));
    }

    }
    the desktop application is attached..

    Thanks..
    Attached Files Attached Files

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You're going to need to try to learn Swing first before you will be able to accomplish this. I suggest you have a look at the Sun Swing tutorials for a good start: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    Much luck!

  3. #3
    realahmed8 is offline Member
    Join Date
    Jun 2008
    Posts
    13
    Rep Power
    0

    Default

    Thanks for tutorial, But I have tried to connect files before submitting the help.. I still can't do it.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Then I'm afraid you have a lot more to learn. You can't learn Swing coding in a day. It's going to take a bit of time and effort. Realize please that no one is going to do your work for you.

Similar Threads

  1. Converting java application to J2ME
    By coldvoice05 in forum NetBeans
    Replies: 0
    Last Post: 10-10-2009, 04:32 PM
  2. run java application from desktop with double click
    By Rose88 in forum Advanced Java
    Replies: 4
    Last Post: 09-29-2009, 06:32 PM
  3. Replies: 1
    Last Post: 03-27-2009, 05:47 PM
  4. Problem running a java desktop application
    By chris@gaiag.net in forum AWT / Swing
    Replies: 2
    Last Post: 08-24-2008, 04:24 AM
  5. Installer for Java desktop application
    By nitingupta183 in forum SWT / JFace
    Replies: 0
    Last Post: 03-18-2008, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •