List of usage examples for java.awt Point Point
public Point(int x, int y)
From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java
/** * This method initializes this/*from www . jav a 2s . c o m*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.gridx = 0; gridBagConstraints41.gridwidth = 2; gridBagConstraints41.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints41.weighty = 0.01; gridBagConstraints41.weightx = 1.0; gridBagConstraints41.gridy = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints3.gridwidth = 2; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.insets = new Insets(0, 20, 0, 0); gridBagConstraints3.gridy = 3; jLabelLicense = new JLabel(); jLabelLicense.setText("License :"); jLabelLicense.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelComponent = new JLabel(); jLabelComponent.setText("Component :"); jLabelComponent.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelBinding = new JLabel(); jLabelBinding.setText("Binding Type :"); jLabelBinding.setFont(new Font("Dialog", Font.PLAIN, 12)); this.setLayout(new GridBagLayout()); this.setSize(570, 480); this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); this.setLocation(new Point(0, 0)); this.add(getJScrollPaneFolder(), gridBagConstraints3); this.add(getJScrollPanePanel(), gridBagConstraints41); getJRadioButtonNotContain().setSelected(false); getJRadioButtonThird().setSelected(false); getJRadioButtonIKnow().setSelected(true); getJScrollPaneFolder().setVisible(true); }
From source file:es.emergya.ui.gis.layers.MapViewerLayer.java
@Override public void paint(Graphics g, MapView mv) { parent = (CustomMapView) mv;/*w w w.ja v a 2 s.co m*/ int iMove = 0; zoom = mv.zoom(); LatLon cen = Main.proj.eastNorth2latlon(mv.getCenter()); center = new Point(OsmMercator.LonToX(cen.getX(), zoom), OsmMercator.LatToY(cen.getY(), zoom)); int tilex = center.x / Tile.SIZE; int tiley = center.y / Tile.SIZE; int off_x = (center.x % Tile.SIZE); int off_y = (center.y % Tile.SIZE); int w2 = mv.getWidth() / 2; int h2 = mv.getHeight() / 2; int posx = w2 - off_x; int posy = h2 - off_y; int diff_left = off_x; int diff_right = Tile.SIZE - off_x; int diff_top = off_y; int diff_bottom = Tile.SIZE - off_y; boolean start_left = diff_left < diff_right; boolean start_top = diff_top < diff_bottom; if (start_top) { if (start_left) { iMove = 2; } else { iMove = 3; } } else { if (start_left) { iMove = 1; } else { iMove = 0; } } // calculate the visibility borders int x_min = -Tile.SIZE; int y_min = -Tile.SIZE; int x_max = mv.getWidth(); int y_max = mv.getHeight(); // paint the tiles in a spiral, starting from center of the map boolean painted = true; int x = 0; while (painted) { painted = false; for (int i = 0; i < 4; i++) { if (i % 2 == 0) { x++; } for (int j = 0; j < x; j++) { if (x_min <= posx && posx <= x_max && y_min <= posy && posy <= y_max) { // tile is visible Tile tile = getTile(tilex, tiley, zoom); if (tile != null) { painted = true; tile.paint(g, posx, posy); if (tileGridVisible) { g.drawString(tile.getXtile() + ", " + tile.getYtile(), posx, posy + 12); g.drawRect(posx, posy, Tile.SIZE, Tile.SIZE); } } } Point p = move[iMove]; posx += p.x * Tile.SIZE; posy += p.y * Tile.SIZE; tilex += p.x; tiley += p.y; } iMove = (iMove + 1) % move.length; } } // outer border of the map int mapSize = Tile.SIZE << zoom; g.drawRect(w2 - center.x, h2 - center.y, mapSize, mapSize); if (LOG.isDebugEnabled()) { g.setColor(Color.LIGHT_GRAY); g.drawString("Tiles in cache: " + tileCache.getTileCount(), 50, 15); } // g.fillRect(0, 100, 300, 55); // g.setColor(Color.BLACK); // g.drawString("center: " + center.x + ", " + center.y, 5, 120); // g.drawString("zoom: " + zoom + " for scale:" + mv.getScale(), 5, // 150); }
From source file:fr.landel.utils.commons.CollectionUtils2Test.java
/** * Test method for/*from www. j a v a2 s.c o m*/ * {@link CollectionUtils2#transformIntoList(java.lang.Iterable, boolean)}. */ @Test public void testTransformIntoListIterableOfIB() { try { List<Point> points = new ArrayList<>(); points.add(new Point(1, 2)); points.add(new Point(2, 0)); points.add(null); List<String> strPoints = CollectionUtils2.transformIntoList(points, true); assertThat(strPoints, Matchers.contains("java.awt.Point[x=1,y=2]", "java.awt.Point[x=2,y=0]", "null")); } catch (IllegalArgumentException e) { fail("The test isn't correct"); } }
From source file:de.unidue.inf.is.ezdl.gframedl.tools.relations.DLObjectGraphView.java
/** * Zoom the graph to the component size. *//*from ww w. ja v a 2s . co m*/ public void zoomBestFit() { int wh = graphSize.width / 2; int hh = graphSize.height / 2; vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).setToIdentity(); vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).setToIdentity(); if ((graphSize.width > vv.getWidth()) || (graphSize.height > vv.getHeight())) { vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW) .translate(-(wh - getWidth() / 2), -(hh - getHeight() / 2)); int minSide = Math.min(vv.getWidth(), vv.getHeight()); double scale = 1.0d / (((double) hh * 2) / minSide); int x = vv.getWidth() / 2 - (int) Math.round(wh * scale); int y = vv.getHeight() / 2 - (int) Math.round(hh * scale); vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).setScale(scale, scale, new Point(x, y)); } }
From source file:com.diversityarrays.kdxplore.trialtool.SimplePlotCellRenderer.java
/** * Override this to customise behaviour. * @param plot/*from www. j av a 2 s. c om*/ * @return */ protected String getHtmlForPlot(Plot plot) { String result; if (htmlProvider == null) { StringBuilder sb = new StringBuilder("<HTML>"); PlotIdentOption pio = plotVisitList.getTrial().getPlotIdentOption(); Point xy = new Point(plot.getPlotColumn(), plot.getPlotRow()); if (xyProvider != null) { xy = xyProvider.transform(plot); } sb.append(plotVisitList.getTrial().getNameForPlot()); switch (pio) { case NO_X_Y_OR_PLOT_ID: break; case PLOT_ID: sb.append(" id=").append(plot.getUserPlotId()); break; case PLOT_ID_THEN_X: sb.append(" id=").append(plot.getUserPlotId()); sb.append("<BR>X=").append(xy.x); break; case PLOT_ID_THEN_XY: sb.append(" id=").append(plot.getUserPlotId()); sb.append("<BR>X=").append(xy.x); sb.append(" Y=").append(xy.y); break; case PLOT_ID_THEN_Y: sb.append(" id=").append(plot.getUserPlotId()); sb.append("<BR>Y=").append(xy.y); break; case PLOT_ID_THEN_YX: sb.append(" id=").append(plot.getUserPlotId()); sb.append("<BR>Y=").append(xy.y); sb.append(" X=").append(xy.x); break; case X_THEN_Y: sb.append(" id=").append(plot.getUserPlotId()); sb.append("<BR>X=").append(xy.x); sb.append(" Y=").append(xy.y); break; case Y_THEN_X: sb.append(" id=").append(plot.getUserPlotId()); sb.append("<BR>Y=").append(xy.y); sb.append(" X=").append(xy.x); break; default: break; } result = sb.toString(); } else { result = htmlProvider.transform(plot); } return result; }
From source file:com.quinsoft.zeidon.objectbrowser.EntitySquare.java
Point getTopAnchor() {
Rectangle b = getBounds();
return new Point(b.x + b.width / 2, b.y);
}
From source file:me.ryandowling.TwitchTools.java
private static void createDefaultSettingsFile() { try {// w w w .java 2 s .c o m Files.createDirectories(Utils.getDataDir()); } catch (IOException e) { e.printStackTrace(); } settings = new Settings(); settings.setMicrophoneStatus(new WindowDetails(new Dimension(200, 200), new Point(100, 100))); saveSettings(); }
From source file:com.quinsoft.zeidon.objectbrowser.EntitySquare.java
Point getBottomAnchor() {
Rectangle b = getBounds();
return new Point(b.x + b.width / 2, b.y + b.height);
}
From source file:modelibra.designer.metaneighbor.MetaNeighbor.java
public Point getMinMaxPoint() { int x = 0;// ww w . ja v a 2s . co m int y = 0; MetaConcept sourceConcept = getMetaSourceConcept(); MetaConcept destinationConcept = getMetaDestinationConcept(); if ((sourceConcept != null) && (destinationConcept != null)) { int x1 = getVisibleBeginPoint().x; int y1 = getVisibleBeginPoint().y; int x2 = getVisibleEndPoint().x; int y2 = getVisibleEndPoint().y; if (x1 <= x2) { x = x1 + 1 * ((x2 - x1) / 8); if (y1 <= y2) { y = y1 + 1 * ((y2 - y1) / 8); } else { y = y2 + 7 * ((y1 - y2) / 8); } } else { x = x2 + 7 * ((x1 - x2) / 8); if (y1 <= y2) { y = y1 + 1 * ((y2 - y1) / 8); } else { y = y2 + 7 * ((y1 - y2) / 8); } } } return new Point(x, y); }
From source file:org.jax.bham.test.HaplotypeAssociationTestGraphPanel.java
/** * Gets the index of the interval with the highest value that falls * under the given Java2D coordinates/*w w w . ja v a 2 s . c o m*/ * @param x * the Java2D X coordinate * @param y * the Java2D Y coordinate * @return * the interval index */ private int getMaximalIntervalIndex(int x, int y) { int clickIndex = -1; int[] chromosomes = this.getSelectedChromosomes(); if (chromosomes.length == 1) { RealValuedBasePairInterval[] selectedValuesList = this.chromosomeToNegLogValueMap.get(chromosomes[0]); if (selectedValuesList != null) { Point2D clickedGraphPoint = JFreeChartUtil.java2DPointToGraphPoint(new Point(x, y), this.chartPanel); // exhaustive search for the maximum clicked index (this could // be a binary search, but this seems to perform OK for now) double graphX = clickedGraphPoint.getX(); int valueCount = selectedValuesList.length; double biggestClickedValue = Double.NEGATIVE_INFINITY; for (int i = 0; i < valueCount; i++) { RealValuedBasePairInterval currValue = selectedValuesList[i]; if (currValue.getStartInBasePairs() < graphX && currValue.getEndInBasePairs() > graphX && currValue.getRealValue() > biggestClickedValue) { biggestClickedValue = currValue.getRealValue(); clickIndex = i; } } // if we didn't click on anything grab the nearest item // (again this could and should be faster) if (clickIndex == -1 && valueCount >= 1) { clickIndex = 0; double nearestDistance = Math.min( Math.abs(selectedValuesList[0].getStartInBasePairs() - graphX), Math.abs(selectedValuesList[0].getEndInBasePairs() - graphX)); for (int i = 1; i < valueCount; i++) { BasePairInterval currValue = selectedValuesList[i]; double currDistance = Math.min(Math.abs(currValue.getStartInBasePairs() - graphX), Math.abs(currValue.getEndInBasePairs() - graphX)); if (currDistance < nearestDistance) { nearestDistance = currDistance; clickIndex = i; } } } } } return clickIndex; }