HTML Tags in Text Fields

W

William Oertell

Does Java natively support html tags in text fields, or does the programmer
have to specify a string type in order for html tags to be treated as tags
rather than text? I ask this because I support an application at work that
allows me to enter text fields that will appear as modals to our users.
Today I discovered that I can use html tags to format the modal. For
instance I can use "<b>xxxx</b" to bold some text, "<center>xxxx</center>"
to center it, "<br>" for a line break, etc. I'm wondering if the programmer
has to specify some sort of string type in order for html tags to be treated
as tags by Java, instead of plain text. To put it another way, does the
programmer have to do something special for html tags to be treated as tags
by Java during runtime?
 
J

Jeff Higgins

William said:
Does Java natively support html tags in text fields, or does the
programmer have to specify a string type in order for html tags to be
treated as tags rather than text? I ask this because I support an
application at work that allows me to enter text fields that will appear
as modals to our users. Today I discovered that I can use html tags to
format the modal. For instance I can use "<b>xxxx</b" to bold some text,
"<center>xxxx</center>" to center it, "<br>" for a line break, etc. I'm
wondering if the programmer has to specify some sort of string type in
order for html tags to be treated as tags by Java, instead of plain text.
To put it another way, does the programmer have to do something special
for html tags to be treated as tags by Java during runtime?
<http://java.sun.com/docs/books/tutorial/uiswing/components/html.html>
 
H

hiwa

Does Java natively support html tags in text fields, or does the programmer
have to specify a string type in order for html tags to be treated as tags
rather than text? I ask this because I support an application at work that
allows me to enter text fields that will appear as modals to our users.
Today I discovered that I can use html tags to format the modal. For
instance I can use "<b>xxxx</b" to bold some text, "<center>xxxx</center>"
to center it, "<br>" for a line break, etc. I'm wondering if the programmer
has to specify some sort of string type in order for html tags to be treated
as tags by Java, instead of plain text. To put it another way, does the
programmer have to do something special for html tags to be treated as tags
by Java during runtime?

See: http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
JLabel, JButton, JToolTip, JEditorPane, JTextPane, JTabbedPane and
some of Menu/MeunItem classes support HTML tags.
 
W

William Oertell

hiwa said:
See: http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
JLabel, JButton, JToolTip, JEditorPane, JTextPane, JTabbedPane and
some of Menu/MeunItem classes support HTML tags.
This isn't quite was I was talking about. I probably tried to be too
brief.

In our admi tool I can set up certain criteria that will cause a message
to be displayed to our techs when they start a job. Today I discovered that
I can include html tags when I set up that message. What I'm wondering is
whether or not Java normally treats html tags in a text field as tags or
just normal text depending on how the programmer tells Java to treat the
text field. IOW, does the programmer have to tell Java to treat all text in
the text field as just text, or does he have to tell Java to treat html tags
as tags?
 
H

hiwa

This isn't quite was I was talking about. I probably tried to be too
brief.

In our admi tool I can set up certain criteria that will cause a message
to be displayed to our techs when they start a job. Today I discovered that
I can include html tags when I set up that message. What I'm wondering is
whether or not Java normally treats html tags in a text field as tags or
just normal text depending on how the programmer tells Java to treat the
text field. IOW, does the programmer have to tell Java to treat all text in
the text field as just text, or does he have to tell Java to treat html tags
as tags?

No. And JTextField can't handle HTML tags as tags.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top