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


Java SwingConstants.HORIZONTAL属性代码示例

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


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

示例1: mousePressed

@Override
public void mousePressed(MouseEvent e) {
	super.mousePressed(e);
	if (!this.toolBar.isEnabled()) {
		return;
	}
	this.pressedToolbarHandler = false;
	Rectangle bumpRect = new Rectangle();

	if (this.toolBar.getOrientation() == SwingConstants.HORIZONTAL) {
		int x = RapidLookTools.isLeftToRight(this.toolBar) ? 0 : this.toolBar.getSize().width - 14;
		bumpRect.setBounds(x, 0, 14, this.toolBar.getSize().height);
	} else { // vertical
		bumpRect.setBounds(0, 0, this.toolBar.getSize().width, 14);
	}
	if (bumpRect.contains(e.getPoint())) {
		this.pressedToolbarHandler = true;
		Point dragOffset = e.getPoint();
		if (!RapidLookTools.isLeftToRight(this.toolBar)) {
			dragOffset.x -= (this.toolBar.getSize().width - this.toolBar.getPreferredSize().width);
		}
		setDragOffset(dragOffset);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:24,代码来源:ToolBarUI.java

示例2: addSeperatorToPanel

protected void addSeperatorToPanel(JPanel addTarget) {
	if (!(addTarget.getLayout() instanceof GridBagLayout)) {
		throw new RuntimeException("JPanel with GridBagLayout is mandatory!");
	}

	JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);

	GridBagConstraints itemConstraint = new GridBagConstraints();
	itemConstraint.gridx = GridBagConstraints.RELATIVE;
	itemConstraint.weightx = 1.0;
	itemConstraint.gridwidth = GridBagConstraints.REMAINDER; // end row
	itemConstraint.fill = GridBagConstraints.HORIZONTAL;
	itemConstraint.insets = new Insets(0, 5, 5, 5);

	addTarget.add(separator, itemConstraint);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:16,代码来源:AbstractConfigurationPanel.java

示例3: paint

/**
 * Override default paint method to draw separating line
 * @param g Graphics object to be painted
 */
@Override
public void paint(Graphics g) {
	try {
		JToolBar parent = (JToolBar) this.getParent();
		Dimension d = this.getSize();
		g.setColor(Color.GRAY);
		if (parent.getOrientation() == SwingConstants.HORIZONTAL) {
			if (orientation != SwingConstants.HORIZONTAL) {
				setMaximumSize(Horizontal);
				orientation = SwingConstants.HORIZONTAL;
				parent.revalidate();
			}
			g.drawLine(d.width / 2, 0, d.width / 2, d.height);
		} else {
			if (orientation != SwingConstants.VERTICAL) {
				setMaximumSize(Vertical);
				orientation = SwingConstants.VERTICAL;
				parent.revalidate();
			}
			g.drawLine(0, d.height / 2, d.width, d.height / 2);
		}
	} catch (ClassCastException ex) {
		super.paint(g);
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:29,代码来源:CustomSeparator.java

示例4: paint

/**
 * Override default paint method to draw separating line
 * @param g Graphics object to be painted
 */
@Override
public void paint(Graphics g) {
	try {
		JToolBar parent = (JToolBar) this.getParent();
		Dimension d = this.getSize();
		g.setColor(Color.gray);
		if (parent.getOrientation() == SwingConstants.HORIZONTAL) {
			if (orientation != SwingConstants.HORIZONTAL) {
				setMaximumSize(Horizontal);
				orientation = SwingConstants.HORIZONTAL;
				parent.revalidate();
			}
			g.drawLine(d.width / 2, 0, d.width / 2, d.height);
		} else {
			if (orientation != SwingConstants.VERTICAL) {
				setMaximumSize(Vertical);
				orientation = SwingConstants.VERTICAL;
				parent.revalidate();
			}
			g.drawLine(0, d.height / 2, d.width, d.height / 2);
		}
	} catch (ClassCastException ex) {
		super.paint(g);
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:29,代码来源:CustomSeparator.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: GUISliderComponent

public GUISliderComponent(JFrame owner, int x, int y, int w, int h, int min, int max, int value, String label)
{
	super(owner);
	this.text = new JLabel(label);
	this.slider = new JSlider(SwingConstants.HORIZONTAL, min, max, value);
	this.slider.setSize(new Dimension(w, h));
	this.slider.setLocation(new Point(x, y));
	this.slider.setVisible(true);
	this.text.setLocation(new Point(x + w, y));
	this.text.setSize(new Dimension(w, h));
	this.owner.add(text);
	this.owner.add(slider);
}
 
开发者ID:Joshuagollaher,项目名称:HawkEngine,代码行数:13,代码来源:GUISliderComponent.java

示例8: calculateThumbLocation

@Override
protected void calculateThumbLocation() {
	super.calculateThumbLocation();
	if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) {
		thumbRect.y -= 4;
	} else {
		thumbRect.x -= 4;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:9,代码来源:SliderUI.java

示例9: getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
				int orientation,
				int direction) {
	Insets ins = axes.getInsets();
	if( orientation==SwingConstants.HORIZONTAL ) {
		return (visibleRect.width-ins.left-ins.right) / 2;
	} else {
		return (visibleRect.height-ins.top-ins.bottom) / 2;
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:10,代码来源:XYGraph.java

示例10: getScrollableUnitIncrement

/**
 * Try to keep the viewport aligned on column boundaries in the direction of interest
 */
@Override
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {

	if (orientation == SwingConstants.HORIZONTAL) {
		return 80;
	}
	return getRowHeight();
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:11,代码来源:ExactTable.java

示例11: getScrollableBlockIncrement

@Override
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
	/* borrowed from JTable */
	if (orientation == SwingConstants.HORIZONTAL) {
		return 5 * getScrollableUnitIncrement(visibleRect, orientation, direction);
	}
	return super.getScrollableBlockIncrement(visibleRect, orientation, direction);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:8,代码来源:ExactTable.java

示例12: SliderFrame

public SliderFrame() 
{
   super("Slider Demo");

   myPanel = new OvalPanel(); // create panel to draw circle
   myPanel.setBackground(Color.YELLOW); 

   // set up JSlider to control diameter value
   diameterJSlider = 
      new JSlider(SwingConstants.HORIZONTAL, 0, 200, 10);
   diameterJSlider.setMajorTickSpacing(10); // create tick every 10
   diameterJSlider.setPaintTicks(true); // paint ticks on slider

   // register JSlider event listener
   diameterJSlider.addChangeListener(
      new ChangeListener() // anonymous inner class
      {  
         // handle change in slider value
         @Override
         public void stateChanged(ChangeEvent e)
         {
            myPanel.setDiameter(diameterJSlider.getValue());
         } 
      } 
   ); 

   add(diameterJSlider, BorderLayout.SOUTH); 
   add(myPanel, BorderLayout.CENTER); 
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:29,代码来源:SliderFrame.java

示例13: MyJSlider

MyJSlider(Method methodToCall, int min, int max, int init, JGraphLayout layout,
    LayouterItem item) {
    super(SwingConstants.HORIZONTAL, min, max, init);
    this.methodToCall = methodToCall;
    this.layout = layout;
    this.item = item;
    // Turn on labels at major tick marks.
    this.setMajorTickSpacing((max - min) / 5);
    this.setMinorTickSpacing((max - min) / 50);
    this.setPaintTicks(true);
    this.setPaintLabels(true);
    this.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    Font font = new Font("Serif", Font.ITALIC, 10);
    this.setFont(font);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:15,代码来源:LayoutKind.java

示例14: NbiSeparator

public NbiSeparator() {
    super(SwingConstants.HORIZONTAL);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:NbiSeparator.java

示例15: RadioButtonPanel

public RadioButtonPanel() {
    this(SwingConstants.HORIZONTAL, false);
}
 
开发者ID:adihubba,项目名称:javafx-3d-surface-chart,代码行数:3,代码来源:RadioButtonPanel.java


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