1

How do I create a Mac panel type window in Java? A picture of a panel type window can be found here. I found something about Window.Type, but that's Java 7 and I am using Java 6.

Basically under examples (in the link) there is an image of a Panel. Notice how the close/minimize/maximize bar is smaller than the other ones.

LanguagesNamedAfterCofee
  • 5,782
  • 7
  • 45
  • 72
  • Can you elaborate on what you want as it is not clear from your link. See for example the screenshots in [this answer](http://stackoverflow.com/questions/5621338/about-swing-and-jtable/5630271#5630271) illustrating how a standard `JFrame` looks on the Mac. To me, that looks the same as the images you linked to – Robin Jun 28 '12 at 16:34
  • @Robin In examples it has a picture of a Panel. The close/minimize/maximize bar is smaller. – LanguagesNamedAfterCofee Jun 28 '12 at 17:15
  • See also `MacWidgets`, mentioned [here](http://stackoverflow.com/a/7720887/230513). – trashgod Jun 28 '12 at 18:54

4 Answers4

2

You can use Mac Look and feel from the library http://www.randelshofer.ch/quaqua/

I hope you wanted to make a panel/window look like Mac. Otherwise please add more details about what you are looking for.

18bytes
  • 5,951
  • 7
  • 42
  • 69
  • You can create a JFrame with quaqua look and feel, to achieve close/minimize/max bar similar to mac. – 18bytes Jun 28 '12 at 17:21
1

This option has been available since J2SE 5:

// makes the buttons smaller and title bar thinner
frame.getRootPane().putClientProperty("Window.style", "small");
// removes the shadow around the window
frame.getRootPane().putClientProperty("Window.shadow", Boolean.FALSE);

More information on that and other similar tricks: https://developer.apple.com/library/mac/technotes/tn2007/tn2196.html#WINDOWS

Unfortunately it seems to be really hard to find an updated list of all these since Apple themselves stopped caring.

Hakanai
  • 12,010
  • 10
  • 62
  • 132
0

You aren't going to get mac style windows unless you run it on a mac (or if you use a custom build library). There is some sort of licensing issue with this, I remember looking into doing it back when using java 1.4.

Rocky Pulley
  • 22,531
  • 20
  • 68
  • 106
-2

You can use something like this to get the default system appearance for each platform i.e. looks like a mac on mac devices, looks like standard window in windows

 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

You will need to surround this in try/catch block. See tutorial or api for further info

Jon Rutherford
  • 679
  • 5
  • 3