开发者

Is it possible to create different look for a JFrame in Swing?

开发者 https://www.devze.com 2023-01-12 03:43 出处:网络
is it possible to create different look for a frame in java. i mean can v extend the core JFrame class and override it so v can create different look n feel... i 开发者_Go百科want to create a frame wh

is it possible to create different look for a frame in java. i mean can v extend the core JFrame class and override it so v can create different look n feel... i 开发者_Go百科want to create a frame which should look like a PS4 frame.....


If you want to have your own custom interface for your Java Swing application, then you could create one in another software (photoshop etc). Thereafter remove the title bar from the swing GUI,

setUndecorated(true);

and finally give the background image to the path of your new GUI (which you created).

You could get any button to work by simply using labels, over each button in the GUI. (LEAVE THE LABEL TEXT EMPTY). Then use the keyPressed or actionPerformed events etc for the particular label to write the code for each button. You could use moveMove and mouse leave methods also for the labels to change the image.


Yes it is. You can change the Look and Feel of swing applications. I don't know (and don't believe) if there is an existing LnF that looks like PS4.

Here is a nice selection of LnFs for Swing.

BTW - the synth look and feel looks like a promising start for an own LnF.


You don't need to extend a frame to apply a custom look and feel to it. You just create the look and feel and apply it only to the frame you want to.

UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
SwingUtilities.updateComponentTreeUI(frame);
0

精彩评论

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

关注公众号