I want to create a customised title bar for my JFrame. I can remove the default title bar with
JFrame.setUndecorated(true)
Now i need to create a customised title bar for my JFrame with a close button?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Without having done that ever, I think I would go this way:
JFrameto undecoratedJRootPaneto add an additional fieldtitleBarTitleBarcomponent holding the title, the close button, etc…LayoutManageron thatJRootPane(have a look atJRootPane.RootLayout) and layout the components in the appropriate order (first the title bar, then below the menubar, then below the content pane)RootPaneon yourJFrameThere are maybe better ways.