开发者

customize Java dialog Color, Appearance, Theme

开发者 https://www.devze.com 2022-12-26 10:07 出处:网络
I want to make Java JDialog appear like it is presented in the image (link below) using JDK 6 Swing. Is it possible? if so kindly guide me.

I want to make Java JDialog appear like it is presented in the image (link below) using JDK 6 Swing. Is it possible? if so kindly guide me. Image 开发者_Python百科Link: Image


Yes, It is possible. You can add your component is,

  myDialog.getContentPane().add(someComponent);

and the color is,

   myDialog.getContentPane().setBackground( Color."YourColor");

and select the theme, and set into to your main program like,

   nimbus, motif,windows,etc

Then the selected look and feel will be chang your theme.


In java swing this is called the 'look and feel'. You can change the look and feel as follows:

UIManager.setLookAndFeel(
        UIManager.getCrossPlatformLookAndFeelClassName());

Sun has a large Look and feel tutorial that explains how this works.

I'm not sure which look and feel you are linking to though, you'd have to find that out.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号