Hello good day to all...
is there anyone can help or suggest me how my code work successfully.

Actually the code was working well, but i wanted to change it`s content to GUI form.
the program description was the user must input a word/String and shuffle/scramble the word that the user inputted and shows the possible output of the program to GUI form.
Collaborating with the LinkedList data structure...

import java.util.LinkedList;
	import java.io.*;
	import javax.swing.JOptionPane;

	public class ScrambleWord {

			    public static void main(String args[]) throws IOException{
			    	LinkedList<String> scrambleWordList = new LinkedList<String>();
			        String str;
			        JOptionPane.showMessageDialog(null, "Welcome to the Program");
			        System.out.println("Enter a Word:");
			        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			        System.out.println("Permutations are :");
			        permute("", str);
			        System.out.println("\nThe First Word in the Scramble List is \t \b"+scrambleWordList.getFirst());

			  public static void permute(String beginningString, String endingString) {
			    if (endingString.length() <= 1)
			      System.out.println(beginningString + endingString);
			      for (int i = 0; i < endingString.length(); i++) {
			        try {
			          String newString = endingString.substring(0, i) + endingString.substring(i + 1);

			          permute(beginningString + endingString.charAt(i), newString);
			        } catch (StringIndexOutOfBoundsException exception) {

Edited by PHkiDz: i forgot somethin`

5 Years
Discussion Span
Last Post by JamesCherrill

For a simple gui: a text field for input, a textarea for output and a button.
User enters text, presses button, output displayed in text area.


i tried it sir, but the code in the permutation method does not associate with the GUI..


You could change your permute method to return the permuted Strings, rather than being void. Then you will be able to call it from your GUI and display the results it returns.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.