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


Java Point类代码示例

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


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

示例1: testCondFlip

import java.awt.Point; //导入依赖的package包/类
@Test
  public void testCondFlip() throws Exception {
  	String fileNameExpected = "images/expected/cond_flip";
      ConditionFlipped graphExpected = new ConditionFlipped();
      TestUtil.drawAndSave(graphExpected, fileNameExpected);
      
      String fileNameGenerated = "images/generated/cond_flip";
      ConresGraph graph = new ConresGraph();
graph.activities = new ArrayList<ConresActivity>();
graph.relations = new ArrayList<ConresRelation>();
ConresActivity act1 = new ConresActivity(0, new Point(50, 35), "Activity 1", "ROLE", false, false, false);
ConresActivity act2 = new ConresActivity(1, new Point(250, 35), "Activity 2", "ROLE", false, false, false);
graph.activities.add(act1);
graph.activities.add(act2);
ConresRelation relation = new ConresRelation(act1, act2, "cond");
graph.relations.add(relation);
JPanel graphGenerated = crv.draw(graph);
      TestUtil.drawAndSave(graphGenerated, fileNameGenerated);
  	
  	String cs1 = TestUtil.getChecksum(fileNameExpected + IMAGE_FORMAT);
  	String cs2 = TestUtil.getChecksum(fileNameGenerated + IMAGE_FORMAT);
  	assertEquals(cs1, cs2);
  }
 
开发者ID:tslaats,项目名称:SE2017-Team1,代码行数:24,代码来源:SingleRelationTests.java

示例2: newEstimateB_actionPerformed

import java.awt.Point; //导入依赖的package包/类
private void newEstimateB_actionPerformed(ActionEvent e, String tasktext, Date startDate, Date endDate) {    	
  	EstimateDialog dlg = new EstimateDialog(App.getFrame(), Local.getString("New Estimate Worksheet"));
  	Dimension frmSize = App.getFrame().getSize();
  	Point loc = App.getFrame().getLocation();
  	dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);    	
dlg.setVisible(true);

if (dlg.CANCELLED)
  		return;

// create Estimate			
  	int size = (int)dlg.loc.getValue();
  	int time = (int)dlg.minutes.getValue();
  	//PSP.Phase phase = PSP.Phase.valueOf(PSP.reverseConversion(dlg.phase.getSelectedItem().toString(),0));
  	PSP.Phase phase = PSP.Phase.valueOf(dlg.phase.getSelectedItem().toString());
  	String comments = dlg.comments.getText();		
  	String mod = dlg.module.getText();			
  	EstimateManager.createEstimate(phase, mod, size, time, comments);
  	saveEstimate();
  }
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:21,代码来源:EstimatePanel.java

示例3: calcDifCentroEapHorizontal

import java.awt.Point; //导入依赖的package包/类
/**
 * Qual a forma mais a direita e qual a mais a esquerda e qual a distnacia delas ao 'centro' da EAP
 *
 * @param areas
 * @return p.x = LEFT e p.y = Right
 */
