Java Code Examples for java.awt.Rectangle#getMinY()

The following examples show how to use java.awt.Rectangle#getMinY() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dsworkbench   File: CoordinateFormatter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String valueToString(Object value) throws ParseException {
    if (value instanceof Point) {
        Point point = (Point) value;
        Village v = null;
        Rectangle dim = ServerSettings.getSingleton().getMapDimension();
        if (point.x >= dim.getMinX() && point.x <= dim.getMaxX()
                && point.y >= dim.getMinY() && point.y <= dim.getMaxY()) {
            v = DataHolder.getSingleton().getVillages()[point.x][point.y];
        }
        if (v == null) {
            return "Kein Dorf (" + point.x + "|" + point.y + ")";
        } else {
            return v.getFullName();
        }
    } else {
        return super.valueToString(value);
    }
}
 
Example 2
private static CoordinateTransform getTransform( Rectangle2D worldBounds, Rectangle imageBounds ) {
    if (worldBounds == null || worldBounds.isEmpty()) {
        throw new IllegalArgumentException("worldBounds must not be null or empty");
    }
    if (imageBounds == null || imageBounds.isEmpty()) {
        throw new IllegalArgumentException("imageBounds must not be null or empty");
    }

    double xscale = (imageBounds.getMaxX() - imageBounds.getMinX()) / (worldBounds.getMaxX() - worldBounds.getMinX());

    double xoff = imageBounds.getMinX() - xscale * worldBounds.getMinX();

    double yscale = (imageBounds.getMaxY() - imageBounds.getMinY()) / (worldBounds.getMaxY() - worldBounds.getMinY());

    double yoff = imageBounds.getMinY() - yscale * worldBounds.getMinY();

    return new AffineCoordinateTransform(new AffineTransform(xscale, 0, 0, yscale, xoff, yoff));
}
 
Example 3
private void firePerformRegionSelectionEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_firePerformRegionSelectionEvent
    if (evt.getSource() == jPerformSelection) {
        Point start = new Point((Integer) jStartX.getValue(), (Integer) jStartY.getValue());
        Point end = new Point((Integer) jEndX.getValue(), (Integer) jEndY.getValue());
        Rectangle mapDim = ServerSettings.getSingleton().getMapDimension();
        
        if (start.x < mapDim.getMinX() || start.x > mapDim.getMaxX() || start.y < mapDim.getMinY() || start.y > mapDim.getMaxY()
                || end.x < mapDim.getMinX() || end.x > mapDim.getMaxX() || end.y < mapDim.getMinY() || end.y > mapDim.getMaxY()) {
            showError("Ung├╝ltiger Start- oder Endpunkt");
        } else if ((Math.abs(end.x - start.x) * (end.y - start.y)) > 30000) {
            showError("<html>Die angegebene Auswahl k&ouml;nnte mehr als 10.000 D&ouml;rfer umfassen.<br/>"
                    + "Die Auswahl k&ouml;nnte so sehr lange dauern. Bitte verkleinere den gew&auml;hlten Bereich.");
        } else {
            List<Village> selection = DataHolder.getSingleton().getVillagesInRegion(start, end);
            addVillages(selection);
        }
    }

    jRegionSelectDialog.setVisible(false);
}
 
Example 4
Source Project: openAGV   File: ViewDragScrollListener.java    License: Apache License 2.0 5 votes vote down vote up
private boolean isFigureCompletelyInView(Figure figure,
                                         JViewport viewport,
                                         OpenTCSDrawingView drawingView) {
  Rectangle viewPortBounds = viewport.getViewRect();
  Rectangle figureBounds = drawingView.drawingToView(figure.getDrawingArea());

  return (figureBounds.getMinX() > viewPortBounds.getMinX())
      && (figureBounds.getMinY() > viewPortBounds.getMinY())
      && (figureBounds.getMaxX() < viewPortBounds.getMaxX())
      && (figureBounds.getMaxY() < viewPortBounds.getMaxY());
}
 
