Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Window Title Bar Text Resizing

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

------------------
Jignesh Patel,
Software Engineer,
Infosys Technologies Ltd.
Bangalore, India.
 
celine mcgowan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Celine
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setTitle() is what you're after

Try this

 
clio katz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

hth...
 
clio katz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops. should say:

for checkbox you would probably want a JToggleButton subclass - and then set your own icons for un/selected
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic