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


Java Rectangle.setSize方法代码示例

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


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

示例1: showConfigurationDialog

import java.awt.Rectangle; //导入方法依赖的package包/类
private void showConfigurationDialog(ITopologyGenerator generator) {
	JDialog dialog = new JDialog();
	dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
	dialog.setLayout(new BorderLayout());
	dialog.setTitle(generator.getName());
	dialog.add(generator.getConfigurationDialog(), BorderLayout.CENTER);

	Rectangle tbounds = this.getBounds();
	Rectangle bounds = new Rectangle();
	bounds.setSize(generator.getConfigurationDialog().getPreferredSize());
	bounds.x = (int) (tbounds.x + 0.5 * tbounds.width - 0.5 * bounds.width);
	bounds.y = (int) (tbounds.y + 0.5 * tbounds.height - 0.5 * bounds.height);
	dialog.setBounds(bounds);
	dialog.setResizable(false);

	dialog.setVisible(true);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:18,代码来源:MultiAlgoScenarioWizard.java

示例2: computePopupBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
private void computePopupBounds (Rectangle result, JLayeredPane lPane, int modelSize) {
    Dimension cSize = comboBar.getSize();
    int width = getPopupWidth();
    Point location = new Point(cSize.width - width - 1, comboBar.getBottomLineY() - 1);
    if (SwingUtilities.getWindowAncestor(comboBar) != null) {
        location = SwingUtilities.convertPoint(comboBar, location, lPane);
    }
    result.setLocation(location);

    // hack to make jList.getpreferredSize work correctly
    // JList is listening on ResultsModel same as us and order of listeners
    // is undefined, so we have to force update of JList's layout data
    jList1.setFixedCellHeight(15);
    jList1.setFixedCellHeight(-1);
    // end of hack

    jList1.setVisibleRowCount(modelSize);
    Dimension preferredSize = jList1.getPreferredSize();

    preferredSize.width = width;
    preferredSize.height += statusPanel.getPreferredSize().height + 3;

    result.setSize(preferredSize);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:QuickSearchPopup.java

示例3: computePopupBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
private void computePopupBounds (Rectangle result, JLayeredPane lPane, int modelSize) {
    Point location =
            new Point(
                comboBar.getIssueComponent().getX(),
                comboBar.getIssueComponent().getY() + comboBar.getIssueComponent().getHeight() - 1);
    location = SwingUtilities.convertPoint(comboBar, location, lPane); // XXX terrible hack! fix this
    result.setLocation(location);

    // hack to make jList.getpreferredSize work correctly
    // JList is listening on ResultsModel same as us and order of listeners
    // is undefined, so we have to force update of JList's layout data
    jList1.setFixedCellHeight(15);
    jList1.setFixedCellHeight(-1);
    // end of hack

    jList1.setVisibleRowCount(modelSize);
    Dimension preferredSize = jList1.getPreferredSize();

    preferredSize.width = comboBar.getIssueComponent().getWidth();
    preferredSize.height += statusPanel.getPreferredSize().height + 3;
    if(preferredSize.height > 150) {
        preferredSize.height = 150;
    }

    result.setSize(preferredSize);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:QuickSearchPopup.java

示例4: boundingBox

import java.awt.Rectangle; //导入方法依赖的package包/类
public Rectangle boundingBox(GamePiece p) {
  final Rectangle r = p.getShape().getBounds();
  r.translate(-thickness, -thickness);
  r.setSize(r.width + 2 * thickness, r.height + 2 * thickness);

  for (Highlighter h : highlighters) r.add(h.boundingBox(p));
  return r;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:9,代码来源:ColoredBorder.java

示例5: getScreenBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Get size of screen accounting for the screen insets (i.e. Windows taskbar)
 *
 * @return
 */
public static Rectangle getScreenBounds(Component c) {
  final Rectangle bounds =
    new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
  final GraphicsConfiguration config = c.getGraphicsConfiguration();
  final Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
  bounds.translate(insets.left, insets.top);
  bounds.setSize(bounds.width - insets.left - insets.right,
                 bounds.height - insets.top - insets.bottom);
  return bounds;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:16,代码来源:Info.java

示例6: boundingBox

import java.awt.Rectangle; //导入方法依赖的package包/类
public Rectangle boundingBox(GamePiece p) {
  final Rectangle r = p.getShape().getBounds();
  if (accept(p)) {
    if (useImage) {
      r.add(ImageUtils.getBounds(imagePainter.getImageSize()));
    }
    else {
      r.translate(-thickness, -thickness);
      r.setSize(r.width + 2 * thickness, r.height + 2 * thickness);
    }
  }
  return r;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:SelectionHighlighter.java

示例7: getEditorBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Returns the bounds to be used for the editor.
 */
public Rectangle getEditorBounds(mxCellState state, double scale) {
  mxIGraphModel model = state.getView().getGraph().getModel();
  Rectangle bounds = null;

  if (useLabelBounds(state)) {
    bounds = state.getLabelBounds().getRectangle();
    bounds.height += 10;
  } else {
    bounds = state.getRectangle();
  }

  // Applies the horizontal and vertical label positions
  if (model.isVertex(state.getCell())) {
    String horizontal = mxUtils.getString(state.getStyle(), mxConstants.STYLE_LABEL_POSITION,
        mxConstants.ALIGN_CENTER);

    if (horizontal.equals(mxConstants.ALIGN_LEFT)) {
      bounds.x -= state.getWidth();
    } else if (horizontal.equals(mxConstants.ALIGN_RIGHT)) {
      bounds.x += state.getWidth();
    }

    String vertical = mxUtils.getString(state.getStyle(),
        mxConstants.STYLE_VERTICAL_LABEL_POSITION, mxConstants.ALIGN_MIDDLE);

    if (vertical.equals(mxConstants.ALIGN_TOP)) {
      bounds.y -= state.getHeight();
    } else if (vertical.equals(mxConstants.ALIGN_BOTTOM)) {
      bounds.y += state.getHeight();
    }
  }

  bounds.setSize((int) Math.max(bounds.getWidth(), Math.round(minimumWidth * scale)),
      (int) Math.max(bounds.getHeight(), Math.round(minimumHeight * scale)));

  return bounds;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:41,代码来源:mxCellEditor.java

示例8: repaint

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Repaint the given area, specified in map coordinates
 */
public void repaint(Rectangle r) {
  r.setLocation(componentCoordinates(new Point(r.x, r.y)));
  r.setSize((int) (r.width * getZoom()), (int) (r.height * getZoom()));
  theMap.repaint(r.x, r.y, r.width, r.height);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:9,代码来源:Map.java

示例9: getEditorBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Returns the bounds to be used for the editor.
 */
public Rectangle getEditorBounds(mxCellState state, double scale)
{
	mxIGraphModel model = state.getView().getGraph().getModel();
	Rectangle bounds = null;

	if (useLabelBounds(state))
	{
		bounds = state.getLabelBounds().getRectangle();
		bounds.height += 10;
	}
	else
	{
		bounds = state.getRectangle();
	}

	// Applies the horizontal and vertical label positions
	if (model.isVertex(state.getCell()))
	{
		String horizontal = mxUtils.getString(state.getStyle(),
				mxConstants.STYLE_LABEL_POSITION, mxConstants.ALIGN_CENTER);

		if (horizontal.equals(mxConstants.ALIGN_LEFT))
		{
			bounds.x -= state.getWidth();
		}
		else if (horizontal.equals(mxConstants.ALIGN_RIGHT))
		{
			bounds.x += state.getWidth();
		}

		String vertical = mxUtils.getString(state.getStyle(),
				mxConstants.STYLE_VERTICAL_LABEL_POSITION,
				mxConstants.ALIGN_MIDDLE);

		if (vertical.equals(mxConstants.ALIGN_TOP))
		{
			bounds.y -= state.getHeight();
		}
		else if (vertical.equals(mxConstants.ALIGN_BOTTOM))
		{
			bounds.y += state.getHeight();
		}
	}

	bounds.setSize(
			(int) Math.max(bounds.getWidth(),
					Math.round(minimumWidth * scale)),
			(int) Math.max(bounds.getHeight(),
					Math.round(minimumHeight * scale)));

	return bounds;
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:56,代码来源:mxCellEditor.java


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