import javax.swing.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class utility
{
public static void directions()
{
Object[] options = {"Play Sklar's Little Game!"};
int n = JOptionPane.showOptionDialog(null,
"Please Think of a number from 1 - 31\n" +
"If it is on the screen click\n" +
"Yes, otherwise, click N0","Here is how to play...",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE, null,
options, options[0]);
}
public static void credits()
{
Object[] options = {"Back to Sklar's Little Game!"};
int n = JOptionPane.showOptionDialog(null,
"Written by John M. Sklar\n" +
"Cardinal Stritch University\n" +
"Written in Swing in the Spring, 2003\n" +
"jmsklar@stritch.edu\n" +
"http://faculty.stritch.edu/jmsklar","John Sklar Wrote This!",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE, null,
options, options[0]);
}
public static void Colorgrid(JButton b,int number)
{
if(number % 2 == 0)
{
b.setBackground(Color.red);
b.setForeground(Color.white);
}
else
{
b.setBackground(Color.white);
b.setForeground(Color.red);
}
}
public static void mix(int[] array )
{
int hold;
int first, second;
for(int j = 0;j<=30000;j++){ // swap them randomly about 30000 times
first = (int)(Math.random()*100)% array.length;
second = (int)(Math.random()*100)% array.length;
hold = array[first]; // swaps the contents of the memory locations
array[first] = array[second];
array[second] = hold;
}
}
}