File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Window Title Bar Text Resizing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Window Title Bar Text Resizing" Watch "Window Title Bar Text Resizing" New topic

Window Title Bar Text Resizing

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all,
i am working on swing components, i need help for the follwoing topics.
1) how can i change the font of window title bar.
2) how can i change the size of buttons of Joptionpane.
3) how can i change the size of square button of Jcheckbox.
your help in this matter will be highly helpful to me.
thanx in anticipation

Jignesh Patel,
Software Engineer,
Infosys Technologies Ltd.
Bangalore, India.
celine mcgowan
Ranch Hand

Joined: Nov 22, 2003
Posts: 36
Hi Jignesh,
I am posting here because i have a very similar question to your question number 1. I know that to set text in the title bar you can do:

in the constructor of your JFrame. What i need to know is how to change this text afterwards. Say, to add a filename that's been opened in the app. If i create a String variable say, 'filename' & update it on opening a file, like so:

and then do super("title bar text" + filename ) in the constructor, will a change to filename update to the title bar???

Thanks everyone!

We've heard that a million monkeys at a million keyboards would eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true.<br />- Robert Wilensky
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
setTitle() is what you're after

Try this

clio katz
Ranch Hand

Joined: Apr 30, 2004
Posts: 101
are you asking about changing the titlebar text or changing the titlebar font?

as your follow-on questions are along the same lines, i'm thinking you are asking about Look and Feel stuff ... maybe?

places to look might be

1) custom LAF
In the LAF/LNF, you can change java gui component default properties like this ... but you would need to write and install a custom LAF ...

xtreme example might be napkin laf

2) java internal properties
as i understand it, there is also some level of control available by overriding java default laf properties ... though i haven't tried it... it's probably the sort of thing you would only want to do as a last resort since you can't really guess how user might override/install laf's themselves OR how laf resources might chg in fut versions...

3) custom components

you can write button subclasses using your own icons for buttons and or checkboxes (some basic checkbox behaviors are button-derived).

the custom window title would be a little trickier, because you might need to do something like simulate a titlebar at the top of an undecorated window

clio katz
Ranch Hand

Joined: Apr 30, 2004
Posts: 101
oops. should say:

for checkbox you would probably want a JToggleButton subclass - and then set your own icons for un/selected
I agree. Here's the link:
subject: Window Title Bar Text Resizing
It's not a secret anymore!