當前位置: 首頁>>代碼示例>>Java>>正文


Java ComponentOrientation.isLeftToRight方法代碼示例

本文整理匯總了Java中java.awt.ComponentOrientation.isLeftToRight方法的典型用法代碼示例。如果您正苦於以下問題:Java ComponentOrientation.isLeftToRight方法的具體用法?Java ComponentOrientation.isLeftToRight怎麽用?Java ComponentOrientation.isLeftToRight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.ComponentOrientation的用法示例。


在下文中一共展示了ComponentOrientation.isLeftToRight方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setComponentOrientation

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void setComponentOrientation(ComponentOrientation o) {

	// Some LaFs might do fun stuff, resulting in this method being called
	// before a border is installed.

	if (getBorder() instanceof GutterBorder) {
		// Reuse the border to preserve its color.
		if (o.isLeftToRight()) {
			((GutterBorder)getBorder()).setEdges(0, 0, 0, 1);
		}
		else {
			((GutterBorder)getBorder()).setEdges(0, 1, 0, 0);
		}
	}
	super.setComponentOrientation(o);
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:21,代碼來源:Gutter.java

示例2: AbstractButtonPanelBuilder

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Constructs a <code>AbstractFormBuilder</code>
 * for the given FormLayout and layout container.
 *
 * @param layout     the {@link FormLayout} to use
 * @param container  the layout container
 *
 * @throws NullPointerException if the layout or container is null
 */
protected AbstractButtonPanelBuilder(FormLayout layout, JPanel container) {
    if (layout == null) {
        throw new NullPointerException("The layout must not be null.");
    }

    if (container == null) {
        throw new NullPointerException("The layout container must not be null.");
    }

    this.container = container;
    this.layout    = layout;
    container.setLayout(layout);

    setOpaque(false);

    currentCellConstraints = new CellConstraints();
    ComponentOrientation orientation = container.getComponentOrientation();
    leftToRight = orientation.isLeftToRight()
              || !orientation.isHorizontal();
}
 
開發者ID:evandrocoan,項目名稱:ComputerScienceGraduation,代碼行數:30,代碼來源:AbstractButtonPanelBuilder.java

示例3: AbstractFormBuilder

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Constructs a <code>AbstractFormBuilder</code>
 * for the given FormLayout and layout container.
 *
 * @param layout     the {@link FormLayout} to use
 * @param container  the layout container
 *
 * @throws NullPointerException if the layout or container is null
 */
public AbstractFormBuilder(FormLayout layout, Container container) {
    if (layout == null)
        throw new NullPointerException("The layout must not be null.");

    if (container == null)
        throw new NullPointerException("The layout container must not be null.");

    this.container = container;
    this.layout    = layout;

    container.setLayout(layout);
    currentCellConstraints = new CellConstraints();
    ComponentOrientation orientation = container.getComponentOrientation();
    leftToRight = orientation.isLeftToRight()
              || !orientation.isHorizontal();
}
 
開發者ID:evandrocoan,項目名稱:ComputerScienceGraduation,代碼行數:26,代碼來源:AbstractFormBuilder.java

示例4: convertToGravity

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
public static final int convertToGravity(int horizontalAlign, ComponentOrientation orien){
	if(orien == null){
		orien = ComponentOrientation.LEFT_TO_RIGHT;
	}

	if(horizontalAlign == SwingConstants.CENTER){
		return Gravity.CENTER | Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
	}else if(horizontalAlign == SwingConstants.LEFT 
			|| (orien.isLeftToRight() && horizontalAlign == SwingConstants.LEADING)
			|| (orien.isLeftToRight() == false && horizontalAlign == SwingConstants.TRAILING)){
		return Gravity.LEFT;
	}else if(horizontalAlign == SwingConstants.RIGHT 
			|| (orien.isLeftToRight() == false && horizontalAlign == SwingConstants.LEADING)
			|| (orien.isLeftToRight() && horizontalAlign == SwingConstants.TRAILING)){
		return Gravity.RIGHT;
	}
	return 0;
}
 
開發者ID:javalovercn,項目名稱:j2se_for_android,代碼行數:19,代碼來源:AndroidUIUtil.java

示例5: inHitRegion

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
* Returns true if the passed in location is a valid mouse location
* to start editing from. This is implemented to return false if
* <code>x</code> is <= the width of the icon and icon gap displayed
* by the renderer. In other words this returns true if the user
* clicks over the text part displayed by the renderer, and false
* otherwise.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return true if the passed in location is a valid mouse location
*/
protected boolean inHitRegion(int x, int y) {
if(lastRow != -1 && tree != null) {
Rectangle bounds = tree.getRowBounds(lastRow);
ComponentOrientation treeOrientation = tree.getComponentOrientation();

if ( treeOrientation.isLeftToRight() ) {
    if (bounds != null && x <= (bounds.x + offset) &&
        offset < (bounds.width - 5)) {
        return false;
    }
} else if ( bounds != null &&
            ( x >= (bounds.x+bounds.width-offset+5) ||
              x <= (bounds.x + 5) ) &&
            offset < (bounds.width - 5) ) {
    return false;
}
}
return true;
}
 
開發者ID:javalovercn,項目名稱:j2se_for_android,代碼行數:31,代碼來源:DefaultTreeCellEditor.java

示例6: getLastVisibleRowIndex

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Returns the row index of the last visible row.
 *
 */
int getLastVisibleRowIndex(JTable table)
{
  ComponentOrientation or = table.getComponentOrientation();
  Rectangle r = table.getVisibleRect();
  r.translate(0, (int) r.getHeight() - 1);
  if (or.isLeftToRight())
    r.translate((int) r.getWidth() - 1, 0);
  // The next if makes sure that we don't return -1 simply because
  // there is white space at the bottom of the table (ie, the display
  // area is larger than the table)
  if (table.rowAtPoint(r.getLocation()) == -1)
    {
      if (getFirstVisibleRowIndex(table) == -1)
        return -1;
      else
        return table.getModel().getRowCount() - 1;
    }
  return table.rowAtPoint(r.getLocation());
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:24,代碼來源:BasicTableUI.java

示例7: setComponentOrientation

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void setComponentOrientation(ComponentOrientation o) {
	// Reuse the border to preserve its color.
	if (o.isLeftToRight()) {
		((GutterBorder)getBorder()).setEdges(0, 0, 0, 1);
	}
	else {
		((GutterBorder)getBorder()).setEdges(0, 1, 0, 0);
	}
	super.setComponentOrientation(o);
}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:15,代碼來源:Gutter.java

示例8: getFirstVisibleColumnIndex

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Returns the column index of the first visible column.
 * @return the column index of the first visible column.
 */
int getFirstVisibleColumnIndex(JTable table)
{
  ComponentOrientation or = table.getComponentOrientation();
  Rectangle r = table.getVisibleRect();
  if (!or.isLeftToRight())
    r.translate((int) r.getWidth() - 1, 0);
  return table.columnAtPoint(r.getLocation());
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:13,代碼來源:BasicTableUI.java

示例9: getLastVisibleColumnIndex

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Returns the column index of the last visible column.
 *
 */
int getLastVisibleColumnIndex(JTable table)
{
  ComponentOrientation or = table.getComponentOrientation();
  Rectangle r = table.getVisibleRect();
  if (or.isLeftToRight())
    r.translate((int) r.getWidth() - 1, 0);
  return table.columnAtPoint(r.getLocation());
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:13,代碼來源:BasicTableUI.java

示例10: getFirstVisibleRowIndex

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Returns the row index of the first visible row.
 *
 */
int getFirstVisibleRowIndex(JTable table)
{
  ComponentOrientation or = table.getComponentOrientation();
  Rectangle r = table.getVisibleRect();
  if (!or.isLeftToRight())
    r.translate((int) r.getWidth() - 1, 0);
  return table.rowAtPoint(r.getLocation());
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:13,代碼來源:BasicTableUI.java

示例11: getToolTipText

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
@Override
public String getToolTipText() {

	StringBuilder sb = new StringBuilder();
	String spacing = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	int threshold = sc.getConfiguration().getInteger(Configuration.SPELL_THRESHOLD);
	List<Word> suggestions = sc.getSuggestions(word, threshold);
	if (suggestions==null || suggestions.size()==0) {
		sb.append(spacing).append("&#8226;&nbsp;<em>");
		//sb.append(msg.getString("None"));
		sb.append("</em><br><br>");
	}
	else {
		sb.append("<center>");
		sb.append("<table width='75%'>");
		for (int i=0; i<suggestions.size(); i++) {
			if ((i%2)==0) {
				sb.append("<tr>");
			}
			sb.append("<td>&#8226;&nbsp;");
			Word suggestion = suggestions.get(i);
			// Surround with double quotes, not single, since
			// replacement words can have single quotes in them.
			sb.append("<a href=\"").append(REPLACE).append("://").
			append(getOffset()).append(',').
			append(getLength()).append(',').
			append(suggestion.getWord()).
			append("\">").
			append(suggestion.getWord()).
			append("</a>").
			append("</td>");
			if ((i&1)==1) {
				sb.append("</tr>");
			}
		}
		if ((suggestions.size()%2)==0) {
			sb.append("<td></td></tr>");
		}
		sb.append("</table>");
		sb.append("</center>");
	}

	SpellingParser sp = (SpellingParser)getParser();
	if (sp.getAllowAdd()) {
		sb.append("<img src='add.png' width='16' height='16'>&nbsp;").
				append("<a href='").append(ADD).
				append("://").append(word).append("'>").
				append("Add To Dictionary").
				append("</a><br>");
	}

	if (sp.getAllowIgnore()) {
		String text = "" ;
		text = MessageFormat.format(text, new Object[] { word });
		sb.append("<img src='ignore.png' width='16' height='16'>&nbsp;").
				append("<a href='").append(IGNORE).
				append("://").append(word).append("'>").
				append("Ignore").append("</a>");
	}

	String firstLine = MessageFormat.format(
							"",
							new Object[] { word });
	ComponentOrientation o = ComponentOrientation.getOrientation(
										Locale.getDefault());
	String dirAttr = o.isLeftToRight() ? "ltr" : "rtl";
	String temp = MessageFormat.format(TOOLTIP_TEXT_FORMAT,
					new Object[] {
						dirAttr,
						firstLine,
						//msg.getString("ErrorToolTip.SuggestionsHtml"),
						sb.toString() });

	return temp;

}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:77,代碼來源:SpellingParser.java

示例12: AutoCompletePopupWindow

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Constructor.
 *
 * @param parent The parent window (hosting the text component).
 * @param ac The auto-completion instance.
 */
public AutoCompletePopupWindow(Window parent, final AutoCompletion ac) {

	super(parent);
	ComponentOrientation o = ac.getTextComponentOrientation();

	this.ac = ac;
	model = new CompletionListModel();
	list = new PopupList(model);

	list.setCellRenderer(new DelegatingCellRenderer());
	list.addListSelectionListener(this);
	list.addMouseListener(this);

	JPanel contentPane = new JPanel(new BorderLayout());
	JScrollPane sp = new JScrollPane(list,
						JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
						JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

	// In 1.4, JScrollPane.setCorner() has a bug where it won't accept
	// JScrollPane.LOWER_TRAILING_CORNER, even though that constant is
	// defined.  So we have to put the logic added in 1.5 to handle it
	// here.
	JPanel corner = new SizeGrip();
	//sp.setCorner(JScrollPane.LOWER_TRAILING_CORNER, corner);
	boolean isLeftToRight = o.isLeftToRight();
    String str = isLeftToRight ? JScrollPane.LOWER_RIGHT_CORNER :
    								JScrollPane.LOWER_LEFT_CORNER;
    sp.setCorner(str, corner);

	contentPane.add(sp);
	setContentPane(contentPane);
	applyComponentOrientation(o);

	// Give apps a chance to decorate us with drop shadows, etc.
	if (Util.getShouldAllowDecoratingMainAutoCompleteWindows()) {
		PopupWindowDecorator decorator = PopupWindowDecorator.get();
		if (decorator!=null) {
			decorator.decorate(this);
		}
	}

	pack();

	setFocusableWindowState(false);

	lastLine = -1;

}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:55,代碼來源:AutoCompletePopupWindow.java

示例13: setComponentOrientation

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
void setComponentOrientation(ComponentOrientation orientation) {
    horizontal = orientation.isHorizontal();
    leftToRight = orientation.isLeftToRight();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:5,代碼來源:LayoutComparator.java

示例14: isRightToLeft

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
public boolean isRightToLeft()
{
	// Check layout orientation
	ComponentOrientation orientation = _parent.getComponentOrientation();
	return orientation.isHorizontal() && !orientation.isLeftToRight();
}
 
開發者ID:pgdurand,項目名稱:jGAF,代碼行數:7,代碼來源:OrientationPolicy.java

示例15: AutoCompletePopupWindow

import java.awt.ComponentOrientation; //導入方法依賴的package包/類
/**
 * Constructor.
 *
 * @param parent
 *            The parent window (hosting the text component).
 * @param ac
 *            The auto-completion instance.
 */
public AutoCompletePopupWindow(Window parent, final AutoCompletion ac) {

	super(parent);
	ComponentOrientation o = ac.getTextComponentOrientation();

	this.ac = ac;
	model = new CompletionListModel();
	list = new PopupList(model);

	list.setCellRenderer(new DelegatingCellRenderer());
	list.addListSelectionListener(this);
	list.addMouseListener(this);


	JPanel contentPane = new JPanel(new BorderLayout());
	listScrollPane = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
			JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

	
	
	// In 1.4, JScrollPane.setCorner() has a bug where it won't accept
	// JScrollPane.LOWER_TRAILING_CORNER, even though that constant is
	// defined. So we have to put the logic added in 1.5 to handle it
	// here.
	JPanel corner = new SizeGrip();
	// sp.setCorner(JScrollPane.LOWER_TRAILING_CORNER, corner);
	boolean isLeftToRight = o.isLeftToRight();
	String str = isLeftToRight ? JScrollPane.LOWER_RIGHT_CORNER : JScrollPane.LOWER_LEFT_CORNER;
	listScrollPane.setCorner(str, corner);

	contentPane.add(listScrollPane);
	setContentPane(contentPane);
	applyComponentOrientation(o);

	// Give apps a chance to decorate us with drop shadows, etc.
	if (Util.getShouldAllowDecoratingMainAutoCompleteWindows()) {
		PopupWindowDecorator decorator = PopupWindowDecorator.get();
		if (decorator != null) {
			decorator.decorate(this);
		}
	}

	pack();

	setFocusableWindowState(false);

	lastLine = -1;

}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:58,代碼來源:AutoCompletePopupWindow.java


注:本文中的java.awt.ComponentOrientation.isLeftToRight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。