Esempio n. 1
0
 @Override
 public Dimension getMaximumSize(JComponent c) {
   Gripper gripper = (Gripper) c;
   if (gripper.getOrientation() == SwingConstants.HORIZONTAL)
     return new Dimension(_size, c.getParent().getHeight());
   else return new Dimension(c.getParent().getWidth(), _size);
 }
Esempio n. 2
0
 public JComponent getDropTarget(JComponent component) {
   if (component instanceof DropTarget) {
     return component;
   } else if (component.getParent() instanceof JComponent) {
     return getDropTarget((JComponent) component.getParent());
   } else {
     return null;
   }
 }
Esempio n. 3
0
 /**
  * Add a component in the list of components that should be refreshed. If <i>c</i> already has a
  * dirty region, the rectangle <i>(x,y,w,h)</i> will be unioned with the region that should be
  * redrawn.
  *
  * @param c Component to repaint, null results in nothing happening.
  * @param x X coordinate of the region to repaint
  * @param y Y coordinate of the region to repaint
  * @param w Width of the region to repaint
  * @param h Height of the region to repaint
  * @see JComponent#repaint
  */
 @Override
 public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
   Rectangle dirtyRegion = getDirtyRegion(c);
   if (dirtyRegion.width == 0 && dirtyRegion.height == 0) {
     int lastDeltaX = c.getX();
     int lastDeltaY = c.getY();
     Container parent = c.getParent();
     while (parent instanceof JComponent) {
       if (!parent.isVisible() || !parent.isDisplayable()) {
         return;
       }
       if (parent instanceof JXPanel
           && (((JXPanel) parent).getAlpha() < 1f || !parent.isOpaque())) {
         x += lastDeltaX;
         y += lastDeltaY;
         lastDeltaX = lastDeltaY = 0;
         c = (JComponent) parent;
       }
       lastDeltaX += parent.getX();
       lastDeltaY += parent.getY();
       parent = parent.getParent();
     }
   }
   super.addDirtyRegion(c, x, y, w, h);
 }
  public void paint(Graphics g, JComponent c) {
    Dimension s = c.getSize();
    if (WindowsMenuItemUI.isVistaPainting()) {
      int x = 1;
      Component parent = c.getParent();
      if (parent instanceof JComponent) {
        Object gutterOffsetObject =
            ((JComponent) parent).getClientProperty(WindowsPopupMenuUI.GUTTER_OFFSET_KEY);
        if (gutterOffsetObject instanceof Integer) {
          /*
           * gutter offset is in parent's coordinates.
           * See comment in
           * WindowsPopupMenuUI.getTextOffset(JComponent)
           */
          x = ((Integer) gutterOffsetObject).intValue() - c.getX();
          x += WindowsPopupMenuUI.getGutterWidth();
        }
      }
      Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
      int skinHeight = skin.getHeight();
      int y = (s.height - skinHeight) / 2;
      skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
    } else {
      int y = s.height / 2;
      g.setColor(c.getForeground());
      g.drawLine(1, y - 1, s.width - 2, y - 1);

      g.setColor(c.getBackground());
      g.drawLine(1, y, s.width - 2, y);
    }
  }
Esempio n. 5
0
 /**
  * Print Oarent of Component
  *
  * @param c component
  */
 static void printParents(JComponent c) {
   if (c.getName() == null) c.setName("C" + String.valueOf(s_no++));
   System.out.print(c.getName());
   System.out.print(" - " + c.getClass().getName());
   System.out.println(
       " ** "
           + c.isOpaque()
           + " bg="
           + (c.getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
   //
   Container container = c.getParent();
   while (container != null) {
     System.out.print(
         " - "
             + container.getName()
             + " "
             + container.getClass().getName()
             + " ** "
             + container.isOpaque());
     if (container instanceof JComponent)
       System.out.print(
           " bg="
               + (((JComponent) container).getClientProperty(CompiereLookAndFeel.BACKGROUND)
                   != null));
     System.out.println();
     container = container.getParent();
   }
 } //  printParents
Esempio n. 6
0
 protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
   JMenuItem b = (JMenuItem) c;
   ButtonModel model = b.getModel();
   if (c.getParent() instanceof JMenuBar) {
     if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
       g.setColor(AbstractLookAndFeel.getMenuSelectionBackgroundColor());
       g.fillRect(x, y, w, h);
     }
   } else {
     if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
       g.setColor(AbstractLookAndFeel.getMenuSelectionBackgroundColor());
       g.fillRect(x, y, w, h);
     } else if (!AbstractLookAndFeel.getTheme().isMenuOpaque()) {
       Graphics2D g2D = (Graphics2D) g;
       Composite composite = g2D.getComposite();
       AlphaComposite alpha =
           AlphaComposite.getInstance(
               AlphaComposite.SRC_OVER, AbstractLookAndFeel.getTheme().getMenuAlpha());
       g2D.setComposite(alpha);
       g.setColor(AbstractLookAndFeel.getMenuBackgroundColor());
       g.fillRect(x, y, w, h);
       g2D.setComposite(composite);
     } else {
       g.setColor(AbstractLookAndFeel.getMenuBackgroundColor());
       g.fillRect(x, y, w, h);
     }
   }
   if (menuItem.isSelected() && menuItem.isArmed()) {
     g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
   } else {
     g.setColor(AbstractLookAndFeel.getMenuForegroundColor());
   }
 }