protected Point calcDifCentroEapHorizontal(HashMap<Forma, EapBarraLigacao> areas) {
    ArrayList<Forma> lst = getListaDeFormasLigadas();
    Forma ma = capturePrincipal();
    lst.remove(ma);
    Forma fmE = getFormaMaisEsquerda(lst);
    Forma fmD = getFormaMaisDireita(lst);
    ArrayList<EapBarraLigacao> jatmp = new ArrayList<>();

    fmE = (areas.get(fmE) == null ? fmE : areas.get(fmE).calcMaisAEsquerda(jatmp, areas));
    jatmp = new ArrayList<>();
    fmD = (areas.get(fmD) == null ? fmD : areas.get(fmD).calcMaisADireita(jatmp, areas));

    int tamE = ma.getLeft() + (ma.getWidth() / 2) - fmE.getLeft();
    int tamD = fmD.getLeftWidth() - (ma.getLeftWidth() - (ma.getWidth() / 2));

    return new Point(tamE, tamD);
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:24,代码来源:EapBarraLigacao.java

示例4: spawnItemDrop

import java.awt.Point; //导入依赖的package包/类
public final void spawnItemDrop(final MapleMapObject dropper, final MapleCharacter owner, final Item item, Point pos, final boolean ffaDrop, final boolean playerDrop) {
    final Point droppos = calcDropPos(pos, pos);
    final MapleMapItem drop = new MapleMapItem(item, droppos, dropper, owner, (byte) (ffaDrop ? 2 : 0), playerDrop);

    spawnAndAddRangedMapObject(drop, new DelayedPacketCreation() {
        @Override
        public void sendPackets(MapleClient c) {
            c.announce(MaplePacketCreator.dropItemFromMapObject(drop, dropper.getPosition(), droppos, (byte) 1));
        }
    }, null);
    broadcastMessage(MaplePacketCreator.dropItemFromMapObject(drop, dropper.getPosition(), droppos, (byte) 0));

    if (!everlast) {
        TimerManager.getInstance().schedule(new ExpireMapItemJob(drop), 180000);
        activateItemReactors(drop, owner.getClient());
    }
}
 
开发者ID:NovaStory,项目名称:AeroStory,代码行数:18,代码来源:MapleMap.java

示例5: mouseClicked

import java.awt.Point; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
    JTable table = (JTable) e.getSource();
    Point pt = e.getPoint();
    int ccol = table.columnAtPoint(pt);
    int crow = table.rowAtPoint(pt);
    Object value = table.getValueAt(crow, ccol);
    if (value instanceof URL) {
        URL url = (URL) value;
        try {
            if (Desktop.isDesktopSupported()) {
                Desktop.getDesktop().browse(url.toURI());
            }
        } catch (Exception ex) {
            throw new IllegalStateException(ex);
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:19,代码来源:ContributorsTable.java

示例6: getCapturePosition

import java.awt.Point; //导入依赖的package包/类
public static byte[] getCapturePosition(MapleMap map) {
    PacketWriter pw = new PacketWriter();

    Point p1 = map.getPointOfItem(2910000);
    Point p2 = map.getPointOfItem(2910001);
    pw.writeShort(SendPacketOpcode.CAPTURE_POSITION.getValue());
    pw.write(p1 == null ? 0 : 1);
    if (p1 != null) {
        pw.writeInt(p1.x);
        pw.writeInt(p1.y);
    }
    pw.write(p2 == null ? 0 : 1);
    if (p2 != null) {
        pw.writeInt(p2.x);
        pw.writeInt(p2.y);
    }

    return pw.getPacket();
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:20,代码来源:CField.java

示例7: getEdgeIcon

import java.awt.Point; //导入依赖的package包/类
@Override
public Image getEdgeIcon(Rectangle bounds, Point[] anglePoints) {
	/*creates background image.*/
	BufferedImage bgImage = new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_4BYTE_ABGR);
	Graphics bgGr = bgImage.getGraphics();
	bgGr.setColor(new Color(0, 0, 0, 0));
	bgGr.fillRect(0, 0, bounds.width, bounds.height);
	for (int i = 0; i < anglePoints.length - 1; i++) {
		//Must convert absolute coords to local coords
		int x0 = anglePoints[i].x - bounds.x, y0 = anglePoints[i].y - bounds.y, x1 = anglePoints[i + 1].x - bounds.x, y1 = anglePoints[i + 1].y
				- bounds.y;
		bgGr.setColor(Color.GRAY);
		bgGr.drawLine(x0, y0, x1, y1);
		bgGr.setColor(new Color(30, 30, 30, 30));
		//bgGr.fillRect(Math.min(x0,x1)-1, Math.min(y0,y1)-1, Math.abs(x1-x0)+3, Math.abs(y1-y0)+3);
		bgGr.drawLine(x0 - 1, y0 - 1, x1 - 1, y1 - 1);
	}
	return bgImage;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:20,代码来源:DefaultIconsToolkit.java

示例8: calculateMovingGridLocation

import java.awt.Point; //导入依赖的package包/类
/**
 * Calculates the grid location of the moved component.
 *
 * @param cursorLocation current position of the cursor.
 */
void calculateMovingGridLocation(Point cursorLocation) {
    Point start = toComponentPane(draggingStart);
    Point end = toComponentPane(cursorLocation);
    int startX = gridXLocation(start.x, true);
    int startY = gridYLocation(start.y, true);
    int endX = gridXLocation(end.x, false);
    int endY = gridYLocation(end.y, false);
    int deltaX = endX-startX;
    int deltaY = endY-startY;
    deltaX = Math.max(deltaX, -selMinX);
    deltaY = Math.max(deltaY, -selMinY);
    int tempGridX = gridInfo.getGridX(focusedComponent) + deltaX;
    int tempGridY = gridInfo.getGridY(focusedComponent) + deltaY;
    if( !gridInfo.isGapColumn(tempGridX) && !gridInfo.isGapRow(tempGridY) ) {
        newGridX = tempGridX;
        newGridY = tempGridY;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:GlassPane.java

示例9: setNewLocation

import java.awt.Point; //导入依赖的package包/类
@Override
public void setNewLocation(Widget w, Point currentLocation) {
    ghost.setPreferredLocation(currentLocation);

    Point center = getGhostCenter();
    PoshWidget<? extends PoshElement> hitWidget = this.findContainingWidget(center);
    if (hitWidget == null) {
        ghost.setBorder(FUTILE_BORDER);
        return;
    }

    List<AbstractAcceptAction> acceptProviders = hitWidget.getAcceptProviders();

    for (AbstractAcceptAction acceptProvider : acceptProviders) {
        DataFlavor ghostDataFlavor = ghost.associatedWidget.getDataNode().getDataFlavor();
        DataFlavor acceptDataFlavor = acceptProvider.getDataFlavor();

        if (acceptDataFlavor.equals(ghostDataFlavor)) {
            ghost.setBorder(ACCEPTING_BORDER);
            return;
        }
    }
    ghost.setBorder(FUTILE_BORDER);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:25,代码来源:DnDMoveProvider.java

示例10: displayErrorDialog

import java.awt.Point; //导入依赖的package包/类
/**
 * displays a dialog box describing an error which occurred.
 */
void displayErrorDialog(Window w, String error) {
    ToolDialog ed = new ToolDialog
            (PolicyTool.getMessage("Error"), tool, this, true);

    // find where the PolicyTool gui is
    Point location = ((w == null) ?
            getLocationOnScreen() : w.getLocationOnScreen());
    //ed.setBounds(location.x + 50, location.y + 50, 600, 100);
    ed.setLayout(new GridBagLayout());

    JLabel label = new JLabel(error);
    addNewComponent(ed, label, 0,
                    0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);

    JButton okButton = new JButton(PolicyTool.getMessage("OK"));
    ActionListener okListener = new ErrorOKButtonListener(ed);
    okButton.addActionListener(okListener);
    addNewComponent(ed, okButton, 1,
                    0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);

    ed.getRootPane().setDefaultButton(okButton);
    ed.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);

    ed.pack();
    ed.setLocationRelativeTo(w);
    ed.setVisible(true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:31,代码来源:PolicyTool.java

示例11: paintGraph

import java.awt.Point; //导入依赖的package包/类
/**
 * Paints the graph outline.
 */
public void paintGraph(Graphics g)
{
	if (graphComponent != null)
	{
		Graphics2D g2 = (Graphics2D) g;
		AffineTransform tx = g2.getTransform();

		try
		{
			Point tr = graphComponent.getGraphControl().getTranslate();
			g2.translate(translate.x + tr.getX() * scale,
					translate.y + tr.getY() * scale);
			g2.scale(scale, scale);

			// Draws the scaled graph
			graphComponent.getGraphControl().drawGraph(g2, drawLabels);
		}
		finally
		{
			g2.setTransform(tx);
		}
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:27,代码来源:mxGraphOutline.java

示例12: loop

import java.awt.Point; //导入依赖的package包/类
static void loop(Simulation sim, PrintWriter out) throws GameOver {
	SimulationState simState = sim.getSimulationState();
	bot.update(simState);

	if (bot.bomb) {
		System.out.println("true");
		out.println("true");
		sim.update(true);
	} else {
		int x = bot.x;
		int y = bot.y;

		System.out.println(x + " " + y);
		out.println(x + " " + y);
		sim.update(new Point(x, y));
	}

}
 
开发者ID:bela127,项目名称:genetic-algorithm,代码行数:19,代码来源:VorführungGenAdv.java

示例13: paint

import java.awt.Point; //导入依赖的package包/类
@Override
public void paint(Graphics g) {
	ShapeTransformer masterViewTransformer = master.getRenderContext()
			.getMultiLayerTransformer().getTransformer(Layer.VIEW);
	ShapeTransformer masterLayoutTransformer = master
			.getRenderContext().getMultiLayerTransformer()
			.getTransformer(Layer.LAYOUT);
	ShapeTransformer vvLayoutTransformer = vv.getRenderContext()
			.getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

	// changed: bounds without offset
	Shape lens = new Rectangle(new Point(), master.getSize());

	lens = masterViewTransformer.inverseTransform(lens);
	lens = masterLayoutTransformer.inverseTransform(lens);
	lens = vvLayoutTransformer.transform(lens);
	Graphics2D g2d = (Graphics2D) g;
	Color old = g.getColor();
	Color lensColor = master.getBackground();
	vv.setBackground(lensColor.darker());
	g.setColor(lensColor);
	g2d.fill(lens);
	g.setColor(Color.gray);
	g2d.draw(lens);
	g.setColor(old);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:27,代码来源:MySatelliteVisualizationViewer.java

示例14: print

import java.awt.Point; //导入依赖的package包/类
/**
 * Prints an image on a component.
 *
 * @param component
 *         The component.
 *
 * @param columnIndex
 *         The x-axis (column) coordinate of the top-left character.
 *
 * @param rowIndex
 *         The y-axis (row) coordinate of the top-left character.
 *
 * @throws NullPointerException
 *         If the screen is null.
 */
private void print(final @NonNull Component component, final int columnIndex, final int rowIndex) {
    final BufferedImage temp = applyTransformations();
    final Point charPosition = new Point(0, 0);

    for (int y = 0 ; y < temp.getHeight() && y < component.getHeight() ; y++) {
        for (int x = 0 ; x < temp.getWidth() && x < component.getWidth() ; x++) {
            final int hexColor = temp.getRGB(x,y);
            final int red = (hexColor & 0x00ff0000) >> 16;
            final int green = (hexColor & 0x0000ff00) >> 8;
            final int blue =  hexColor & 0x000000ff;

            final int charX = x + columnIndex;
            final int charY = y + rowIndex;
            charPosition.setLocation(charX, charY);

            final AsciiCharacter character = component.getCharacterAt(charPosition);
            character.setCharacter(printChar);
            character.setForegroundColor(new Color(red, green, blue));
        }
    }
}
 
开发者ID:Valkryst,项目名称:VTerminal,代码行数:37,代码来源:ImagePrinter.java

示例15: isCellEditable

import java.awt.Point; //导入依赖的package包/类
@Override
public boolean isCellEditable(EventObject anEvent) {
    if (anEvent.getSource() instanceof JTable) {
        JTable table = (JTable) anEvent.getSource();
        if (anEvent instanceof MouseEvent) {
            MouseEvent event = (MouseEvent) anEvent;
            Point p = event.getPoint();
            int row = table.rowAtPoint(p);
            int col = table.columnAtPoint(p);
            Rectangle rect = table.getCellRect(row, col, true);
            p.translate(-rect.x, -rect.y);
            System.out.println("isCellEditable("+anEvent+")");
            System.out.println("Point "+p+"in rectangle "+rect);
            if (p.x > rect.width - 24) {
                // last 24 points not editable
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TableRendererTest.java


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