當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。