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


Java SwingConstants.RIGHT属性代码示例

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


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

示例1: alignRectsRunFor

protected void alignRectsRunFor(final Rectangle[] rects, final Dimension tabPaneSize, final int tabPlacement, final boolean isRightToLeft) {
    final boolean isVertical = tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT;

    if (isVertical) {
        if (needsScrollers) {
            stretchScrollingVerticalRun(rects, tabPaneSize);
        } else {
            centerVerticalRun(rects, tabPaneSize);
        }
    } else {
        if (needsScrollers) {
            stretchScrollingHorizontalRun(rects, tabPaneSize, isRightToLeft);
        } else {
            centerHorizontalRun(rects, tabPaneSize, isRightToLeft);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:AquaTabbedPaneTabState.java

示例2: CompositeButtonPainter

/**
 * Creates a new {@code CompositeButtonPainter} for the given button. The position indicates the
 * painting style.
 *
 * @param button
 *            the button to paint
 * @param position
 *            the button's position
 */
public CompositeButtonPainter(AbstractButton button, int position) {
	// button must not be null
	if (button == null) {
		throw new IllegalArgumentException("Button must not be null!");
	}
	this.button = button;

	// the painter only support positions left, center, and right
	switch (position) {
		case SwingConstants.LEFT:
		case SwingConstants.CENTER:
		case SwingConstants.RIGHT:
			this.position = position;
			break;
		default:
			throw new IllegalArgumentException("Position (swing constant) not supported.");
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:27,代码来源:CompositeButtonPainter.java

示例3: getTableCellRendererComponent

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
	if (value == null)
		return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
	if (value instanceof Number) {
		super.setHorizontalAlignment(SwingConstants.RIGHT);
	} else if (value instanceof Boolean) {
		return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
	} else {
		super.setHorizontalAlignment(SwingConstants.CENTER);
	}
	if (isSelected) {
		if (!hasFocus) {
			isSelected = false;
		}
		Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
		return c;
	}
	JLabel res = new JLabel((String)value,  SwingConstants.CENTER);
	if (errorRows[row]) {
		res.setForeground(Color.RED);
	} else if (warningRows[row]) {
		res.setForeground(Color.BLUE);
	}
	return res;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:26,代码来源:ClassSwitchSectionPanel.java

示例4: paintTabBorderSelected

private void paintTabBorderSelected(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h) {
	if (tabPlacement == SwingConstants.TOP) {
		paintSelectedTop(g, x, y, w, h);
	} else if (tabPlacement == SwingConstants.LEFT) {
		paintSelectedLeft(g, x, y, w, h);
	} else if (tabPlacement == SwingConstants.RIGHT) {
		paintSelectedRight(g, x, y, w, h);
	} else {
		paintSelectedBottom(g, x, y, w, h);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:TabbedPaneUI.java

示例5: ToggleButtonGroup

/**
 * Creates a new button group from the given Actions (requires at least two actions).
 *
 * @param preferredSize
 *            the preferredSize of the nested {@link CompositeToggleButton}s or {@code null}
 * @param actions
 *            the action
 */
public ToggleButtonGroup(Dimension preferredSize, Action... actions) {
	if (actions.length < 2) {
		throw new IllegalArgumentException("At least two primary actions must be specified.");
	}

	this.setOpaque(false);
	this.preferredSize = preferredSize;

	primaryButtons = new CompositeToggleButton[actions.length];
	for (int i = 0; i < actions.length; i++) {
		int position;
		if (i == 0) {
			position = SwingConstants.LEFT;
		} else if (i < actions.length - 1) {
			position = SwingConstants.CENTER;
		} else {
			position = SwingConstants.RIGHT;
		}
		primaryButtons[i] = new CompositeToggleButton(actions[i], position);
	}

	// align buttons left to right with no padding
	GridBagLayout layout = new GridBagLayout();
	setLayout(layout);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.insets = new Insets(0, 0, 0, 0);
	gbc.fill = GridBagConstraints.VERTICAL;
	gbc.weighty = 1;

	for (JToggleButton button : primaryButtons) {
		button.addActionListener(buttonChooser);
		if (preferredSize != null) {
			button.setMinimumSize(preferredSize);
			button.setPreferredSize(preferredSize);
		}
		add(button, gbc);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:47,代码来源:ToggleButtonGroup.java

示例6: getTableCellRendererComponent

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
	if (value instanceof Number) {
		super.setHorizontalAlignment(SwingConstants.RIGHT);
	} else if (value instanceof Boolean) {
		return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
	} else {
		super.setHorizontalAlignment(SwingConstants.CENTER);
	}
	return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:11,代码来源:ExactCellRenderer.java

示例7: isRightAligned

private boolean isRightAligned(AbstractButton button, int position) {
    if (position == SwingConstants.EAST) {
        boolean ltr = button.getComponentOrientation().isLeftToRight();
        int hAlign = button.getHorizontalAlignment();
        return ((ltr && (hAlign == SwingConstants.RIGHT ||
                         hAlign == SwingConstants.TRAILING)) ||
                (!ltr && (hAlign == SwingConstants.LEADING)));
    }
    return false;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:10,代码来源:LayoutStyle.java

示例8: getTableCellRendererComponent

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {

	//Federico Dall'Orso 22/6/2005
	//OLD
	/* called side effects
	super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

	/* adjust alignment */
	/*
	if (value instanceof Number) {
		setHorizontalAlignment(SwingConstants.RIGHT);
	} else {
		setHorizontalAlignment(SwingConstants.CENTER);
	}

	return this;
	*/
	//NEW
	if (value instanceof Number) {
		super.setHorizontalAlignment(SwingConstants.RIGHT);
	} else if (value instanceof Boolean) {
		return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
	} else {
		super.setHorizontalAlignment(SwingConstants.CENTER);
	}
	Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

	return c;
	//END Federico Dall'Orso
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:31,代码来源:ExactCellRenderer.java

示例9: getTableCellRendererComponent

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
	Component renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

	// Paints infinity symbol as a number
	if (value instanceof String && "\u221E".equals(value)) {
		super.setHorizontalAlignment(SwingConstants.RIGHT);
	}
	if (!table.isCellEditable(row, col)) {
		renderer.setEnabled(false);
	} else {
		renderer.setEnabled(true);
	}
	return renderer;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:15,代码来源:GrayCellRenderer.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: ColorChooserPanel

ColorChooserPanel(ColorModel model) {
    this.model = model;
    this.panel = new ColorPanel(this.model);
    this.slider = new DiagramComponent(this.panel, false);
    this.diagram = new DiagramComponent(this.panel, true);
    this.text = new JFormattedTextField();
    this.label = new JLabel(null, null, SwingConstants.RIGHT);
    ValueFormatter.init(6, true, this.text);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ColorChooserPanel.java

示例12: convertAlignment

/**
 * Converts {@code Label} alignment constant to the {@code JLabel} constant.
 * If wrong Label alignment provided returns default alignment.
 *
 * @param alignment {@code Label} constant.
 *
 * @return {@code JLabel} constant.
 */
private static int convertAlignment(final int alignment) {
    switch (alignment) {
        case Label.CENTER:
            return SwingConstants.CENTER;
        case Label.RIGHT:
            return SwingConstants.RIGHT;
        default:
            return SwingConstants.LEFT;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:LWLabelPeer.java

示例13: createCompositeMenuToggleButton

@Override
protected CompositeMenuToggleButton createCompositeMenuToggleButton(Action... actions) {
	return new PerspectiveMenuToggleButton(perspectiveController, SwingConstants.RIGHT, actions);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:4,代码来源:PerspectiveToggleGroup.java

示例14: getRightAlignedLabel

public JLabel getRightAlignedLabel(String text) {
    return new JLabel(text, SwingConstants.RIGHT);
}
 
开发者ID:Zephyr-Koo,项目名称:java-gui-practical-demo,代码行数:3,代码来源:P3Q5.java

示例15: createCompositeMenuToggleButton

/**
 * Creates a {@link CompositeMenuToggleButton} with the given actions and the position
 * {@link SwingConstants#RIGHT}.
 *
 * @param actions
 *            the actions which should be included
 * @return the created button
 */
protected CompositeMenuToggleButton createCompositeMenuToggleButton(Action... actions) {
	return new CompositeMenuToggleButton(SwingConstants.RIGHT, actions);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:ToggleButtonGroup.java


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