本文整理汇总了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();
}
}
}
示例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;
}
示例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);
}
示例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());
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
示例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));
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
示例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();
}
}
示例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;
}
示例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();
}
};
}