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


Java View.setSize方法代码示例

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


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

示例1: modelToView

import javax.swing.text.View; //导入方法依赖的package包/类
static Rectangle2D modelToView(JTextComponent tc, int pos, Position.Bias bias) throws BadLocationException {
Document doc = tc.getDocument();
if (doc instanceof AbstractDocument) {
    ((AbstractDocument)doc).readLock();
}
try {
    Rectangle alloc = getVisibleEditorRect(tc);
    if (alloc != null) {
               View rootView = tc.getUI().getRootView(tc);
	rootView.setSize(alloc.width, alloc.height);
	Shape s = rootView.modelToView(pos, alloc, bias);
	if (s != null) {
	  return s.getBounds2D();
	}
    }
} finally {
    if (doc instanceof AbstractDocument) {
	((AbstractDocument)doc).readUnlock();
    }
}
return null;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:Utilities.java

示例2: viewToModel

import javax.swing.text.View; //导入方法依赖的package包/类
static int viewToModel(JTextComponent tc, double x, double y, Position.Bias[] biasReturn) {
int offs = -1;
Document doc = tc.getDocument();
if (doc instanceof AbstractDocument) {
    ((AbstractDocument)doc).readLock();
}
try {
    Rectangle alloc = getVisibleEditorRect(tc);
    if (alloc != null) {
               View rootView = tc.getUI().getRootView(tc);
               View documentView = rootView.getView(0);
               if (documentView instanceof EditorView) {
                   documentView.setSize(alloc.width, alloc.height);
                   offs = ((EditorView) documentView).viewToModelChecked(x, y, alloc, biasReturn);
               } else {
                   rootView.setSize(alloc.width, alloc.height);
                   offs = rootView.viewToModel((float) x, (float) y, alloc, biasReturn);
               }
    }
} finally {
    if (doc instanceof AbstractDocument) {
	((AbstractDocument)doc).readUnlock();
    }
}
       return offs;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:Utilities.java

示例3: setTipText

import javax.swing.text.View; //导入方法依赖的package包/类
@Override
public void setTipText(String tipText) {
    super.setTipText(tipText);
    if( getPreferredSize().width > 400 ) {
        View v = (View) getClientProperty("html"); //NOI18N
        if( null != v )
            v.setSize(300.0f, 300.0f);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:DemoPanel.java

示例4: getPreferredSize

import javax.swing.text.View; //导入方法依赖的package包/类
/**
 * Returns the preferred size to set a component at in order to render an
 * html string. You can specify the size of one dimension.
 */
private static Dimension getPreferredSize(String html, boolean width, int prefSize) {

	RESIZER.setText(html);

	View view = (View) RESIZER.getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey);

	view.setSize(width ? prefSize : 0, width ? 0 : prefSize);

	float w = view.getPreferredSpan(View.X_AXIS);
	float h = view.getPreferredSpan(View.Y_AXIS);

	return new java.awt.Dimension((int) Math.ceil(w), (int) Math.ceil(h));
}
 
开发者ID:michaelnetter,项目名称:dracoon-dropzone,代码行数:18,代码来源:SettingsDialog.java

示例5: getPreferredSize

import javax.swing.text.View; //导入方法依赖的package包/类
public static java.awt.Dimension getPreferredSize(String text,
                                                  boolean width, int prefSize) {

    JLabel resizer = new JLabel(text);

    View view = (View) resizer
            .getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey);

    view.setSize(width ? prefSize : 0, width ? 0 : prefSize);

    float w = view.getPreferredSpan(View.X_AXIS);
    float h = view.getPreferredSpan(View.Y_AXIS) + 2;

    return new java.awt.Dimension((int) Math.ceil(w), (int) Math.ceil(h));
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:16,代码来源:HTMLTableHeader.java


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