Package java.awt

Examples of java.awt.Component


    JPopupMenu popup = getChooseClassPopupMenu();

    // show the popup where the source component is
    if (e.getSource() instanceof Component) {
      Component comp = (Component) e.getSource();
      popup.show(comp, comp.getX(), comp.getY());
      popup.pack();
      popup.repaint();
    }
  }
      });
View Full Code Here


    m_ElementEditor = null; m_ListModel = null;
    removeAll();
    if ((o != null) && (o.getClass().isArray())) {
      Class elementClass = o.getClass().getComponentType();   
      PropertyEditor editor = PropertyEditorManager.findEditor(elementClass);
      Component view = null;
      ListCellRenderer lcr = new DefaultListCellRenderer();
      if (editor != null) {
  if (editor instanceof GenericObjectEditor) {
    ((GenericObjectEditor) editor).setClassType(elementClass);
  }
View Full Code Here

    instanceof PropertyVetoException) {
              String message = "WARNING: Vetoed; reason is: "
                               + ex.getTargetException().getMessage();
        System.err.println(message);
             
              Component jf;
              if(evt.getSource() instanceof JPanel)
                  jf = ((JPanel)evt.getSource()).getParent();
              else
                  jf = new JFrame();
              JOptionPane.showMessageDialog(jf, message,
                                            "error",
                                            JOptionPane.WARNING_MESSAGE);
              if(jf instanceof JFrame)
                  ((JFrame)jf).dispose();

            } else {
        System.err.println(ex.getTargetException().getClass().getName()+
         " while updating "+ property.getName() +": "+
         ex.getTargetException().getMessage());
              Component jf;
              if(evt.getSource() instanceof JPanel)
                  jf = ((JPanel)evt.getSource()).getParent();
              else
                  jf = new JFrame();
              JOptionPane.showMessageDialog(jf,
View Full Code Here

    }
  }

  private boolean containsProgram(final JMenu menu, ProgramMenuItem pItem) {
    for (int i = 0; i < menu.getMenuComponentCount(); i++) {
      Component comp = menu.getMenuComponent(i);
      if (comp instanceof ProgramMenuItem) {
        ProgramMenuItem oldItem = (ProgramMenuItem) comp;
        if (oldItem.getProgram().equals(pItem.getProgram())) {
          return true;
        }
View Full Code Here

        return getValueAt(0, column).getClass();
      }

      public Component prepareRenderer(TableCellRenderer renderer,
          int row, int column) {
        Component c = super.prepareRenderer(renderer, row, column);
        if (!c.getBackground().equals(getSelectionBackground()))
        {
          String type = (String)getModel().getValueAt(row, 3);
          Color backgroundIndicator = null;
          if (type.startsWith("ERROR")) {
            backgroundIndicator = Color.RED;
          } else if (type.startsWith("WARNING")) {
            backgroundIndicator = Color.YELLOW;
          } else if (type.startsWith("INTERRUPTED")) {
            backgroundIndicator = Color.MAGENTA;
          }
          c.setBackground(backgroundIndicator);
        }
        return c;
      }
    };
   
View Full Code Here

  /**
   * Displays this panel in a modal dialog box.
   */
  public void displayView(View parentView) {
    final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (SwingTools.showConfirmDialog((JComponent)parentView,
            this, this.dialogTitle, this.nameTextField) == JOptionPane.OK_OPTION) {
      if (this.controller.getBackFaceShown() != null
          && this.controller.getBackFaceShown()) {
        JRootPane rootPane = SwingUtilities.getRootPane((JComponent)parentView);
        Cursor defaultCursor = rootPane.getCursor();
        try {
          rootPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
          this.controller.setModel(ImportFurnitureTaskPanel.copyToTemporaryOBJContent(
              this.iconComponent.getModel(), this.controller.getModel()));
        } catch (IOException e) {
          JOptionPane.showMessageDialog(rootPane,
              preferences.getLocalizedString(FurniturePanel.class, "backFaceShownError"),
              preferences.getLocalizedString(FurniturePanel.class, "errorTitle"),
              JOptionPane.ERROR_MESSAGE);
        } finally {
          rootPane.setCursor(defaultCursor);
        }
      }
      this.controller.modifyFurniture();
    }
    if (focusOwner != null) {
      focusOwner.requestFocusInWindow();
    }
  }
View Full Code Here

    mAction.putValue(Action.NAME,"<html>" + a.getValue(Action.NAME)+ "</html>");
    mAction.putValue(Action.ACTION_COMMAND_KEY,a.getValue(Action.ACTION_COMMAND_KEY));
    mAction.putValue(Action.SMALL_ICON,a.getValue(Action.SMALL_ICON));

    Component c;

    if(ContextMenuSeparatorAction.getInstance().equals(menu.getAction())) {
      parent.add(Box.createRigidArea(new Dimension(0,2)));
      c = parent.add(new JSeparator());
      parent.add(Box.createRigidArea(new Dimension(0,2)));
View Full Code Here

        if (image instanceof BufferedImage) {
            return (BufferedImage)image;

        } else {
            @SuppressWarnings("serial")
      MediaTracker tracker = new MediaTracker(new Component(){}); // not sure if this is the right thing to do.
            tracker.addImage(image, 0);
            try {
                tracker.waitForAll();
            } catch (InterruptedException e) {
                throw new IOException(e.getMessage());
View Full Code Here

        setBorderPainted(false);
        //Making nice rollover effect
        //we use the same listener for all buttons
        addMouseListener(new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            Component component = e.getComponent();

            if (component instanceof AbstractButton) {
              AbstractButton button = (AbstractButton) component;
              button.setBorderPainted(true);
            }
          }

          public void mouseExited(MouseEvent e) {
            Component component = e.getComponent();
            if (component instanceof AbstractButton) {
              AbstractButton button = (AbstractButton) component;
              button.setBorderPainted(false);
            }
          }
View Full Code Here

      enableItems(menubar);
    }
   
    public void actionPerformed(ActionEvent e) {
      Object src = e.getSource();
      Component c = tabbedPane.getSelectedComponent();
      if (c instanceof JScrollPane) {
        c = ((JScrollPane) c).getViewport().getView();
      }
      if (!(c instanceof TabInterface)) return;
      TabInterface tab = (TabInterface) c;
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.