Esempio n. 7
0
  private Insets getScrollBarInsets(SynthContext context, Insets insets) {
    int troughBorder = getClassSpecificIntValue(context, "trough-border", 1);
    insets.left = insets.right = insets.top = insets.bottom = troughBorder;

    JComponent c = context.getComponent();
    if (c.getParent() instanceof JScrollPane) {
      // This scrollbar is part of a scrollpane; use only the
      // "scrollbar-spacing" style property to determine the padding
      // between the scrollbar and its parent scrollpane.
      int spacing = getClassSpecificIntValue(WidgetType.SCROLL_PANE, "scrollbar-spacing", 3);
      if (((JScrollBar) c).getOrientation() == JScrollBar.HORIZONTAL) {
        insets.top += spacing;
      } else {
        if (c.getComponentOrientation().isLeftToRight()) {
          insets.left += spacing;
        } else {
          insets.right += spacing;
        }
      }
    } else {
      // This is a standalone scrollbar; leave enough room for the
      // focus line in addition to the trough border.
      if (c.isFocusable()) {
        int focusSize = getClassSpecificIntValue(context, "focus-line-width", 1);
        int focusPad = getClassSpecificIntValue(context, "focus-padding", 1);
        int totalFocus = focusSize + focusPad;
        insets.left += totalFocus;
        insets.right += totalFocus;
        insets.top += totalFocus;
        insets.bottom += totalFocus;
      }
    }
    return insets;
  }
 /** {@inheritDoc} */
 @Override
 protected void exportDone(JComponent source, Transferable data, int action) {
   try {
     CargoLabel label = (CargoLabel) data.getTransferData(DefaultTransferHandler.flavor);
     if (source.getParent() instanceof CargoPanel) {
       TradeRouteInputPanel.this.cargoPanel.remove(label);
       int[] indices = TradeRouteInputPanel.this.stopList.getSelectedIndices();
       for (int stopIndex : indices) {
         TradeRouteStop stop = TradeRouteInputPanel.this.stopListModel.get(stopIndex);
         List<GoodsType> cargo = new ArrayList<>(stop.getCargo());
         for (int index = 0; index < cargo.size(); index++) {
           if (cargo.get(index) == label.getType()) {
             cargo.remove(index);
             break;
           }
         }
         stop.setCargo(cargo);
       }
       TradeRouteInputPanel.this.stopList.revalidate();
       TradeRouteInputPanel.this.stopList.repaint();
       TradeRouteInputPanel.this.cargoPanel.revalidate();
       TradeRouteInputPanel.this.cargoPanel.repaint();
     }
   } catch (IOException | UnsupportedFlavorException ex) {
     logger.log(Level.WARNING, "CargoHandler export", ex);
   }
 }
Esempio n. 9
0
 @Override
 public void paint(Graphics g, JComponent c) {
   if (c.getParent() instanceof JFileChooser) {
     return;
   } else {
     super.paint(g, c);
   }
 }
