Results 1 to 2 of 2
  1. #1
    er.raj is offline Member
    Join Date
    Mar 2012
    Rep Power

    Default Problem with GUI in java applet using swing in eclipse

    I am trying to make a chat like GUI in eclipse using the swing library.
    The basic code is working with one small problem. When I run the program, the graphics are not displayed. But, when I click on the window boundary or maximize it, they show up. I can't figure out whats the issue here.

    This is my code
    Java Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TextArea1 extends JApplet implements ActionListener {
      private static final String NULL = null;
      JTextField Input;
      JTextArea Echo;
      JScrollPane scrolltxt ;
      Container Panel;
      LayoutManager Layout;
      public TextArea1 () {
    	  JFrame frame = new JFrame("Counselling centre");
    	  setLayout(new BorderLayout());
    	Input = new JTextField (20);
        Echo = new JTextArea ("\n");
        JLabel label=new JLabel("YOU :");
        JLabel label1=new JLabel("WELCOME");
        Layout = new FlowLayout ();
        Panel = getContentPane ();
        Echo.setEditable (false); 
        scrolltxt = new JScrollPane(Echo);
        Input.addActionListener (this);
        label1.setBounds(40, 10, 220, 30);
        label.setBounds(20, 400, 220, 30);
        Input.setBounds(70, 400, 450, 30);
    	scrolltxt.setBounds(40, 45, 500, 300);
        Echo.setLineWrap (true);
        Panel.add (Input);
        Panel.add (scrolltxt);
      public void actionPerformed (ActionEvent e)  {
        String Reply;
        Reply =  Input.getText();
        Echo.append("YOU : "+ Reply + "\n\n");
    public static void main(String[] args){
      TextArea1 obj = new TextArea1();
    Any help on this will be appreciated.
    Last edited by er.raj; 03-26-2012 at 04:23 PM.

  2. #2
    er.raj is offline Member
    Join Date
    Mar 2012
    Rep Power

    Default Re: Problem with GUI in java applet using swing in eclipse

    Okay so the problem seems to be solved now.
    Removing "extends JApplet" fixed it.

Similar Threads

  1. Swing -> Applet size problem
    By y2k in forum Java Applets
    Replies: 5
    Last Post: 03-07-2012, 09:33 PM
  2. Replies: 4
    Last Post: 09-13-2011, 09:28 PM
  3. Swing applet problem
    By link6790 in forum New To Java
    Replies: 9
    Last Post: 05-24-2011, 03:31 PM
  4. Running as Java Applet in eclipse
    By atomant in forum New To Java
    Replies: 0
    Last Post: 12-05-2010, 03:22 AM
  5. Replies: 0
    Last Post: 11-20-2008, 02:49 PM

Tags for this Thread

Posting Permissions

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