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


Java SwingConstants.VERTICAL属性代码示例

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


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

示例1: getScrollableUnitIncrement

@Override
public int getScrollableUnitIncrement( Rectangle visibleRect, int orientation, int direction ) {
    int res = 0;
    if( orientation == SwingConstants.VERTICAL ) {
        res = getRowHeight() / 2;
    } else {
        Point columnPoint = visibleRect.getLocation();
        columnPoint.x += 1;
        int col = columnAtPoint( columnPoint );
        if( col >= 0 ) {
            Rectangle rect = getCellRect( 0, col, true );
            res = rect.width / 2;
        } else {
            res = super.getScrollableUnitIncrement( visibleRect, orientation, direction );
        }
    }
    if( direction < 0 )
        res *= -1;
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TabTable.java

示例2: getScrollableBlockIncrement

@Override
public int getScrollableBlockIncrement(Rectangle vis, int orientation, int direction) {
	if (orientation == SwingConstants.VERTICAL) {
		int height = measures.getCellHeight();
		if (height < 1) {
			measures.recompute();
			height = measures.getCellHeight();
			if (height < 1)
				return 19 * vis.height / 20;
		}
		int lines = Math.max(1, (vis.height / height) - 1);
		return lines * height;
	} else {
		return 19 * vis.width / 20;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:16,代码来源:HexEditor.java

示例3: getUI

@Override
public JComponent getUI() {
	
	JPanel out = new JPanel(new BorderLayout());
	
	int MAX = 1000;
	final JSlider s = new JSlider(SwingConstants.VERTICAL, 0, MAX, sliderValue);
	
	s.addChangeListener(new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			sliderValue = s.getValue();
			setHeight( sliderValue / (float) MAX);
		}
	});

	out.add(s, BorderLayout.WEST);
	
	return s;
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:20,代码来源:LineGen.java

示例4: paint

@Override
public void paint(Graphics g, JComponent c)
{
	JSeparator sep = (JSeparator) c;
	Dimension dim = sep.getSize();

	g.setColor(sep.getForeground());

	if( sep.getOrientation() == SwingConstants.VERTICAL )
	{
		int x = dim.width / 2;
		g.drawLine(x, 0, x, dim.height);
	}
	else
	{
		int y = dim.height / 2;
		g.drawLine(0, y, dim.width, y);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:19,代码来源:FlatterSeparatorUI.java

示例5: getScrollableUnitIncrement

@Override
public int getScrollableUnitIncrement(
        Rectangle visible, int orientation, int direction) {
    switch (orientation) {
        case SwingConstants.HORIZONTAL:
            return visible.width * 10 / 100;
        case SwingConstants.VERTICAL:
            return visible.height * 10 / 100;
        default:
            throw new IllegalArgumentException("Invalid orientation: " + orientation); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ScrollableJPanel.java

示例6: getScrollableBlockIncrement

@Override
public int getScrollableBlockIncrement(
        Rectangle visible, int orientation, int direction) {
    switch (orientation) {
        case SwingConstants.HORIZONTAL:
            return visible.width * 100 / 100;
        case SwingConstants.VERTICAL:
            return visible.height * 100 / 100;
        default:
            throw new IllegalArgumentException("Invalid orientation: " + orientation); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ScrollableJPanel.java

示例7: getScrollableUnitIncrement

/**
 * fix for #38139. 
 * returns height of a line for vertical scroll unit
 * or width of a widest char for a horizontal scroll unit
 */
@Override
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
    switch (orientation) {
        case SwingConstants.VERTICAL:
            return fontHeight;
        case SwingConstants.HORIZONTAL:
            return charWidth;
        default:
            throw new IllegalArgumentException("Invalid orientation: " +orientation);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:QuietEditorPane.java

示例8: getScrollableUnitIncrement

@Override
public int getScrollableUnitIncrement(Rectangle vis, int orientation, int direction) {
	if (orientation == SwingConstants.VERTICAL) {
		int ret = measures.getCellHeight();
		if (ret < 1) {
			measures.recompute();
			ret = measures.getCellHeight();
			if (ret < 1)
				return 1;
		}
		return ret;
	} else {
		return Math.max(1, vis.width / 20);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:HexEditor.java

示例9: getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
			int orientation, int direction) {
	if( orientation == SwingConstants.VERTICAL) return visibleRect.height/2;
	int dx = visibleRect.width/2;
	int newX = visibleRect.x + (direction>0 ? dx : -dx);
	if( wrap>0. ) {
		dx = (int) (wrap*zoom);
		int test = getPreferredSize().width - visibleRect.width;
		while( newX<0 ) newX += dx;
		while( newX>test ) newX -= dx;
	}
	return (direction>0) ? (newX-visibleRect.x) : -(newX-visibleRect.x);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:13,代码来源:XMap.java

示例10: addToBar

private void addToBar(JComponent comp, int pos, boolean priority, boolean separator)
{
	JPanel panel = getPanel(pos);
	JSeparator sep = new JSeparator(SwingConstants.VERTICAL);
	sep.setPreferredSize(new Dimension(3, image.getIconHeight()));
	comp.setBorder(new EmptyBorder(0, 5, 0, 5));
	boolean sepFirst = false;
	int loc = -1;

	// This could all be done nicer, but who cares if it works?
	if( pos == SwingConstants.RIGHT )
	{
		if( priority )
		{
			sepFirst = true;
		}
		else
		{
			loc = 0;
		}
	}
	else
	{
		if( priority )
		{
			loc = 0;
			sepFirst = true;
		}
	}

	if( sepFirst && separator )
	{
		panel.add(sep, loc);
	}
	panel.add(comp, loc);
	if( !sepFirst && separator )
	{
		panel.add(sep, loc);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:40,代码来源:JStatusBar.java

示例11: getPreferredSize

@Override
public Dimension getPreferredSize(JComponent c)
{
	if( ((JSeparator) c).getOrientation() == SwingConstants.VERTICAL )
	{
		return new Dimension(1, 0);
	}
	else
	{
		return new Dimension(0, 1);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:FlatterSeparatorUI.java

示例12: getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
			int orientation, int direction) {
	if( orientation == SwingConstants.VERTICAL) return 10;
	int newX = visibleRect.x + (direction>0 ? 10 : -10);
	if( wrap>0. ) {
		int dx = (int) (wrap*zoom);
		int test = getPreferredSize().width - visibleRect.width;
		while( newX<0 ) newX += dx;
		while( newX>test ) newX -= dx;
	}
	return (direction>0) ? (newX-visibleRect.x) : -(newX-visibleRect.x);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:12,代码来源:XMap.java

示例13: getScrollOrientation

@Override
public int getScrollOrientation() {
    return SwingConstants.VERTICAL;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:JSpinnerOperator.java

示例14: getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
	int hundredth = (orientation == SwingConstants.VERTICAL ? getParent().getHeight() : getParent().getWidth()) / 100;
	return (hundredth == 0 ? 1 : hundredth);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:4,代码来源:WarningWindow.java

示例15: includeSeparator

private void includeSeparator() {
  JSeparator separator = new JSeparator(SwingConstants.VERTICAL);
  separator.setPreferredSize(new Dimension(2, 14));
  this.panel.add(separator);
  this.panel.add(FileType.label);
}
 
开发者ID:maumss,项目名称:file-type-plugin,代码行数:6,代码来源:FileType.java


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