当前位置: 首页>>代码示例>>Java>>正文


Java NumberFormat.setMaximumIntegerDigits方法代码示例

本文整理汇总了Java中java.text.NumberFormat.setMaximumIntegerDigits方法的典型用法代码示例。如果您正苦于以下问题:Java NumberFormat.setMaximumIntegerDigits方法的具体用法?Java NumberFormat.setMaximumIntegerDigits怎么用?Java NumberFormat.setMaximumIntegerDigits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.NumberFormat的用法示例。


在下文中一共展示了NumberFormat.setMaximumIntegerDigits方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setNumberOfAgents

import java.text.NumberFormat; //导入方法依赖的package包/类
/**
 * Sets the number of agents.
 * @param noAgents the new number of agents
 */
public void setNumberOfAgents(Integer noAgents) {
	
	String displayText = null;
	
	NumberFormat nf = NumberFormat.getInstance(); 
	nf.setMinimumIntegerDigits(5);  
	nf.setMaximumIntegerDigits(5); 
	nf.setGroupingUsed(false);
	
	if (noAgents==null) {
		displayText = " " + nf.format(0) + " " + Language.translate("Agenten") + " ";
	} else {
		displayText = " " + nf.format(noAgents) + " " + Language.translate("Agenten") + " ";
	}
	jLabelAgentCount.setText(displayText);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:SystemLoadPanel.java

示例2: ajustVol

import java.text.NumberFormat; //导入方法依赖的package包/类
/**
 * 调整音量
 *
 * @param increase true=增加百分之20 false=减少百分之20
 */

public String ajustVol(boolean increase, int progress) {
    AudioManager mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
    int currentVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
    float max = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    currentVolume = (int) (currentVolume + max * (progress / 100.0f) * (increase ? 1 : -1));
    if (currentVolume < 0)
        currentVolume = 0;
    else if (currentVolume > max)
        currentVolume = (int) max;
    mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, currentVolume, 0);
    //弹出系统媒体音量调节框
    mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
            AudioManager.ADJUST_SAME, AudioManager.FLAG_PLAY_SOUND
                    | AudioManager.FLAG_SHOW_UI);

    NumberFormat nf = NumberFormat.getPercentInstance();
    //返回数的整数部分所允许的最大位数
    nf.setMaximumIntegerDigits(3);
    //返回数的小数部分所允许的最大位数
    // nf.setMaximumFractionDigits(2);
    return nf.format(currentVolume / max);
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:29,代码来源:MusicPlayProcessor.java

示例3: convertFloat

import java.text.NumberFormat; //导入方法依赖的package包/类
/**
 * Convert a float to a string format
 * 
 * @param f The float to convert 
 * @return The string formatted from the float
 */
