?
Solved

Java Applet - JTextField and JTextArea not appearing fully??

Posted on 2003-03-19
4
Medium Priority
?
737 Views
Last Modified: 2012-08-13
HI

I've written a Java JApplet. Everythings working fine except for the JTextField and the JTextArea. They're initalised and set in the init() method but don't appear properly in the applet.

The appear invisible until clicked on or highlighted - then they appear - even though I used the '.setVisible(true)' method on both. I initalise buttons and labels which appear fine.


code:

setBackground(Color.gray);

chatArea = new JTextArea(5,60);
JScrollPane scrollPane = new JScrollPane(chatArea);
chatArea.setEditable(false);
chatArea.setVisible(true);
chatArea.setLineWrap(true);
chatArea.setWrapStyleWord(true);
chatArea.setBackground(java.awt.Color.white);
scrollPane.setBounds(10,720,200,50);
scrollPane.setVisible(true);


message = new JTextField(60);
message.setEditable(true);
message.setVisible(true);
message.setBackground(java.awt.Color.white);
message.setBounds(285,720,100,20);
message.requestFocus();


0
Comment
Question by:gibbonss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:antonsigur
ID: 8170015
try calling updateUI() on the components
0
 
LVL 92

Expert Comment

by:objects
ID: 8170051
u do not need to call setVisible().
do u add them to your applet in your init() method?
if not, then you'll need to force your applet to relayout its children after u add them:

add(message);
revalidate();
repaint();
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8171992
objects is right. Please add the chatArea and message to your Applet in your init () method.

Mayank.
0
 

Accepted Solution

by:
sexperts_exchange earned 1000 total points
ID: 8341339
Hey Stephen,

can I have these points??!!!

Great!!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question