Package java.awt

Examples of java.awt.ComponentOrientation


        JCheckBox result = new JCheckBox(new BooleanOptionAction(option));
        result.setText(myi18n.getOptionLabel(option));
        result.setHorizontalAlignment(JCheckBox.LEFT);
        result.setHorizontalTextPosition(SwingConstants.TRAILING);
        result.setSelected(option.isChecked());
        ComponentOrientation componentOrientation = GanttLanguage.getInstance().getComponentOrientation();
        result.setComponentOrientation(componentOrientation);
        return result;
    }
View Full Code Here


   * depending on toolbar orientation.
   */
  private void layoutToolBarButtons(JToolBar toolBar,
                                    JButton previousButton,
                                    JButton nextButton) {
    ComponentOrientation orientation = toolBar.getComponentOrientation();
    GridBagLayout layout = (GridBagLayout)toolBar.getLayout();
    GridBagConstraints firstButtonConstraints = new GridBagConstraints(
        0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
        GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    GridBagConstraints secondButtonContraints = new GridBagConstraints(
        1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
        GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0);
    layout.setConstraints(orientation.isLeftToRight() ? previousButton : nextButton,
        firstButtonConstraints);
    layout.setConstraints(orientation.isLeftToRight() ? nextButton : previousButton,
        secondButtonContraints);
    // Use segmented buttons under Mac OS X 10.5
    if (OperatingSystem.isMacOSXLeopardOrSuperior()) {
      previousButton.putClientProperty("JButton.buttonType", "segmentedTextured");
      previousButton.putClientProperty("JButton.segmentPosition", "first");
View Full Code Here

   * Under Mac OS X 10.5, it also uses segmented buttons and groups them depending
   * on toolbar orientation and whether a button is after or before a separator.
   */
  private void updateToolBarButtons() {
    // Retrieve component orientation because Mac OS X 10.5 miserably doesn't it take into account
    ComponentOrientation orientation = getComponentOrientation();
    Component previousComponent = null;
    for (int i = 0, n = getComponentCount(); i < n; i++) {       
      JComponent component = (JComponent)getComponentAtIndex(i);
      // Remove focusable property on buttons
      component.setFocusable(false);
     
      if (!(component instanceof AbstractButton)) {
        previousComponent = null;
        continue;
      }         
      if (OperatingSystem.isMacOSXLeopardOrSuperior()) {
        Component nextComponent;
        if (i < n - 1) {
          nextComponent = getComponentAtIndex(i + 1);
        } else {
          nextComponent = null;
        }
        component.putClientProperty("JButton.buttonType", "segmentedTextured");
        if (previousComponent == null
            && !(nextComponent instanceof AbstractButton)) {
          component.putClientProperty("JButton.segmentPosition", "only");
        } else if (previousComponent == null) {
          component.putClientProperty("JButton.segmentPosition",
              orientation.isLeftToRight()
                ? "first"
                : "last");
        } else if (!(nextComponent instanceof AbstractButton)) {
          component.putClientProperty("JButton.segmentPosition",
              orientation.isLeftToRight()
                ? "last"
                : "first");
        } else {
          component.putClientProperty("JButton.segmentPosition", "middle");
        }
View Full Code Here

                    setButtonsAttrs(fileChooser.getDialogType());
                } else {
                    approveButtonText = (String)event.getNewValue();
                }
            } else if (StringConstants.COMPONENT_ORIENTATION.equals(changedProperty)) {
                ComponentOrientation co = (ComponentOrientation)event.getNewValue();
                fileChooser.applyComponentOrientation(co);
            }
        }
View Full Code Here

        Rectangle visibleRect = getVisibleRect();
        if (visibleRect.isEmpty()) {
            return -1;
        }

        ComponentOrientation co = getComponentOrientation();
        if (co.isHorizontal()) {
            for (int i = 0; i < model.getSize(); i++) {
                Rectangle bounds = getCellBounds(i, i);
                if (bounds.intersects(visibleRect)) {
                    return i;
                }
View Full Code Here

        Rectangle visibleRect = getVisibleRect();
        if (visibleRect.isEmpty()) {
            return -1;
        }

        ComponentOrientation co = getComponentOrientation();
        if (co.isHorizontal()) {
            for (int i = model.getSize() - 1; i >= 0; i--) {
                Rectangle bounds = getCellBounds(i, i);
                if (bounds.intersects(visibleRect)) {
                    return i;
                }
View Full Code Here

        if (tipWindow==null) {
          return;
        }

        tipWindow.fixSize();
        ComponentOrientation o = textArea.getComponentOrientation();

        Point p = e.getPoint();
        SwingUtilities.convertPointToScreen(p, textArea);
        int x = o.isLeftToRight() ? (p.x-10) :
                    (p.x - tipWindow.getWidth() + MARGIN);
        int y = p.y + MARGIN;

        // Ensure tooltip is in the window bounds.
        Dimension ss = tipWindow.getToolkit().getScreenSize();
View Full Code Here

    if (osxSizeGrip!=null) {
      g.drawImage(osxSizeGrip, dim.width-16, dim.height-16, null);
      return;
    }

    ComponentOrientation orientation = getComponentOrientation();

    if (orientation.isLeftToRight()) {
      int width = dim.width  -= 3;
      int height = dim.height -= 3;
      g.setColor(c1);
      g.fillRect(width-9,height-1, 3,3);
      g.fillRect(width-5,height-1, 3,3);
View Full Code Here

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

        container.setLayout(layout);
        currentCellConstraints = new CellConstraints();
        ComponentOrientation orientation = container.getComponentOrientation();
        leftToRight = orientation.isLeftToRight()
                  || !orientation.isHorizontal();
    }
View Full Code Here

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

        container.setLayout(layout);
        currentCellConstraints = new CellConstraints();
        ComponentOrientation orientation = container.getComponentOrientation();
        leftToRight = orientation.isLeftToRight()
                  || !orientation.isHorizontal();
    }
View Full Code Here

TOP

Related Classes of java.awt.ComponentOrientation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.