Esempio n. 10
0
    /**
     * Given a MouseEvent, finds the VisualItem (if any) on which the event occurred.
     *
     * @param e
     * @return item on which the MouseEvent occurred, or null if it did not occur on any item.
     */
    public VisualItem findClickedItem(MouseEvent e) {

      // get click coordinates
      int x = e.getX();
      int y = e.getY();
      // translate coordinates to Prefuse region
      int xOffset = 0;
      int yOffset = 0;
      JComponent component = display;
      // recursively go through this Component's ancestors, summing offset information in order to
      // get the absolute position relative to window
      do {
        Point visLocation = component.getLocation();
        xOffset += visLocation.x;
        yOffset += visLocation.y;
      } while ((!component.getParent().getClass().equals(JRootPane.class))
          && (component = (JComponent) component.getParent()) != null);
      x -= xOffset;
      y -= yOffset;

      // debug
      //            System.out.println("debug: "+this.getClass().getName()+": mouse click at ("+x+",
      // "+y+")");

      // search each item, determining which was clicked on
      Iterator items = m_vis.getGroup(DATA_GROUP).tuples();
      while (items.hasNext()) {
        VisualItem item = (VisualItem) items.next();
        double itemX = item.getX();
        double itemY = item.getY();
        double itemW = item.getDouble(WIDTH);
        double itemH = item.getDouble(HEIGHT);
        if (x >= itemX && x <= (itemX + itemW) && y >= itemY && y <= (itemY + itemH)) {
          // debug
          //                    System.out.println("debug: "+this.getClass().getName()+": match:
          // ("+itemX+", "+itemY+", "+itemW+", "+itemH+")");
          return item;
        } else {
          // debug
          //                    System.out.println("debug: "+this.getClass().getName()+": no-match:
          // ("+itemX+", "+itemY+", "+itemW+", "+itemH+")");
        }
      }
      return null;
    }
  @Override
  protected void paintComponent(final Graphics g) {
    super.paintComponent(g);

    if (myToolbar != null
        && myToolbar.getParent() == this
        && myContent != null
        && myContent.getParent() == this) {
      g.setColor(UIUtil.getBorderColor());
      if (myVertical) {
        final int y = (int) myToolbar.getBounds().getMaxY();
        g.drawLine(0, y, getWidth(), y);
      } else {
        int x = (int) myToolbar.getBounds().getMaxX();
        g.drawLine(x, 0, x, getHeight());
      }
    }
  }
Esempio n. 12
0
 private static void setComponentName(JComponent component, String name) {
   if (component != null) {
     Container parent = component.getParent();
     if (parent != null) {
       component.setName(parent.getName() + "." + name);
     } else {
       component.setName(name);
     }
   }
 }
  public PannerHandler(JComponent target, Dimension size, int percent, Point offset) {
    this.target = target;
    this.size = size;
    this.percent = percent;
    this.offset = offset;
    this.corner = percent < 50 ? UL : CENTER;
    target.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (!affixed) {
              int modifiers = e.getModifiers();
              if ((modifiers & PANNER_MASK) == PANNER_MASK) {
                if (panner == null || !panner.isAttached()) show(false);
              }
            }
          }

          public void keyReleased(KeyEvent e) {
            if (!affixed) {
              hide();
            }
          }
        });
    ComponentListener listener =
        new ComponentAdapter() {
          private void refresh() {
            if (panner != null && panner.isShowing()) show(affixed);
          }

          public void componentResized(ComponentEvent e) {
            refresh();
          }

          public void componentMoved(ComponentEvent e) {
            refresh();
          }
        };
    target.addComponentListener(listener);
    if (target.getParent() instanceof JViewport) {
      target.getParent().addComponentListener(listener);
    }
  }
Esempio n. 14
0
  @Override
  protected void paintComponent(Graphics g) {
    for (JComponent invalid : invalidFields) {
      if (invalid.getParent() instanceof JViewport) {
        JViewport viewport = (JViewport) invalid.getParent();
        // the parent of the viewport is a JScrollPane
        invalid = (JComponent) viewport.getParent();
      }

      Point p = invalid.getLocationOnScreen();
      SwingUtilities.convertPointFromScreen(p, this);

      int x = p.x - warningIcon.getWidth() / 2;
      int y = (int) (p.y + invalid.getHeight() - warningIcon.getHeight() / 1.5);

      if (g.getClipBounds().intersects(x, y, warningIcon.getWidth(), warningIcon.getHeight())) {
        g.drawImage(warningIcon, x, y, null);
      }
    }
  }
