Question
This is code ////// //////////////////////////// Can you make this code to GUI version plz and it would be like this //////////////////////////////////////////////// import java.io.BufferedReader; import java.io.File;
This is code ////// //////////////////////////// Can you make this code to GUI version plz
and it would be like this
////////////////////////////////////////////////
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashSet; import java.util.Set;
import javax.swing.JFileChooser;
public class HexagonMain { static Hexagon[] places = new Hexagon[7]; static Set solution = new HashSet(); // Set to store solutions. Set will avoid duplicate solutions
public static void main(String[] args) { Hexagon[] hexagons = new Hexagon[7]; JFileChooser jFileChooser = new JFileChooser(); jFileChooser.showOpenDialog(null); //prompts user to select file File file = jFileChooser.getSelectedFile(); if (file != null) { try { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String input = null; int index = 0; while ((input = br.readLine()) != null && index
}
//method to arrange hexagons, inputs are hexagons and first position to place the hexagon public static void arrange(Hexagon[] hexagons, int start) { if (start
//Method to check if any every placement is valid public static boolean checkValid() {
for (int i = 0; i
}
File: Hexagon.java
public class Hexagon { char[] section; int position = -1; public Hexagon(String colorString){ //constructor section = colorString.toCharArray(); } //Method to rotate hexagon public void rotate(){ char temp = section[0]; for(int i=1;i section[i-1] = section[i]; } section[section.length -1] = temp; }
@Override public String toString() { return "Position " + (position + 1) + ": " + new String(section); }
}
//////////////////////////////////////////////////////////////////////////////////////////////////
3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started