javax.swing.text.BoxView类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中javax.swing.text.BoxView类的一些代码示例,展示了BoxView类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoxView类的具体详情如下:
包路径:javax.swing.text.BoxView
类名称:BoxView

BoxView介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

var view = new BoxView({ctx: ctx, model: model});
  view.render();
})

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Determines the minimum span for this view along an
 * axis.  This is implemented to provide the superclass
 * behavior after first making sure that the current font
 * metrics are cached (for the nested lines which use
 * the metrics to determine the height of the potentially
 * wrapped lines).
 *
 * @param axis may be either View.X_AXIS or View.Y_AXIS
 * @return  the span the view would like to be rendered into.
 *           Typically the view is told to render into the span
 *           that is returned, although there is no guarantee.
 *           The parent may choose to resize or break the view.
 * @see View#getMinimumSpan
 */
@Override
public float getMinimumSpan(int axis) {
  updateMetrics();
  float span = super.getPreferredSpan(axis);
  if (axis==View.X_AXIS) { // EOL marker
    span += metrics.charWidth('\u00b6'); // metrics set in updateMetrics
  }
  return span;
}

代码示例来源:origin: stackoverflow.com

Try this

class Main extents Activity
{
 BoxView boxView;
 @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
 // if view is used using layout then
boxView = (BoxView)findViewByID(id);

//else if directly used

 boxView = new BoxView(this);

 box.setOnClickListener(new onClickListener()
 {

 @Override
    public void onClick(View view) {
    boxView.setCaption("X");
boxView.invalidate();
    }
 });
  }

}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Sets the size of the view.  This should cause layout of the view along
 * the given axis, if it has any layout duties.
 *
 * @param width the width >= 0
 * @param height the height >= 0
 */
@Override
public void setSize(float width, float height) {
  updateMetrics();
  if ((int) width != getWidth()) {
    // invalidate the view itself since the childrens
    // desired widths will be based upon this views width.
    preferenceChanged(null, true, true);
    widthChanging = true;
  }
  super.setSize(width, height);
  widthChanging = false;
}

代码示例来源:origin: com.google.code.findbugs/findbugs

@Override
public void layout(int width, int height) {
  super.layout(32768, height);
}

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

/**
 * Sets the size of the view.  This should cause layout of the view along
 * the given axis, if it has any layout duties.
 *
 * @param width the width >= 0
 * @param height the height >= 0
 */
@Override
public void setSize(float width, float height) {
  updateMetrics();
  if ((int) width != getWidth()) {
    // invalidate the view itself since the childrens
    // desired widths will be based upon this views width.
    preferenceChanged(null, true, true);
    widthChanging = true;
  }
  super.setSize(width, height);
  widthChanging = false;
}

代码示例来源:origin: chatty/chatty

@Override
protected void layout(int width, int height) {
  if (Debugging.isEnabled("layout")) {
    long start = System.currentTimeMillis();
    super.layout(width, height);
    long duration = System.currentTimeMillis() - start;
    if (duration > 1) {
      layouts++;
      Debugging.println("layout "+duration + " " + layouts);
    }
  } else {
    super.layout(width, height);
  }
}

代码示例来源:origin: stackoverflow.com

return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
  return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
  return new ComponentView(elem);

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Determines the maximum span for this view along an
 * axis.  This is implemented to provide the superclass
 * behavior after first making sure that the current font
 * metrics are cached (for the nested lines which use
 * the metrics to determine the height of the potentially
 * wrapped lines).
 *
 * @param axis may be either View.X_AXIS or View.Y_AXIS
 * @return  the span the view would like to be rendered into.
 *           Typically the view is told to render into the span
 *           that is returned, although there is no guarantee.
 *           The parent may choose to resize or break the view.
 * @see View#getMaximumSpan
 */
@Override
public float getMaximumSpan(int axis) {
  updateMetrics();
  float span = super.getPreferredSpan(axis);
  if (axis==View.X_AXIS) { // EOL marker
    span += metrics.charWidth('\u00b6'); // metrics set in updateMetrics
  }
  return span;
}

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

/**
 * Sets the size of the view.  This should cause layout of the view along
 * the given axis, if it has any layout duties.
 *
 * @param width the width >= 0
 * @param height the height >= 0
 */
public void setSize(float width, float height) {
  updateMetrics();
  if ((int) width != getWidth()) {
    // invalidate the view itself since the childrens
    // desired widths will be based upon this views width.
    preferenceChanged(null, true, true);
    widthChanging = true;
  }
  super.setSize(width, height);
  widthChanging = false;
}

代码示例来源:origin: stackoverflow.com

canvas.click(function() {
 var newview = new BoxView({
  tagName: 'canvas', //Instead of el: canvas
  model: model
 });
$("#new").html(newview.render());
});

