Results 1 to 5 of 5
  1. #1
    riefs is offline Member
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Exclamation Make Java Output to GUI ? Insertion Sort

    Hello, i'm newbie. I have this code

    Insertion Sort

    Java Code:
    import java.util.Random;
    public class insertion{
     
    public static void main(String[] args) {
    Random rdm = new Random();
    int randomer;
    int bilangan[] = new int[1000]; //numbers of all int w
                   
            System.out.println("Sebelum Sorting :");
            for(int i=0; i < bilangan.length; i++) {
    			randomer = rdm.nextInt (9); //Int from 0 until 9
    			bilangan [i]=randomer;
                
    			System.out.print(bilangan[i] + " ");
            }
    
    		long start1 = System.currentTimeMillis();
    		insertionSort(bilangan); //sorting array
    		long stop1 = System.currentTimeMillis();
    		long waktu1 = stop1 - start1;
                    System.out.println(" ");
    
    
    
    
    
            System.out.println("\nSetelah Sorting maka :");
            for(int i=0; i < bilangan.length; i++) {
    			System.out.print(bilangan[i]+" " );
            }
    		
    		System.out.println("\n\nWaktu yang digunakan untuk fungsi sorting Insertion adalah "+ waktu1 +" ms\n");      
    
    }
     
            
    		private static void insertionSort(int[] bilangan) {
    			for (int i = 1; i < bilangan.length; i++) {
    			int nilai = bilangan[i];
    			int j;
    				for (j = i-1; j>=0 && bilangan[j] > nilai; j-- ) {
    					bilangan [j+1]= bilangan [j];
    				}
    					bilangan [j+1] = nilai;
    			}
    		}
    }

    So, i just need to make a java gui app, when i click that OK. So, it will show all the result.
    Thanks

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Make Java Output to GUI ? Insertion Sort

    Quote Originally Posted by riefs View Post
    So, i just need to make a java gui app, when i click that OK. So, it will show all the result.
    And we wish you all success with that.

    Did you have a question?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    riefs is offline Member
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Default Re: Make Java Output to GUI ? Insertion Sort

    Make Java Output to GUI ? Insertion Sort-screenshot007.jpeg

    so, i want to make a gui program. how ?
    just like pict above. but i am not experienced in gui/swing/swt etc.

    it need long time to learn again (i think about deadline). so is there a good simple of gui code for this insertion?

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Make Java Output to GUI ? Insertion Sort

    PM received from riefs:
    Quote Originally Posted by riefs
    sorry, what i mean is, just like i want to convert my commandline java result to be better in GUI.
    and i am so blind with gui (newbie).
    i think you know what i meant.

    thank you for your replies.
    Please keep discussion on the forum.

    Also, go through the Forum Rules, particularly the second paragraph. Adn don't post to old dead threads and don't hijack another poster's thread. Your post in a 3 year old thread has been removed.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Make Java Output to GUI ? Insertion Sort

    At the present time, the most commonly used Java GUI toolkit and the one for which the largest volume of learning resources are available is Swing.

    Start here: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Insertion Sort
    By apiwowar in forum New To Java
    Replies: 2
    Last Post: 08-31-2011, 07:20 AM
  2. Help with insertion sort
    By daendoonge in forum Java Applets
    Replies: 0
    Last Post: 01-29-2011, 11:28 PM
  3. problem with insertion sort???
    By blueduiker in forum New To Java
    Replies: 2
    Last Post: 03-22-2010, 01:17 PM
  4. Insertion Sort in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-15-2008, 07:41 PM
  5. Insertion sort algorithm
    By Albert in forum Advanced Java
    Replies: 2
    Last Post: 06-28-2007, 08:26 PM

Tags for this Thread

Posting Permissions

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