Fonts in textarea
I have problems changing fonts in my textarea..
I can change the size and change to bold.. Any1 know what to do?
I use textArea.append(string); to send strings.
yes.. I know.. but it doesn't change the font.. just the size and the style..
here is the code:
// File Test.java
import java.awt.*;
import java.awt.event.*;
public class Test extends Frame implements WindowListener {
private final TextArea TA = new TextArea("", 25, 80, TextArea.SCROLLBARS_NONE);
private final String NEWLINE = "" + '\n';
public Test() {
Font fnt = new Font("Lucida Console", Font.PLAIN, 15); //Font selection
setFont(fnt); //set selected font
TA.setEditable(false);
TA.setBackground(java.awt.Color.black);
TA.setForeground(java.awt.Color.lightGray);
add(TA);
setTitle("MS-DOS-prompt");
setResizable(false);
addWindowListener(this);
pack();
setVisible(true);
// The last methods were inherited
// because we extend java.awt.Frame
public void print(String s) {
TA.append(s);
public void println(String s) {
TA.append(s);
TA.append(NEWLINE);
public void cls() {
TA.setText("");
public void kill() {
dispose();
// We must implement the following as we are
// implementing WindowListener
public void windowDeactivated(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowOpened(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowClosed(WindowEvent e) {
System.exit(0);
public void windowClosing(WindowEvent e) {
dispose();
public static void main(String[] args) {
Test t = new Test();
t.println("abcdefghijklmnopqrstuvwxyz");
t.println("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
try {
Thread.sleep(5000); // Wait 5 seconds
catch (InterruptedException e) {
// Do nothing, not critical to
// be interrupted
t.cls();
try {
Thread.sleep(5000);
catch (InterruptedException e) {
// Do nothing, not critical to
// be interrupted
t.kill();
}
Similar Messages
-
Please, Help Embedding Fonts in TextArea , TextInput and Alert Components
Please, forgive my bad english.
Here is my problem (using Flash CS3 ActionScript 2).
I have on the stage :
• an instance of TextArea with Instance Name :
message_ta
• an instance of TextInput with instance Name : name_ti
• and I have in the library an instance of Alert
component, with default linkage Identifier : Alert
for each one of this components I need to embed the same
font.
I already created a New Font in the library, choosing the
font I want to use, giving it name "my_font" and size 8px.
Now, please, can someone help me to write the actions to
embed that font (my_font) inside the TextArea, TextInput and Alert
components ?
Thank you .You're right,my mistake, components don't have a font
parameter, I was thinking of the textField. In any case you can use
setStyle.
1. Import the font(s) that you want to use into your movie's
Library.
2. Set each font's Linkage to be exported for Actionscript.
Set the identifier name as you like
3. Set your component(s) on the stage.
4. Name each component instance.
5. In a frame action space, define the style for each
component:
componentName.setStyle("fontFamily","fontName");
componentName.setStyle("fontSize",12);
componentName.text = "hello";
componentName.embedFonts = true;
There is a section in the online help that lists the various
style properties that you can set for each component. -
How do I embed fonts in TextArea?
I was going to use a TextField with a UIScrollBar but godaddy disables UIScrollBar so I'm using a TextArea for my output. So far I'm able to disable text input, load htmlText and use the TextFormat class but I can't figure how to embed a font in it. Any ideas?
Here's what I'm using now:
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Bitstream Vera Sans";
myFormat.size = 14;
myFormat.leading = 2.5;
externalLoad.load(externalReq);
externalLoad.addEventListener(Event.COMPLETE, textReady);
function textReady(event:Event):void {
bioText.setStyle("textFormat", myFormat);
bioText.htmlText = event.target.data;I created this font symbol: http://www.jimslounge.com/Font1.jpg
and chenged my code:
import fl.controls.*;
var myFont:Font1 = new Font1();
var externalReq:URLRequest = new URLRequest("bio.txt");
var externalLoad:URLLoader = new URLLoader();
var myFormat:TextFormat = new TextFormat();
myFormat.font = myFont.Font1;
myFormat.size = 14;
myFormat.leading = 2.5;
bioText.setStyle("textFormat", myFormat);
bioText.setStyle("embedFont", true);
// bioText.textField.embedFonts = true;
bioText.textField.alpha=0.5;
externalLoad.load(externalReq);
externalLoad.addEventListener(Event.COMPLETE, textReady);
function textReady(event:Event):void {
bioText.htmlText = event.target.data;
I've tried both the options for embedding you see in the code and in both cases it dosen't even apply the font let alone embed. -
Hello,
I'm working on a small Editor-App and I just want to add the oppurtunity to change fonts. I'm using a TextArea and it should be possible to change the font for parts of the TextArea, not just for the whole one.
Thanks for your solutions
Greets
ThomasThe java.awt.TextArea doesn't support multiple fonts in a single TextArea. AFAIK, if you want to use java.awt, you'll have to write your own. The javax.swing text classes make it easier.
-
Changing fonts in textArea ??
How does one change the fonts of only part of the text inside a textArea? For my project I need to turn some strings bold when a button is pressed, but leave the rest of the text untouched.
Does anyone know how to do this?
Thank you,
Lazhi,
i have created an applet, and have created a textarea in that, run the program, and it have got what you have wanted,
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
public class Friends extends Applet implements ItemListener {
Choice friend;
TextArea text;
String msg="";
Label name;
//Font myFont;
public void init() {
name = new Label("select your buddy");
text = new TextArea();
add(text);
text.setBackground(Color.yellow);
text.setEditable(false);
friend = new Choice();
friend.add("welcome");
friend.add("ksenji");
friend.add("majnu");
friend.add("bakka");
friend.add("lingam");
friend.add("romeo");
friend.add("boobs");
friend.add("srinath");
friend.add("funky");
friend.add("casper");
friend.add("yoko");
friend.add("perk");
friend.add("bojji");
friend.add("mouli");
friend.add("gali");
friend.add("undi");
friend.add("rose");
friend.add("lokesh");
friend.add("mabbu");
friend.add("lara");
add(name);
add(friend);
friend.addItemListener(this);
public void itemStateChanged(ItemEvent ie) {
repaint();
public void paint(Graphics g){
if(friend.getSelectedItem().equals("welcome")){
Font myFont = new Font("Arial", Font.BOLD,36);
text.setFont(myFont);
msg = "Welcome \nto my \nHome Page\n";
text.setText(msg);
//g.drawString(msg,6,160);
else if(friend.getSelectedItem().equals("ksenji")){
Font myFont = new Font("Times New Roman", Font.PLAIN,12);
text.setFont(myFont);
msg = "\nName: kishore k senji\n\n"+
"Nick Name: senji\n\n"+
"1108 Tiger Blvd, Clemson, SC, USA 29631\n\n"+
"(864)-653-6492\n\n"+
"Birthday on: 7 th of November.";
text.setText(msg);
// g.drawString(msg,6,160);
else {
Font myFont = new Font("Times New Roman", Font.PLAIN,12);
msg="Yet to be implemented";
text.setText(msg);
} -
How to embeded the fonts to textarea
How to embeded the fonts to textarea
embed a font in your library, create a textformat instance (eg, tfor) and assign the font and, if ta is your textarea, use:
ta.setStyle("textFormat", tfor);
ta.setStyle("embedFonts", true); -
I have a TextArea that I use append(�string�) to write to. How do I choose and use a Font like �Courier New� that is equally spaced from one character to the next?
dewayneI do not ask before I look, contrary to your expectations. What I needed from the very beginning was the word "monospaced". I didn't see it in the documentation of class Font. Maybe others have different documentation. Haven't tried your information yet though, but it looks like what I wanted. You are very helpful, and thank you very much.
dewayne -
How to set Telugu(my own) font to AWT TextArea
Hi,
I have a Telugu Font file(.TTF file). I have installed that .TTF file in my system.
Now i want to set that font to AWT TextArea.
can any body tell how can i solve tha above problem
--balai tried it , but it does'nt work.
but what exactly i want is , i have a font(.ttf). i want to set that font to textarea.
--bala -
I am creating a word processor which allows for font changes. it works to change the font, but it will change previously entered font in addition. i do not want text that has already been entered to be changed by new settings. how can i accomplish this?
for reference, this is an example of how i change the font:
oldFont = textArea.getFont();
textArea.setFont(new font(oldFont.getFontName(),Font.ITALIC,oldFont.getSize()));Thanks.Ok, so I implemented a text Pane setup. Though, it still does the same thing. Any time an option is modified, all of the text will change.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
import javax.swing.text.StyledDocument;
public class wordTemp extends JFrame {
private final int sizeValues[] = { 8, 9, 10, 11, 12, 14, 16, 18, 20, 25, 36, 48, 72};
private final String fontNames[] = { "Serif", "Monospaced", "SansSerif" };
private JRadioButtonMenuItem sizeItems[], fonts[];
private JToggleButton boldButton, italicButton;
private JTextPane textPane;
private ButtonGroup fontGroup, sizeGroup;
private Font oldFont;
private StyleContext context = new StyleContext();
private StyledDocument document = new DefaultStyledDocument(context);
private Style style = context.getStyle(StyleContext.DEFAULT_STYLE);
// set up GUI
public wordTemp()
super( "SimpWoPro - Simple Word Processor" );
// set up File menu and its menu items
JMenu fileMenu = new JMenu( "File" );
fileMenu.setMnemonic( 'F' );
// set up About... menu item
JMenuItem aboutItem = new JMenuItem( "About SimpWoPro..." );
aboutItem.setMnemonic( 'A' );
fileMenu.add( aboutItem );
aboutItem.addActionListener(
new ActionListener() { // anonymous inner class
// display message dialog when user selects About...
public void actionPerformed( ActionEvent event )
JOptionPane.showMessageDialog( wordTemp.this,
"This is a simple word processor \n developed to show menus and ways \n of altering fonts in a \n text area.",
"About", JOptionPane.PLAIN_MESSAGE );
} // end anonymous inner class
); // end call to addActionListener
// set up Exit menu item
JMenuItem exitItem = new JMenuItem( "Exit" );
exitItem.setMnemonic( 'x' );
fileMenu.add( exitItem );
exitItem.addActionListener(
new ActionListener() { // anonymous inner class
// terminate application when user clicks exitItem
public void actionPerformed( ActionEvent event )
System.exit( 0 );
} // end anonymous inner class
); // end call to addActionListener
// create menu bar and attach it to MenuTest window
JMenuBar bar = new JMenuBar();
setJMenuBar( bar );
bar.add( fileMenu );
// create Format menu, its submenus and menu items
JMenu formatMenu = new JMenu( "Font Type" );
formatMenu.setMnemonic( 'r' );
// create size submenu
String sizes[] = { "8", "9", "10", "11", "12", "14", "16", "18", "20", "25", "36", "48", "72"};
JMenu sizeMenu = new JMenu( "Font Size" );
sizeMenu.setMnemonic( 'S' );
sizeItems = new JRadioButtonMenuItem[ sizes.length ];
sizeGroup = new ButtonGroup();
ItemHandler itemHandler = new ItemHandler();
// create size radio button menu items
for ( int count = 0; count < sizes.length; count++ ) {
sizeItems[ count ] = new JRadioButtonMenuItem( sizes[ count ] );
sizeMenu.add( sizeItems[ count ] );
sizeGroup.add( sizeItems[ count ] );
sizeItems[ count ].addActionListener( itemHandler );
// select first size menu item
sizeItems[ 0 ].setSelected( true );
// create Font submenu
JMenu fontMenu = new JMenu( "Font" );
fontMenu.setMnemonic( 'n' );
fonts = new JRadioButtonMenuItem[ fontNames.length ];
fontGroup = new ButtonGroup();
// create Font radio button menu items
for ( int count = 0; count < fonts.length; count++ ) {
fonts[ count ] = new JRadioButtonMenuItem( fontNames[ count ] );
fontMenu.add( fonts[ count ] );
fontGroup.add( fonts[ count ] );
fonts[ count ].addActionListener( itemHandler );
// select first Font menu item
fonts[ 0 ].setSelected( true );
// Create the bold button.
boldButton = new JToggleButton( "Bold" );
boldButton.addItemListener(
new ItemListener() { // anonymous inner class
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
StyleConstants.setBold(style, true);
else{
StyleConstants.setBold(style, false);
} // end anonymous inner class
// Create the italic button.
italicButton = new JToggleButton( "Italic" );
italicButton.addItemListener(
new ItemListener() { // anonymous inner class
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
StyleConstants.setItalic(style, true);
else{
StyleConstants.setItalic(style, false);
} // end anonymous inner class
// add Format menu to menu bar
bar.add( fontMenu );
bar.add( sizeMenu );
bar.add( boldButton );
bar.add( italicButton );
textPane = new JTextPane(document);
JScrollPane scrollPane = new JScrollPane(textPane);
getContentPane().add( scrollPane );
setSize( 500, 200 );
setVisible( true );
} // end constructor
public static void main( String args[] )
wordTemp application = new wordTemp();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
// inner class to handle action events from menu items
private class ItemHandler implements ActionListener {
// process size and font selections
public void actionPerformed( ActionEvent event )
// process size selection
for ( int count = 0; count < sizeItems.length; count++ ){
if ( event.getSource() == sizeItems[ count ] ) {
StyleConstants.setFontSize(style, sizeValues[count] );
// process font selection
for ( int count = 0; count < fonts.length; count++ ){
if ( event.getSource() == fonts[ count ] ) {
StyleConstants.setFontFamily(style, fontNames[count] );
} // end method actionPerformed
} // end class ItemHandler
}How could I change this so that old text is not changed?
Thanks. -
Variable textArea not found in class javax.swing.JFrame...
Making progress on this issue -- but still stuck. Again trying to get the text from a JTextArea on exit:
frame.addWindowListener
(new WindowAdapter() {
public void windowClosing(WindowEvent e)
System.out.println("Why me???" + frame.textArea.getText());
});User MARSIAN helped me understand the scope fo the variables and now that has been fixed. Unfortunately I cannot access my variable textArea in the above code. If get this error:
Error: variable textArea not found in class javax.swing.JFrame
What am I doing wrong?
import java.net.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import FragImpl.*;
public class Framework extends WindowAdapter {
public int numWindows = 0;
private Point lastLocation = null;
private int maxX = 500;
private int maxY = 500;
JFrame frame;
public Framework() {
newFrag();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
maxX = screenSize.width - 50;
maxY = screenSize.height - 50;
makeNewWindow();
public void makeNewWindow() {
frame = new MyFrame(this); //*
numWindows++;
System.out.println("Number of windows: " + numWindows);
if (lastLocation != null) {
//Move the window over and down 40 pixels.
lastLocation.translate(40, 40);
if ((lastLocation.x > maxX) || (lastLocation.y > maxY)) {
lastLocation.setLocation(0, 0);
frame.setLocation(lastLocation);
} else {
lastLocation = frame.getLocation();
System.out.println("Frame location: " + lastLocation);
frame.setVisible(true);
frame.addWindowListener
(new WindowAdapter() {
public void windowClosing(WindowEvent e)
System.out.println("Why me???" + frame.textArea.getText());
//This method must be evoked from the event-dispatching thread.
public void quit(JFrame frame) {
if (quitConfirmed(frame)) {
System.exit(0);
System.out.println("Quit operation not confirmed; staying alive.");
private boolean quitConfirmed(JFrame frame) {
String s1 = "Quit";
String s2 = "Cancel";
Object[] options = {s1, s2};
int n = JOptionPane.showOptionDialog(frame,
"Windows are still open.\nDo you really want to quit?",
"Quit Confirmation",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
s1);
if (n == JOptionPane.YES_OPTION) {
return true;
} else {
return false;
private void newFrag()
Frag frag = new FragImpl();
public static void main(String[] args) {
Framework framework = new Framework();
class MyFrame extends JFrame {
protected Dimension defaultSize = new Dimension(200, 200);
protected Framework framework = null;
private Color color = Color.yellow;
private Container c;
JTextArea textArea;
public MyFrame(Framework controller) {
super("New Frame");
framework = controller;
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(defaultSize);
//Create a text area.
textArea = new JTextArea(
"This is an editable JTextArea " +
"that has been initialized with the setText method. " +
"A text area is a \"plain\" text component, " +
"which means that although it can display text " +
"in any font, all of the text is in the same font."
textArea.setFont(new Font("Serif", Font.ITALIC, 16));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBackground ( Color.yellow );
JScrollPane areaScrollPane = new JScrollPane(textArea);
//Create the status area.
JPanel statusPane = new JPanel(new GridLayout(1, 1));
ImageIcon icoOpen = null;
URL url = null;
try
icoOpen = new ImageIcon("post_it0a.gif"); //("doc04d.gif");
catch(Exception ex)
ex.printStackTrace();
System.exit(1);
setIconImage(icoOpen.getImage());
c = getContentPane();
c.setBackground ( Color.yellow );
c.add ( areaScrollPane, BorderLayout.CENTER ) ;
c.add ( statusPane, BorderLayout.SOUTH );
c.repaint ();
}Yeah!!! It works. Turned out to be a combination of DrKlap's and Martisan's suggestions -- had to change var frame's declaration from JFrame to MyFrame:
MyFrame frame;Next, created the external class -- but again changed JFrame references to MyFrame:
public class ShowOnExit extends WindowAdapter {
// JFrame aFrame;
MyFrame aFrame;
public ShowOnExit(MyFrame f) {
aFrame = f;
public void windowClosing(WindowEvent e)
System.out.println("Why me???" + aFrame.textArea.getText()); // aFrame here not frame !!!
}This worked. So looks like even though the original code added a WindowListener to 'frame', the listener didn't couldn't access frame's methods unless it was explicitly passed in as a parameter. Let me know if that's wrong.
Thanks again, all. -
Some japanese characters shows inccorrect TLF (but correct in TextArea)
Some japanese characters replaces squares, but this characters shows correct in TextArea. How can I see this characters in TLF?
Text example:
123 ヒホミァ
おきなヴァ ・ マギナァ
GHJ
EnglishI didn't change font in TextArea, in TLF font is Verdana.
OS: Windows XP
Font: Verdana device font
This problem we can see also in demo version (http://labs.adobe.com/technologies/textlayout/demos/) -
i have read in books that java supports unicode and hence all the language charectors. i have the unicodes for hindi fonts. i want to write them in TextArea or JTextArea. but the problem is that when i use command append(""+<code>), i see some numbers in the textarea instead of hindi fonts. is there any way i can add hindi fonts to textArea? i am intended to use them in applet.
let me explain a bit. i want my applet to display hindi fonts when i put it online. if i use the setFont() it displays hindi fonts but the fonts MUST be present in my system ( i have hindi fonts in my system ). i want a more flexible way so that there should be no need of hindi fonts on user's system. i tried making an Font object of hindi fonts and saving it on the disk using ObjectOutputStream. but when i read it back on another system, it does not show hindi fonts. even i have tried directly supplying the unicode of hindi fonts, but nothing works. please friends help me! is there nobody to guide me?
-
Index problem in my font program--very very important
Hi friends, in the below program which i have given
go to the if loop of "Times New Roman Font" and there i have given two setText inputs.But when i give two or more input within one if loop ,i am getting only the last input as many times in my comboBox.
ie.for two different inputs in times new roman i am getting the second input printed twice in my combobox leaving the first one .but i want to see both first and second input in my combobox.Like that the problem occurs for other loop also.
one more thing for two "times new roman" font inputs i want two different index.but it is giving same index for that particular font regardless of how many inputs you are giving of that font type.
so i want slight changes in logic or any other idea.this is very urgent and my mail id is [email protected]
please reply me as soon as possible
This is my code
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class ComboBoxFonts extends JFrame implements ItemListener
{ // JTextArea textArea;
JComboBox comboBox;
public Font abiFont = new Font("Arial Black Italic",Font.PLAIN,20);
public Font bmoFont = new Font("Book Man Old Style Bold",Font.BOLD,20); public Font cniFont = new Font("Courier New Italic",Font.PLAIN,20);
public Font fraFont = new Font("Franklin Gothic Medium",Font.BOLD,20);
public Font garFont = new Font("Garamond",Font.PLAIN,20);
public Font geoFont = new Font("Georgia Italic",Font.BOLD,20);
public Font lucFont = new Font("Lucida Sans Italic", Font.BOLD, 20);
public Font romFont = new Font("Roman",Font.PLAIN,20);
public Font tahFont = new Font("Tahoma Bold",Font.BOLD,20);
public Font tnrFont = new Font("Times New Roman",Font.PLAIN,20);
public Font verFont = new Font("Verdana Bold",Font.BOLD,20);
public Font webFont = new Font("Webdings",Font.BOLD,20);
public ComboBoxFonts()
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
Font [] fonts = ge.getAllFonts ();
Font [] example = {abiFont,bmoFont,cniFont,fraFont,garFont,geoFont,lucFont,romFont,tahFont,tnrFont,verFont,webFont,hinFont};
//The above example array contains the order in which the fonts are displayed in our ComboBox.
comboBox = new JComboBox(example);
comboBox.setRenderer( new MyFontRenderer() );
comboBox.addItemListener( this );
getContentPane().add( comboBox, BorderLayout.NORTH );
comboBox.setBounds(162,42,180,25);
public void itemStateChanged(ItemEvent e)
Font font = (Font)e.getItem();
//textArea.setFont( font.deriveFont( textArea.getFont().getSize2D() ) );
comboBox.setFont( font.deriveFont( comboBox.getFont().getSize2D() ) );
public static void main(String[] args)
ComboBoxFonts frame = new ComboBoxFonts();
frame.setDefaultCloseOperation( DISPOSE_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );
class MyFontRenderer extends BasicComboBoxRenderer
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
Font font = (Font)value;
String fontName = font.getFontName();
//setFont( font.deriveFont(12.0f) );
int size = font.getSize();
System.out.println("index"+index+"--fontName : "+fontName+" size : "+size);
if(fontName.equals("Garamond"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Arial Black Italic"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
//setText("Welcome To Geneva Software Technologies Pvt ltd");
return this;
else if(fontName.equals("Roman"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Times New Roman"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
setText(""+(char)117+""+(char)99+""+(char)69+""+(char)63+""+(char)63+""+(char)84+""+(char)71);
return this;
else if(fontName.equals("Lucida Sans Italic"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Franklin Gothic Medium"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Tahoma Bold"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Georgia Italic"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Webdings"))
//Webdings font is the last font displayed in our ComboBox drop down list
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Verdana Bold"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else if(fontName.equals("Book Man Old Style Bold"))
setFont( font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
else
setFont(font.deriveFont(100));
setText(""+(char)69+""+(char)78+""+(char)71+""+(char)76+""+(char)73+""+(char)83+""+(char)72);
return this;
}I dont see what the problem with the code is, but I would suggest the following:
1) comment out all code except for 2 types of fonts. It will make debugging easier.
2) Your browser (or whatever type of display you have) may not support all the types of fonts you have listed.
If not, it probably uses the same default font (therefore many fonts will look the same because they are using the default).
3) If you are putting two text messages in two different panels on the display, you will only see one panel if that panel is drawn
on top of the other panel. You need to separate the panels on the display (offset them). -
Help ! TextArea doesn't work w/ html property
IDE version : Flash 8 / CS2
Hi,
I have big troubles with TextArea component using html and
embedFonts properties with integrated font.
In brief words:
- When embedFonts and html properties are true and using
integrated font, my textarea is empty. No error in action script.
- When embedFonts is true and html propertiy is false and
using integrated font, I see my text with the integrated font but
all html tags appear as text elements.
- When embedFonts property is false and no reference to
integrated font, just html property with true, text appears with
html aspect. But with default font.
I’m trying to understand and fix the problem, but with
no success. I did not find any information about this strange
behaviour.
Many thanks for help.
Regards.
Apologize for my poor English speaking.Hi Again,
I'm still trying to find a solution to fix that, but with no
success.
Pleeaaase, help me.
Thanks a lot. -
Hello,
I am trying to change the background color of the textarea using in-line css.
responseBox = new TextArea();
responseBox.setStyle("-fx-font: 14px 'Courier New';-fx-background-color: #000000;");The background color should be black, but it remains as defult (white).
What am i doing wrong?
How do I change the color of the font within TextArea?
GaborHi Darryl,
It doesn't work for me. I got this error message permanetly on the console on the other hand either using style or not:
knownConverters does not contain mapping for javafx.geometry.Insets
INFO: com.sun.javafx.css.StyleableProperty error
Styleable [email protected]
(inherits=false, converter=, initial=2, property=-fx-margin) for
com.sun.javafx.scene.control.skin.TextInputSkin margin:
Could not infer 'converter'I saw in a previous post that one experienced this and he was told that TextArea is buggy.
Thanks, Gabor
Maybe you are looking for
-
SAP NAME FILE lock error while creating the TR in development system.
Hi All, I am getting an error message while saving the changes in my SAP Script that 'SAP names file for <UserId> locked by another process' The name of the lock file is "/usr/sap/trans/tmp/<UserId>.LOS". Can any body help me, how to resolve this pro
-
What is the offline method of downloading and installing Firefox?
I'd like to upgrade to the latest version of Firefox. The catch is, I only have a dialup connection, so online installation is not an option. It would take hours -- or even days. (And I'm charged by the minute.) Is there an offline way to install Fir
-
Can one reference points to many objects?
HI friend: Can I use one object reference points to all objects defined in same class? Because sometimes I only want to access some instance methods and they require a object reference to access. And it doesn't matter which object it is. For example:
-
I am using CC with both Edge Animate and Muse. After uploading to the website host it plays great on the Mac but images don't appear when I'm using Windows. Any suggestions?
-
Camera not working on MBA 13" mid 2012 with OS X 10.9.1
The built-in camera is not being recognized by anything - Skype, FaceTime, PhotoBooth, you name it. There are no updates available and I've tried rebooting, so I have no idea what to do here. Does anyone have suggestions, please??