Help with Java code.
I am trying to do a multiplication table. But I cannot get it to work. I don't really know the code for it.
This is what I have so far...
Oh and...I need someone to check this for me. Tell me if it gives out random boxes? Please and thank you.
Thank you.
This is what I have so far...
Oh and...I need someone to check this for me. Tell me if it gives out random boxes? Please and thank you.
- Code:
package Unit1;
import javax.swing.*;
import java.awt.*;
public class GUIWindow {
public static void main(String [] args){
JFrame theGUI = new JFrame();
theGUI.setTitle("Random Boxes");
theGUI.setSize(350, 400);
theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel1 = new JPanel();
panel1.setBackground(Color.cyan);
JPanel panel2 = new JPanel();
panel2.setBackground(Color.blue);
JPanel panel3 = new JPanel();
panel3.setBackground(Color.red);
JPanel panel4 = new JPanel();
panel4.setBackground(Color.black);
Container pane = theGUI.getContentPane();
pane.setLayout(new GridLayout(2, 2));
pane.add(panel1);
pane.add(panel2);
pane.add(panel3);
pane.add(panel4);
theGUI.setVisible(true);
}
}
Thank you.
由美子
