Results 1 to 5 of 5
  1. #1
    Tb0h is offline Member
    Join Date
    Jul 2009
    Posts
    21
    Rep Power
    0

    Question JOptionPane Troubles

    Hello All,
    I simply want to create an Applet which can be placed online to display a message saying "Hello". Whenever I use the code below the Applet pops up blank. My IDE is Eclipse.
    Java Code:
    import java.applet.Applet;
    import javax.swing.JOptionPane;
    
    public class Main extends Applet implements Runnable {
    	public static void main(String[] args) 
    	{
    		JOptionPane.showMessageDialog(null,"Hello", "Output", JOptionPane.INFORMATION_MESSAGE);
    	}
    	public void run() {
    	}
    
    }

  2. #2
    Tb0h is offline Member
    Join Date
    Jul 2009
    Posts
    21
    Rep Power
    0

    Default

    Oh yeah, and I want to use JOptionPane.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Read the applet tutorial on the Sun tutorial site (you should probably have done this prior to asking this question actually), as you've got applets all wrong. The tutorial will explain all, and you'll see why the main method isn't necessary and isn't called.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Fubarable View Post
    and you'll see why the main method isn't necessary and isn't called.
    Yes. And also it's nice feature I would like see in my IDE one day, warning about the main method included in an applet. Actually it's not an error anymore, but a warning message is nice.

Similar Threads

  1. Integer troubles
    By Tb0h in forum New To Java
    Replies: 11
    Last Post: 08-13-2009, 04:56 PM
  2. Gif decoding/LZW troubles
    By hellochar in forum Advanced Java
    Replies: 2
    Last Post: 07-14-2009, 11:26 PM
  3. Image troubles
    By Theodoreb in forum New To Java
    Replies: 24
    Last Post: 07-14-2009, 12:41 AM
  4. subclass troubles
    By xf021209 in forum New To Java
    Replies: 12
    Last Post: 04-20-2009, 11:46 PM
  5. StreamCorruptedException and Casting troubles
    By Wassa in forum Networking
    Replies: 2
    Last Post: 02-18-2009, 03:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •