MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 04-04-04, 20:14
Computer Acolyte Computer Acolyte is offline
Senior Member
Join Date: Dec 2003
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Default Java help

Ok this is a very basic problem but I can't figure out what's wrong.
I'm learning the awt (Abstract Windowing Toolkit) package (I know it's old but that's what the Java book has)
Anyway, I wrote a small program just to see how it all fits together, it's supposed to give me a window titled "Animals" with 3 colored buttons.
Here's the code:

import java.awt.*;
public class TestAwt {
public static void main(String[] args) {
Frame frame=new Frame("Animals");
Panel panel=new Panel();
Button b1=new Button("Dog");
Button b2=new Button("Cat");
Button b3=new Button("Hamster");





For some reason all it gives me is the frame (overall window) but no components inside (no buttons, no background [panel]), which is very strange, considering that this program (a simpler version of the previous one) works:

import java.awt.*;
public class Wtf {
public static void main(String[] args) {
Frame frame=new Frame("Alice in wonder land");
Panel panel=new Panel();
Button b=new Button("Press");


What am I missing here?
Sponsored links

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unknown Java error, possible virus/hacker? kwyjibo Software 1 11-15-03 19:07
Help with Java please. ColonelAngus Software 7 07-15-03 07:43
IE and java morlok Software 17 07-13-03 15:39

All times are GMT -5. The time now is 20:25.

MajorGeeks.Com Menu

MajorGeeks.Com \ All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ NEW! PC Games \ System Tools \ Macintosh \ Demonews.Com \ Top Downloads

MajorGeeks.Com \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds

All content Copyright source code Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger