Start New Discussion within our Software Development Community

I can't figure out how to make a portion of the text bold in the below line(and others). This text is output into a popup dialog. Prefer the first portion "trimmed/squeezed" to be bold. I even tried inserting html code lol.

Tried setBold and everthing else I've found on the net.

Thanks for any input and guidance you pass my way.

TextAreaOutput += "trimmed/squeezed: " + textConverter.squeeze(textConverter.trimmed(curString)) + "\n";

Here is an example Click Here.

You are right,just use HTML tags and it will work.

There is another example in this forum only.
This shows using setFont to set font of JLabel

Code snippet for the same

 LayoutManager layout; 
        private JPanel panel [] = new JPanel [5]; 
        private GridLayout grid; 
        private JButton button [] = new JButton [10]; 
        private JLabel label [] = new JLabel [5]; 
        private JTextField field [] = new JTextField [10]; 
        public void init() 
            layout = new BoxLayout (this,BoxLayout.Y_AXIS); 
            grid = new GridLayout (3, 3, 5, 5); 
            panel[1] = new JPanel(); 
            panel[1].setLayout (new FlowLayout());
            label[1] = new JLabel ("----------------- | TIC TAK TOE | -------------------"); 
            label[1].setFont(new Font("Courier", Font.PLAIN, 12));
            panel[1].add (label[1]); 
            label[2] = new JLabel ("----------------- | TIC TAK TOE | -------------------"); 
            label[2].setFont(new Font("Courier", Font.BOLD, 12));
            panel[1].add (label[2]); 

            add (Box.createRigidArea(new Dimension (100, 100)));
            add (panel[1]);  
This article has been dead for over six months. Start a new discussion instead.