• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Utils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.javafx.Utils的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Utils类属于com.sun.javafx包,在下文中一共展示了Utils类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: snapValueToTicks

import com.sun.javafx.Utils; //导入依赖的package包/类
private double snapValueToTicks(double val) {
    final DoubleSlider doubleSlider = getControl();
    double v = val;
    double tickSpacing = 0;
    // compute the nearest tick to this value
    if (doubleSlider.getMinorTickCount() != 0) {
        tickSpacing = doubleSlider.getMajorTickUnit() / (Math.max(doubleSlider.getMinorTickCount(),0)+1);
    } else {
        tickSpacing = doubleSlider.getMajorTickUnit();
    }
    int prevTick = (int)((v - doubleSlider.getMin())/ tickSpacing);
    double prevTickValue = (prevTick) * tickSpacing + doubleSlider.getMin();
    double nextTickValue = (prevTick + 1) * tickSpacing + doubleSlider.getMin();
    v = Utils.nearest(prevTickValue, v, nextTickValue);
    return Utils.clamp(doubleSlider.getMin(), v, doubleSlider.getMax());
}
 
开发者ID:epigenome,项目名称:iTagPlot,代码行数:17,代码来源:DoubleSliderBehavior.java


示例2: snapValueToTicks

import com.sun.javafx.Utils; //导入依赖的package包/类
/**
 * Utility function which, given the specified value, will position it
 * either aligned with a tick, or simply clamp between min & max value,
 * depending on whether snapToTicks is set.
 *
 * @expert This function is intended to be used by experts, primarily
 *         by those implementing new Skins or Behaviors. It is not common
 *         for developers or designers to access this function directly.
 */
private double snapValueToTicks(double val) {
    double v = val;
    if (isSnapToTicks()) {
        double tickSpacing = 0;
        // compute the nearest tick to this value
        if (getMinorTickCount() != 0) {
            tickSpacing = getMajorTickUnit() / (Math.max(getMinorTickCount(),0)+1);
        } else {
            tickSpacing = getMajorTickUnit();
        }
        int prevTick = (int)((v - getMin())/ tickSpacing);
        double prevTickValue = (prevTick) * tickSpacing + getMin();
        double nextTickValue = (prevTick + 1) * tickSpacing + getMin();
        v = Utils.nearest(prevTickValue, v, nextTickValue);
    }
    return Utils.clamp(getMin(), v, getMax());
}
 
开发者ID:epigenome,项目名称:iTagPlot,代码行数:27,代码来源:DoubleSlider.java


示例3: show

import com.sun.javafx.Utils; //导入依赖的package包/类
public void show(Node node, Side side, double d, double d1) {
	if (node == null) {
		return;
	}

	Event.fireEvent(this, new Event(Menu.ON_SHOWING));
	if (buttonPane.getChildren().size() == 0) {
		return;
	} else {
		HPos hpos = side != Side.LEFT ? side != Side.RIGHT ? HPos.CENTER : HPos.RIGHT : HPos.LEFT;
		VPos vpos = side != Side.TOP ? side != Side.BOTTOM ? VPos.CENTER : VPos.BOTTOM : VPos.TOP;
		// Point2D point2d = Utils.pointRelativeTo(node,
		// computePrefWidth(-1D), computePrefHeight(-1D), hpos, vpos, d,
		// d1, true);
		Point2D point2d = Utils.pointRelativeTo(node, buttonPane.getPrefWidth(), buttonPane.getPrefHeight(), hpos,
				vpos, d, d1, true);
		super.show(node, point2d.getX(), point2d.getY());
		return;
	}
}
 
开发者ID:jointry,项目名称:jointry,代码行数:21,代码来源:MultiKeyPopup.java


示例4: thumbDragged

