Glen Tanner

Ranch Hand
+ Follow
since Apr 16, 1999
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Glen Tanner

Sorry about the confusion....and thanks for the welcome!
I agree the Swing tutorial is a great place to start.
The Bunkhouse is another.
16 years ago
Sorry, the other thread was closed so I started another...

Short answer is that you have to add the JPanel to a top level container.

http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html
16 years ago
code:


package BouncingBalls;

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

public class Main {

public static void main(String[] args) {

JPanel p = new JPanel();
p.setPreferredSize(new Dimension(400, 400));
p.setVisible(true);

}

}




Simply, why the JPanel is not visible when running this. Nothing appears and there are no errors.

Thanks



ANSWER:

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

public class Main {

public static void main(String[] args) {

JFrame f = new JFrame("My Frame");
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);

JPanel p = new JPanel();
p.setPreferredSize(new Dimension(400, 400));

f.getContentPane().add(p);
f.pack();
f.setVisible(true);

}

}
16 years ago
"I'm having deja vu and amnesia at the same time."
17 years ago
Killed my TV years ago too. I let my kids watch Dora DVDs though. Now if I can just get rid of XM Radio.
19 years ago
920. Reminds me of Elf Bowling.
19 years ago
My HP Pavilion (XP SP2) laptop is a bear. It only sporadically wakes up from hibernation. I'm sure there's a probability algorithm involved here somehow.
20 years ago
Kayal,
When thinking about resale value, you have to think about what you would do. You're looking at this house and you're willing to overlook the stair thing. A potential buyer will most likely do the same. But, you may want to check if it meets building code for your area. Other than that, have fun in your new home!
[ November 22, 2004: Message edited by: Glen Tanner ]
20 years ago
The gutter is a friendly place.
20 years ago
It does pay to be the 2nd mouse.
[ November 15, 2004: Message edited by: Glen Tanner ]
20 years ago
Bad cop. No Donut.
20 years ago
Just don't buy a GM, Ford, Dodge. After all, you want the vehicle to outlast the payments.

I like both the Honda and Yoytota.
20 years ago
Q: How many Microsoft technicians does it take to change a light bulb?
A: Three. Two to hold the ladder and one to hammer the bulb into a faucet.
20 years ago
My favorite phrase: "...and Bob's your uncle!".
20 years ago