Esempio n. 15
0
 public void mouseExited(MouseEvent e) {
   JComponent c = (JComponent) e.getSource();
   AbstractButton b;
   if (c instanceof AbstractButton) {
     b = (AbstractButton) c;
     c = (JComponent) c.getParent();
   } else {
     b = (AbstractButton) c.getComponent(0);
   }
   if (!b.isSelected()) setIfNotNull(c, "TabbedPane.background");
 }
 public void paintBackground(Graphics g, JComponent c) {
   if (c.isOpaque()) {
     Component parent = c.getParent();
     if ((parent != null) && (parent.getBackground() instanceof ColorUIResource)) {
       AluminiumUtils.fillComponent(g, c);
     } else {
       if (parent != null) {
         g.setColor(parent.getBackground());
       } else {
         g.setColor(c.getBackground());
       }
       g.fillRect(0, 0, c.getWidth(), c.getHeight());
     }
   }
 }
  public Point getLocationOn(JComponent c) {
    Point location;
    if (isRealPopup()) {
      location = myPopup.getLocationOnScreen();
      SwingUtilities.convertPointFromScreen(location, c);
    } else {
      if (myCurrentIdeTooltip != null) {
        Point tipPoint = myCurrentIdeTooltip.getPoint();
        Component tipComponent = myCurrentIdeTooltip.getComponent();
        return SwingUtilities.convertPoint(tipComponent, tipPoint, c);
      } else {
        location =
            SwingUtilities.convertPoint(myComponent.getParent(), myComponent.getLocation(), c);
      }
    }

    return location;
  }
  public void setSize(final Dimension size) {
    if (myIsRealPopup && myPopup != null) {
      // There is a possible case that a popup wraps target content component into other components
      // which might have borders.
      // That's why we can't just apply component's size to the whole popup. It needs to be adjusted
      // before that.
      JComponent popupContent = myPopup.getContent();
      int widthExpand = 0;
      int heightExpand = 0;
      boolean adjustSize = false;
      JComponent prev = myComponent;
      for (Container c = myComponent.getParent(); c != null; c = c.getParent()) {
        if (c == popupContent) {
          adjustSize = true;
          break;
        }
        if (c instanceof JComponent) {
          Border border = ((JComponent) c).getBorder();
          if (prev != null && border != null) {
            Insets insets = border.getBorderInsets(prev);
            widthExpand += insets.left + insets.right;
            heightExpand += insets.top + insets.bottom;
          }
          prev = (JComponent) c;
        } else {
          prev = null;
        }
      }
      Dimension sizeToUse = size;
      if (adjustSize && (widthExpand != 0 || heightExpand != 0)) {
        sizeToUse = new Dimension(size.width + widthExpand, size.height + heightExpand);
      }
      myPopup.setSize(sizeToUse);
    } else if (!isAwtTooltip()) {
      myComponent.setSize(size);

      myComponent.revalidate();
      myComponent.repaint();
    }
  }
  @Override
  public void setLocation(@NotNull RelativePoint point) {
    if (isRealPopup()) {
      myPopup.setLocation(point.getScreenPoint());
    } else {
      if (myCurrentIdeTooltip != null) {
        Point screenPoint = point.getScreenPoint();
        if (!screenPoint.equals(
            new RelativePoint(myCurrentIdeTooltip.getComponent(), myCurrentIdeTooltip.getPoint())
                .getScreenPoint())) {
          myCurrentIdeTooltip.setPoint(point.getPoint());
          myCurrentIdeTooltip.setComponent(point.getComponent());
          IdeTooltipManager.getInstance().show(myCurrentIdeTooltip, true, false);
        }
      } else {
        Point targetPoint = point.getPoint(myComponent.getParent());
        myComponent.setLocation(targetPoint);

        myComponent.revalidate();
        myComponent.repaint();
      }
    }
  }
 public static boolean isActive(JComponent c) {
   if (c == null) {
     return false;
   }
   boolean active = true;
   if (c instanceof JInternalFrame) {
     active = ((JInternalFrame) c).isSelected();
   }
   if (active) {
     Container parent = c.getParent();
     while (parent != null) {
       if (parent instanceof JInternalFrame) {
         active = ((JInternalFrame) parent).isSelected();
         break;
       }
       parent = parent.getParent();
     }
   }
   if (active) {
     active = isFrameActive(c);
   }
   return active;
 }
