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

Java SizeValue类代码示例

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

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



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

示例1: startDrag

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public void startDrag(final GElement element){
    if(dragged != null){
        throw new IllegalStateException("You can't start more than one drag&drop");
    }
    
    dragged = element;
    nifty.showPopup(nifty.getCurrentScreen(),popUp.getId(), null);
    final Element ele = this.dragged.getNiftyElement();
    final SizeValue width = SizeValue.px(ele.getWidth());
    this.previousX = ele.getX();
    this.previousY = ele.getY();
    this.previousIndex = this.findIndex(dragged);
    final SizeValue height = SizeValue.px(ele.getHeight());
     ele.setConstraintX(SizeValue.px(previousX));
    ele.setConstraintY(SizeValue.px(previousY));
    ele.setConstraintHeight(height);
    ele.setConstraintWidth(width);
    element.getNiftyElement().markForMove(popUp);
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:20,代码来源:NiftyDDManager.java


示例2: revertDrag

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public void revertDrag(){
    if(dragged == null){
        throw new IllegalStateException("You must start drag before!");
    }
    
     dragged.getNiftyElement().setConstraintX(SizeValue.px(previousX));
     dragged.getNiftyElement().setConstraintY(SizeValue.px(previousY));
     dragged.getNiftyElement().markForMove(dragged.getParent().getDropContext(),new EndNotify() {

        @Override
        public void perform() {
            dragged.getNiftyElement().setConstraintX(SizeValue.px(previousX));
            dragged.getNiftyElement().setConstraintY(SizeValue.px(previousY));
            dragged.getNiftyElement().setIndex(previousIndex);
            dragged.refresh();
            dragged = null;
        }
    });
     
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:21,代码来源:NiftyDDManager.java


示例3: getTableCellEditorComponent

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
   public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
       SizeValue val = new SizeValue(value.toString());
       this.setUpByType(val);
       SwingUtilities.invokeLater(new Runnable() {

           @Override
           public void run() {
              int res = JOptionPane.showConfirmDialog(null, editorPane,"SizeEditor", JOptionPane.OK_CANCEL_OPTION);
       if(res == JOptionPane.OK_OPTION){
           fireEditingStopped();
       }else{
           cancelCellEditing();
       }
           }
       });

return new JLabel(this.edited.toString());
   }
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:20,代码来源:SizeEditor.java


示例4: setUpByType

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
private void setUpByType(Object value) {
if(value == null) {
   this.px.setEnabled(true);
} else {
    String s = value.toString();
    if(s.endsWith("px")) {
               this.percEditor.setEnabled(false);
               this.pxEditor.setEnabled(true);
               this.pxEditor.setValue((SizeValue)value);
               this.px.getModel().setSelected(true);
    } else if(s.endsWith("%")) {
               this.percEditor.setEnabled(true);
               this.pxEditor.setEnabled(false);
               this.percEditor.setValue((SizeValue)value);
               this.perc.getModel().setSelected(true);
    } else if(s.equals("*")) {
	this.percEditor.setEnabled(false);
               this.pxEditor.setEnabled(false);
               this.fill.getModel().setSelected(true);
               this.edited = SizeValue.wildcard();
           }
}
   }
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:24,代码来源:SizeEditor.java


示例5: setText

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void setText(@Nonnull final String text) {
    if (buttonTextRenderer != null && buttonTextElement != null) {
        buttonTextRenderer.setText(text);
        if (!buttonTextRenderer.isLineWrapping()) {
            buttonTextElement.setConstraintWidth(SizeValue.px(getTextWidth()));
        }
    } else {
        if (!isBound()) {
            throw new IllegalStateException("Setting the text is not possible before the binding is done.");
        }
        log.warning("Failed to apply the text because the required references are not set. Maybe the element is not " +
                "bound yet?");
    }
}
 
开发者ID:SkidRunner,项目名称:jME3-Examples,代码行数:16,代码来源:ProgressBarControl.java


示例6: setProgress

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void setProgress(float progress) {
	this.progress = progress;
	final int MIN_WIDTH = 32;
	int pixelWidth = (int) (MIN_WIDTH + (element.getParent().getWidth() - MIN_WIDTH) * progress);
	element.setConstraintWidth(new SizeValue(pixelWidth + "px"));
	element.getParent().layoutElements();
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:9,代码来源:LoadingbarController.java


示例7: dragAround

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
/**
 * Move dragged element around
 * @param x
 * @param y 
 */
public void dragAround(int x,int y){
        if(dragged == null){
            throw new IllegalStateException("You must start drag before!");
        }
        Element ele = this.dragged.getNiftyElement();
        ele.setConstraintX(SizeValue.px(x-ele.getWidth()/2));
        ele.setConstraintY(SizeValue.px(y-ele.getHeight()/2));
        
        popUp.layoutElements();
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:16,代码来源:NiftyDDManager.java


示例8: SizeEditor

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public SizeEditor(){
    GridBagLayout gridLayout = new GridBagLayout();
    editorPane = new JPanel(gridLayout);
    GridBagConstraints c = new GridBagConstraints();
    perc = new JRadioButton("Percentage");
    px = new JRadioButton("Pixel");
    fill = new JRadioButton("*");
    fill.setToolTipText("Wildcard, leave this value to layoutmanger");
    fill.addActionListener(this);
    px.addActionListener(this);
    perc.addActionListener(this);
    group = new ButtonGroup();
    group.add(perc);
    group.add(px);
    group.add(fill);
    px.setSelected(true);
    c.gridx = 0;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    editorPane.add(perc,c);
    c.gridx=1;
    editorPane.add(percEditor,c);
    c.gridx = 0;
    c.gridy = 1;
    editorPane.add(px,c);
    c.gridx = 1;
    c.gridy = 1;
    editorPane.add(pxEditor,c);
    c.gridx = 0;
    c.gridy = 2;
    editorPane.add(fill,c);
    this.percEditor.setEnabled(false);
    this.percEditor.setValue(SizeValue.percent(50));
    this.pxEditor.setEnabled(true);
    percEditor.addPropertyChangeListener(this);
    pxEditor.addPropertyChangeListener(this);
    
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:38,代码来源:SizeEditor.java


示例9: actionPerformed

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if(fill.equals(source)){
        SizeValue old = this.edited;
        this.setUpByType(new SizeValue("*"));
         pcs.firePropertyChange("value",old, edited); //event forwarding
    }else if(px.equals(source)){
        this.setUpByType(new SizeValue("0px"));
    }else if(perc.equals(source)){
        this.setUpByType(new SizeValue("50%"));
    }
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:14,代码来源:SizeEditor.java


示例10: propertyChange

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if(evt.getPropertyName().equals("value")){
        this.edited = (SizeValue) evt.getNewValue();
        pcs.firePropertyChange("value",evt.getOldValue(), evt.getNewValue());//event forwarding
    }
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:8,代码来源:SizeEditor.java


示例11: setValue

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public final void setValue(SizeValue newValue){
    SizeValue old = value;
    this.value = newValue;
    this.firePropertyChange("value", old, newValue);
    this.initSliders();
    
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:8,代码来源:ValueEditor.java


示例12: stateChanged

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
    Integer val = (Integer) jSpinner1.getValue();
    SizeValue temp = this.value;
    this.value = percent ? SizeValue.percent(val.intValue()) : SizeValue.px(val.intValue()) ;
    this.firePropertyChange("value", temp, this.value);
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:8,代码来源:ValueEditor.java


示例13: setProgress

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public void setProgress(final float progressValue)
{
        float progress = progressValue;
        
        if (progress < 0.0f)
        {
                progress = 0.0f;
        }
        else if (progress > 1.0f)
        {
                progress = 1.0f;
        }
        
        if (progressValue > this.min && progressValue <= this.max)
        {
                if (!element.isVisible() || first) { element.show(); }
        }
        else
        {
                if (element.isVisible()) { element.hide(); }
        }
        
        if (progressBarElement != null)
        {
                int pixelWidth = (int) (progressBarElement.getParent().getWidth() * progress);
                progressBarElement.setConstraintWidth(new SizeValue(pixelWidth + "px"));
                progressBarElement.getParent().layoutElements();
        }

        if (progressTextElement != null)
        {
                String progressText = String.format("%3.0f%%", progress * 100);
                progressTextElement.getRenderer(TextRenderer.class).setText(progressText);
        }
        
        first = false;
}
 
开发者ID:Periapsis,项目名称:aphelion,代码行数:38,代码来源:EnergyBar.java


示例14: setWidth

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void setWidth(final SizeValue width) {
    element.setConstraintWidth(width);
}
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:5,代码来源:MyMenu.java


示例15: setHeight

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
@Override
public void setHeight(final SizeValue height) {
    element.setConstraintHeight(height);
}
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:5,代码来源:MyMenu.java


示例16: movePopup

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
private void movePopup() {
    element.setConstraintX(new SizeValue(nifty.getNiftyMouse().getX() + "px"));
    element.setConstraintY(new SizeValue(nifty.getNiftyMouse().getY() + "px"));
    element.getParent().layoutElements();
}
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:6,代码来源:MyMenu.java


示例17: setValue

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public void setValue(Object value){
    SizeValue val = new SizeValue(value.toString());
    this.setUpByType(val);
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:5,代码来源:SizeEditor.java


示例18: ValueEditor

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
/**
 * Creates new form ValueEditor
 */
public ValueEditor(SizeValue value) {
    initComponents();
    this.setValue(value);
    this.jSpinner1.addChangeListener(this);
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:9,代码来源:ValueEditor.java


示例19: getValue

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
public SizeValue getValue(){
    return this.value;
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:4,代码来源:ValueEditor.java


示例20: updateHealthBar

import de.lessvoid.nifty.tools.SizeValue; //导入依赖的package包/类
private static void updateHealthBar(){
	Element e = HUD.nifty.getCurrentScreen().findElementByName("healthbar");
	int width = 100 * player.getHealth() / player.getMaxHealth();
	e.setConstraintWidth(SizeValue.percent(width));
	e.getParent().layoutElements();
}
 
开发者ID:Mathgoat,项目名称:square-loot,代码行数:7,代码来源:HUD.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java PlotCommitList类代码示例发布时间:2022-05-23
下一篇:
Java CodeVisitorSupport类代码示例发布时间: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