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


Java BoxView类代码示例

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


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

示例1: create

import javax.swing.text.BoxView; //导入依赖的package包/类
@Override
public View create(Element elem) {
  String kind = elem.getName();
  if (kind != null) {
    if (kind.equals(AbstractDocument.ContentElementName)) {
      return createLabelView(elem);
    } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
      // return new MyParagraphView(elem);
      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);
    }
  } // default to text display
  return new LabelView(elem);
}
 
开发者ID:Adrodoc55,项目名称:MPL,代码行数:20,代码来源:BnJaggedEditorKit.java

示例2: create

import javax.swing.text.BoxView; //导入依赖的package包/类
@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);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:19,代码来源:ExtendedTextPane.java

示例3: create

import javax.swing.text.BoxView; //导入依赖的package包/类
@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);
		}
	}

	// default to text display
	return new LabelView(elem);
}
 
开发者ID:arianne,项目名称:stendhal,代码行数:21,代码来源:KTextEdit.java

示例4: create

import javax.swing.text.BoxView; //导入依赖的package包/类
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)) {
			// We changed this so we can mess with tab stops
			return new SPParagraphView(elem);
		} else if (kind.equals(AbstractDocument.SectionElementName)) {
			return new BoxView(elem, View.Y_AXIS);
			// we changed this so we can zoom in on text
			//return new ScaledBoxView(elem, View.Y_AXIS);
		} else if (kind.equals(StyleConstants.ComponentElementName)) {
			return new ComponentView(elem);
		} else if (kind.equals(StyleConstants.IconElementName)) {
			return new IconView(elem);
		}
	// default to text display
	return new LabelView(elem);
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:21,代码来源:SamplePrintEditor.java

示例5: testGetInsetWithPaddingPercentWithParent

import javax.swing.text.BoxView; //导入依赖的package包/类
public void testGetInsetWithPaddingPercentWithParent() throws Exception {
    BoxView parent = new BoxView(doc.getDefaultRootElement(), View.Y_AXIS) {
        public int getWidth() {
            return 361;
        }
        public int getHeight() {
            return 257;
        }
    };
    view.setParent(parent);
    ss.addCSSAttribute(attrs, Attribute.PADDING, "10%");
    assertEquals(4, attrs.getAttributeCount());
    final float width  = isHarmony() ? 361 * 0.1f : 0;
    assertEquals(width, bp.getInset(View.TOP, view), 1e-5f);
    assertEquals(width, bp.getInset(View.RIGHT, view), 1e-5f);
    assertEquals(width, bp.getInset(View.BOTTOM, view), 1e-5f);
    assertEquals(width, bp.getInset(View.LEFT, view), 1e-5f);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:StyleSheet_BoxPainterTest.java

示例6: create

import javax.swing.text.BoxView; //导入依赖的package包/类
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);
        }
    }

    // default to text display
    return new LabelView(elem);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:20,代码来源:WrapEditorKit.java

示例7: create

import javax.swing.text.BoxView; //导入依赖的package包/类
/**
       * 要素に基づいてビューを作成します。
       * @param elem		作成対象要素
       * @return			ビュー
       */
      @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 NoWrapParagraphView(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);
      }
 
开发者ID:K-scope,项目名称:K-scope,代码行数:24,代码来源:InformationDialog.java

示例8: create

import javax.swing.text.BoxView; //导入依赖的package包/类
/**
 * 要素に基づいてビューを作成します。
 * 
 * @param elem
 *            作成対象要素
 * @return ビュー
 */
@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 NoWrapParagraphView(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);
}
 
开发者ID:K-scope,项目名称:K-scope,代码行数:26,代码来源:SwingUtils.java

示例9: create

import javax.swing.text.BoxView; //导入依赖的package包/类
/**
 * 要素に基づいてビューを作成します。
 * @param elem		作成対象要素
 * @return			ビュー
 */
@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 WordWrapParagraphView(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);
}
 
开发者ID:K-scope,项目名称:K-scope,代码行数:24,代码来源:CodePane.java

示例10: create

import javax.swing.text.BoxView; //导入依赖的package包/类
@Override
public javax.swing.text.View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        switch (kind) {
            case AbstractDocument.ContentElementName:
                return new WrapLabelView(elem);
            case AbstractDocument.ParagraphElementName:
                return new ParagraphView(elem);
            case AbstractDocument.SectionElementName:
                return new BoxView(elem, javax.swing.text.View.Y_AXIS);
            case StyleConstants.ComponentElementName:
                return new ComponentView(elem);
            case StyleConstants.IconElementName:
                return new IconView(elem);
        }
    }
    // default to text display
    return new LabelView(elem);
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:21,代码来源:MessageList.java

示例11: create

import javax.swing.text.BoxView; //导入依赖的package包/类
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);
        }
    }

    // default to text display
    return new LabelView(elem);
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:20,代码来源:WrapTextPane.java

示例12: create

import javax.swing.text.BoxView; //导入依赖的package包/类
public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            return new ChatroomPanel.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);
        }
    }
 
    // default to text display
    return new LabelView(elem);
}
 
开发者ID:fsworld009,项目名称:JTChat,代码行数:20,代码来源:ChatroomPanel.java

示例13: preferenceChanged

import javax.swing.text.BoxView; //导入依赖的package包/类
public void preferenceChanged(View child, boolean width, boolean height) {
    areColumnSizeRequirementsValid = false;

    super.preferenceChanged(this, width, height);

    for (int i = 0; i < getViewCount(); i++) {
        if (getView(i) instanceof BoxView) {
            ((BoxView)getView(i)).layoutChanged(X_AXIS);
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:TableTagView.java

示例14: forwardUpdate

import javax.swing.text.BoxView; //导入依赖的package包/类
protected void forwardUpdate(ElementChange change, DocumentEvent event, Shape shape, ViewFactory factory) {
    boolean xValid = isLayoutValid(X_AXIS);

    super.forwardUpdate(change, event, shape, factory);

    if (xValid && !isLayoutValid(X_AXIS)) {
        Rectangle rc = shape.getBounds();
        getContainer().repaint(rc.x, rc.y, ((BoxView)getParent()).getWidth(), rc.height);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:TableTagView.java

示例15: resolveRelativeValue

import javax.swing.text.BoxView; //导入依赖的package包/类
Object resolveRelativeValue(final View view) {
    if (view == null) {
        return ZERO;
    }

    final AttributeSet attr = view.getAttributes();

    switch (relativeUnits) {
    case RELATIVE_UNITS_EM:
    case RELATIVE_UNITS_EX:
        final Object fs = attr.getAttribute(Attribute.FONT_SIZE);
        final float fontSize = fs != null
                               ? ((Length)fs).floatValue(view)
                               : FontSize.getDefaultValue().floatValue();

        float result = fontSize * theValue.floatValue();
        if (relativeUnits == RELATIVE_UNITS_EX) {
            result /= 2;
        }
        return new Float(result);

    case RELATIVE_UNITS_PERCENTAGE:
        View parent = view.getParent();
        if (!(parent instanceof BoxView)) {
            return ZERO;
        }
        float width = ((BoxView)parent).getWidth();
        if (width >= Integer.MAX_VALUE) {
            return ZERO;
        }

        return new Float(width * theValue.floatValue() / 100);

    default:
        System.err.println(Messages.getString("swing.err.07")); //$NON-NLS-1$
    }
    return ZERO;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:39,代码来源:CSS.java


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