ciao!
volevo sapere questo.
ho un pulsante su cui devo mettere del testo e un'iconcina
come faccio a stabilire io la loro disposizione? per esempio, se volessi mettere
l'icona tutta a sinistra e il testo centrale.
grazie
fla
ciao!
volevo sapere questo.
ho un pulsante su cui devo mettere del testo e un'iconcina
come faccio a stabilire io la loro disposizione? per esempio, se volessi mettere
l'icona tutta a sinistra e il testo centrale.
grazie
fla
I metodi a disposizione sono forniti dalla classe AbstractButton che è un antenato di JBotton, che quindi li eredita. I metodi sono questi:
public void setVerticalAlignment(int alignment)
Sets the vertical alignment of the icon and text.
Parameters:
alignment - one of the following values:
SwingConstants.CENTER (the default)
SwingConstants.TOP
SwingConstants.BOTTOM
public void setHorizontalAlignment(int alignment)
Sets the horizontal alignment of the icon and text.
Parameters:
alignment - one of the following values:
SwingConstants.RIGHT (the default)
SwingConstants.LEFT
SwingConstants.CENTER
SwingConstants.LEADING
SwingConstants.TRAILING
public void setVerticalTextPosition(int textPosition)
Sets the vertical position of the text relative to the icon.
public void setHorizontalTextPosition(int textPosition)
Sets the horizontal position of the text relative to the icon.
Parameters:
textPosition - one of the following values:
SwingConstants.RIGHT
SwingConstants.LEFT
SwingConstants.CENTER
SwingConstants.LEADING
SwingConstants.TRAILING (the default)
Throws:
IllegalArgumentException - if textPosition is not one of the legal values listed above
grazie!
proverò!
fla