Can I use Css within a Swing application?

Asked

Viewed 419 times

0

It is possible to style a java application made in Swing, using css or javascript?

  • 3

    It is not possible. You need to use the Look and Feels to do this. If you want to style using css, try Javafx

1 answer

-2

Some things can be done in the component. Below is an example of using CSS and HTML for a Jbutton:

jbBotao = new javax.swing.JButton();
jbBotao.setText("<html>\n<style>\ndiv {\ncolor: white;\nfont-family:arial;\nbackground-color: black\n}\n</style>\n<div>Teste</div>\n</html>");
  • 2

    I believe the question concerns the use of stylization over the entire application, not just certain components. And that won’t change anything from styling the button, only from its text.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.