This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Simple Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Simple Swing" Watch "Simple Swing" New topic
Author

Simple Swing

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 606


This code does not show any thing, Why?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Depends what you did with it. Did you create an appropriate HTML file naming this class in an applet tag, and open the HTML in a browser or the appletviewer application?


[Jess in Action][AskingGoodQuestions]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13872
    
  10

That's a Swing applet. How are you running that code, is it packaged properly, do you have a HTML web page with an applet tag, etc.? See Oracle's applet tutorial.

You should build the GUI in the Swing event dispatch thread, for example using SwingUtilities.invokeAndWait, as shown in this example.

Also, you do not need to call setVisible(true) for an applet.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Swing
 
Similar Threads
How to Maximize and minimize JButton on Mouse over
Painting components over images
Java Newbie needs guidance
in flow lay out how can i force to add component on next line?
Tryin to do Jbutton disappear.