Java Code Examples for java.awt.ComponentOrientation#RIGHT_TO_LEFT
The following examples show how to use
java.awt.ComponentOrientation#RIGHT_TO_LEFT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFileChooserOrientation.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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); } }
Example 2
Source File: JFlowPanel.java From nordpos with GNU General Public License v3.0 | 5 votes |
private int getPosition(int x, int width) { if (getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT) { return width - x ; } else { return x; } }
Example 3
Source File: PreferencesHandler.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public static ComponentOrientation getComponentOrientation() { String orientationString = getPreference(PREF_ORIENTATION, LEFT_TO_RIGHT); if (orientationString.equals(RIGHT_TO_LEFT)) { return ComponentOrientation.RIGHT_TO_LEFT; } else { return ComponentOrientation.LEFT_TO_RIGHT; } }
Example 4
Source File: TestBundle_iw.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
protected Object[][] getContents() { return new Object[][] { { "Orientation", ComponentOrientation.RIGHT_TO_LEFT }, }; }
Example 5
Source File: TestBundle_iw.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
protected Object[][] getContents() { return new Object[][] { { "Orientation", ComponentOrientation.RIGHT_TO_LEFT }, }; }
Example 6
Source File: TestBundle_iw.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
protected Object[][] getContents() { return new Object[][] { { "Orientation", ComponentOrientation.RIGHT_TO_LEFT }, }; }
Example 7
Source File: AnnotationEditor.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
/** * Finds the best location for the editor dialog for a given span of text. */ @Override public void placeDialog(int start, int end) { if(popupWindow.isVisible() && pinnedButton.isSelected()) { // just resize Point where = popupWindow.getLocation(); popupWindow.pack(); if(where != null) { popupWindow.setLocation(where); } } else { // calculate position try { Rectangle startRect = owner.getTextComponent().modelToView(start); Rectangle endRect = owner.getTextComponent().modelToView(end); Point topLeft = owner.getTextComponent().getLocationOnScreen(); int x = topLeft.x + startRect.x; int y = topLeft.y + endRect.y + endRect.height; // make sure the window doesn't start lower // than the end of the visible rectangle Rectangle visRect = owner.getTextComponent().getVisibleRect(); int maxY = topLeft.y + visRect.y + visRect.height; // make sure window doesn't get off-screen popupWindow.pack(); // responding to changed orientation if(currentOrientation == ComponentOrientation.RIGHT_TO_LEFT) { x = x - popupWindow.getSize().width; if(x < 0) x = 0; } Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); boolean revalidate = false; if(popupWindow.getSize().width > screenSize.width) { popupWindow.setSize(screenSize.width, popupWindow.getSize().height); revalidate = true; } if(popupWindow.getSize().height > screenSize.height) { popupWindow.setSize(popupWindow.getSize().width, screenSize.height); revalidate = true; } if(revalidate) popupWindow.validate(); // calculate max X int maxX = screenSize.width - popupWindow.getSize().width; // calculate max Y if(maxY + popupWindow.getSize().height > screenSize.height) { maxY = screenSize.height - popupWindow.getSize().height; } // correct position if(y > maxY) y = maxY; if(x > maxX) x = maxX; popupWindow.setLocation(x, y); } catch(BadLocationException ble) { // this should never occur throw new GateRuntimeException(ble); } } if(!popupWindow.isVisible()) popupWindow.setVisible(true); }
Example 8
Source File: AnnotationEditor.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void changeOrientation(ComponentOrientation orientation) { if(orientation == null) return; // remember the current orientation this.currentOrientation = orientation; // input map InputMap inputMap = ((JComponent)popupWindow.getContentPane()) .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); Action solAction = actionMap.get("solAction"); Action sorAction = actionMap.get("sorAction"); Action eolAction = actionMap.get("eolAction"); Action eorAction = actionMap.get("eorAction"); if(orientation == ComponentOrientation.RIGHT_TO_LEFT) { // in right to left orientation // extending start offset is equal to extending end offset solButton.setAction(eorAction); solButton.setToolTipText(EOR_DESC); setShortCuts(inputMap, SOL_KEY_STROKES, "eorAction"); solButton.setIcon(MainFrame.getIcon("extend-left")); // shrinking start offset is equal to shrinking end offset sorButton.setAction(eolAction); sorButton.setToolTipText(EOL_DESC); setShortCuts(inputMap, SOR_KEY_STROKES, "eolAction"); sorButton.setIcon(MainFrame.getIcon("extend-right")); // shrinking end offset is equal to shrinking start offset eolButton.setAction(sorAction); eolButton.setToolTipText(SOR_DESC); setShortCuts(inputMap, EOL_KEY_STROKES, "sorAction"); eolButton.setIcon(MainFrame.getIcon("extend-left")); // extending end offset is extending start offset eorButton.setAction(solAction); eorButton.setToolTipText(SOL_DESC); setShortCuts(inputMap, EOR_KEY_STROKES, "solAction"); eorButton.setIcon(MainFrame.getIcon("extend-right")); } else { solButton.setAction(solAction); solButton.setToolTipText(SOL_DESC); setShortCuts(inputMap, SOL_KEY_STROKES, "solAction"); solButton.setIcon(MainFrame.getIcon("extend-left")); sorButton.setAction(sorAction); sorButton.setToolTipText(SOR_DESC); setShortCuts(inputMap, SOR_KEY_STROKES, "sorAction"); sorButton.setIcon(MainFrame.getIcon("extend-right")); eolButton.setAction(eolAction); eolButton.setToolTipText(EOL_DESC); setShortCuts(inputMap, EOL_KEY_STROKES, "eolAction"); eolButton.setIcon(MainFrame.getIcon("extend-left")); eorButton.setAction(eorAction); eorButton.setToolTipText(EOR_DESC); setShortCuts(inputMap, EOR_KEY_STROKES, "eorAction"); eorButton.setIcon(MainFrame.getIcon("extend-right")); } }
Example 9
Source File: TestBundle_iw.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
protected Object[][] getContents() { return new Object[][] { { "Orientation", ComponentOrientation.RIGHT_TO_LEFT }, }; }
Example 10
Source File: TestBundle_iw.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
protected Object[][] getContents() { return new Object[][] { { "Orientation", ComponentOrientation.RIGHT_TO_LEFT }, }; }