Esempio n. 21
0
    @Override
    //        public void itemPressed(VisualItem item, MouseEvent e) {
    public void itemClicked(VisualItem item, MouseEvent e) {
      // load (or unload) marked-up text into glasspane on rightclick
      // glasspane text is now loaded on mouseover instead

      // temp: zoom on selection
      if (SwingUtilities.isLeftMouseButton(e)) {
        if (item.canGetInt(DocumentGridTable.NODE_ID)) {
          int nodeId = item.getInt(DocumentGridTable.NODE_ID);
          boolean hasSelectFocus = item.getBoolean(SELECT_FOCUS);
          boolean hasWidthFocus = item.getBoolean(WIDTH_FOCUS);
          boolean hasHeightFocus = item.getBoolean(HEIGHT_FOCUS);
          if (hasSelectFocus) {
            // simply deselect the node
            resetGlyphFocus();
          } else {
            // clear all other node selections
            resetGlyphFocus();
            // select this node
            item.setBoolean(SELECT_FOCUS, true);
            item.setBoolean(WIDTH_FOCUS, true);
            item.setBoolean(HEIGHT_FOCUS, true);
          }

          // ensure that the layout has been reprocessed before loading glasspane
          documentGridLayout.categoricalLayout();

          m_vis.run(
              "init"); // init is needed to run here, since sizing is tightly-bound with our
                       // faux-fisheye zooming
          //                    m_vis.run("repaint");

          // appear the glasspane at appropriate size & location
          // get relative location of Visualization
          int xOffset = 0;
          int yOffset = 0;
          JComponent component = display;
          // recursively go through this Component's ancestors, summing offset information in order
          // to get the absolute position relative to window
          do {
            Point visLocation = component.getLocation();
            xOffset += visLocation.x;
            yOffset += visLocation.y;
          } while ((!component.getParent().getClass().equals(JRootPane.class))
              && (component = (JComponent) component.getParent()) != null);
          // debug
          //                    System.out.println("debug: " + this.getClass().getName() + ":
          // offsets: " + xOffset + ", " + yOffset);

          String attrIdStr =
              colorAttrName; // TODO make highlighting more general, not just based on color!

          // make sure that the clicked item is not temporarily ``disabled'' (ie, zoom state was not
          // immediately toggled by a glasspane-oriented class)
          if (disableNextZoomItem == null || disableNextZoomItem != item) {
            disableNextZoomItem = null;
            int x = (int) item.getEndX() + bufferPx + xOffset;
            int y = (int) item.getEndY() + bufferPx + yOffset;
            int w = (int) item.getDouble(WIDTH_END) - 2 * bufferPx;
            int h = (int) item.getDouble(HEIGHT_END) - 2 * bufferPx;
            // debug
            System.out.println(
                "debug: "
                    + this.getClass().getName()
                    + ": displaying sized glasspane at x="
                    + x
                    + ", y="
                    + y
                    + ", w="
                    + w
                    + ", h="
                    + h);
            glassPane.displaySizedPane((int) x, (int) y, (int) w, (int) h, item);

            AbstractDocument doc = glassPane.getAbstDoc();
            controller.writeDocTextWithHighlights(doc, nodeId, attrIdStr);

            glassPane.setBackgroundColor(new Color(docColorAction.getColor(item)));
          } else {
            disableNextZoomItem = null;
          }
        }
      }
    }
Esempio n. 22
0
 /** Returns true if the specified widget is in a toolbar. */
 static boolean isToolBarButton(JComponent c) {
   return (c.getParent() instanceof JToolBar);
 }
