This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

Glen Tanner

Ranch Hand
+ Follow
since Apr 16, 1999
Glen likes ...
Java Python Ruby
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

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.
11 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
11 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);

}

}
11 years ago
"I'm having deja vu and amnesia at the same time."
12 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.
14 years ago
920. Reminds me of Elf Bowling.
14 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.
15 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 ]
15 years ago
The gutter is a friendly place.
15 years ago
It does pay to be the 2nd mouse.
[ November 15, 2004: Message edited by: Glen Tanner ]
15 years ago
Bad cop. No Donut.
15 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.
15 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.
15 years ago
My favorite phrase: "...and Bob's your uncle!".
15 years ago