עזרה ב-JAVA
למה בקטע הקוד הפשוט המצורף, לא רואים את התויות או הכפתורים ? import javax.swing.*; import java.awt.*; public class Matrix extends JFrame { private GridLayout grid; private Container c; private JButton button []; private JLabel label []; public Matrix() { super("Matrix"); grid = new GridLayout(4,4); c = getContentPane(); c.setLayout(grid); label = new JLabel[16]; button = new JButton[16]; for (int i=0; i<16; i++){ label = new JLabel(); button = new JButton("b**"); c.add(label); c.add(button); } setVisible(true); setSize(300,300); label[2].setText("***"); button[2].setText("B***"); } public static void main (String args[]) { new Matrix(); } }
למה בקטע הקוד הפשוט המצורף, לא רואים את התויות או הכפתורים ? import javax.swing.*; import java.awt.*; public class Matrix extends JFrame { private GridLayout grid; private Container c; private JButton button []; private JLabel label []; public Matrix() { super("Matrix"); grid = new GridLayout(4,4); c = getContentPane(); c.setLayout(grid); label = new JLabel[16]; button = new JButton[16]; for (int i=0; i<16; i++){ label = new JLabel(); button = new JButton("b**"); c.add(label); c.add(button); } setVisible(true); setSize(300,300); label[2].setText("***"); button[2].setText("B***"); } public static void main (String args[]) { new Matrix(); } }