当前位置: 首页>>代码示例>>Java>>正文


Java Container.validate方法代码示例

本文整理汇总了Java中java.awt.Container.validate方法的典型用法代码示例。如果您正苦于以下问题:Java Container.validate方法的具体用法?Java Container.validate怎么用?Java Container.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Container的用法示例。


在下文中一共展示了Container.validate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveGameRecord

import java.awt.Container; //导入方法依赖的package包/类
public void saveGameRecord(JFrame frame, String competidores, PvpScore pvpScore) {
    try {
        frame.validate();
        frame.repaint();            
        Container c = frame.getContentPane();
        c.validate();
        c.repaint();
        BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
        c.paint(im.getGraphics());
        pvpScore.setGameRecord(im);
    } catch (Exception ex) {
        Logger.getLogger(OthelloTournament.class
                .getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:data-library,项目名称:jOthelloT,代码行数:16,代码来源:OthelloTournament.java

示例2: 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

示例3: dockToolBar

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Docks the associated toolbar at the secified edge and indicies.
 */
public void dockToolBar(final int edge, final int row, final int index) {
    final Container target = ourDockLayout.getTargetContainer();
    if (target == null)
        return;

    target.remove(ourToolBar);
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame != null) {
        floatFrame.setVisible(false);
        floatFrame.getContentPane().remove(ourToolBar);
    }

    ourConstraints.setEdge(edge);
    ourConstraints.setRow(row);
    ourConstraints.setIndex(index);

    target.add(ourToolBar, ourConstraints);
    ourToolBarShouldFloat = false;

    target.validate();
    target.repaint();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:26,代码来源:Handler.java

示例4: hideToolBar

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Hides the associated toolbar by removing it from its dock or by closing
 * its client floating frame.
 */
public void hideToolBar() {
    final Container target = ourDockLayout.getTargetContainer();
    target.remove(ourToolBar);
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame != null) {
        floatFrame.setVisible(false);
        floatFrame.getContentPane().remove(ourToolBar);
    }

    target.validate();
    target.repaint();
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:17,代码来源:Handler.java

示例5: floatToolBar

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Floats the associated toolbar at the specified screen location,
 * optionally centering the floating frame on this point.
 */
public void floatToolBar(int x, int y, final boolean center) {
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame == null)
        return;

    final Container target = ourDockLayout.getTargetContainer();
    if (target != null)
        target.remove(ourToolBar);
    floatFrame.setVisible(false);
    floatFrame.getContentPane().remove(ourToolBar);

    ourToolBar.setOrientation(ToolBarLayout.HORIZONTAL);
    floatFrame.getContentPane().add(ourToolBar, BorderLayout.CENTER);
    floatFrame.pack();

    if (center) {
        x -= floatFrame.getWidth() / 2;
        y -= floatFrame.getHeight() / 2;
    }

    // x and y are given relative to screen
    floatFrame.setLocation(x, y);
    floatFrame.setTitle(ourToolBar.getName());
    floatFrame.setVisible(true);

    ourToolBarShouldFloat = true;

    if (target != null) {
        target.validate();
        target.repaint();
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:37,代码来源:Handler.java

示例6: 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:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:GraphViewer.java

示例7: placeToolbar

import java.awt.Container; //导入方法依赖的package包/类
private void placeToolbar() {
	String loc = AppPreferences.TOOLBAR_PLACEMENT.get();
	Container contents = getContentPane();
	contents.remove(toolbar);
	mainPanelSuper.remove(toolbar);
	if (AppPreferences.TOOLBAR_HIDDEN.equals(loc)) {
		; // don't place value anywhere
	} else if (AppPreferences.TOOLBAR_DOWN_MIDDLE.equals(loc)) {
		toolbar.setOrientation(Toolbar.VERTICAL);
		mainPanelSuper.add(toolbar, BorderLayout.WEST);
	} else { // it is a BorderLayout constant
		Object value = BorderLayout.NORTH;
		for (Direction dir : Direction.cardinals) {
			if (dir.toString().equals(loc)) {
				if (dir == Direction.EAST)
					value = BorderLayout.EAST;
				else if (dir == Direction.SOUTH)
					value = BorderLayout.SOUTH;
				else if (dir == Direction.WEST)
					value = BorderLayout.WEST;
				else
					value = BorderLayout.NORTH;
			}
		}

		contents.add(toolbar, value);
		boolean vertical = value == BorderLayout.WEST || value == BorderLayout.EAST;
		toolbar.setOrientation(vertical ? Toolbar.VERTICAL : Toolbar.HORIZONTAL);
	}
	contents.validate();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:32,代码来源:Frame.java

示例8: setEnlargedView

import java.awt.Container; //导入方法依赖的package包/类
/**
 * This method shows the enlarged dialog for the current ontology class instances
 * in order to provide an easier access for the end user.
 */
private void setEnlargedView() {
	
	JDialog dialog = new JDialog(OntologyVisualisationConfiguration.getOwnerWindow());
	dialog.setPreferredSize(new Dimension(100, 200));
	dialog.setName("Ontology-Instance-Viewer");
	dialog.setTitle(OntologyVisualisationConfiguration.getApplicationTitle() +  ": Ontology-Instance-Viewer");
	dialog.setModal(true);
	dialog.setResizable(true);
	dialog.setContentPane(getJContentPane());
	
	// --- Size and center the dialog -----------------
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	int diaWidth = (int) (screenSize.width*0.8);
	int diaHeight = (int) (screenSize.height * 0.9);

	int left = (screenSize.width - diaWidth) / 2;
	int top = (screenSize.height - diaHeight) / 2; 

	dialog.setSize(new Dimension(diaWidth, diaHeight));
    dialog.setLocation(left, top);	
	
    // --- Remind and remove THIS from the parent -----
    this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
    Container parentContainer = this.getParent();
    parentContainer.remove(this);
    parentContainer.validate();
    parentContainer.repaint();
    
    // --- Add THIS to the dialog ---------------------
    this.removeEnlargeTab();
    jPanel4TouchDown.add(this, BorderLayout.CENTER);
    dialog.setVisible(true);
	// - - - - - - - - - - - - - - - - - - - - - - - -  
    // - - User-Interaction  - - - - - - - - - - - - - 
	// - - - - - - - - - - - - - - - - - - - - - - - -
    this.addEnlargeTab();
	
    // --- Add THIS again to the parent ---------------
    this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
    parentContainer.add(this);
    parentContainer.validate();
    parentContainer.repaint();
    
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:49,代码来源:OntologyInstanceViewer.java

示例9: hideComponent

import java.awt.Container; //导入方法依赖的package包/类
/** Hide the hideable component */
public void hideComponent() {
  if (getHideableComponent().isVisible()) {
    if (resizeOnVisibilityChange) {
      Container ancestor = getTopLevelAncestor();
      if (ancestor != null) {
        switch (hideablePosition) {
        case HIDE_LEFT:
        case HIDE_RIGHT:
          ancestor.setSize(new Dimension(ancestor.getSize().width - getHideableComponent().getSize().width, ancestor.getSize().height - getDividerSize()));
          break;
        case HIDE_TOP:
        case HIDE_BOTTOM:
          ancestor.setSize(new Dimension(ancestor.getSize().width, ancestor.getSize().height - getHideableComponent().getSize().height - getDividerSize()));
          break;
        }
        ancestor.validate();
      }
    }
    // Running later causes race conditions in the Module Manager
    //Runnable runnable = new Runnable() {
    //  public void run() {
        ((BasicSplitPaneUI) getUI()).getDivider().setVisible(false);
        getHideableComponent().setVisible(false);
        switch (hideablePosition) {
        case HIDE_LEFT:
        case HIDE_TOP:
          setDividerLocation(0.0);
          break;
        case HIDE_RIGHT:
        case HIDE_BOTTOM:
          setDividerLocation(1.0);
        }
    //  }
    //};
    //SwingUtilities.invokeLater(runnable);
    SplitPane split = getTransverseSplit();
    if (split != null) {
      split.hideTransverseComponent(this);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:43,代码来源:ComponentSplitter.java

示例10: showComponent

import java.awt.Container; //导入方法依赖的package包/类
/**
 * Show the hideable component
 */
public void showComponent() {
  if (getHideableComponent().isVisible()) {
    return;
  }

  if (resizeOnVisibilityChange) {
    final Container ancestor = getTopLevelAncestor();
    if (ancestor == null) {
      return;
    }

    final Rectangle screenBounds = Info.getScreenBounds(ancestor);
    final Point ancestorPos = ancestor.getLocation();
    final Dimension ancestorSize = ancestor.getSize();
    final Dimension prefHSize = getHideableComponent().getPreferredSize();
    final Dimension prefBSize = getBaseComponent().getPreferredSize();

    double div = 0.0;
    int w = 0, h = 0;
    switch (getOrientation()) {
    case JSplitPane.HORIZONTAL_SPLIT:
      w = Math.min(
        ancestorSize.width + prefHSize.width,
        screenBounds.width - ancestorPos.x
      );
      h = ancestorSize.height;
      div = prefBSize.width/(double)(prefBSize.width + prefHSize.width);
      break;
    case JSplitPane.VERTICAL_SPLIT:
      w = ancestorSize.width;
      h = Math.min(
        ancestorSize.height + prefHSize.height,
        screenBounds.height - ancestorPos.y
      );
      div = prefBSize.height/(double)(prefBSize.height + prefHSize.height);
      break;
    }

    ancestor.setSize(w, h);
    ancestor.validate();
    getHideableComponent().setVisible(true);
    ((BasicSplitPaneUI) getUI()).getDivider().setVisible(true);

    final double divPos = div;
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        setDividerLocation(divPos);
      }
    });
  }
  else {
    getHideableComponent().setVisible(true);
    ((BasicSplitPaneUI) getUI()).getDivider().setVisible(true);

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        setDividerLocation(getPreferredDividerLocation());
      }
    });

    final SplitPane split = getTransverseSplit();
    if (split != null) {
      split.showTransverseComponent(ComponentSplitter.SplitPane.this);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:70,代码来源:ComponentSplitter.java


注:本文中的java.awt.Container.validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。