Example 5
Source Project: logbook-kai   File: CaptureController.java    License: MIT License 5 votes vote down vote up
private void setBounds(Robot robot, Rectangle fixed) {
    String text = "(" + (int) fixed.getMinX() + "," + (int) fixed.getMinY() + ")";
    this.message.setText(text);
    this.capture.setDisable(false);
    this.config.setDisable(false);
    this.sc = new ScreenCapture(robot, fixed);
    this.sc.setItems(this.images);
    this.sc.setCurrent(this.preview);
}
 
Example 6
Source Project: GVGAI_GYM   File: ContinuousPhysics.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Euclidean distance between two rectangles.
 * @param r1 rectangle 1
 * @param r2 rectangle 2
 * @return Euclidean distance between the top-left corner of the rectangles.
 */
public double distance(Rectangle r1, Rectangle r2)
{
    double topDiff = r1.getMinY() - r2.getMinY();
    double leftDiff = r1.getMinX() - r2.getMinX();
    return Math.sqrt(topDiff*topDiff + leftDiff*leftDiff);
}
 
Example 7
Source Project: GVGAI_GYM   File: VGDLSprite.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Draws the resources hold by this sprite, as an horizontal bar on top of the sprite.
 * @param gphx graphics to draw in.
 * @param game game being played at the moment.
 */
protected void _drawResources(Graphics2D gphx, Game game, Rectangle r)
{
    int numResources = resources.size();
    double barheight = r.getHeight() / 3.5f / numResources;
    double offset = r.getMinY() + 2*r.height / 3.0f;

    Set<Map.Entry<Integer, Integer>> entries = resources.entrySet();
    for(Map.Entry<Integer, Integer> entry : entries)
    {
        int resType = entry.getKey();
        int resValue = entry.getValue();

        if(resType > -1) {
            double wiggle = r.width / 10.0f;
            double prop = Math.max(0, Math.min(1, resValue / (double) (game.getResourceLimit(resType))));

            Rectangle filled = new Rectangle((int) (r.x + wiggle / 2), (int) offset, (int) (prop * (r.width - wiggle)), (int) barheight);
            Rectangle rest = new Rectangle((int) (r.x + wiggle / 2 + prop * (r.width - wiggle)), (int) offset, (int) ((1 - prop) * (r.width - wiggle)), (int) barheight);

            gphx.setColor(game.getResourceColor(resType));
            gphx.fillRect(filled.x, filled.y, filled.width, filled.height);
            gphx.setColor(Types.BLACK);
            gphx.fillRect(rest.x, rest.y, rest.width, rest.height);
            offset += barheight;
        }
    }

}
 
Example 8
Source Project: GVGAI_GYM   File: VGDLSprite.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Draws the health bar, as a vertical bar on top (and left) of the sprite.
 * @param gphx graphics to draw in.
 * @param game game being played at the moment.
 * @param r rectangle of this sprite.
 */
protected void _drawHealthBar(Graphics2D gphx, Game game, Rectangle r)
{
    int maxHP = maxHealthPoints;
    if(limitHealthPoints != 1000)
        maxHP = limitHealthPoints;

    double wiggleX = r.width * 0.1f;
    double wiggleY = r.height * 0.1f;
    double prop = Math.max(0,Math.min(1, healthPoints / (double) maxHP));

    double barHeight = r.height-wiggleY;
    int heightHealth = (int) (prop*barHeight);
    int heightUnhealth = (int) ((1-prop)*barHeight);
    int startY = (int) (r.getMinY()+wiggleY*0.5f);

    int barWidth = (int) (r.width * 0.1f);
    int xOffset = (int) (r.x+wiggleX * 0.5f);

    Rectangle filled = new Rectangle(xOffset, startY + heightUnhealth, barWidth, heightHealth);
    Rectangle rest   = new Rectangle(xOffset, startY, barWidth, heightUnhealth);

    if (game.no_players > 1)
        gphx.setColor(color);
    else
        gphx.setColor(Types.RED);
    gphx.fillRect(filled.x, filled.y, filled.width, filled.height);
    gphx.setColor(Types.BLACK);
    gphx.fillRect(rest.x, rest.y, rest.width, rest.height);
}
 
Example 9
/**
 * Define the lookup area on given corner, knowing the reference point of the
 * entity (head).
 * Global slope is used (plus and minus slopeMargin).
 *
 * @return the lookup area
 */
