tags:

views:

61

answers:

3

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 want to create a frame which should look like a PS4 frame.....

+1  A: 

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.

Andreas_D
I don't think that changes the look of the JFrame. The JFrame is drawn using OS style, not the LnF.
Stroboskop
The window decorations are drawn by the OS by default, but you can change that using the `setDefaultLookAndFeelDecorated` method. See: "http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JFrame.html#setDefaultLookAndFeelDecorated(boolean)"
Tikhon Jelvis
Very good. You should have posted that as an answer, Tikhon.
Stroboskop
+1  A: 

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);
Bozhidar Batsov
+3  A: 

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.

Yoosuf
Or you could use JButtons placed in the right place. You can put an ImageIcon on a JButton without difficulty, I think, and that might be easier that using a JLabel.
Tikhon Jelvis