import com.sun.javafx.Utils; //导入依赖的package包/类
/**
     * @param position The mouse position on track with 0.0 being beginning of
     *        track and 1.0 being the end
     */
    public void thumbDragged(DoubleSliderSkin.ThumbNumber thumbNumber, MouseEvent e, double position) {
        final DoubleSlider doubleSlider = getControl();
        switch(thumbNumber){
        case Thumb1:
//        	doubleSlider.setValue1(Utils.clamp(doubleSlider.getMin(), (position * (doubleSlider.getMax() - doubleSlider.getMin())) + doubleSlider.getMin(), doubleSlider.getMax()));
        	doubleSlider.setValue1(Utils.clamp(doubleSlider.getMin(), (position * (doubleSlider.getMax() - doubleSlider.getMin())) + doubleSlider.getMin(), doubleSlider.getValue2()));
        	break;
        case Thumb2:
        	doubleSlider.setValue2(Utils.clamp(doubleSlider.getValue1(), (position * (doubleSlider.getMax() - doubleSlider.getMin())) + doubleSlider.getMin(), doubleSlider.getMax()));
        }
    }
 
开发者ID:epigenome,项目名称:iTagPlot,代码行数:16,代码来源:DoubleSliderBehavior.java


示例5: adjustValues

import com.sun.javafx.Utils; //导入依赖的package包/类
/**
 * Ensures that value1 is always somewhere between the min and value2, and that
 * value2 is always somewhere between the value1 and max, and that 
 * if snapToTicks is set then the values will always be set to align with a tick mark.
 */
private void adjustValues() {
    if ((getValue1() < getMin() || getValue1() > getValue2()) /* &&  !isReadOnly(value)*/)
         setValue1(Utils.clamp(getMin(), getValue1(), getValue2()));
    if ((getValue2() < getValue1() || getValue2() > getMax()) /* &&  !isReadOnly(value)*/)
        setValue2(Utils.clamp(getValue1(), getValue2(), getMax()));
}
 
开发者ID:epigenome,项目名称:iTagPlot,代码行数:12,代码来源:DoubleSlider.java


示例6: getSongTitle

import com.sun.javafx.Utils; //导入依赖的package包/类
/**
 * @author Andrew Returns the title of the Soundcloud url provided
 *
 * @return title
 */
private static String getSongTitle(final String HTML) {
	String title = "";

	title = MediaUtils.getBetween(HTML, TITLE_PATTERN, "\",\"");
	title = StringEscapeUtils.escapeHtml4(title.replaceAll(
			"[^\\x20-\\x7e]", ""));
	title = Utils.convertUnicode(title);
	title = StringEscapeUtils.unescapeHtml4(title);

	if (title.contains(",")) {
		title = escapeComma(title);
	}
	return title.trim();
}
 
开发者ID:stevengalarza,项目名称:aurous-app,代码行数:20,代码来源:SoundCloudService.java


示例7: repel

import com.sun.javafx.Utils; //导入依赖的package包/类
public Vector2D repel(Particle particle) {

        // calculate direction of force
        Vector2D dir = Vector2D.subtract(location, particle.location);

        // get distance (constrain distance)
        double distance = dir.magnitude(); // distance between objects
        dir.normalize(); // normalize vector (distance doesn't matter here, we just want this vector for direction)
        distance = Utils.clamp(distance, 5, 1000); // keep distance within a reasonable range

        // calculate magnitude
        double force = -1.0 * Settings.REPELLER_STRENGTH / (distance * distance); // repelling force is inversely proportional to distance

        // make a vector out of direction and magnitude
        dir.multiply(force); // get force vector => magnitude * direction

        return dir;

    }
 
开发者ID:amoAHCP,项目名称:JavaOne2015JavaFXPitfalls,代码行数:20,代码来源:Repeller.java


示例8: invoke

import com.sun.javafx.Utils; //导入依赖的package包/类
@Override
public void invoke() {
    if(Utils.isUnix() || Utils.isMac()) javax.swing.JOptionPane.showMessageDialog(this, "The linux and mac versions of this program are in a experimental phase.\nIf you continue with the execution of this program will be your responsability.", "Notice", javax.swing.JOptionPane.INFORMATION_MESSAGE);
}
 
开发者ID:iiegor,项目名称:xat-decompiler,代码行数:5,代码来源:EnvironmentService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TrustedChannelResolver类代码示例发布时间:2022-05-23
下一篇:
Java Filters类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap