JFrame: Selective removal of borders

Is it possible to remove just the borders of an external JFrame without removing the title bar as well? I want the title bar to be there for minimizing and exiting (I do want to have uit minimizable to the taskbar), but I want the borders removed so that the look and feel is more like a widget that has some transparency. I know setUndecorated(true) won't do the trick as it removes the title bar as well. Is there any way I can accomplish this, short of making my own title bar (which I have done)? Is it possible to override the JFrame function which controls how the window is drawn?

Message was edited by:

Aeridus

[639 byte] By [Aeridusa] at [2007-10-3 9:23:13]
# 1
have you tried JFrame.setWindowDecorationStyle()? I've never used it, so I can't tell if it does what you want and the javadoc seems to be very skimpy on details.
dberanskya at 2007-7-15 4:37:00 > top of Java-index,Desktop,Core GUI APIs...
# 2

try this

import java.awt.*;

import javax.swing.*;

class Testing

{

public void buildGUI()

{

JFrame f = new JFrame();

f.setUndecorated(true);

JRootPane rp = f.getRootPane();

rp.setWindowDecorationStyle(JRootPane.FRAME);

rp.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setSize(300,300);

f.setLocationRelativeTo(null);

f.setVisible(true);

}

public static void main(String[] args)

{

SwingUtilities.invokeLater(new Runnable(){

public void run(){

new Testing().buildGUI();

}

});

}

}

Michael_Dunna at 2007-7-15 4:37:00 > top of Java-index,Desktop,Core GUI APIs...