private Area getLuArea ()
{
    final double slope = skew.getSlope();
    final double dSlope = -xDir * yDir * params.slopeMargin;

    final Point2D outPt = getOutPoint();
    final Point2D inPt = getInPoint();

    // Look Up path, start by head horizontal segment
    final Path2D lu = new Path2D.Double();
    lu.moveTo(outPt.getX(), outPt.getY());
    lu.lineTo(inPt.getX(), inPt.getY());

    // Then segment away from head (system limit)
    final Rectangle systemBox = system.getBounds();
    final double yLimit = (yDir > 0) ? systemBox.getMaxY() : systemBox.getMinY();
    final double dy = yLimit - outPt.getY();
    lu.lineTo(inPt.getX() + ((slope + dSlope) * dy), yLimit);
    lu.lineTo(outPt.getX() + ((slope - dSlope) * dy), yLimit);
    lu.closePath();

    // Attachment
    StringBuilder sb = new StringBuilder();
    sb.append((corner.vSide == TOP) ? "T" : "B");
    sb.append((corner.hSide == LEFT) ? "L" : "R");
    head.addAttachment(sb.toString(), lu);

    return new Area(lu);
}
 
Example 10
/**
 * Start scrolling.
 */
private void scrollNow() {
	if (mouseOnScreenPoint != null && target.isShowing()) {
		Point origin = target.getLocationOnScreen();
		Point relative = new Point(mouseOnScreenPoint.x - origin.x, mouseOnScreenPoint.y - origin.y);

		Rectangle visibleRect = target.getVisibleRect();

		if (!visibleRect.contains(relative)) {
			int destX = relative.x;
			if (relative.getX() < visibleRect.getMinX()) {
				destX = (int) visibleRect.getMinX() - PAN_STEP_SIZE;
			}
			if (relative.getX() > visibleRect.getMaxX()) {
				destX = (int) visibleRect.getMaxX() + PAN_STEP_SIZE;
			}

			int destY = relative.y;
			if (relative.getY() < visibleRect.getMinY()) {
				destY = (int) visibleRect.getMinY() - PAN_STEP_SIZE;
			}
			if (relative.getY() > visibleRect.getMaxY()) {
				destY = (int) visibleRect.getMaxY() + PAN_STEP_SIZE;
			}

			target.scrollRectToVisible(new Rectangle(new Point(destX, destY)));
		}
	}
}
 
Example 11
Source Project: chipster   File: SelectableChartPanel.java    License: MIT License 5 votes vote down vote up
public Rectangle.Double translateToChart(Rectangle mouseCoords){
	
	//Screen coordinates are integers
	Point corner1 = new Point((int)mouseCoords.getMinX(), (int)mouseCoords.getMinY());
	Point corner2 = new Point((int)mouseCoords.getMaxX(), (int)mouseCoords.getMaxY());
	
	Point.Double translated1 = translateToChart(corner1);
	Point.Double translated2 = translateToChart(corner2);
	
	return createOrderedRectangle(translated1, translated2);				
}
 
Example 12
Source Project: gemfirexd-oss   File: LifelineState.java    License: Apache License 2.0 5 votes vote down vote up
public void highlight(Graphics2D g) {
  Rectangle bounds = g.getClipBounds();
  if(startY > bounds.getMaxY()  || startY+height <bounds.getMinY()) {
      return;
  }
  
  int x = line.getX();
  int width  = line.getWidth();

  g.drawRoundRect(x, startY, width, height, ARC_SIZE, ARC_SIZE);
}
 
