package holeg.ui; import holeg.GridSolverResult; import javax.swing.*; public class SolveResultMessageBox { public static void show(GridSolverResult result) { switch(result) { case Error: default: JOptionPane.showMessageDialog(null,"Could not solve grid.","Error while solving.", JOptionPane.ERROR_MESSAGE); break; case PartialFailure: JOptionPane.showMessageDialog(null,"Could not solve some part of the grid.","Error while solving.", JOptionPane.ERROR_MESSAGE); break; case Solved: JOptionPane.showMessageDialog(null,"Successfully solved!","Success", JOptionPane.INFORMATION_MESSAGE); break; case Interrupted: JOptionPane.showMessageDialog(null,"Solver interrupted!","Interrupted while solving.", JOptionPane.WARNING_MESSAGE); break; } } public static void showSolverTookTooLongToStart() { JOptionPane.showMessageDialog(null,"Could not solve grid.","Solver took too long to start", JOptionPane.ERROR_MESSAGE); } public static void showInternalError(Exception exception) { exception.printStackTrace(); JOptionPane.showMessageDialog(null,"Could not solve grid.","Internal error.", JOptionPane.ERROR_MESSAGE); } }