Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Formatting JLabels

Posted on 2003-11-23
11
Medium Priority
?
416 Views
Last Modified: 2010-05-18
HI all

Im creating a simple GUI, ive got a box with a biography in it (about 500 words), currently im displaying them in a JLabel, the problem is that the text all appears across the same line. I also tried JText Area, but the problem with that was it was editable or it looked editable.

I basically need a large text area that appears the same as a JLabel, if anyone know how to do that it would be a great help

Thanks in advance

0
Comment
Question by:KrisM82
[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
  • 4
  • 2
  • +1
11 Comments
 
LVL 15

Expert Comment

by:jimmack
ID: 9806047
You could still use a JLabel if you really want using HTML (just add normal HTML as the label text, including the <HTML> tags and <P> etc.

I assume that you aren't happy setting the JTextArea uneditable (using setEditable(false)).
0
 

Author Comment

by:KrisM82
ID: 9806057
Thanks that should do the trick for now, is there anyway to that i can do this with out adding the tags, because each biography is different and then if I cange the layout i will need to re position all the <br> tags, and as there are over 50 biographycs i dont really want to have to edit them all every time I change the GUi a bit
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9806079
Just call

setEditable(false);

on the JTextArea
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 86

Expert Comment

by:CEHJ
ID: 9806082
Oh sorry missed the fact that that's been suggested ;-) What's the problem with it btw?
0
 

Author Comment

by:KrisM82
ID: 9806097
Ive got a biorgaphy for about 500 people which are between 300 and 500 words in size, I want to display them so they look the same as a Jlbabel to keep the style all the same, ive tried using JTextAread and a fe others but they all look like edtable fields even if you set them not to be. I just want to displayed so the user cant edit it and the page has a running format
0
 

Author Comment

by:KrisM82
ID: 9806574
the problem is that its white and you can select the test and I want it to look like a JLabel so the game looks the same all over
0
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 9806827
textarea.setBackground(bgcolour);
0
 
LVL 92

Expert Comment

by:objects
ID: 9806858
And to stop it being selected just set the selection colour the same as the background colour using setSelectionColor().
0
 
LVL 92

Expert Comment

by:objects
ID: 9806862
You''l probably also need to change the foreground colour and font to also match the JLabel.
0
 

Author Comment

by:KrisM82
ID: 9806982
Sorted the problem, thanks for the help
0
 
LVL 92

Expert Comment

by:objects
ID: 9807013
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

610 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