Hey guys,

I can set the font of a label just fine. However I want to set the font of the text on a button. Alas JButton only takes a string as a parameter for the text on the button. Any ideas what i can do?

Thanks for the help people!

I guess after you create the button, you would set the font of it:

JButton.setText("Button");
JButton.setFont(new Font("sansserif",Font.BOLD,12);

Don't know if that will work or not, doing it from memory.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.