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


Java Dimension.getHeight方法代码示例

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


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

示例1: clampToMap

import java.awt.Dimension; //导入方法依赖的package包/类
protected Point2D clampToMap(Point2D focus) {
  if (Game.getEnvironment() == null || Game.getEnvironment().getMap() == null || !this.isClampToMap()) {
    return focus;
  }

  final Dimension mapSize = Game.getEnvironment().getMap().getSizeInPixels();
  final Dimension resolution = Game.getScreenManager().getResolution();

  double minX = resolution.getWidth() / this.getRenderScale() / 2.0;
  double maxX = mapSize.getWidth() - minX;
  double minY = resolution.getHeight() / this.getRenderScale() / 2.0;
  double maxY = mapSize.getHeight() - minY;

  double x = mapSize.getWidth() * this.getRenderScale() < resolution.getWidth() ? minX : MathUtilities.clamp(focus.getX(), minX, maxX);
  double y = mapSize.getHeight() * this.getRenderScale() < resolution.getHeight() ? minY : MathUtilities.clamp(focus.getY(), minY, maxY);

  return new Point2D.Double(x, y);
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:19,代码来源:Camera.java

示例2: paintMainLabel

import java.awt.Dimension; //导入方法依赖的package包/类
/** Paints the main label in a JLabel, providing HTML formatting. */
private void paintMainLabel(Graphics g, Point2D p) {
    Dimension size = setTextInJLabel(this.jView);
    if (size != null && (size.getWidth() != 0 || size.getHeight() != 0)) {
        this.jLabel.setSize(size);
        int sw = (int) size.getWidth();
        int sh = (int) size.getHeight();
        Graphics2D g2 = (Graphics2D) g;
        int dx = -sw / 2;
        int offset = this.isMoveBelowZero ? 0 : Math.min(0, (int) (dx + p.getX()));
        g2.translate(p.getX() - offset, p.getY());
        if (isOpaque()) {
            g.setColor(getBackground());
            g.fillRect(-sw / 2 - 1, -sh / 2 - 1, sw + 2, sh + 2);
        }
        int dy = -sh / 2;
        g.setColor(this.fontColor);
        g.translate(dx, dy);
        //the fontMetrics stringWidth and height can be replaced by
        //getLabel().getPreferredSize() if needed
        this.jLabel.paint(g);
        g.translate(-dx, -dy);
        g2.translate(-p.getX() + offset, -p.getY());
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:26,代码来源:JEdgeView.java

示例3: computeVisibleSpan

import java.awt.Dimension; //导入方法依赖的package包/类
private int[] computeVisibleSpan() {
    Component parent = pane.getParent();
    
    if (parent instanceof JLayeredPane) {
        parent = parent.getParent();
    }

    if (parent instanceof JViewport) {
        JViewport vp = (JViewport) parent;

        Point start = vp.getViewPosition();
        Dimension size = vp.getExtentSize();
        Point end = new Point((int) (start.getX() + size.getWidth()), (int) (start.getY() + size.getHeight()));

        int startPosition = pane.viewToModel(start);
        int endPosition = pane.viewToModel(end);

        if (parentWithListener != vp) {
            vp.addChangeListener(WeakListeners.change(this, vp));
            parentWithListener = vp;
        }
        return new int[] {startPosition, endPosition};
    }

    return new int[] {0, pane.getDocument().getLength()};
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ComponentPeer.java

示例4: getPreferredSize

import java.awt.Dimension; //导入方法依赖的package包/类
public Dimension getPreferredSize() {
    if (isPreferredSizeSet()) {
        return super.getPreferredSize();
    }
    
    int height = Math.max(500, currentCustomizer.getPreferredSize().height + 50);
    int width = Math.max(800, currentCustomizer.getPreferredSize().width + 240);
    
    Dimension dim = super.getPreferredSize();
    if (dim == null) {
        return new Dimension(width, height);
    }
    if (dim.getWidth() < width || dim.getHeight() < height) {
        return new Dimension(width, height);
    }
    
    if (dim.getWidth() > MAX_WIDTH) {
        dim.width = MAX_WIDTH;
    }
    if (dim.getHeight() > MAX_HEIGHT) {
        dim.height = MAX_HEIGHT;
    }
    return dim;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:CustomizerPane.java

示例5: createContentImage

import java.awt.Dimension; //导入方法依赖的package包/类
private BufferedImage createContentImage( Component c, Dimension contentSize ) {
    GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getDefaultConfiguration();

    BufferedImage res = config.createCompatibleImage(contentSize.width, contentSize.height);
    Graphics2D g = res.createGraphics();
    //some components may be non-opaque so just black rectangle would be painted then
    g.setColor( Color.white );
    g.fillRect(0, 0, contentSize.width, contentSize.height);
    if( WinSysPrefs.HANDLER.getBoolean(WinSysPrefs.DND_SMALLWINDOWS, true) && c.getWidth() > 0 && c.getHeight() > 0 ) {
        double xScale = contentSize.getWidth() / c.getWidth();
        double yScale = contentSize.getHeight() / c.getHeight();
        g.setTransform(AffineTransform.getScaleInstance(xScale, yScale) );
    }
    c.paint(g);
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:DragWindow.java

示例6: initialize

import java.awt.Dimension; //导入方法依赖的package包/类
@Override
    public void initialize() {
        Dimension d = getSize();

        if (d != null) {

            double y = d.getHeight() / 2;
            double x = d.getWidth() / 2;

            Room startRoom = getStartRoomAndResetDraweds();
            if (startRoom == null) {
                return;
            }
//			System.out.println("iter drawing: "+x+" "+y);
            Point2D center = new Point2D.Double( x, y );
            iterativeDrawing( startRoom, center );
        }
    }
 
开发者ID:lauriholmas,项目名称:batmapper,代码行数:19,代码来源:MapperLayout.java

示例7: getDisplayModes

import java.awt.Dimension; //导入方法依赖的package包/类
private static DisplayMode[] getDisplayModes(DisplayMode[] p_getDisplayModes_0_, Dimension p_getDisplayModes_1_)
{
    List list = new ArrayList();

    for (int i = 0; i < p_getDisplayModes_0_.length; ++i)
    {
        DisplayMode displaymode = p_getDisplayModes_0_[i];

        if ((double)displaymode.getWidth() == p_getDisplayModes_1_.getWidth() && (double)displaymode.getHeight() == p_getDisplayModes_1_.getHeight())
        {
            list.add(displaymode);
        }
    }

    DisplayMode[] adisplaymode = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()]));
    return adisplaymode;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:Config.java

示例8: GetImageSize

import java.awt.Dimension; //导入方法依赖的package包/类
private Dimension GetImageSize(String workingFile, File folderRef) {
	Dimension RawImageSize = GetRawImageSize(workingFile, folderRef);
	if (!Orientation(workingFile, folderRef).isEmpty() && !IsHorizontal(workingFile, folderRef)) {
		//addToLog("Switching coordinates", false);
		return (new Dimension((int) Math.round(RawImageSize.getHeight()), (int) Math.round(RawImageSize.getWidth())));
	}
	return (new Dimension((int) RawImageSize.getWidth(), (int) RawImageSize.getHeight()));
}
 
开发者ID:mirkodcomparetti,项目名称:PictureTravelSuite,代码行数:9,代码来源:PictureTravelSuiteClass.java

示例9: initializeLocations

import java.awt.Dimension; //导入方法依赖的package包/类
public StaticLayout initializeLocations(Dimension d, Graph g)
{
	this.total_vertices = g.getVertices().size();
	vertex_number = 0;

	double height = d.getHeight();
	double width = d.getWidth();

	radius = 0.45 * Math.min(height, width);

	return super.initializeLocations(d, g);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:13,代码来源:CircleLayout.java

示例10: UserDataCellRenderer

import java.awt.Dimension; //导入方法依赖的package包/类
UserDataCellRenderer(Component comp) {
    this.comp = comp;
    Dimension d = comp.getPreferredSize();
    if (d.getHeight() > 200) {
        comp.setPreferredSize(new Dimension((int) d.getWidth(), 200));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:XMBeanNotifications.java

示例11: MaximizedCellRenderer

import java.awt.Dimension; //导入方法依赖的package包/类
MaximizedCellRenderer(Component comp) {
    this.comp = comp;
    Dimension d = comp.getPreferredSize();
    if (d.getHeight() > 220) {
        comp.setPreferredSize(new Dimension((int) d.getWidth(), 220));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:XMBeanAttributes.java

示例12: ensureHeight

import java.awt.Dimension; //导入方法依赖的package包/类
/**
 * Ensures that the process is at least height heigh.
 *
 * @param executionUnit
 *            the process to ensure the minimum height
 * @param width
 *            the mininum height
 */
void ensureHeight(final ExecutionUnit executionUnit, final int height) {
	Dimension old = new Dimension((int) model.getProcessWidth(executionUnit),
			(int) model.getProcessHeight(executionUnit));
	if (height > old.getHeight()) {
		model.setProcessHeight(executionUnit, height);
		balance();
		model.fireProcessSizeChanged();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:ProcessRendererController.java

示例13: releayout

import java.awt.Dimension; //导入方法依赖的package包/类
public void releayout() {
	mxHierarchicalLayout layout = new mxHierarchicalLayout(graph, SwingConstants.NORTH);
	layout.execute(graph.getDefaultParent());

	mxRectangle graphSize = graph.getGraphBounds();
	Dimension viewPortSize = graphComponent.getViewport().getSize();

	double ratiox = viewPortSize.getWidth() / graphSize.getWidth();
	double ratioy = viewPortSize.getHeight() / graphSize.getHeight();
	double ratio = ratiox < ratioy ? ratiox : ratioy;

	graphComponent.zoom(ratio);
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:14,代码来源:InfrastructureGraphPanel.java

示例14: setVisible

import java.awt.Dimension; //导入方法依赖的package包/类
@Override
public void setVisible(boolean value) {
	if (value) {
		pack();
		Dimension dim = getToolkit().getScreenSize();
		int x = (int) (dim.getWidth() - getWidth()) / 2;
		int y = (int) (dim.getHeight() - getHeight()) / 2;
		setLocation(x, y);
	}
	super.setVisible(value);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:12,代码来源:SplashScreen.java

示例15: scale

import java.awt.Dimension; //导入方法依赖的package包/类
public void scale(Dimension old, Dimension newDim) {
    this.x *= (newDim.getWidth() / old.getWidth());
    this.y *= (newDim.getHeight() / old.getHeight() );
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:5,代码来源:Coordinates.java


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