當前位置: 首頁>>代碼示例>>Java>>正文


Java Container.getParent方法代碼示例

本文整理匯總了Java中java.awt.Container.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getParent方法的具體用法?Java Container.getParent怎麽用?Java Container.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Container的用法示例。


在下文中一共展示了Container.getParent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: formAncestorAdded

import java.awt.Container; //導入方法依賴的package包/類
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
    if (addedUndoListener) {
        return;
    }
    addedUndoListener = true;
    if (evt.getComponent() instanceof Container) {
        Container anc = (Container) evt.getComponent();
        while (anc != null && anc instanceof Container) {
            if (anc instanceof UndoableEditListener) {
                editSupport.addUndoableEditListener((UndoableEditListener) anc);
                break;
            }
            anc = anc.getParent();
        }
    }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:17,代碼來源:VPotSliderTextControl.java

示例2: getContainers

import java.awt.Container; //導入方法依賴的package包/類
/**
 * Returns an array of containers for this component.
 *
 * @return an array of containers
 */
public Container[] getContainers() {
    int counter = 0;
    Container cont = getSource().getParent();
    if (cont == null) {
        return new Container[0];
    }
    do {
        counter++;
    } while ((cont = cont.getParent()) != null);
    Container[] res = new Container[counter];
    cont = getSource().getParent();
    counter = 0;
    do {
        counter++;
        res[counter - 1] = cont;
    } while ((cont = cont.getParent()) != null);
    return res;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:ComponentOperator.java

示例3: findContextHeirarchy

import java.awt.Container; //導入方法依賴的package包/類
public JSONObject findContextHeirarchy(Container parent) {
    JSONObject r = null;
    JSONObject current = null;
    while (parent != null && !(parent instanceof Window)) {
        if (ContextManager.isContext(parent)) {
            JSONObject pContext = getContextJSONObject(parent);
            if (r == null) {
                r = pContext;
            }
            if (current != null) {
                current.put("container", pContext);
            }
            current = pContext;
        }
        parent = parent.getParent();
    }
    return addWindowParents(r, (Window) parent, current);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:RComponent.java

示例4: updateColumnSelectionMouseListener

import java.awt.Container; //導入方法依賴的package包/類
/**
 * This method update mouse listener on the scrollPane if it is needed.
 * It also recomputes the model of searchCombo. Both actions are needed after
 * the set of visible columns is changed.
 */
void updateColumnSelectionMouseListener() {
    Container p = getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane)gp;
            // Make certain we are the viewPort's view and not, for
            // example, the rowHeaderView of the scrollPane -
            // an implementor of fixed columns might do this.
            JViewport viewport = scrollPane.getViewport();
            if (viewport == null || viewport.getView() != this) {
                return;
            }
            scrollPane.removeMouseListener(columnSelectionMouseListener);
            if (getColumnModel().getColumnCount() == 0) {
                scrollPane.addMouseListener(columnSelectionMouseListener);
            }
        }
    }
    if (searchCombo != null) {
        searchCombo.setModel(getSearchComboModel());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ETable.java

示例5: formAncestorAdded

import java.awt.Container; //導入方法依賴的package包/類
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
            if (addedUndoListener) {
                return;
            }
            addedUndoListener = true;
            if (evt.getComponent() instanceof Container) {
                Container anc = (Container) evt.getComponent();
                while (anc != null && anc instanceof Container) {
                    if (anc instanceof UndoableEditListener) {
                        editSupport.addUndoableEditListener((UndoableEditListener) anc);
                        break;
                    }
                    anc = anc.getParent();
                }
            }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:17,代碼來源:IPotSliderTextControl.java

示例6: addNotify

import java.awt.Container; //導入方法依賴的package包/類
/**
	 *	Assigns the scrollPane.
	 */
	public void addNotify() {
		super.addNotify();
		Container c = getParent();
		while(c != null) {
			if( c instanceof JScrollPane ) {
				scrollPane = (JScrollPane) c;

//				***** GMA 1.6.4: Add adjustment listeners to scroll bars to perform pan
				scrollPane.getHorizontalScrollBar().addAdjustmentListener(this);
				scrollPane.getVerticalScrollBar().addAdjustmentListener(this);

				return;
			}
			c = c.getParent();
		}
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:20,代碼來源:XMap.java

示例7: unconfigureEnclosingScrollPane

import java.awt.Container; //導入方法依賴的package包/類
@Override
protected void unconfigureEnclosingScrollPane() {
	Container p = getParent();
	if (p instanceof JViewport) {
		Container gp = p.getParent();
		if (gp instanceof JScrollPane) {
			JScrollPane scrollPane = (JScrollPane) gp;
			// Make certain we are the viewPort's view and not, for
			// example, the rowHeaderView of the scrollPane -
			// an implementor of fixed columns might do this.
			JViewport viewport = scrollPane.getViewport();
			if (viewport == null || viewport.getView() != this) {
				return;
			}
			scrollPane.setColumnHeaderView(null);
			scrollPane.setRowHeaderView(null);

			viewport.removeChangeListener(scrollListener);
			rowHeader.uninstall();
		}
	}
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:23,代碼來源:ExactTable.java

示例8: alloyRepaint

import java.awt.Container; //導入方法依賴的package包/類
/** Repaint this component. */
public void alloyRepaint() {
	Container c = getParent();
	while (c != null) {
		if (c instanceof JViewport)
			break;
		else
			c = c.getParent();
	}
	setSize((int) (graph.getTotalWidth() * scale), (int) (graph.getTotalHeight() * scale));
	if (c != null) {
		c.invalidate();
		c.repaint();
		c.validate();
	} else {
		invalidate();
		repaint();
		validate();
	}
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:21,代碼來源:GraphViewer.java

示例9: addViewportListener

import java.awt.Container; //導入方法依賴的package包/類
private void addViewportListener(JEditorPane pane) {
    Container parent = pane.getParent();
    
    if (parent instanceof JLayeredPane) {
        parent = parent.getParent();
    }

    if (parent instanceof JViewport) {
        JViewport viewport = (JViewport) parent;

        viewport.addChangeListener(WeakListeners.change(AnnotationHolder.this, viewport));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:AnnotationHolder.java

示例10: getApplication

import java.awt.Container; //導入方法依賴的package包/類
private Application getApplication() {
	Container parent = this.getTopLevelAncestor();
	if(parent instanceof Application)
		return (Application)parent;
	parent = this.getParent();
	while((parent=parent.getParent())!=null)
		if(parent instanceof Application)
			break;
	return parent!=null?(Application)parent:null;
}
 
開發者ID:kristian,項目名稱:JDigitalSimulator,代碼行數:11,代碼來源:Simulation.java

示例11: configureEnclosingScrollPane

import java.awt.Container; //導入方法依賴的package包/類
/**
 * duplicated to avoid repeating the same checks multiple times
 */
@Override
protected void configureEnclosingScrollPane() {
	Container p = getParent();
	if (p instanceof JViewport) {
		Container gp = p.getParent();
		if (gp instanceof JScrollPane) {
			JScrollPane scrollPane = (JScrollPane) gp;
			// Make certain we are the viewPort's view and not, for
			// example, the rowHeaderView of the scrollPane -
			// an implementor of fixed columns might do this.
			JViewport viewport = scrollPane.getViewport();
			if (viewport == null || viewport.getView() != this) {
				return;
			}
			scrollPane.setColumnHeaderView(getTableHeader());
			Border border = scrollPane.getBorder();
			if (border == null || border instanceof UIResource) {
				scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
			}
			//rowHeader=new RowHeader(dataModel);
			rowHeader.setRowHeight(CommonConstants.ROW_HEIGHT);
			rowHeader.install(this, scrollPane);
			installLabels(scrollPane);
			installSelectAllButton(scrollPane);
			viewport.addChangeListener(scrollListener);
		}
	}
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:32,代碼來源:ExactTable.java

示例12: getInstance

import java.awt.Container; //導入方法依賴的package包/類
/**
 * Returns a new instance of DistributionsEditor, given parent container (used to find
 * top level Dialog or Frame to create this dialog as modal)
 * @param parent any type of container contained in a Frame or Dialog
 * @param initial initial distribution to be set
 * @param recursive indicated if the DistributionEditor is used to select a nested distribution
 * @return new instance of DistributionsEditor
 */
public static DistributionsEditor getInstance(Container parent, Distribution initial, boolean recursive) {
	// Finds top level Dialog or Frame to invoke correct costructor
	while (!(parent instanceof Frame || parent instanceof Dialog)) {
		parent = parent.getParent();
	}

	if (parent instanceof Frame) {
		return new DistributionsEditor((Frame) parent, initial, recursive);
	} else {
		return new DistributionsEditor((Dialog) parent, initial, recursive);
	}
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:21,代碼來源:DistributionsEditor.java

示例13: addNotify

import java.awt.Container; //導入方法依賴的package包/類
public void addNotify() {
	super.addNotify();
	Container c = getParent();
	while( c!=null ) {
		if( c instanceof JScrollPane ) {
			scrollPane = (JScrollPane)c;
			return;
		}
		c = c.getParent();
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:12,代碼來源:SCSImage.java

示例14: getTopmostProvider

import java.awt.Container; //導入方法依賴的package包/類
Container getTopmostProvider(Container focusCycleRoot, Component aComponent) {
    Container aCont = aComponent.getParent();
    Container ftp = null;
    while (aCont  != focusCycleRoot && aCont != null) {
        if (aCont.isFocusTraversalPolicyProvider()) {
            ftp = aCont;
        }
        aCont = aCont.getParent();
    }
    if (aCont == null) {
        return null;
    }
    return ftp;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:SortingFocusTraversalPolicy.java

示例15: getData

import java.awt.Container; //導入方法依賴的package包/類
public Iterator<String> getData(int data){
		Container c = ds.map.getParent();
		while (!(c instanceof Frame || c == null)) c = c.getParent();
		DBOutputConfigDialog dialog = new DBOutputConfigDialog((Frame) c,ds,xIndex,yIndex);
		final int indices[] = dialog.indices;
		if (indices==null) return null;

		return new Iterator<String>() {
			int i=-1;
			public void remove() {
				throw new UnsupportedOperationException();
			}

			public boolean hasNext() {
				return i<ds.tm.displayToDataIndex.size();
			}

			public String next() {
				StringBuffer s = new StringBuffer();
				for (int z = 0;z<indices.length;z++){
					if (i==-1)	s.append(ds.header.get(indices[z]));
					else {
//						int x = ((Integer)ds.tm.displayIndex.get(i)).intValue();
						s.append((ds.rowData
									.get(ds.tm.displayToDataIndex.get(i)))
										.get(indices[z]));
					}
					if (z<indices.length-1) s.append("\t");
				}
				i++;
				return s.toString();
			}
		};
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:35,代碼來源:DataSetGraph.java


注:本文中的java.awt.Container.getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。