private String convertFloat(float f) {
	NumberFormat format = NumberFormat.getInstance();
	format.setMinimumFractionDigits(2);
	format.setMaximumFractionDigits(2);
	format.setMinimumIntegerDigits(1);
	format.setMaximumIntegerDigits(5);
	return format.format(f);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:15,代码来源:GraphEditorWindow.java

示例4: setNumberOfContainer

import java.text.NumberFormat; //导入方法依赖的package包/类
/**
 * Sets the number of container.
 * @param noContainer the new number of container
 */
public void setNumberOfContainer(Integer noContainer) {
	
	NumberFormat nf = NumberFormat.getInstance(); 
	nf.setMinimumIntegerDigits(3);  
	nf.setMaximumIntegerDigits(3); 
	nf.setGroupingUsed(false);
	String displaText = " " + nf.format(noContainer) + " " + Language.translate("Container") + " ";
	jLabelContainerCount.setText(displaText);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:14,代码来源:SystemLoadPanel.java

示例5: createUUID

import java.text.NumberFormat; //导入方法依赖的package包/类
private Long createUUID(Long num, String day, Integer length) {
    String id = String.valueOf(num);
    if (id.length() < length) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setGroupingUsed(false);
        nf.setMaximumIntegerDigits(length);
        nf.setMinimumIntegerDigits(length);
        id = nf.format(num);
    }
    return Long.parseLong(day + id);
}
 
开发者ID:gaochao2000,项目名称:redis_util,代码行数:12,代码来源:UUIDServiceRedisImpl.java

示例6: getFireAtTime

import java.text.NumberFormat; //导入方法依赖的package包/类
/**
 * Returns the fire time for the <CODE>NthIncludedDayTrigger</CODE> as a
 * string with the format &quot;HH:MM[:SS]&quot;, with HH representing the 
 * 24-hour clock hour of the fire time. Seconds are optional and their 
 * inclusion depends on whether or not they were provided to 
 * {@link #setFireAtTime(String)}. 
 * 
 * @return the fire time for the trigger
 * @see #setFireAtTime(String)
 */
public String getFireAtTime() {
    NumberFormat format = NumberFormat.getNumberInstance();
    format.setMaximumIntegerDigits(2);
    format.setMinimumIntegerDigits(2);
    format.setMaximumFractionDigits(0);
    
    return format.format(this.fireAtHour) + ":" + 
           format.format(this.fireAtMinute) + ":" +
           format.format(this.fireAtSecond);
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:21,代码来源:NthIncludedDayTrigger.java

示例7: onBindViewHolder

import java.text.NumberFormat; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (position == 0) {
        HeaderHolder headerHolder = (HeaderHolder) holder;
        //专辑详情
        Glide.with(mContext).load(mAlbum.getCoverUrlMiddle()).into(headerHolder.mIvAlbum);
        headerHolder.mTvAlbumTitle.setText(mAlbum.getAlbumTitle());
        LastUpTrack lastUptrack = mAlbum.getLastUptrack();
        StringBuilder sb = new StringBuilder();
        headerHolder.mTvLastTrack.setText(sb.append("更新至").append(TimeUtils.formatDate(new Date(lastUptrack.getCreatedAt()))).append("  ").append(lastUptrack.getTrackTitle()).toString());
        sb.setLength(0);
        headerHolder.mTvPlayCount.setText(sb.append(StringUtils.formPlayCount(mAlbum.getPlayCount())).append("次播放").toString());
        sb.setLength(0);
        headerHolder.mTvTrackCount.setText(sb.append(mAlbum.getIncludeTrackCount()).append("集").toString());
        //订阅状态
        boolean isSubscribe = mAlbumDao.isSubscribe(mAlbumId);
        headerHolder.mTvSubscribe.setText(isSubscribe ? "已订阅" : "订阅");
        LevelListDrawable ld = (LevelListDrawable) headerHolder.mTvSubscribe.getBackground();
        ld.setLevel(isSubscribe ? 1 : 0);

        if (mHistory != null) {
            headerHolder.mRlHistoryBox.setVisibility(View.VISIBLE);
            sb.setLength(0);
            headerHolder.mTvHistoryTitle.setText(sb.append("继续播放:").append(mHistory.getTrackTitle()).toString());
            sb.setLength(0);
            NumberFormat nf = NumberFormat.getPercentInstance();
            //返回数的整数部分所允许的最大位数
            nf.setMaximumIntegerDigits(3);
            //返回数的小数部分所允许的最大位数
            nf.setMaximumFractionDigits(0);
            headerHolder.mTvProgress.setText(sb.append("已播  ").append(nf.format(mHistory.getBreakPos() / (double) mHistory.getDuration())).toString());
            headerHolder.mIvTingSwitch.setImageLevel((XmlyManager.get().isPlaying() && playTrackId == mHistory.getTrackId()) ? 1 : 0);
        } else {
            headerHolder.mRlHistoryBox.setVisibility(View.GONE);
        }

    } else {
        Track track = mTracks.get(position);
        TrackDetailHolder detailHolder = (TrackDetailHolder) holder;
        detailHolder.mTvTrackTitle.setText(track.getTrackTitle());
        detailHolder.mTvTrackTitle.setTextColor(track.getDataId() == playTrackId
                ? mContext.getResources().getColor(R.color.second_base_color)
                : mContext.getResources().getColor(R.color.new_text_color_first));
        detailHolder.mIvTingSwitch.setImageLevel(0);
        if (track.getDataId() == playTrackId)
            detailHolder.mIvTingSwitch.setImageLevel(XmlyManager.get().isPlaying() ? 1 : 0);
        detailHolder.mTvCreated.setText(TimeUtils.getInstance().getDateString(new Date(track.getCreatedAt())));
        detailHolder.mTvDuration.setText(new SimpleDate().formDuration(track.getDuration()));
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:51,代码来源:TingAlbumDetailAdapter.java


注:本文中的java.text.NumberFormat.setMaximumIntegerDigits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。