473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

JTextArea not appearing?

I haven't done any Java programming for a good long bit, so this is probably
something really silly but anyways, can anyone tell me why my JTextArea is
not appearing when I run this?

public class MyApp extends JFrame {
JTextArea textArea;

public MyApp() {
getContentPane().setLayout(null);

textArea = new JTextArea();
textArea.setColumns(300);
textArea.setRows(10);
textArea.setLocation(120, 5);
textArea.setVisible(true);

getContentPane().add(textArea);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
}

public static void main(String args[]) {
MyApp win = new MyApp();
}
}
Jul 17 '05 #1
1 3146

"Chris Williams" <ch***@dwango.com> wrote in message
news:bp********@dispatch.concentric.net...
I haven't done any Java programming for a good long bit,
so this is probably something really silly but anyways, can
anyone tell me why my JTextArea is not appearing when
I run this?

public class MyApp extends JFrame {
JTextArea textArea;

public MyApp() {
getContentPane().setLayout(null);

textArea = new JTextArea();
textArea.setColumns(300);
textArea.setRows(10);
textArea.setLocation(120, 5);
textArea.setVisible(true);

getContentPane().add(textArea);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
}

public static void main(String args[]) {
MyApp win = new MyApp();
}
}


Remove this line:

getContentPane().setLayout(null);

Also, this:

textArea.setVisible(true);

is unnecessary, but benign.

I hope this helps.

Anthony Borla
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: - ions | last post by:
Hello, i am relatively new to programming, Java being the first language im learning. At the moment im having trouble changing the setEnable value of a button, relative to the state of a JTextArea,...
1
by: Jan Gregor | last post by:
Hello I want to redirect output of jython's functions print and println to JTextArea component. Is it possible ? I tried this (swingConsole.textArea is instance): In my class ...
1
by: Colibasi | last post by:
I would like to have a JTextArea with a background white and text should be readonly. The way I tried is something like this: JTextArea text = new JTextArea(); text.setEditable(false);...
2
by: domel | last post by:
How to display a text fragment in different color or in a different font then other part of text in JTextArea ?? thanks :)
2
by: janaki112 | last post by:
Hi, Can u please help in getting the contents in the JTextArea and writing tat into a file and also writing the contents of the file in to JTextArea???? can u give me the class or function name...
2
by: aryan24 | last post by:
i have a jtextfield and jtextarea. The textfield displays a file name. Please provide me the code to drag the filename into the textarea , so that the text area displays the fie contents....
3
by: olafatia | last post by:
import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; import java.io.File; import java.util.*; /* <Applet Code="MyPaint.class" width=400 height=400>...
3
by: MiziaQ | last post by:
is there a way to position the jtextarea on the content pane in a certain location ?
1
by: chanshaw | last post by:
Ok my problem is that when it loads the JTextArea, it does not show the full component's width and height. I've tried specifying it with setrow, setcolumn, setprefferedsize, all of that. It does...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.