Change the font of a selected text

First of all sorry for my english because i'm spanish. I'm doing a simple text editor 100% compatible with all the web browsers. The editor must to have the option of change the font of a selected text. I don't know how to do this. Thank you.

you should look at examples that are provided with swing package, there are some simple texteditors, and then of course you should start thinking in AWT to make your editor compatible with all browsers as you wanted...
if you want to use TextArea in your editor then you must remember that in one textarea you can use only one Font at the time... as well as you may not use different colors for different parts of text, but with such textarea you may create thing like Notepad in windows.
L.

Similar Messages

  • To change the font of a selected row in a Jtable

    Hello,
    Is it possible to change the font of a selected row in a jtable?
    i.e. if all the table is set to a bold font, how would you change the font of the row selected to a normal (not bold) font?
    thank you.

    String will be left justified
    Integer will be right justified
    Date will be a simple date without the time.
    As it will with this renderer.Only if your custom renderer duplicates the code
    found in each of the above renderers. This is a waste
    of time to duplicate code. The idea is to reuse code
    not duplicate and debug again.
    No, no, no there will be NO duplicated code.
    A single renderer class can handle all types ofdata.
    Sure you can fit a square peg into a round hole if
    you work hard enough. Why does the JDK come with
    separate renderers for Date, Integer, Double, Icon,
    Boolean? So that, by default the rendering for common classes is done correctly.
    Because its a better design then having code
    with a bunch of "instanceof" checks and nested
    if...else code.This is only required for customization BEYOND what the default renderers provide
    >
    And you would only have to use instanceof checkswhen you required custom
    rendering for a particular classAgreed, but as soon as you do require custom
    renderering you need to customize your renderer.
    which you would also have to do with theprepareRenderer calls too
    Not true. The code is the same whether you treat
    every cell as a String or whether you use a custom
    renderer for every cell. Here is the code to make the
    text of the selected line(s) bold:
    public Component prepareRenderer(TableCellRenderer
    renderer, int row, int column)
    Component c = super.prepareRenderer(renderer, row,
    , column);
         if (isRowSelected(row))
              c.setFont( c.getFont().deriveFont(Font.BOLD) );
         return c;
    }It will work for any renderer used by the table since
    the prepareRenderer(...) method returns a Component.
    There is no need to do any kind of "instanceof"
    checking. It doesn't matter whether the cell is
    renderered with the "Object" renderer or the
    "Integer" renderer.
    If the user wants to treat all columns as Strings or
    treat individual columns as String, Integer, Data...,
    then they only need to override the getColumnClass()
    method. There is no change to the prepareRenderer()
    code.
    Have you actually tried the code to see how simple it
    is?
    I've posted my code. Why don't you post your solution
    that will allow the user to bold the text of a Date,
    Integer, and String data in separate column and then
    let the poster decide.Well, I don't see a compilable, runnable demo anywhere in this thread. So here's one
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Arrays;
    import java.util.Date;
    import java.util.Vector;
    public class TableRendererDemo extends JFrame{
        String[] headers = {"String","Integer","Float","Boolean","Date"};
        private JTable table;
        public TableRendererDemo() {
            buildGUI();
        private void buildGUI() {
            JPanel mainPanel = (JPanel) getContentPane();
            mainPanel.setLayout(new BorderLayout());
            Vector headerVector = new Vector(Arrays.asList(headers));
             Vector data = createDataVector();
            DefaultTableModel tableModel = new DefaultTableModel(data, headerVector){
                public Class getColumnClass(int columnIndex) {
                    return getValueAt(0,columnIndex).getClass();
            table = new JTable(tableModel);
    //        table.setDefaultRenderer(Object.class, new MyTableCellRenderer());
            table.setDefaultRenderer(String.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Integer.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Float.class, new MyTableCellRenderer());
            table.setDefaultRenderer(Date.class, new MyTableCellRenderer());
            JScrollPane jsp = new JScrollPane(table);
            mainPanel.add(jsp, BorderLayout.CENTER);
            pack();
            setLocationRelativeTo(null);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        private Vector createDataVector(){
            Vector dataVector = new Vector();
            for ( int i = 0 ; i < 10; i++){
                Vector rowVector = new Vector();
                rowVector.add(new String("String "+i));
                rowVector.add(new Integer(i));
                rowVector.add(new Float(1.23));
                rowVector.add( (i % 2 == 0 ? Boolean.TRUE : Boolean.FALSE));
                rowVector.add(new Date());
                dataVector.add(rowVector);
            return dataVector;
        public static void main(String[] args) {
            Runnable runnable = new Runnable() {
                public void run() {
                    TableRendererDemo tableRendererDemo = new TableRendererDemo();
                    tableRendererDemo.setVisible(true);
            SwingUtilities.invokeLater(runnable);
        class MyTableCellRenderer extends DefaultTableCellRenderer{
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                 super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if ( isSelected){
                    setFont(getFont().deriveFont(Font.BOLD));
                else{
                    setFont(getFont().deriveFont(Font.PLAIN));
                if ( value instanceof Date){
                    SimpleDateFormat formatter =(SimpleDateFormat) SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
                    setText(formatter.format((Date)value));
                if(value instanceof Number){
                   setText(((Number)value).toString());
                return this;
    }Hardly a "bunch of instanceof or nested loops. I only used the Date instanceof to allow date format to be specified/ modified. If it was left out the Date column would be "18 Apr 2005" ( DateFormat.MEDIUM, which is default).
    Cheers
    DB

  • Change the font color of a text field in a table by key-combination

    I want to change the font color of a text field in a table (single cell only) on pressing a key combination. Does anybody know how to do this.
    I have a lot of data in a table. During an evaluation of the data in a meeting I want to change the color of the text depending on the result of the meeting. (for example: High risk = CTRL+R makes the text red).
    I know how to change the color using a button, but I do not want to add a button after each cell. For this reason I would like to do it on a key combination that alway refers to the active cell.
    Many thanks for your help in advance.
    Marcel

    Hi,
    I don't think you can use the ctrl key like that as those shortcuts will be intercepted by Reader (ctrl-R toggles the ruler display on / off).  You also might have trouble updating the color while you still have focus on it.  You can use the shift key in a similar way, so if you only have lower case characters in the text fields then you can do something like;
    if (xfa.event.shift)
        switch (xfa.event.change)
            case "R":
                this.fontColor = "255,0,0";
                break;
            case "O":
                this.fontColor = "255,102,0";
                break;
            case "G":
                this.fontColor = "0,255,0";
                break;
        xfa.event.change = ""; // ignore character
    If you need uppercase characters maybe you can have one button to set "review mode" and test that on the if (xfa.event.shift) line.  But again it wont take effect until you have tabbed out of the field.
    Regards
    Bruce

  • HT3529 how do you change the font size on your text messaging on the iphone 4s

    how do you change the font size on your text messaging on the iphone 4s

    Settings > General > Accessibility > Large Text.

  • How to change the FONT size for a TEXT object?

    Hello
    I am keeping a TEXT element to get a static text (as 'Visitor Info Form'), so i inserted TEXT from palattes, its size is Aerial 10, but i want to have its size as 24, I tried by right clicking on TEXT, then selected FONT, then choosen the 24 from drop-down list, its not working/reflecting!! but, when i change the PARAGRAPH settings, they are reflecting!
    Pls. let me know how to change size from 10 to 24?
    Thank you

    Don't specify the styleclass for the inner panelHeader.
    <af:panelHeader text="panelHeader 1" id="ph1" styleClass="CustomHelpHeader">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:panelHeader text="inner panelHeader" id="ph2">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar"/>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    </af:panelHeader>
    </af:panelHeader>
    The inner panel header does not get affected and is displayed normally.
    Thanks,
    Navaneeth

  • Is there a way to allow the end user to change the font color in a text field?

    I didn't know LiveCycle existed yesterday so I have been using the Google a bunch.
    I am building a request form and was asked if there was a way to change the color of font within a text field. (EXAMPLE: Original content is black. Notes are red)
    I have 2 thoughts on this, one is to type it out and highlight then click a button to turn it red. The other way I am more partial to. Have a radial button that when off, types black. When on, types red. What is the best way to do this or is it even possible?

    Figured it out. Change "plain text" to "rich text" and have user press ctr+e. Seems odd to me but it works.

  • How to change the font size in sap scripts?

    hi friends,
        i had a query regarding to SAPSCRIPT.
      how to change the font size of a text in sap script form in which it should change it  dynamically.
    is it possible to change the font size dynamically in scripts.
    one more query regarding to this only.
    i need to get the hard copy of a script .
    what is the transaction code to get the hard copy?

    Hi venkata,
    You can specify the font size either in the Character format or pharagraph format.
    You better decide it according to your requirement.  If you want to apply the same font size for the entire form create the Paragraph format and give the paragraph format in the default paragraph format.
    If you want to apply that to limited text, then create character format.
    The process of creating it is just after going inside paragraph format click EDIT-> Create Element and give the font size.
    This applies for character format also.
    Reward points if useful.
    Thanks,
    karthik

  • When I convert my pdf doc to word, the fonts go really weird and it also puts some text into boxes. when I try to select the test and change the font, it does not change it properly?

    When I convert my pdf doc to word, the fonts go really weird and it also puts some text into boxes. when I try to select the text and change the font, it does not change it properly? This is making it impossible to amend.

    Hi Janedance1,
    If the PDF that you converted already has searchable text, please try disabling OCR as described in this document: How to disable Optical Character Recognition (OCR) when converting PDF to Word or Excel. (If the PDF was created from a scanned document and doesn't already have searchable text, disabling OCR isn't a great option, as the text won't be searchable/editable in the converted Word doc.)
    Please let us know how it goes.
    Best,
    Sara

  • How to Change the Font Size in Module Pool Selection Screen?

    Hi,
    There is a module pool, and I need to change the font size mentioned in the selection screen. Could you plaese tell me, how will I be able to do that?

    Hi ,
    If you are asking for text field , then check the options avaliable in Display tab of Attributes.
    Hope this helps you.

  • How do I change the font size and color in a text box in Adobe Acrobat 9 Pro (ctrl e does not work)?

    I need to mark up scanned pdf documents with text box comments. I can insert the text box and type text but I cannot change the font or color. When I press Crtl E, no tool bar appears in the menu bar. What does appear in the menu bar is "No current selection". Please advise.

    I am already doing that: creating the text box, typing the text, selecting the text i.e. highlighting the text. This morning, for a scant minute, the properties tool bar appeared and I was able to refine the text in a text box. Then it disappeared never to be activated again this morning.
    I work half of my weekly hours at this client office and I only have this problem on their pc and adobe software (version 9 pro). When I am home, my laptop and the adobe software (version 10 pro) is fine. I can create the text boxes and refine the format at will with no issues. Could it be a software version and/or update issue? Thanks for any assistance.

  • How do I change the font size and color in a text box?

    How do I change the font size and color in a text box?

    Really frustrating to find the first time but simple once you figure it out. I think I spent hours trying to find this. Simply right click on a blank spot in the toolbar up top and select Properties Bar. There it is! The available properties will change depending on whether you have the content (text) selected or the box itself.
    I haven't found a way yet to make it show up as a regular part of the toolbar. It floats around and gets in the way so I don't leave it on and then have to open it again when I need it. Again - frustrating; but at least it's there!

  • How do you change the font in multiple text boxes?

    I just started using illustrator and I can't figure this one out.  Maybe someone can point me in the right direction.
    I made a bunch of text boxes using the type tool.  Is there a way I can link the boxes and easily change the font?
    Thanks,
    Justin

    You select the text frames holding dow the shift keys then go to Type>Thread text, I would select the text frames in the order you wan them threaded.
    Then once threaded you click the text tool inside of one of the text strings and do a command A to select all the text and then choose any method of changing the font such as Character Panel, Control Panel or Type>Font menu item.
    you can also look into creating Paragraph styles as well.

  • How to change the font of the text in Control Editor??

    How to change the font of the text in Control Editor??

    Hi,
            you have to create a smartstyle and acces that in So10 transaction.in change mode,menu->FORMAT->CHANGE STYLE.
    here you will get all styles available.
    so first you have to create a style in SE72 and activate it. and then
    goto SO10-> change mode
    menu->FORMAT->CHANGE STYLE.
    now you will see the style you have created. select that.
    now you can see the format.
    <b>Reward points</b>
    Regards

  • How to change the font used to fill in a text field.

    Can you please tell me how to change the font that comes up when a text field is filled in?
    Can I change this setting in InDesign or does it have to be done in Acrobat?

    It must be done in Acrobat. InDesign only allows Times Roman for some reason.
    To change it in Acrobat 11, open the PDF and select: Tools > Forms > Edit
    and select the field(s) you want to change, bring up the field properties dialog, and look on the Appearance tab for the font dropdown.

  • How to change the font size of Text Box  Properties Appearance tab into 2 decimal digit.

    How to change the font size of Text Box  Properties Appearance tab into 2 decimal digit. I am uanble to modify it to 5.38 pt for example. Its only allowing to 1 decimal place.

    Click on each field and the choose Properties from either File menu (or if on Mac hold dow mouse button until context menu appears choose properties)
    go to Font
    choose desired size and type font,you can choose to make this the default.
    Do this with each field.
    Or if you have a lot of fields:
    while one is selected select all of them
    then go to fonts in properties
    change Font and size and make default.

Maybe you are looking for

  • Infoset functionality in BI-HR

    HI all, I worked on infoset, but functionality of Infoset with time dependent objects is different. Can any one share there experience with infoset scenarios in HR module implementations. 0HR_PA_0 and 0HR_PA_1 doesn't support delta , then how to capt

  • Cover Flow on Itunes 9.2/9.2.1

    Hi to all, after upgrading Itunes at 9.2 (and then 9.2.1) i've noticed some strange artifacts on Cover Flow, but just on songs that haven't illustrations. Surfing the web i've seen that is a common problem, this is a screenshot. http://i30.tinypic.co

  • Exporting PDF with cropmarks

    I've got some artwork and  need to make a PDF with cropmarks from Illustrator 10. I add cropmarks using Object/Cropmarks/Make and that looks fine. But I can't get them into a PDF. If I "Save as PDF" or "Save a copy", the result contains everything EX

  • 10.5.2 | I REALLY cannot believe that Apple did NOT fix this Issue !

    I've been reporting about this BUG - numerous of times - Here and to the Apple Feedback. I've even called Apple Support - who WAS able to reproduce the BUG. Its the Finder "Drag to new location in Column View" Major BUG Look Here http://www.youtube.c

  • [Solved] pacman see's a tarball that I installed without pacman??

    Okay, before the "you need to use pacman for that" comments begin, I've aparently been doing things the hard way.  I finally read up on the ABS.  Been putting it off because I thought it was only for making new packages to add to the database.  If it