Esempio n. 23
0
  public static void main(String args[]) {
    JComponent ch = new JComponent() {};
    ch.getAccessibleContext();
    ch.isFocusTraversable();
    ch.setEnabled(false);
    ch.setEnabled(true);
    ch.requestFocus();
    ch.requestFocusInWindow();
    ch.getPreferredSize();
    ch.getMaximumSize();
    ch.getMinimumSize();
    ch.contains(1, 2);
    Component c1 = ch.add(new Component() {});
    Component c2 = ch.add(new Component() {});
    Component c3 = ch.add(new Component() {});
    Insets ins = ch.getInsets();
    ch.getAlignmentY();
    ch.getAlignmentX();
    ch.getGraphics();
    ch.setVisible(false);
    ch.setVisible(true);
    ch.setForeground(Color.red);
    ch.setBackground(Color.red);
    for (String font : Toolkit.getDefaultToolkit().getFontList()) {
      for (int j = 8; j < 17; j++) {
        Font f1 = new Font(font, Font.PLAIN, j);
        Font f2 = new Font(font, Font.BOLD, j);
        Font f3 = new Font(font, Font.ITALIC, j);
        Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);

        ch.setFont(f1);
        ch.setFont(f2);
        ch.setFont(f3);
        ch.setFont(f4);

        ch.getFontMetrics(f1);
        ch.getFontMetrics(f2);
        ch.getFontMetrics(f3);
        ch.getFontMetrics(f4);
      }
    }
    ch.enable();
    ch.disable();
    ch.reshape(10, 10, 10, 10);
    ch.getBounds(new Rectangle(1, 1, 1, 1));
    ch.getSize(new Dimension(1, 2));
    ch.getLocation(new Point(1, 2));
    ch.getX();
    ch.getY();
    ch.getWidth();
    ch.getHeight();
    ch.isOpaque();
    ch.isValidateRoot();
    ch.isOptimizedDrawingEnabled();
    ch.isDoubleBuffered();
    ch.getComponentCount();
    ch.countComponents();
    ch.getComponent(1);
    ch.getComponent(2);
    Component[] cs = ch.getComponents();
    ch.getLayout();
    ch.setLayout(new FlowLayout());
    ch.doLayout();
    ch.layout();
    ch.invalidate();
    ch.validate();
    ch.remove(0);
    ch.remove(c2);
    ch.removeAll();
    ch.preferredSize();
    ch.minimumSize();
    ch.getComponentAt(1, 2);
    ch.locate(1, 2);
    ch.getComponentAt(new Point(1, 2));
    ch.isFocusCycleRoot(new Container());
    ch.transferFocusBackward();
    ch.setName("goober");
    ch.getName();
    ch.getParent();
    ch.getGraphicsConfiguration();
    ch.getTreeLock();
    ch.getToolkit();
    ch.isValid();
    ch.isDisplayable();
    ch.isVisible();
    ch.isShowing();
    ch.isEnabled();
    ch.enable(false);
    ch.enable(true);
    ch.enableInputMethods(false);
    ch.enableInputMethods(true);
    ch.show();
    ch.show(false);
    ch.show(true);
    ch.hide();
    ch.getForeground();
    ch.isForegroundSet();
    ch.getBackground();
    ch.isBackgroundSet();
    ch.getFont();
    ch.isFontSet();
    Container c = new Container();
    c.add(ch);
    ch.getLocale();
    for (Locale locale : Locale.getAvailableLocales()) ch.setLocale(locale);

    ch.getColorModel();
    ch.getLocation();

    boolean exceptions = false;
    try {
      ch.getLocationOnScreen();
    } catch (IllegalComponentStateException e) {
      exceptions = true;
    }
    if (!exceptions)
      throw new RuntimeException("IllegalComponentStateException did not occur when expected");

    ch.location();
    ch.setLocation(1, 2);
    ch.move(1, 2);
    ch.setLocation(new Point(1, 2));
    ch.getSize();
    ch.size();
    ch.setSize(1, 32);
    ch.resize(1, 32);
    ch.setSize(new Dimension(1, 32));
    ch.resize(new Dimension(1, 32));
    ch.getBounds();
    ch.bounds();
    ch.setBounds(10, 10, 10, 10);
    ch.setBounds(new Rectangle(10, 10, 10, 10));
    ch.isLightweight();
    ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    ch.getCursor();
    ch.isCursorSet();
    ch.inside(1, 2);
    ch.contains(new Point(1, 2));
    ch.isFocusable();
    ch.setFocusable(true);
    ch.setFocusable(false);
    ch.transferFocus();
    ch.getFocusCycleRootAncestor();
    ch.nextFocus();
    ch.transferFocusUpCycle();
    ch.hasFocus();
    ch.isFocusOwner();
    ch.toString();
    ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
    ch.getComponentOrientation();
  }
 public boolean isInState(JComponent c) {
   return !(c.getParent() instanceof javax.swing.JViewport);
 }
Esempio n. 25
0
 /**
  * Checks and answers if this combo is in a tool bar.
  *
  * @param c the component to check
  * @return true if in tool bar, false otherwise
  */
 protected boolean isToolBarComboBox(JComponent c) {
   Container parent = c.getParent();
   return parent != null && (parent instanceof JToolBar || parent.getParent() instanceof JToolBar);
 }