Package java.awt

Examples of java.awt.Component$ComponentLock


        tab.selectAll();
      }
    }
   
    private void enableItems(LogisimMenuBar menubar) {
      Component c = tabbedPane.getSelectedComponent();
      if (c instanceof JScrollPane) {
        c = ((JScrollPane) c).getViewport().getView();
      }
      boolean support = c instanceof TabInterface;
      menubar.setEnabled(LogisimMenuBar.CUT, support);
View Full Code Here


      return true;
    }

    public Object getCellEditorValue() {
      // Returns the value contained in the editor.
      Component comp = currentEditor;
      if (comp instanceof JTextField) {
        return ((JTextField) comp).getText();
      } else if (comp instanceof JComboBox) {
        return ((JComboBox) comp).getSelectedItem();
      } else {
View Full Code Here

      if (columnIndex == 0) {
        return new JLabel(row.getLabel());
      } else {
        if (currentEditor != null) currentEditor.transferFocus();

        Component editor = row.getEditor(parent);
        if (editor instanceof JComboBox) {
          ((JComboBox) editor).addActionListener(this);
          editor.addFocusListener(this);
        } else if (editor instanceof JInputComponent) {
          JInputComponent input = (JInputComponent) editor;
          MyDialog dlog;
          Window parent = AttrTable.this.parent;
          if (parent instanceof Frame) {
            dlog = new MyDialog((Frame) parent, input);
          } else {
            dlog = new MyDialog((Dialog) parent, input);
          }
          dlog.setVisible(true);
          Object retval = dlog.getValue();
          try {
            row.setValue(retval);
          } catch (AttrTableSetException e) {
            JOptionPane.showMessageDialog(parent, e.getMessage(),
                Strings.get("attributeChangeInvalidTitle"),
                JOptionPane.WARNING_MESSAGE);
          }
          editor = new JLabel(row.getValue());
        } else {
          editor.addFocusListener(this);
        }
        currentRow = row;
        currentEditor = editor;
        return editor;
      }
View Full Code Here

    // FocusListener methods
    //
    public void focusLost(FocusEvent e) {
      Object dst = e.getOppositeComponent();
      if (dst instanceof Component) {
        Component p = (Component) dst;
        while (p != null && !(p instanceof Window)) {
          if (p == AttrTable.this) {
            // switch to another place in this table,
            // no problem
            return;
          }
          p = p.getParent();
        }
        // focus transferred outside table; stop editing
        editor.stopCellEditing();
      }
    }
View Full Code Here

  }

  private static class ChannelListCellRenderer extends DefaultListCellRenderer {
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
        boolean cellHasFocus) {
      Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

      if (c instanceof JLabel && value instanceof Channel) {
        ((JLabel) c).setIcon(UiUtilities.createChannelIcon(((Channel) value).getIcon()));
      }
View Full Code Here

      int column = columnAtPoint(event.getPoint());
      int row = rowAtPoint(event.getPoint());
      if (column >= 1 && column <= 2 && row >= 0) {
        Object value = getValueAt(row, column);
        if (value != null) {
          Component renderComp = getCellRenderer(row, column).getTableCellRendererComponent(this, value, false, false, row, column);
          if (renderComp instanceof Container) {
            Container container = (Container) renderComp;
            if (container.getComponentCount() > 0 && container.getComponent(0) instanceof ProgramPanel) {
              ProgramPanel panel = (ProgramPanel) container.getComponent(0);
              Rectangle cellRect = getCellRect(row, column, true);
View Full Code Here

      throw new IllegalArgumentException("index less than zero.");
    }

    JMenuItem menuItem = null;

    Component component = getMenuComponent(pos);
    if (component instanceof JMenuItem) {
      menuItem = (JMenuItem) component;
    }

    return menuItem;
View Full Code Here

    if (scrollableItems.size() > maxItemsToDisplay && super.getMenuComponentCount() - 4 < maxItemsToDisplay) {

      if (beginIndex + maxItemsToDisplay <= scrollableItems.size()) {
        int end = beginIndex + maxItemsToDisplay - 1;
        Component addComponent = scrollableItems.elementAt(end);

        super.add(addComponent, maxItemsToDisplay + 1);
      } else if (beginIndex > 0 && beginIndex <= scrollableItems.size()) {

        Component addComponent = scrollableItems.elementAt(--beginIndex);

        super.add(addComponent, 2);
      }
    } else if (beginIndex > 0 && beginIndex + maxItemsToDisplay > scrollableItems.size()) {
      beginIndex--;
View Full Code Here

  }

  private Component getFirstVisibleAndEnabledComponent() {
    if (super.getMenuComponentCount() > 4) {
      for (int index = 2; index < super.getMenuComponentCount() - 2; index++) {
        Component component = super.getMenuComponent(index);
        if (component instanceof MenuElement && component.isEnabled()) {
          return component;
        }
      }
    }
    return null;
View Full Code Here

  }

  private Component getLastVisibleAndEnabledComponent() {
    if (super.getMenuComponentCount() > 4) {
      for (int index = super.getMenuComponentCount() - 3; index > 1; index--) {
        Component component = super.getMenuComponent(index);

        if (component instanceof MenuElement && component.isEnabled()) {
          return component;
        }
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of java.awt.Component$ComponentLock

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.