本文整理汇总了Java中javax.swing.border.TitledBorder.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java TitledBorder.setTitle方法的具体用法?Java TitledBorder.setTitle怎么用?Java TitledBorder.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.border.TitledBorder
的用法示例。
在下文中一共展示了TitledBorder.setTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SampledSoundSelector
import javax.swing.border.TitledBorder; //导入方法依赖的package包/类
/** Creates new form DrumSelector.
* @param player the DrumSound to control.
*/
public SampledSoundSelector (SampledSoundPlayer player){
drumSound = player;
names = SampledSoundPlayer.getSoundFilePaths();
ArrayList<String> displayNames = new ArrayList();
for ( String n:names ){
try{
String sn = n.substring(n.lastIndexOf('/') + 1);
displayNames.add(sn);
} catch ( Exception e ){
log.warning(e.toString());
}
}
initComponents();
instrCB.setModel(new DefaultComboBoxModel(displayNames.toArray()));
instrCB.setSelectedIndex(player.getSoundNumber());
TitledBorder b = (TitledBorder)getBorder();
b.setTitle("Drum #" + player.getDrumNumber());
}
示例2: DrumSelector
import javax.swing.border.TitledBorder; //导入方法依赖的package包/类
/** Creates new form DrumSelector.
* @param ds the DrumSound to control.
*/
public DrumSelector(DrumSound ds) {
drumSound = ds;
initComponents();
instrCB.setModel(new DefaultComboBoxModel(DrumSound.PERCUSSION_NAMES));
TitledBorder b = (TitledBorder) getBorder();
b.setTitle("Drum #" + ds.getDrumNumber());
instrCB.setSelectedIndex(ds.getIndex());
}
示例3: localizeBorder
import javax.swing.border.TitledBorder; //导入方法依赖的package包/类
/**
* Localize the a titled border.
*
* @param component The {@code JComponent} to localize.
* @param template The {@code StringTemplate} to use.
*/
public static void localizeBorder(JComponent component,
StringTemplate template) {
TitledBorder tb = (TitledBorder)component.getBorder();
tb.setTitle(Messages.message(template));
}