本文整理汇总了Java中javax.swing.JComponent.setDefaultLocale方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.setDefaultLocale方法的具体用法?Java JComponent.setDefaultLocale怎么用?Java JComponent.setDefaultLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.setDefaultLocale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.swing.JComponent; //导入方法依赖的package包/类
public static void main(String[] args) {
Locale reservedLocale = Locale.getDefault();
try {
// it affects Swing because it is not initialized
Locale.setDefault(Locale.KOREAN);
validate(KOREAN, create());
// it does not affect Swing because it is initialized
Locale.setDefault(Locale.CANADA);
validate(KOREAN, create());
// it definitely should affect Swing
JComponent.setDefaultLocale(Locale.FRENCH);
validate(FRENCH, create());
} finally {
// restore the reserved locale
Locale.setDefault(reservedLocale);
}
}
示例2: setLanguageJLabels
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Method description
*
* @see
*/
final public void setLanguageJLabels(boolean bolPhideControlJFrame) {
final Rectangle objLcontrolJFrameRectangle = this.getBounds();
// Save the current configuration :
final PatternsManager objLsavedJugglePatternsManager = this.getPatternsManager();
final byte bytLsavedAnimationStatus = this.objGjuggleMasterPro.bytGanimationStatus;
final int intLsavedObjectIndex = this.objGjuggleMasterPro.intGobjectIndex;
// Set the special language pattern manager :
final PatternsManager objLlanguageJugglePatternsManager = new PatternsManager(Constants.bytS_MANAGER_NEW_ABSTRACT_LANGUAGE);
this.objGjuggleMasterPro.bytGanimationStatus = Constants.bytS_STATE_ANIMATION_PAUSED;
this.objGjuggleMasterPro.intGobjectIndex = objLlanguageJugglePatternsManager.getPatternsFileManager().intGstartObjectIndex;
this.setJugglePatternsManager(objLlanguageJugglePatternsManager);
// Set dialog language :
try {
final Locale objLlocale = new Locale(this.getLanguageString(Language.intS_LANGUAGE_ISO_639_1_CODE));
JComponent.setDefaultLocale(objLlocale);
} catch (final Throwable objPthrowable) {
Tools.err("Error while trying to apply ISO 639-1 language code");
}
// Place the widgets :
this.setWidgetsPreferredSizes(false);
this.setWidgetsControls();
if (bolPhideControlJFrame) {
this.setVisible(false);
this.getJuggleMasterPro().getFrame().setVisible(false);
}
this.validate();
this.pack();
this.setWidgetsPreferredSizes(true);
final int intLoldWidth = (int) objLcontrolJFrameRectangle.getWidth();
final int intLnewWidth = Math.max(this.getWidth(), intLoldWidth);
if (intLnewWidth > intLoldWidth) {
this.setBounds( Math.max(0, this.getX() - (intLnewWidth - intLoldWidth)),
this.getY(),
intLnewWidth,
(int) objLcontrolJFrameRectangle.getHeight());
} else {
this.setBounds( Math.max(0, (int) objLcontrolJFrameRectangle.getX()),
this.getY(),
intLoldWidth,
(int) objLcontrolJFrameRectangle.getHeight());
}
if (bolPhideControlJFrame) {
this.setVisible(true);
this.getJuggleMasterPro().getFrame().setVisible(true);
this.getJuggleMasterPro().getFrame().repaint();
}
// Restore the previous configuration :
this.setJugglePatternsManager(objLsavedJugglePatternsManager);
this.objGjuggleMasterPro.intGobjectIndex = intLsavedObjectIndex;
this.objGjuggleMasterPro.bytGanimationStatus = bytLsavedAnimationStatus;
this.setWidgetsControls();
this.setJButtonsEnabled(true);
this.repaint();
// Set the menus :
this.setMenusJLabels();
this.setMenusEnabled();
this.objGjuggleMasterPro.objGdataJFrame.setHeaders();
this.objGjuggleMasterPro.objGdataJFrame.setButtonsJLabels();
}