Example 13
Source Project: niftyeditor   File: ImageModeCanvas.java    License: Apache License 2.0 5 votes vote down vote up
@Override
 public void mouseMoved(MouseEvent e) {
     
     Rectangle selected = this.model.getRectangle();
     if(e.getX()>selected.getMaxX()-5 && e.getX()<selected.getMaxX()+5 
            && e.getY()>selected.getMaxY()-5
            && e.getY()<selected.getMaxY()+5
            ){
        
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
        curDir=DIR_SE;
    }else if(e.getX()==selected.getMinX() && (e.getY()<selected.getMaxY() && e.getY()>selected.getMinY() )){
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
        curDir=DIR_W;
    }else if(e.getX()==selected.getMaxX() && (e.getY()<selected.getMaxY() && e.getY()>selected.getMinY() )){
       e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
       curDir=DIR_E;
    }
    else if(e.getY()<selected.getMaxY()+5 && e.getY()>selected.getMaxY()-5 
            && (e.getX()<selected.getMaxX() && e.getX()>selected.getMinX() )){
         e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR)); 
         curDir=DIR_S;
    }
     else if(e.getY()==selected.getMinY() && (e.getX()<selected.getMaxX() && e.getX()>selected.getMinX() )){
         curDir=DIR_N;
         e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); 
}else if(e.getY()<selected.getCenterY()+10 &&
        e.getY()>selected.getCenterY()-10 && (e.getX()<(selected.getCenterX()+10) && e.getX()>selected.getCenterX()-10 )){
          e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); 
          curDir = MOV;
     }
     else{
         e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 
         curDir=NOP;
     }
   }
 
Example 14
private void refreshMap() {
  //ensure that within map range
  Rectangle mapDim = ServerSettings.getSingleton().getMapDimension();
  if(dCenterX < mapDim.getMinX() || dCenterX > mapDim.getMaxX() || dCenterY < mapDim.getMinY() || dCenterY > mapDim.getMaxX()) {
    //find out where we tried to leaf map and set these valuese to max / min
    if(dCenterX < mapDim.getMinX()) {
      dCenterX = (int) mapDim.getMinX();
      jCenterX.setText(Integer.toString((int) dCenterX));
    } else if(dCenterX > mapDim.getMaxX()) {
      dCenterX = (int) mapDim.getMaxX();
      jCenterX.setText(Integer.toString((int) dCenterX));
    }
    
    if(dCenterY < mapDim.getMinY()) {
      dCenterY = (int) mapDim.getMinY();
      jCenterY.setText(Integer.toString((int) dCenterY));
    } else if(dCenterY > mapDim.getMaxX()) {
      dCenterY = (int) mapDim.getMaxX();
      jCenterY.setText(Integer.toString((int) dCenterY));
    }
  }
  
  double w = (double) MapPanel.getSingleton().getWidth() / GlobalOptions.getSkin().getBasicFieldWidth() * dZoomFactor;
  double h = (double) MapPanel.getSingleton().getHeight() / GlobalOptions.getSkin().getBasicFieldHeight() * dZoomFactor;
  MinimapPanel.getSingleton().setSelection((int) Math.floor(dCenterX), (int) Math.floor(dCenterY), (int) Math.rint(w), (int) Math.rint(h));
  MapPanel.getSingleton().updateMapPosition(dCenterX, dCenterY, true);
}
 
Example 15
Source Project: dsworkbench   File: FarmManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Find barbarians in radius around all own villages
 */
public int findFarmsFromBarbarians(int pRadius) {
  int addCount = 0;
  invalidate();
  for (Village v : GlobalOptions.getSelectedProfile().getTribe().getVillageList()) {
    Ellipse2D.Double e = new Ellipse2D.Double((int) v.getX() - pRadius, (int) v.getY() - pRadius, 2 * pRadius, 2 * pRadius);
    
    Rectangle mapDim = ServerSettings.getSingleton().getMapDimension();
    for (int x = (int) v.getX() - pRadius; x < (int) v.getX() + pRadius; x++) {
      for (int y = (int) v.getY() - pRadius; y < (int) v.getY() + pRadius; y++) {
        if (x >= mapDim.getMinX() && x <= mapDim.getMaxX()
                && y >= mapDim.getMinY() && y <= mapDim.getMaxY()) {
          if (e.contains(new Point2D.Double(x, y))) {
            Village farm = DataHolder.getSingleton().getVillages()[x][y];
            if (farm != null && farm.getTribe().equals(Barbarians.getSingleton())) {
              FarmInformation info = addFarm(farm);
              if (info.getLastReport() < 0) {
                FightReport r = ReportManager.getSingleton().findLastReportForSource(farm);
                if (r != null) {
                  info.updateFromReport(r);
                } else {
                  info.setInitialResources();
                }
                addCount++;
              }
            }
          }
        }
      }
    }

  }
  revalidate(true);
  return addCount;
}
 
