本文整理匯總了Java中java.awt.ComponentOrientation.LEFT_TO_RIGHT屬性的典型用法代碼示例。如果您正苦於以下問題:Java ComponentOrientation.LEFT_TO_RIGHT屬性的具體用法?Java ComponentOrientation.LEFT_TO_RIGHT怎麽用?Java ComponentOrientation.LEFT_TO_RIGHT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.ComponentOrientation
的用法示例。
在下文中一共展示了ComponentOrientation.LEFT_TO_RIGHT屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showFileChooser
private static void showFileChooser() throws Exception {
if (tryLookAndFeel(lookAndFeelComboBox.getSelectedItem().toString())) {
openChooser = new JFileChooser();
ComponentOrientation orientation
= ComponentOrientation.UNKNOWN;
switch (orientationComboBox.getSelectedItem().toString()) {
case orientationLTR:
orientation = ComponentOrientation.LEFT_TO_RIGHT;
break;
case orientationRTL:
orientation = ComponentOrientation.RIGHT_TO_LEFT;
break;
}
openChooser.setComponentOrientation(orientation);
openChooser.showOpenDialog(frame);
}
}
示例2: convertToGravity
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;
}
示例3: getLastVisibleIndex
/**
* Returns the list index of the lower right or lower left corner of the
* visible rectangle of this list, depending on the {@link
* Component#getComponentOrientation} property.
*
* @return The index of the last visible list cell, or <code>-1</code>
* if none is visible.
*/
public int getLastVisibleIndex()
{
ComponentOrientation or = getComponentOrientation();
Rectangle r = getVisibleRect();
r.translate(0, (int) r.getHeight() - 1);
if (or == ComponentOrientation.LEFT_TO_RIGHT)
r.translate((int) r.getWidth() - 1, 0);
if (getUI().locationToIndex(this, r.getLocation()) == -1
&& indexToLocation(getModel().getSize() - 1).y < r.y)
return getModel().getSize() - 1;
return getUI().locationToIndex(this, r.getLocation());
}
示例4: getCorner
public Component getCorner(String key)
{
if (getComponentOrientation()
== ComponentOrientation.LEFT_TO_RIGHT)
{
if (key == LOWER_LEADING_CORNER)
key = LOWER_LEFT_CORNER;
else if (key == LOWER_TRAILING_CORNER)
key = LOWER_RIGHT_CORNER;
else if (key == UPPER_LEADING_CORNER)
key = UPPER_LEFT_CORNER;
else if (key == UPPER_TRAILING_CORNER)
key = UPPER_RIGHT_CORNER;
}
else if (getComponentOrientation()
== ComponentOrientation.RIGHT_TO_LEFT)
{
if (key == LOWER_LEADING_CORNER)
key = LOWER_RIGHT_CORNER;
else if (key == LOWER_TRAILING_CORNER)
key = LOWER_LEFT_CORNER;
else if (key == UPPER_LEADING_CORNER)
key = UPPER_RIGHT_CORNER;
else if (key == UPPER_TRAILING_CORNER)
key = UPPER_LEFT_CORNER;
}
if (key == LOWER_RIGHT_CORNER)
return lowerRight;
else if (key == UPPER_RIGHT_CORNER)
return upperRight;
else if (key == LOWER_LEFT_CORNER)
return lowerLeft;
else if (key == UPPER_LEFT_CORNER)
return upperLeft;
return null;
}
示例5: getContents
protected Object[][] getContents() {
return new Object[][] {
{ "Orientation", ComponentOrientation.LEFT_TO_RIGHT },
};
}
示例6: getOrientation
static String getOrientation(ComponentOrientation orientation) {
return orientation == ComponentOrientation.LEFT_TO_RIGHT ? "LEFT_TO_RIGHT" : "RIGHT_TO_LEFT";
}
示例7: setCorner
public void setCorner(String key, Component c)
{
if (getComponentOrientation()
== ComponentOrientation.LEFT_TO_RIGHT)
{
if (key == LOWER_LEADING_CORNER)
key = LOWER_LEFT_CORNER;
else if (key == LOWER_TRAILING_CORNER)
key = LOWER_RIGHT_CORNER;
else if (key == UPPER_LEADING_CORNER)
key = UPPER_LEFT_CORNER;
else if (key == UPPER_TRAILING_CORNER)
key = UPPER_RIGHT_CORNER;
}
else if (getComponentOrientation()
== ComponentOrientation.RIGHT_TO_LEFT)
{
if (key == LOWER_LEADING_CORNER)
key = LOWER_RIGHT_CORNER;
else if (key == LOWER_TRAILING_CORNER)
key = LOWER_LEFT_CORNER;
else if (key == UPPER_LEADING_CORNER)
key = UPPER_RIGHT_CORNER;
else if (key == UPPER_TRAILING_CORNER)
key = UPPER_LEFT_CORNER;
}
if (key == LOWER_RIGHT_CORNER)
{
removeNonNull(lowerRight);
lowerRight = c;
addNonNull(c, JScrollPane.LOWER_RIGHT_CORNER);
}
else if (key == UPPER_RIGHT_CORNER)
{
removeNonNull(upperRight);
upperRight = c;
addNonNull(c, JScrollPane.UPPER_RIGHT_CORNER);
}
else if (key == LOWER_LEFT_CORNER)
{
removeNonNull(lowerLeft);
lowerLeft = c;
addNonNull(c, JScrollPane.LOWER_LEFT_CORNER);
}
else if (key == UPPER_LEFT_CORNER)
{
removeNonNull(upperLeft);
upperLeft = c;
addNonNull(c, JScrollPane.UPPER_LEFT_CORNER);
}
else
throw new IllegalArgumentException("unknown corner " + key);
sync();
}