3
3ashmawy
I have just started writing a simple gui application . I add to the
frame and ImageIcon(an image as the background) .then i added a
textArea . the textArea dissapears . Why ?
here is the code ...
import javax.swing.*;
import java.awt.*;
public class chatGUI {
JFrame frame = new JFrame();
JLabel contacts = new JLabel();
JTextArea sendRecieveArea = new JTextArea();
JTextArea typingArea = new JTextArea();
JLabel backgroundLabel;
public chatGUI()
{
frame.setLayout(null);
frame.setTitle("Chat");
frame.setBounds(300,200,500,500);
backgroundLabel = new JLabel(new
ImageIcon("graphics/background.gif"));
backgroundLabel.setBounds(0,0,500,500);
frame.add(backgroundLabel);
sendRecieveArea.setBounds(0,0,350,300);
sendRecieveArea.setLineWrap(true);
frame.add(sendRecieveArea);
typingArea.setLineWrap(true);
typingArea.setBounds(10,330,400,100);
frame.add(typingArea);
frame.setVisible(true);
}
public static void main(String args[])
{
chatGUI gui = new chatGUI();
}
}
Thanx in advance for your help.
3ashmawy
frame and ImageIcon(an image as the background) .then i added a
textArea . the textArea dissapears . Why ?
here is the code ...
import javax.swing.*;
import java.awt.*;
public class chatGUI {
JFrame frame = new JFrame();
JLabel contacts = new JLabel();
JTextArea sendRecieveArea = new JTextArea();
JTextArea typingArea = new JTextArea();
JLabel backgroundLabel;
public chatGUI()
{
frame.setLayout(null);
frame.setTitle("Chat");
frame.setBounds(300,200,500,500);
backgroundLabel = new JLabel(new
ImageIcon("graphics/background.gif"));
backgroundLabel.setBounds(0,0,500,500);
frame.add(backgroundLabel);
sendRecieveArea.setBounds(0,0,350,300);
sendRecieveArea.setLineWrap(true);
frame.add(sendRecieveArea);
typingArea.setLineWrap(true);
typingArea.setBounds(10,330,400,100);
frame.add(typingArea);
frame.setVisible(true);
}
public static void main(String args[])
{
chatGUI gui = new chatGUI();
}
}
Thanx in advance for your help.
3ashmawy