TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prime b
NA
810
346.9k
Java problem with layout.
Apr 3 2012 4:32 PM
What I am trying to make is simple dial pad on the cellphone with a textfield in the north region( top)
But in my cause it just puts textfields next to the numbers!!!!!!!!!!!!!!!!!!!!!! CANT WAIT FOR THIS CLASS TO BE OVER, BECAUSE I HONESTLY CANT STAND JAVA GUI
ublic class Calc extends JFrame
{
private final int WIDTH = 250;
private final int HEIGHT =250;
JTextField inputText;
JButton button1;
JButton button2;
JButton button3;
JButton button4;
JButton button5;
JButton button6;
JButton button7;
JButton button8;
JButton button9;
JButton button0;
JButton buttonStar;
JButton buttonPound;
JButton buttonClear;
JButton buttonCalc;
public Calc()
{
setTitle("Phone");
setSize(WIDTH,HEIGHT);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(4,3));
inputText = new JTextField();
add(inputText,BorderLayout.NORTH);
button1 = new JButton("1");
add(button1);
button2 = new JButton("2");
add(button2);
button3 = new JButton("3");
add(button3);
button4 = new JButton("4");
add(button4);
button5 = new JButton("5");
add(button5);
button6 = new JButton("6");
add(button6);
button7 = new JButton("7");
add(button7);
button8 = new JButton("8");
add(button8);
button9 = new JButton("9");
add(button9);
button0 = new JButton("0");
add(button0);
buttonStar = new JButton("*");
add(buttonStar);
buttonPound = new JButton("#");
add(buttonPound);
buttonClear = new JButton("Clear");
add(buttonClear);
buttonCalc = new JButton("Call");
add(buttonCalc);
setVisible(true);
}
}
Reply
Answers (
2
)
How can be restrict a class for making its limited objects?.
How can be create a analog clock by using treading in java ?