Example 16
Source Project: dsworkbench   File: FarmManager.java    License: Apache License 2.0 5 votes vote down vote up
public int findFarmsFromBarbarians(Point pCenter, int pRadius) {
  int addCount = 0;
  invalidate();
  Ellipse2D.Double e = new Ellipse2D.Double(pCenter.x - pRadius, pCenter.y - pRadius, 2 * pRadius, 2 * pRadius);
    
  Rectangle mapDim = ServerSettings.getSingleton().getMapDimension();
  for (int i = pCenter.x - pRadius; i < pCenter.x + pRadius; i++) {
    for (int j = pCenter.y - pRadius; j < pCenter.y + pRadius; j++) {
      if (i >= mapDim.getMinX() && i <= mapDim.getMaxX()
          && j >= mapDim.getMinY() && j <= mapDim.getMaxY()) {
        if (e.contains(new Point2D.Double(i, j))) {
          Village v = DataHolder.getSingleton().getVillages()[i][j];
          if (v != null && v.getTribe().equals(Barbarians.getSingleton())) {
            FarmInformation info = addFarm(v);
            if (info.getLastReport() < 0) {
              FightReport r = ReportManager.getSingleton().findLastReportForSource(v);
              if (r != null) {
                info.updateFromReport(r);
              } else {
                info.setInitialResources();
              }
              addCount++;
            }
          }
        }
      }
    }
  }
  revalidate(true);
  return addCount;
}
 
Example 17
Source Project: whyline   File: FileControlArrow.java    License: MIT License 4 votes vote down vote up
protected void paintSelectedArrow(Graphics2D g, int labelLeft, int labelRight, int labelTop, int labelBottom) {
	
	if(toRange != null && toRange.first != null) {

		Area area = files.getAreaForTokenRange(toRange);
		if(area != null) {
			Rectangle tokens = area.getBounds();

			g.setColor(relationship.getColor(true));

			// Outline the tokens
			files.outline(g, toRange);
		
			// Get the boundaries of the selection.
			int tokenLeft = (int)tokens.getMinX();
			int tokenRight = (int) tokens.getMaxX();
			int tokenTop = (int) tokens.getMinY();
			int tokenBottom = (int) tokens.getMaxY();
			
			int labelX = tokenRight < (labelLeft + labelRight) / 2  ? labelLeft : labelRight;
			int labelY = labelBottom - descent;
			
			Line2D line = Util.getLineBetweenRectangleEdges(
					labelX, labelX + 1,
					labelY, labelY + 1,
					tokenLeft, tokenRight,
					tokenTop, tokenBottom
			);

			int xOff = 0;
			int yOff = 0;

			Util.drawQuadraticCurveArrow(g, (int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2(), xOff, yOff, true, relationship.getStroke(true));

			g.drawLine(labelLeft, labelY, labelRight, labelY);
			
		}
		
	}
	
}
 
Example 18
/**
 * Initializes a number of things about this frame.
 */
private void initializeFrame() {
    frame = new JFrame(Messages.getString("ClientGUI.title")); //$NON-NLS-1$
    frame.setJMenuBar(menuBar);
    Rectangle virtualBounds = getVirtualBounds();
    int x, y, w, h;
    if (GUIPreferences.getInstance().getWindowSizeHeight() != 0) {
        x = GUIPreferences.getInstance().getWindowPosX();
        y = GUIPreferences.getInstance().getWindowPosY();
        w = GUIPreferences.getInstance().getWindowSizeWidth();
        h = GUIPreferences.getInstance().getWindowSizeHeight();
        if ((x < virtualBounds.getMinX())
                || ((x + w) > virtualBounds.getMaxX())) {
            x = 0;
        }
        if ((y < virtualBounds.getMinY())
                || ((y + h) > virtualBounds.getMaxY())) {
            y = 0;
        }
        if (w > virtualBounds.getWidth()) {
            w = (int) virtualBounds.getWidth();
        }
        if (h > virtualBounds.getHeight()) {
            h = (int) virtualBounds.getHeight();
        }
        frame.setLocation(x, y);
        frame.setSize(w, h);
    } else {
        frame.setSize(800, 600);
    }
    frame.setMinimumSize(new Dimension(640, 480));
    frame.setBackground(SystemColor.menu);
    frame.setForeground(SystemColor.menuText);
    List<Image> iconList = new ArrayList<Image>();
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16)
                    .toString()));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32)
                    .toString()));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48)
                    .toString()));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256)
                    .toString()));
    frame.setIconImages(iconList);

    mechW = new JDialog(frame, Messages.getString("ClientGUI.MechDisplay"), false);
    x = GUIPreferences.getInstance().getDisplayPosX();
    y = GUIPreferences.getInstance().getDisplayPosY();
    h = GUIPreferences.getInstance().getDisplaySizeHeight();
    w = GUIPreferences.getInstance().getDisplaySizeWidth();
    if ((x + w) > virtualBounds.getWidth()) {
        x = 0;
        w = Math.min(w, (int)virtualBounds.getWidth());
    }
    if ((y + h) > virtualBounds.getHeight()) {
        y = 0;
        h = Math.min(h, (int)virtualBounds.getHeight());
    }
    mechW.setLocation(x, y);
    mechW.setSize(w, h);
    mechW.setResizable(true);
    unitDisplay = new UnitDisplay(null);
    mechW.add(unitDisplay);
    mechW.setVisible(true);
    unitDisplay.displayEntity(testEntity);
}
 
