i get no GUI when i run!

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class Calculator
{
private JTextField resultTF;
private JButton calculateB, numbersB[] = new JButton[11];



public void driver()
{
//Create Window
JFrame calc = new JFrame("Calculator version 1.0");
calc.setSize(500, 500);
calc.setDefaultCloseOperation(calc.EXIT_ON_CLOSE);


//Get the content pane (object of type Container)
Container cp = calc.getContentPane();
cp.setLayout(new GridLayout(4, 3));


resultTF = new JTextField(10);


resultTF.setEditable(false);


numbersB[0] = new JButton("clear");
String num;
for(int i = 1; i<11; i++)
{
numbersB = new JButton();
numbersB.setText(Integer.toString(i-1));
}


calc.setVisible(true);


Calculator c = new Calculator();
c.driver();
}


public static void main(String[]args){
new Calculator();
}



}

You create buttons etc but you don't add them to your JFrame.

sorry i clicked the minus, i havent used this forum... what do you mean???

You create buttons etc but you don't add them to your JFrame.

You need to add your buttons etc to the form, otherwize they are just floating about in a vacuum. Eg

Container cp = calc.getContentPane();
...
resultTF = new JTextField(10);
[B]cp.add(resultTF);[/B]

well i did just that and Still no gui popup

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Calculator
{
	private JTextField resultTF;
	private JButton calculateB, numbersB[] = new JButton[11];


	public void driver()
	{
	//Create Window
	JFrame calc = new JFrame("Calculator version 1.0");
	calc.setSize(500, 500);
	calc.setDefaultCloseOperation(calc.EXIT_ON_CLOSE);

	//Get the content pane (object of type Container)
	Container cp = calc.getContentPane();
	cp.setLayout(new GridLayout(4, 3));

	resultTF = new JTextField(10);

	resultTF.setEditable(false);

	numbersB[0] = new JButton("clear");
	String num;
	for(int i = 1; i<11; i++)
	{
		numbersB[i] = new JButton();
		numbersB[i].setText(Integer.toString(i-1));
	}



	Calculator c = new Calculator();
	c.driver();

	cp.add(resultTF);
	for (int i=0; i<11; i++)
		{
		cp.add(numbersB[i]);
		}

	calc.setVisible(true);
	}

	public static void main(String[]args){
		new Calculator();
	}


}

GOT IT!!

THank you James!!!!!!!!!!!!!!!!!!

OK, great! Mark this "solved" for the DaniWeb knowledge base.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.