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


Java Rectangle.getHeight方法代码示例

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


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

示例1: paintTrack

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
	int x = (int) trackBounds.getX();
	int y = (int) trackBounds.getY();
	int w = (int) trackBounds.getWidth();
	int h = (int) trackBounds.getHeight();

	g.setColor(Colors.SCROLLBAR_TRACK_BACKGROUND);
	g.fillRect(x - 1, y - 1, w + 2, h + 2);

	g.setColor(Colors.SCROLLBAR_TRACK_BORDER);
	if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
		g.drawLine(x, y, x + w, y);
	} else {
		g.drawLine(x, y, x, y + h);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:ScrollBarUI.java

示例2: getUserLocation

import java.awt.Rectangle; //导入方法依赖的package包/类
private Point getUserLocation(GraphicsConfiguration gconf, OptionsPanel optionsPanel) {
      final Rectangle screenBounds = Utilities.getUsableScreenBounds(gconf);
      int x = NbPreferences.forModule(OptionsDisplayerImpl.class).getInt("OptionsX", Integer.MAX_VALUE);//NOI18N
      int y = NbPreferences.forModule(OptionsDisplayerImpl.class).getInt("OptionsY", Integer.MAX_VALUE);//NOI18N
      Dimension userSize = optionsPanel.getUserSize();
      if (x > screenBounds.x + screenBounds.getWidth() || y > screenBounds.y + screenBounds.getHeight()
              || x + userSize.width > screenBounds.x + screenBounds.getWidth() 
              || y + userSize.height > screenBounds.y + screenBounds.getHeight()
              || (x < screenBounds.x && screenBounds.x >= 0)
|| (x > screenBounds.x && screenBounds.x < 0)
|| (y < screenBounds.y && screenBounds.y >= 0)
|| (y > screenBounds.y && screenBounds.y < 0)){
          return null;
      } else {
          return new Point(x, y);
      }
  }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:OptionsDisplayerImpl.java

示例3: doZoom

import java.awt.Rectangle; //导入方法依赖的package包/类
public void doZoom( Point p, double factor ) {
Rectangle rect = getVisibleRect();
double x = p.getX() / zoom;
		double y = p.getY() / zoom;
		double w = rect.getWidth();
		double h = rect.getHeight();
		zoom *= factor;
zoomX = zoomY = zoom;
		int newX = (int) (x*zoom - w*.5d);
		int newY = (int) (y*zoom - h*.5d);
		invalidate();
		scrollPane.validate();
		JScrollBar sb = scrollPane.getHorizontalScrollBar();
		sb.setValue(newX);
		sb = scrollPane.getVerticalScrollBar();
		sb.setValue(newY);
		repaint();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:19,代码来源:SCSImage2.java

示例4: mergeCrop

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Merges the given object map in the image object map, at the specified
 * coordinates.
 *
 * @param newObjMap - the object map that has to be merged in the result map
 * @param pos       - the position where the image has to be copied: info x - the top-left X coordinate where the image has to be copied info; y - the top-left Y coordinate where the image has to be copied info; width - the width of the image to be copied info; height - the height of the image to be copied
 * @param objId     - the object id as byte value (it is obtained by computing the image object id % 255)
 * @param mergeBkg  - true if both the background and object have to overwrite the existent content of the object map; false if only the object should be merged
 */
public void mergeCrop(byte[][] newObjMap, Rectangle pos, long objId, boolean mergeBkg) {
    byte mapId = getByteObjId(objId);

    // update objectMap
    for (int y = 0; y < pos.getHeight(); y++) {
        for (int x = 0; x < pos.getWidth(); x++) {

            if (mergeBkg) {
                // merge bakground in object map (overwrites the initial byte, no matter what was storred, with bkg)
                objMap[x + pos.x][y + pos.y] = (newObjMap[x][y] > 0) ? mapId : (byte) 0;

            } else {
                // merge just the pure object - when the pixel in the  object map is != 0
                objMap[x + pos.x][y + pos.y] = ((objMap[x + pos.x][y + pos.y] == mapId) && (newObjMap[x][y] == 0)) ? 0 : objMap[x + pos.x][y + pos.y];
                objMap[x + pos.x][y + pos.y] = (newObjMap[x][y] > 0) ? mapId : objMap[x + pos.x][y + pos.y];
            }
        }
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:29,代码来源:ResultPanel.java

示例5: getScreentoWorld

import java.awt.Rectangle; //导入方法依赖的package包/类
public static Point2D getScreentoWorld(double x, double y) throws Exception {
    Rectangle imageBounds=null;
    ReferencedEnvelope mapBounds=null;
    try{
//        mapBounds=map.getLayerBounds();
        imageBounds = mapFrame.getBounds();
        int width = (int)imageBounds.getWidth();
        int height = (int)imageBounds.getHeight();
    }catch(Exception e){
        
    } 
    
    AffineTransform world2screen =
    RendererUtilities.worldToScreenTransform(mapBounds, imageBounds);
    
    AffineTransform screen2world = world2screen.createInverse();
    Point2D pointScreenAbsolute = new Point2D.Double(x, y);
    Point2D pointScreen = screen2world.transform(pointScreenAbsolute, null); 
    return pointScreen;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:21,代码来源:WorldScreen.java

示例6: print

import java.awt.Rectangle; //导入方法依赖的package包/类
public int print(Graphics g, PageFormat fmt, int pageNo) {
	if( pageNo>0 ) return NO_SUCH_PAGE;
	Graphics2D g2 = (Graphics2D)g;
	Dimension dim = wwd.getPreferredSize();
	Rectangle r = wwd.getBounds();

	if(r.width>dim.width) r.width = dim.width;
	if(r.height>dim.height) r.height = dim.height;

	org.geomapapp.util.DateFmt df = new org.geomapapp.util.DateFmt();
	int secs = (int)(System.currentTimeMillis()/1000L);
	String date = df.format(secs);
	Font font = new Font("SansSerif", Font.PLAIN, 8);
	g.setFont( font );
	Rectangle2D r2d = font.getStringBounds(date, g2.getFontRenderContext());
//	g2.translate( r.getWidth()-20.-r2d.getWidth(), r.getHeight()+18. );
	g2.setColor( Color.black);

//	g.setClip( new Rectangle( 0, 0, r.width, r.height) );
	double w = fmt.getImageableWidth();
	double h = fmt.getImageableHeight();
	double x = fmt.getImageableX();
	double y = fmt.getImageableY();
	g2.translate(x, y);
	double scale = Math.min( w / r.getWidth(), h / r.getHeight());
	int xd = (int)(scale*r.getWidth()-10.-r2d.getWidth());
	int yd = (int)(scale*r.getHeight()+18.);
	g2.drawString( date, xd, yd);
	g2.translate( -r.getX()*scale, -r.getY()*scale );
	g2.scale( scale, scale);

	wwd.getContext().makeCurrent();
	BufferedImage image = Screenshot.readToBufferedImage(r.width, r.height);
	g2.drawImage(image, 0, 0, this);
	return PAGE_EXISTS;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:37,代码来源:WWMap.java

示例7: getWESN

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Not Implemented.
 */
public double[] getWESN() {
	double[] wesn = new double[4];
	Rectangle r = getVisibleRect();
	if(mapBorder != null) {
		r = mapBorder.getInteriorRectangle(this, r.x, r.y, r.width, r.height);
	}
	Point2D.Double pt = new Point2D.Double( r.getX(), r.getY() );
	pt = (Point2D.Double)proj.getRefXY( getScaledPoint(pt));
	wesn[0] = pt.x;
	wesn[3] = pt.y;
	pt = new Point2D.Double( r.getX()+r.getWidth(),
				 r.getY()+r.getHeight() );
	pt = (Point2D.Double)proj.getRefXY( getScaledPoint(pt));
	wesn[1] = pt.x;
	wesn[2] = pt.y;
	return wesn;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:21,代码来源:XMap.java

示例8: paintBorder

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
public void paintBorder(Component c, java.awt.Graphics g, int x, int y, int width, int height) {
    DefaultOutlineCellRenderer ren = (DefaultOutlineCellRenderer)
            ((JComponent) c).getClientProperty(DefaultOutlineCellRenderer.class);
    if (ren == null) {
        ren = (DefaultOutlineCellRenderer) c;
    }
    if (ren.isShowHandle() && !ren.isLeaf()) {
        Icon icon = ren.isExpanded() ? getExpandedIcon() : getCollapsedIcon();
        int iconY;
        int iconX = ren.getNestingDepth() * getNestingWidth();
        if (icon.getIconHeight() < height) {
            iconY = (height / 2) - (icon.getIconHeight() / 2);
        } else {
            iconY = 0;
        }
        if (isNimbus) {
            iconX += icon.getIconWidth()/3; // To look good
        }
        if (isGtk) {
            JLabel lbl = ren.isExpanded () ? lExpandedIcon : lCollapsedIcon;
            lbl.setSize (Math.max (getExpansionHandleWidth (), iconX + getExpansionHandleWidth ()), height);
            lbl.paint (g);
        } else {
            icon.paintIcon(c, g, iconX, iconY);
        }
    }
    JCheckBox chBox = ren.getCheckBox();
    if (chBox != null) {
        int chBoxX = getExpansionHandleWidth() + ren.getNestingDepth() * getNestingWidth();
        Rectangle bounds = chBox.getBounds();
        int chBoxY;
        if (bounds.getHeight() < height) {
            chBoxY = (height / 2) - (((int) bounds.getHeight()) / 2);
        } else {
            if (isNimbus) {
                chBoxY = 1;
            } else {
                chBoxY = 0;
            }
        }
        Dimension chDim = chBox.getSize();
        java.awt.Graphics gch = g.create(chBoxX, chBoxY, chDim.width, chDim.height);
        chBox.paint(gch);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:DefaultOutlineCellRenderer.java

示例9: getTableCellRendererComponent

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent (
    JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column
) {
    JLabel c = (JLabel)defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    
    if (value instanceof String) {
        Rectangle cellRect = table.getCellRect(row, column, false);
        String scCell = (String) value;
        Dimension d = new Dimension((int) cellRect.getWidth(), (int) cellRect.getHeight());
        if (panel == null)
            panel = new ShortcutCellPanel(scCell);
        panel.setText(scCell);
        panel.setSize(d);

        if (isSelected) {
            panel.setBgColor(table.getSelectionBackground());
            if (UIManager.getLookAndFeel ().getID ().equals ("GTK"))
                panel.setFgCOlor(table.getForeground(), true);
            else
                panel.setFgCOlor(table.getSelectionForeground(), true);
        } else {
            panel.setBgColor(c.getBackground());
            panel.setFgCOlor(c.getForeground(), false);
        }
        if (hasFocus) {
            panel.setBorder(c.getBorder());
        } else {
            panel.setBorder(null);
        }

        return panel;
    }
    else {
        return c;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:ButtonCellRenderer.java

示例10: checkBounds

import java.awt.Rectangle; //导入方法依赖的package包/类
private boolean checkBounds(Rectangle r) {
    Rectangle[] screens = getScreenBounds();
    for (Rectangle screen : screens) {
        if (r.getX() >= screen.getX() && r.getY() >= screen.getY()
                && r.getX() + r.getWidth() < screen.getX() + screen.getWidth()
                && r.getY() + r.getHeight() < screen.getY() + screen.getHeight()) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DialogBoundsPreserver.java

示例11: paintFocus

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
protected void paintFocus(Graphics g, Rectangle textRect, Dimension d) {
	int x = 0, y = 0, w = 0, h = 0;
	x = (int) textRect.getX() - 2;
	y = (int) textRect.getY();
	w = (int) textRect.getWidth() + 4;
	h = (int) textRect.getHeight();

	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
	g2.setColor(Colors.RADIOBUTTON_BORDER_FOCUS);
	g2.setStroke(DASHED_STROKE);
	g2.drawRect(x, y, w, h);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:RadioButtonUI.java

示例12: paintComponent

import java.awt.Rectangle; //导入方法依赖的package包/类
@Override
protected void paintComponent(Graphics graphics) {
	super.paintComponent(graphics);
	double scaleX = (double) getWidth() / (double) processRenderer.getWidth();
	double scaleY = (double) getHeight() / (double) processRenderer.getHeight();
	scale = Math.min(scaleX, scaleY);
	double scaledW = processRenderer.getWidth() * scale;
	double scaledH = processRenderer.getHeight() * scale;

	Graphics2D g = (Graphics2D) graphics.create();
	g.translate((getWidth() - scaledW) / 2d, (getHeight() - scaledH) / 2d);
	g.scale(scale, scale);

	g.setRenderingHints(ProcessDrawer.LOW_QUALITY_HINTS);
	processRenderer.getOverviewPanelDrawer().draw(g, true);

	g.setStroke(new BasicStroke((int) (1d / scale)));

	Rectangle visibleRect = processRenderer.getVisibleRect();
	Rectangle drawRect = new Rectangle((int) visibleRect.getX(), (int) visibleRect.getY(),
			(int) visibleRect.getWidth() - 1, (int) visibleRect.getHeight() - 1);

	g.setColor(FILL_COLOR);
	g.fill(drawRect);

	g.setColor(DRAW_COLOR);
	g.draw(drawRect);

	g.dispose();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:31,代码来源:OverviewPanel.java

示例13: draw

import java.awt.Rectangle; //导入方法依赖的package包/类
public void draw(GamePiece p, Graphics g, int x, int y,
                 Component obs, double zoom) {
  if (thickness > 0) {
    if (c != null) {
      // Find the border by outsetting the bounding box, and then scaling
      // the shape to fill the outset.
      final Shape s = p.getShape();
      final Rectangle br = s.getBounds();

      // Don't bother if the shape is empty.
      if (!br.isEmpty()) {
        final double xzoom = (br.getWidth()+1) / br.getWidth();
        final double yzoom = (br.getHeight()+1) / br.getHeight();
        final AffineTransform t = AffineTransform.getTranslateInstance(x,y);
        t.scale(xzoom*zoom, yzoom*zoom);

        final Graphics2D g2d = (Graphics2D) g;
        final Stroke str = g2d.getStroke();
        g2d.setStroke(
          new BasicStroke(Math.max(1, Math.round(zoom*thickness))));
        g2d.setColor(c);
        g2d.draw(t.createTransformedShape(s));
        g2d.setStroke(str);
      }
    }
    else {
      highlightSelectionBounds(p, g, x, y, obs, zoom);
    }
  }

  // Draw any additional highlighters
  for (Highlighter h : highlighters) {
    h.draw(p, g, x, y, obs, zoom);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:36,代码来源:ColoredBorder.java

示例14: handleSelectionChanged

import java.awt.Rectangle; //导入方法依赖的package包/类
public void handleSelectionChanged(com.twinsoft.twinj.twinxEvent0 twinxEvent0) {
        try {
            Rectangle selectedZone = javelin.getSelectionZone();
            boolean bSelected = (selectedZone != null) && (selectedZone.getWidth() != 0) && (selectedZone.getHeight() != 0);
            addButton.setEnabled(bSelected);
        } catch (Exception e) {
//            Studio.theApp.exception(e, "Unable to handle Javelin selection zone change.");
        }
    }
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:10,代码来源:ColumnEditor.java

示例15: getClipRect2D

import java.awt.Rectangle; //导入方法依赖的package包/类
/**
 * Gets the region currently displayed in Projection coordinates.
 * @return the region currently displayed in Projection coordinates.
 */
public Rectangle2D getClipRect2D() {
	Rectangle r = getVisibleRect();
	Dimension dim = getPreferredSize();
	r.width = Math.min(r.width, dim.width);
	r.height = Math.min(r.height, dim.height);
	AffineTransform at = new AffineTransform();
	if(rotation==1) {
		at.translate( 0., dim.getHeight() );
		at.rotate(-.5*Math.PI);
	} else if( rotation==2 ) {
		at.translate( dim.getWidth(), dim.getHeight() );
		at.rotate( Math.PI );
	} else if( rotation == 3) {
		at.translate( dim.getWidth(), 0. );
		at.rotate( .5*Math.PI );
	}
	if(rotation != 0) {
		Point2D p1 = at.transform(new Point(r.x,r.y), null);
		Point2D p2 = at.transform(new Point(r.x+r.width,r.y+r.width), null);
		r.x = (int) Math.min(p1.getX(), p2.getX());
		r.width = (int) Math.max(p1.getX(), p2.getX()) - r.x;
		r.y = (int) Math.min(p1.getY(), p2.getY());
		r.height = (int) Math.max(p1.getY(), p2.getY()) - r.y;
	}

	if(mapBorder != null) {
		Insets ins = mapBorder.getBorderInsets(this);
		r.width -= ins.left + ins.right;
		r.height -= ins.top + ins.bottom;
	}
	Rectangle2D.Double r2d = new Rectangle2D.Double(
			r.getX()/zoom, r.getY()/zoom,
			r.getWidth()/zoom, r.getHeight()/zoom);
	return r2d;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:40,代码来源:XMap.java


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