Package java.awt

Examples of java.awt.Component


      if (len > 2 && path[len - 3] instanceof ScrollableMenu && path[len - 2] instanceof JPopupMenu) {

        ScrollableMenu menu = (ScrollableMenu) path[len - 3];
        MenuElement selected = path[len - 1];
        Component component = (direction == ScrollDirection.UP ? menu
            .getFirstVisibleAndEnabledComponent() : menu
            .getLastVisibleAndEnabledComponent());
        if (component == null || selected == component) {
          boolean enableScroll = (direction == ScrollDirection.UP ? menu.scrollUp.mEnableScroll
              : menu.scrollDown.mEnableScroll);
          if (enableScroll) {
            do {
              if (direction == ScrollDirection.UP) {
                menu.scrollUpClicked();
                component = menu.getFirstVisibleComponent();
                enableScroll = menu.scrollUp.mEnableScroll;
              } else {
                menu.scrollDownClicked();
                component = menu.getLastVisibleComponent();
                enableScroll = menu.scrollDown.mEnableScroll;
              }
            } while (component != null && (!(component instanceof MenuElement)) && (component instanceof JSeparator)
                && enableScroll);

            if (component == null || !component.isEnabled()
                || (!(component instanceof MenuElement))) {
              return;
            }
          } else {
            for (int index = 0; index < menu.getMenuComponentCount(); index++) {
View Full Code Here


    if (index >= 0) {
      Rectangle bounds = getCellBounds(index, index);
      if (bounds != null) {
        int x = point.x - bounds.x;
        int y = point.y - bounds.y;
        Component component = getCellRenderer()
            .getListCellRendererComponent(this, mPrograms.elementAt(index),
                index, false, false);
        if (component != null && component instanceof Container) {
          Container container = (Container) component;
          component = container.getComponent(1);
View Full Code Here

      this.tableCellRenderer = tableCellRenderer;
    }

    public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
      Component c = tableCellRenderer.getTableCellRendererComponent(table,
          value, isSelected, hasFocus, row, column);
      if (c instanceof JLabel) {
        JLabel l = (JLabel) c;
        l.setHorizontalTextPosition(SwingConstants.LEFT);
        int modelColumn = table.convertColumnIndexToModel(column);
View Full Code Here

      }
    }

    public Component getListCellRendererComponent(JList list, Object value,
        int index, boolean isSelected, boolean cellHasFocus) {
      Component comp = mOldRenderer.getListCellRendererComponent(list, value,
          index, isSelected, cellHasFocus);
      if (index != -1 && mIndexes.contains(index + 1)) { // index==1 if renderer is
                                                      // used to paint current
                                                      // value in combo
        mSeparatorPanel.removeAll();
View Full Code Here

      return;
    }

    // me.getComponent(...) returns the heavy weight component on which event
    // occured
    Component comp = SwingUtilities.getDeepestComponentAt(me.getComponent(), me.getX(), me.getY());

    // interested only in textcomponents
    if (!(comp instanceof JTextComponent)) {
      return;
    }
View Full Code Here

  public void storeProperties() {
    Property property = getProperty();
    if (property instanceof SplitViewProperty && mComponent instanceof JSplitPane && !MainFrame.isStarting()) {
      JSplitPane splitPane = (JSplitPane)mComponent;
      SplitViewProperty prop = (SplitViewProperty)property;
      Component comp;
      if (prop.getLeftComponentFixed()) {
        comp = splitPane.getLeftComponent();
      }
      else {
        comp = splitPane.getRightComponent();
      }

      if (comp != null) {
        if (prop.getVerticalSplit()) {
          prop.setFixedComponentWidth(comp.getHeight());
        }
        else {
          if(prop.getLeftComponentFixed()) {
            prop.setFixedComponentWidth(comp.getWidth());
          } else {
            prop.setFixedComponentWidth(comp.getWidth() + splitPane.getDividerSize());
          }
        }
      }
    }
View Full Code Here

      int width = 0;
      int height = 0;
      int cnt = container.getComponentCount();

      for (int i = 0; i<cnt; i++) {
        Component c = container.getComponent(i);
        Dimension dim = c.getPreferredSize();
        if (dim.getWidth() > width) {
          width = (int) dim.getWidth();
        }
        if (dim.getHeight() > height) {
          height = (int) dim.getHeight();
View Full Code Here

            vIndent = height-rowHeight;
        }


        for (int i = 0; i<cnt; i++) {
          Component c = container.getComponent(i);
          int x = (i%compsPerRow)*(compDimension.width + mHGap) + hIndent;
          int y = (i/compsPerRow)*(compDimension.height+ mVGap) + vIndent;
          c.setLocation(x, y);
          c.setSize(compDimension);
        }
      }
    }
View Full Code Here

public NewTextFieldCommand(SectionWidget sw, MouseEvent e) {
    super(sw, "text", new Point(e.getPoint()));

    // Translate insertLoc's mouse coordinates to SectionFieldPanel
    // coordinates.
    Component c = e.getComponent();
    while (!(c instanceof SectionFieldPanel)) {
  java.awt.Rectangle bounds = c.getBounds();
  insertLoc.translate(bounds.x, bounds.y);
  c = c.getParent();
  if (c == null)    // Should never happen
      break;
    }
}
View Full Code Here

    mPanel.add(mIconLabel, cc.xy(3, 2));
    mPanel.add(mNoteLabel, cc.xy(1, 4));
  }
 
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    Component def = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
   
    if (value instanceof ReminderListItem) {
      final ReminderListItem listItem = (ReminderListItem) value;
      Integer minutes = listItem.getMinutes();
     
      mTextLabel.setText(ReminderFrame.getStringForMinutes(minutes.intValue()));
     
      mTextLabel.setOpaque(def.isOpaque());
      mTextLabel.setForeground(def.getForeground());
      mTextLabel.setBackground(def.getBackground());
     
      mPanel.setOpaque(def.isOpaque());
      mPanel.setBackground(def.getBackground());
     
      final String comment = listItem.getComment();
      if (comment != null && !comment.isEmpty()) {
        mNoteLabel.setVisible(true);
        mNoteLabel.setText(mLocalizer.msg("note", "Note: {0}", comment));
        mNoteLabel.setOpaque(def.isOpaque());
        mNoteLabel.setForeground(def.getForeground());
        mNoteLabel.setBackground(def.getBackground());
      } else {
        mNoteLabel.setVisible(false);
      }
     
      return mPanel;
View Full Code Here

TOP

Related Classes of java.awt.Component

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.