Example 19
Source Project: megamek   File: ClientGUI.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes a number of things about this frame.
 */
private void initializeFrame() {
    frame = new JFrame(Messages.getString("ClientGUI.title")); //$NON-NLS-1$
    menuBar.setGame(client.getGame());
    frame.setJMenuBar(menuBar);
    Rectangle virtualBounds = getVirtualBounds();
    if (GUIPreferences.getInstance().getWindowSizeHeight() != 0) {
        int x = GUIPreferences.getInstance().getWindowPosX();
        int y = GUIPreferences.getInstance().getWindowPosY();
        int w = GUIPreferences.getInstance().getWindowSizeWidth();
        int h = GUIPreferences.getInstance().getWindowSizeHeight();
        if ((x < virtualBounds.getMinX()) || ((x + w) > virtualBounds.getMaxX())) {
            x = 0;
        }
        if ((y < virtualBounds.getMinY()) || ((y + h) > virtualBounds.getMaxY())) {
            y = 0;
        }
        if (w > virtualBounds.getWidth()) {
            w = (int) virtualBounds.getWidth();
        }
        if (h > virtualBounds.getHeight()) {
            h = (int) virtualBounds.getHeight();
        }
        frame.setLocation(x, y);
        frame.setSize(w, h);
    } else {
        frame.setSize(800, 600);
    }
    frame.setMinimumSize(new Dimension(640,480));
    frame.setBackground(SystemColor.menu);
    frame.setForeground(SystemColor.menuText);
    List<Image> iconList = new ArrayList<>();
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_16X16).toString()
    ));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_32X32).toString()
    ));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_48X48).toString()
    ));
    iconList.add(frame.getToolkit().getImage(
            new MegaMekFile(Configuration.miscImagesDir(), FILENAME_ICON_256X256).toString()
    ));
    frame.setIconImages(iconList);
}
 
Example 20
/**
 * Creates new area from given points. Point order doesn't matter
 *
 * @param p1
 *            point
 * @param p2
 *            point
 * @param p3
 *            point
 * @param p4
 *            point
 * @param minZ
 *            minimal z
 * @param maxZ
 *            maximal z
 */
public RectangleArea(ZoneName zoneName, int worldId, Point p1, Point p2, Point p3, Point p4, int minZ, int maxZ) {
	super(zoneName, worldId, minZ, maxZ);

	Rectangle r = new Rectangle();
	r.add(p1);
	r.add(p2);
	r.add(p3);
	r.add(p4);

	minX = (int) r.getMinX();
	maxX = (int) r.getMaxX();
	minY = (int) r.getMinY();
	maxY = (int) r.getMaxY();
}