代码示例来源:origin: bobbylight/RSyntaxTextArea

float span = 0;
if (axis==View.X_AXIS) { // Add EOL marker
  span = super.getPreferredSpan(axis);
  span += metrics.charWidth('\u00b6'); // metrics set in updateMetrics
  span = super.getPreferredSpan(axis);
  host = (RSyntaxTextArea)getContainer();
  if (host.isCodeFoldingEnabled()) {

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

/**
 * Sets the size of the view.  This should cause layout of the view along
 * the given axis, if it has any layout duties.
 *
 * @param width the width >= 0
 * @param height the height >= 0
 */
public void setSize(float width, float height) {
  updateMetrics();
  if ((int) width != getWidth()) {
    // invalidate the view itself since the childrens
    // desired widths will be based upon this views width.
    preferenceChanged(null, true, true);
    widthChanging = true;
  }
  super.setSize(width, height);
  widthChanging = false;
}

代码示例来源:origin: stackoverflow.com

render: function () {
  this.collection.each(function (model) {
    var boxView = new BoxView({model: model});
    this.$el.append(boxView.render().$el)
  }, this);

代码示例来源:origin: com.google.code.findbugs/findbugs

@Override
  public float getMinimumSpan(int axis) {
    return super.getPreferredSpan(axis);
  }
}

代码示例来源:origin: protegeproject/protege

@Override
  public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null)
      if (kind.equals(AbstractDocument.ContentElementName)) {
        return new LabelView(elem);
      } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
        return new LogParagraphView(elem);
      } else if (kind.equals(AbstractDocument.SectionElementName)) {
        return new BoxView(elem, View.Y_AXIS);
      } else if (kind.equals(StyleConstants.ComponentElementName)) {
        return new ComponentView(elem);
      } else if (kind.equals(StyleConstants.IconElementName)) {
        return new IconView(elem);
      }
    return new LabelView(elem);
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

/**
 * Determines the preferred span for this view along an
 * axis.  This is implemented to provide the superclass
 * behavior after first making sure that the current font
 * metrics are cached (for the nested lines which use
 * the metrics to determine the height of the potentially
 * wrapped lines).
 *
 * @param axis may be either View.X_AXIS or View.Y_AXIS
 * @return  the span the view would like to be rendered into.
 *           Typically the view is told to render into the span
 *           that is returned, although there is no guarantee.  
 *           The parent may choose to resize or break the view.
 * @see View#getPreferredSpan
 */
public float getPreferredSpan(int axis) {
  updateMetrics();
  return super.getPreferredSpan(axis);
}

代码示例来源:origin: chatty/chatty

@Override
  public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
      if (kind.equals(AbstractDocument.ContentElementName)) {
        return new WrapLabelView(elem);
      } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
        return new ParagraphView(elem);
      } else if (kind.equals(AbstractDocument.SectionElementName)) {
        return new BoxView(elem, View.Y_AXIS);
      } else if (kind.equals(StyleConstants.ComponentElementName)) {
        return new ComponentView(elem);
      } else if (kind.equals(StyleConstants.IconElementName)) {
        return new IconView(elem);
      }
    }
    return new LabelView(elem);
  }
}

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

/**
 * Determines the preferred span for this view along an
 * axis.  This is implemented to provide the superclass
 * behavior after first making sure that the current font
 * metrics are cached (for the nested lines which use
 * the metrics to determine the height of the potentially
 * wrapped lines).
 *
 * @param axis may be either View.X_AXIS or View.Y_AXIS
 * @return  the span the view would like to be rendered into.
 *           Typically the view is told to render into the span
 *           that is returned, although there is no guarantee.  
 *           The parent may choose to resize or break the view.
 * @see View#getPreferredSpan
 */
public float getPreferredSpan(int axis) {
  updateMetrics();
  float span = super.getPreferredSpan(axis);
  if (axis==View.X_AXIS) { // EOL marker
    span += metrics.charWidth('\u00b6'); // metrics set in updateMetrics
  }
  return span;
}

代码示例来源:origin: RPTools/maptool

/**
   * @see javax.swing.text.ViewFactory#create(javax.swing.text.Element)
   */
  public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
      if (kind.equals(AbstractDocument.ContentElementName)) {
        return new TwoToneLabelView(elem);
      } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
        return new ParagraphView(elem);
      } else if (kind.equals(AbstractDocument.SectionElementName)) {
        return new BoxView(elem, View.Y_AXIS);
      } else if (kind.equals(StyleConstants.ComponentElementName)) {
        return new ComponentView(elem);
      } else if (kind.equals(StyleConstants.IconElementName)) {
        return new IconView(elem);
      } // endif
    } // endif
    // default to text display
    return new TwoToneLabelView(elem);
  }
}

相关文章

微信公众号

最新文章

更多