Results 1 to 3 of 3

Thread: Applet problem

  1. #1
    Ed
    Ed is offline Senior Member
    Join Date
    Jun 2007
    Posts
    110
    Rep Power
    0

    Default Applet problem

    Why my applet doesn't work?
    Can you help me?
    Java Code:
    package src.com.test;
    import java.awt.*;
    import javax.swing.*;
    import java.applet.*;
    
    public class TableTest extends Applet {
    
    private static final long serialVersionUID = 1L;
    JTable myTable;
    JButton myButton;
    JPanel myPanel;
    JMenu myMenu;
    
    public TablaTest(){
    myPanel=new JPanel();
    myMenu=new JMenu();
    myTable=new JTable();
    myButton=new JButton("Query");
    }
    
    public void init(){
    myPanel.setLayout(null);
    myPanel.setBackground(Color.BLUE );
    myPanel.add(myButton);
    myPanel.setSize(200,200);
    myPanel.setVisible(true);
    }
    
    public static void main(String[] args) {
    TableTest T=new TableTest();
    T.init();
    }
    }
    thank you

  2. #2
    bbq
    bbq is offline Senior Member
    Join Date
    Jun 2007
    Posts
    132
    Rep Power
    0

    Default

    It doesn't work because in Applet component you have to add a Frame or some container to visualized it in standalone application or create a html to tests it in your browser

    Also you are joining swing and awt components, and that is wrong

  3. #3
    Peter is offline Senior Member
    Join Date
    Jun 2007
    Posts
    119
    Rep Power
    0

    Default

    mm you are doing a bad use of the hierarchy methods of the applet class
    check it

Similar Threads

  1. Serious applet problem
    By willemjav in forum Java Applets
    Replies: 1
    Last Post: 03-25-2008, 06:01 PM
  2. IMPORTANT: Applet Problem Please Help!
    By nvidia in forum Java Applets
    Replies: 1
    Last Post: 01-22-2008, 03:25 AM
  3. applet problem plz HELP
    By shibajisanyal in forum Java Applets
    Replies: 1
    Last Post: 01-09-2008, 02:47 AM
  4. Problem Exporting a Jar as an Applet
    By Hank Ag99 in forum Eclipse
    Replies: 0
    Last Post: 12-22-2007, 10:22 PM
  5. Problem with run Java Applet
    By Albert in forum Java Applets
    Replies: 1
    Last Post: 07-13-2007, 04:06 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
  •