本文整理匯總了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();
}
};
}