Package java.awt

Examples of java.awt.Component


            bfPanel.setAlignmentY(Component.CENTER_ALIGNMENT); // BOTTOM
            tabs.addTab("Layer Visibility", bfPanel);

            for (int i = 0; i < layerComps.length; i++) {
                Layer layer = (Layer) layerComps[i];
                Component layerGUI = layer.getGUI();
                if (layerGUI != null) {
                    tabs.addTab(layer.getName(), layerGUI);
                }

                VisHelper layerVisibility = new VisHelper(layer);
View Full Code Here


     * Stores the source view in the entry editor, if one is open, has the source view
     * selected and the source has been edited.
     * @return boolean false if there is a validation error in the source panel, true otherwise.
     */
    public boolean entryEditorAllowsChange() {
      Component c = splitPane.getBottomComponent();
      if ((c != null) && (c instanceof EntryEditor)) {
        return ((EntryEditor)c).lastSourceAccepted();
      }
      else
        return true;
View Full Code Here

      else
        return true;
    }

    public void moveFocusToEntryEditor() {
      Component c = splitPane.getBottomComponent();
      if ((c != null) && (c instanceof EntryEditor)) {
        new FocusRequester(c);
      }
    }
View Full Code Here

    }else{
      String subMenu = subMenus[0];
      String suffix = action.substring(subMenu.length()+1);

      // Search in currentMenu components, if the subMenu does exist already
      Component c[] =  currentMenu.getComponents();
      for (int i=0; i<c.length; ++i) {
        if ((c[i] instanceof JMenu) && ((JMenu)c[i]).getText().equals(subMenu)){
          return createMenuItem(((JMenu)c[i]), suffix, icon);
        }
      }
View Full Code Here

 

  /** Adds a menu entry in the tools menu */
 
  public void setMenu(JMenuBar mb) {
    Component c[] = mb.getComponents();
    JMenu jm =null;
    boolean found=false;
   
    for (int i=0; i<c.length; ++i) {
      jm = (JMenu)c[i];
View Full Code Here

    }

    class SourceCellRenderer extends DefaultTreeCellRenderer {
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
                boolean leaf, int row, boolean hasFocus) {
            Component c = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
            if (value == null) {
                return c;
            }
            if (value instanceof SourceNode) {
                Object o = ((SourceNode) value).getUserObject();
                if (o instanceof ExpressionDataSource) {
                    setText(DataInfo.toString(o) + " = " + DataInfo.getComment(o));
                }
                Icon icon = (Icon) dataSourceIcons.get(o.getClass());
                if (icon != null) {
                    setIcon(icon);
                } else {
                    Class parent = o.getClass().getSuperclass();
                    if (parent != null) {
                        icon = (Icon) dataSourceIcons.get(parent);
                        if (icon != null) {
                            setIcon(icon);
                        }
                    }
                }
                if (((SourceNode) value).isLocked()) {
                    c.setForeground(SystemColor.controlDkShadow);
                }
            }
            return c;
        }
View Full Code Here

        // remove the tabPane
        tabPane = null;
        removeAll();
        if(firstSplitBorder!=null){
          Element ef=getElement(firstSplitBorder.comp);
          Component c=ef.owner;
          if(tabSplit==c){
            add(ef.border);
            ef.owner=ef.border;
          }
          else{
            add(c);
          }
        }
        tabSplit = null;
      }
    } else if (e.owner == e.border) {
      removeAll();
      firstSplitBorder=null;
    } else if (e.owner instanceof JSplitPane) {
      JSplitPane sp = (JSplitPane) e.owner;
      if ((sp.getLeftComponent() instanceof SplitBorder)
          && ((SplitBorder) (sp.getLeftComponent())).comp == e.comp) {
        Component r=sp.getRightComponent();
        if(sp.getParent() instanceof JSplitPane){
          JSplitPane previous = (JSplitPane)sp.getParent();
          sp.removeAll();
          previous.setRightComponent(r);
          if(r instanceof SplitBorder){
            SplitBorder b=(SplitBorder)r;
            Element eb=(Element)getElement(b.comp);
            if(previous.getLeftComponent()==tabPane){
              firstSplitBorder=b;
            }
            eb.owner=previous;
          }
          else if(r instanceof JSplitPane){
          }
          else {
            throw new RuntimeException(
                "SplitTabPane unexpected state : right component = "+r);
          }
        }
        else if(sp.getParent()==this){
          sp.removeAll();
          removeAll();
          add(r);
          if(r instanceof SplitBorder){
            SplitBorder b=(SplitBorder)r;
            Element eb=(Element)getElement(b.comp);
            eb.owner=b;
            firstSplitBorder=b;
          }
          else if(r instanceof JSplitPane){
            firstSplitBorder=(SplitBorder)((JSplitPane)r).getLeftComponent();
          }
          else {
            throw new RuntimeException(
                "SplitTabPane unexpected state : right component = "+r);
          }
        }
        else{
          throw new RuntimeException(
          "SplitTabPane unexpected state : root split is not owned by this");
        }
      } else if ((sp.getRightComponent() instanceof SplitBorder)
          && ((SplitBorder) (sp.getRightComponent())).comp == e.comp) {
        Component left = sp.getLeftComponent();
        if (left instanceof JSplitPane) {
          throw new RuntimeException(
              "SplitTabPane unexpected state : left element is a split");
        } else {
          if (left == tabPane) {
View Full Code Here

        // Get width of column header
        TableCellRenderer renderer = col.getHeaderRenderer();
        if (renderer == null) {
            renderer = table.getTableHeader().getDefaultRenderer();
        }
        Component comp = renderer.getTableCellRendererComponent(
            table, col.getHeaderValue(), false, false, 0, 0);
        width = comp.getPreferredSize().width;
   
        // Get maximum width of column data
        for (int r=0; r<table.getRowCount(); r++) {
            renderer = table.getCellRenderer(r, vColIndex);
            comp = renderer.getTableCellRendererComponent(
                table, table.getValueAt(r, vColIndex), false, false, r, vColIndex);
            width = Math.max(width, comp.getPreferredSize().width);
        }
   
        // Add margin
        width += 2*margin;
   
View Full Code Here

         */
        public void layoutContainer(Container target) {
            if (target.getComponentCount() == 0) {
                return;
            }
            Component c = target.getComponent(0);
            Dimension d = target.getSize();
            c.setSize(d.width, d.height);
            c.setLocation(0, 0);
        }
View Full Code Here

 
 
 
  /** Adds a menu entry in the tools menu */
  public void setMenu(JMenuBar mb) {
    Component c[] = mb.getComponents();
    for (int i=0; i<c.length; ++i) {
      JMenu jm = (JMenu)c[i];
      if (jm.getText().equals(JSynopticPanels.resources.getString("toolsMenu"))) {
        jmi = new JMenuItem(resources.getString("LookAndFeel..."));
        jm.add(jmi);
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.