當前位置: 首頁>>代碼示例>>Java>>正文


Java JComponent.setDefaultLocale方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:Test6524757.java

示例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();
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:73,代碼來源:ControlJFrame.java


注:本文中的javax.swing.JComponent.setDefaultLocale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。