1

Is the above question possible? The effect I'm trying to achieve is similar to how MS Word displays "Document- Microsoft Word (Technical Preview)" in this picture link: http://img.blogsolute.com/ms-word-2010.png, but with a colored background.

2 Answers2

3

You can set the title of any frame you create by passing the title string to the constructor of the JFrame. You can't, however, add any controls to the 'decoration' portion of the frame - i.e., the title bar.

What you probably can do, however, is create an undecorated frame, and manually add the decoration using customised Border objects. This effectively allows you to put any controls you like around the outside, and the root pane will happily work inside it.

JTeagle
  • 2,196
  • 14
  • 15
  • Thats what I'm trying to achieve. Anywhere I can find a tutorial? –  Mar 27 '12 at 06:22
  • I see what you mean. Thanks for the tip! :) –  Mar 27 '12 at 06:26
  • 1
    Look for the setUndecorated() method of JFrame in the help docs, and then check out the Border interface for known classes that implement borders and the setBorder() method. The documentation is at http://docs.oracle.com/javase/6/docs/api/ – JTeagle Mar 27 '12 at 06:31
1

Why do you need JLabel for that? You can use setTitle("") for this purpose

Sunil Kumar B M
  • 2,735
  • 1
  • 24
  • 31