Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Letter Spacing

Options
  • 02-09-2004 3:47pm
    #1
    Closed Accounts Posts: 536 ✭✭✭


    I'm looking to increasing the letter spacing in a JLabel in my Java App.
    i.e. have
    Can anyone tell me how to do this using either the Font or similar class or with plain HTML code?

    thanks!


Comments

  • Closed Accounts Posts: 196 ✭✭colincarnate


    not sure what you're looking for, do you want the following in a jlabel:

    l a b e l ???


  • Closed Accounts Posts: 536 ✭✭✭flyz


    yeah sorry I should be a bit more specific.

    If a mouse goes over a clickable Component, I want the text to change from 'My Button' to 'M y B u t t o n'.

    I could just enter the spaces myself but would prefer to automate it.


  • Registered Users Posts: 1,865 ✭✭✭Syth


    It's been ages since I dealt with an Java GUI, but the way I'd do it is to create a function that'd take in a string and spit out the string with all those extra spaces inserted. Then in the JLabel class you should call that function from on of the events. onMouseClickEvent() or something like that.


  • Closed Accounts Posts: 196 ✭✭colincarnate


    you could extend JButton and make your own crazy Decorator class invoking the MouseEntered or Hovered-Over event, whereby you'll fire the b u t t o n crazyness

    but here, hovering over a button and changing the spacing is unsightly and crappy looking no?


  • Closed Accounts Posts: 536 ✭✭✭flyz


    but here, hovering over a button and changing the spacing is unsightly and crappy looking no?

    certainly is! have to show it first to prove it though. ;)
    that's why I was hoping to use character spacing instead of putting in spaces myself. I would have full control of the amount of space between characters then.


  • Advertisement
  • Registered Users Posts: 1,865 ✭✭✭Syth


    flyz wrote:
    certainly is! have to show it first to prove it though. ;)
    that's why I was hoping to use character spacing instead of putting in spaces myself. I would have full control of the amount of space between characters then.
    Well if you're just trying to demonstrate to someone that spacing changing is horrible then it'd probably be easier to use some JavaScript and CSS. There's a way you can change the letter spacing in CSS, and using JavaScript and onmousehover event you can change the style class. That should show the horribleness.


Advertisement