Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 7th, 2006, 05:52 AM
Authorized User
Join Date: Oct 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Set font for different word inside a table field

    Hi All, i've difficult to set text font for certain text inside a a table field. I've try to edit the highlight function to make it become set font function but it isn't work. Below is the highlight function in my code which work for text highlighter. I'm really appreaciated if have any help. Thank you very much.

function highglight:
public void highlight(JTextComponent textComp, String pattern) {
        // First remove all old highlights

        try {
            Highlighter hilite = textComp.getHighlighter();

            Document doc = textComp.getDocument();
            String text = doc.getText(0, doc.getLength());
            int pos = 0;

            // Search for pattern
            while ((pos = text.indexOf(pattern, pos)) >= 0) {
                // Create highlighter using private painter and apply around pattern
                hilite.addHighlight(pos, pos+pattern.length(), myHighlightPainter);
                pos += pattern.length();
        } catch (BadLocationException e) {


Similar Threads
Thread Thread Starter Forum Replies Last Post
set font for grid column header suji Visual Studio 2005 0 June 12th, 2008 07:40 AM
set font in text file! dpkbahuguna Beginning VB 6 2 August 23rd, 2007 07:08 AM
Set Printer Font savandavande VB.NET 2002/2003 Basics 0 October 7th, 2006 05:31 AM
Font for Text Field zaeem Classic ASP Basics 3 November 9th, 2003 03:23 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.