Make Java Output to GUI ? Insertion Sort
Hello, i'm newbie. I have this code
Insertion Sort
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
Re: Make Java Output to GUI ? Insertion Sort
Quote:
Originally Posted by
riefs
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
1 Attachment(s)
Re: Make Java Output to GUI ? Insertion Sort
Attachment 4289
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?
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
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