import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Square extends JApplet {
int size;
public void init()
{
String input = JOptionPane.showInputDialog(
"Enter square size:");
size = Integer.parseInt( input );
}
public void squareOfCharacters( Graphics g )
{
String input = JOptionPane.showInputDialog(
"Enter Character:");
int y = 50, x = 5;
for ( int a = 1; a <= size * size; a++ ) {
g.drawString( "\n%s!\n", x += 5, y );
}
}
public void paint( Graphics g )
{
squareOfCharacters( g );
}
}
I am having the worst time with this. I am supposed to form the square out of whatever character is contained in character parameter fillcharacter. Thus, if side is 5 and fillcharacter is"#", the method should display
#####
#####
#####
#####
#####
Thanks..............