import javax.swing.*;
import java.awt.*;
public class CalPanel extends JPanel
{
JButton buttons[];
JPanel ButtonPanel;
String names[] = {"+","-","*","/","7","8","9","8","4","5","6","5","1","2","3","2"};
CalPanel()
{
ButtonPanel = new JPanel();
setLayout(new BorderLayout());
buttons = new JButton[names.length];
ButtonPanel.setLayout( new GridLayout(4,4) );
for(int counter = 0; counter < names.length; counter++)
{
buttons[counter] = new JButton(names[counter]);
ButtonPanel.add(buttons[counter]);
}
}
}
So far this is all I have since I've been messing with it for the past 30 minutes. Im new at Java and help would be appreciated. I started out with a GridLayout normally and the buttons appeared fine, but once I tried adding another JPanel for my BorderLayout, nothing appeared. Thanks in advanced!

New Topic/Question
Reply



MultiQuote



|