Solved

Bold text i JButton

Posted on 2009-04-07
3
238 Views
Last Modified: 2013-11-23
How do I create a JButton with bold text on it.
0
Comment
Question by:mdoland
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 150 total points
ID: 24085973
Easiest
b.setText("<html><b>BOLD</b></html>");

Open in new window

0
 
LVL 25

Assisted Solution

by:InteractiveMind
InteractiveMind earned 100 total points
ID: 24086079
Or the not-so-easy way,
b.setFont(new Font(b.getFont().getFontName(), Font.BOLD, b.getFont().getSize());

b.setText("BOLD");

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24086778
:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now