Results 1 to 2 of 2
- 03-26-2012, 03:17 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 15
- Rep Power
- 0
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
Any help on this will be appreciated.Java Code:import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; 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"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 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 (); Panel.setLayout(null); 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(label1); Panel.add(label); Panel.add (Input); Panel.add (scrolltxt); frame.add(Panel); frame.setSize(600,600); frame.setVisible(true); } public void actionPerformed (ActionEvent e) { String Reply; Reply = Input.getText(); Input.setText(""); Echo.append("YOU : "+ Reply + "\n\n"); } public static void main(String[] args){ TextArea1 obj = new TextArea1(); } }Last edited by er.raj; 03-26-2012 at 03:23 PM.
- 03-26-2012, 03:53 PM #2
Member
- Join Date
- Mar 2012
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Swing -> Applet size problem
By y2k in forum Java AppletsReplies: 5Last Post: 03-07-2012, 08:33 PM -
Eclipse Configuration(JAVA Applet) - I am trrying run my HW
By mikey1115 in forum New To JavaReplies: 4Last Post: 09-13-2011, 08:28 PM -
Swing applet problem
By link6790 in forum New To JavaReplies: 9Last Post: 05-24-2011, 02:31 PM -
Running as Java Applet in eclipse
By atomant in forum New To JavaReplies: 0Last Post: 12-05-2010, 02:22 AM -
Integrate Eclipse RCP Help into Java Swing application
By Abhishek.n in forum EclipseReplies: 0Last Post: 11-20-2008, 01:49 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks