|
|
| Hide/remove titlebar of JInternalframe |
Expert:pankaj
i am designing a account management application using java. so to give good look i want to hide/remove the title bar of JInternalFrame. if any one know how to do this please reply.....
thanks in advance |
| Answers |
Hi friend,
using this javax.swing.plaf.InternalFrameUI ifu= iFrame.getUI(); ((javax.swing.plaf.basic.BasicInternalFrameUI)ifu).setNorthPane(null);
to remove the titlebar run this code. i am sending running program.
Here is the complete code:
import javax.swing.*; import java.awt.event.*; import java.awt.*; import javax.swing.JLabel;
public class RemoveTitleBar extends JFrame {
public RemoveTitleBar() { super("Frame Without TitleBar");
JInternalFrame iFrame = new JInternalFrame();
// Get the titlebar and set it to null setRootPaneCheckingEnabled(false); javax.swing.plaf.InternalFrameUI ifu= iFrame.getUI(); ((javax.swing.plaf.basic.BasicInternalFrameUI)ifu).setNorthPane(null);
iFrame.setBounds(30,30,200,200); iFrame.setVisible(true);
JDesktopPane jp = new JDesktopPane(); jp.add(iFrame); setContentPane(jp); }
public static void main(String[] args){ RemoveTitleBar rtb = new RemoveTitleBar(); rtb.setBounds(20,20,400,400); rtb.setVisible(true); rtb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
----------------------------------------------------------
Read for more information about swing at:
http://www.roseindia.net/java/example/java/swing/
Thanks.
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|