Example usage for java.awt Point Point

List of usage examples for java.awt Point Point

Introduction

In this page you can find the example usage for java.awt Point Point.

Prototype

public Point(int x, int y) 

Source Link

Document

Constructs and initializes a point at the specified (x,y) location in the coordinate space.

Usage

From source file:business.ImageManager.java

public void doDrawPathPcOrder(Graphics2D big, Point ori, Point dest) {
    final int x = 04 + 7 / 2 - 4;
    final int y = 22 + 13 / 2 + 2;
    doDrawPathOrdem(big, new Point((int) ori.getX() + x, (int) ori.getY() + y),
            new Point((int) dest.getX() + x, (int) dest.getY() + y), colorMineOrdem);
}

From source file:edu.ku.brc.af.ui.forms.validation.ValFormattedTextFieldSingle.java

@Override
public void paint(Graphics g) {
    super.paint(g);

    String text = getText();/*from  w  w  w .ja va  2 s.c  om*/

    //System.err.println("isViewOnly "+isViewOnly+"  isEnabled() "+isEnabled()+ "  ["+text+"]  "+(text.length() < bgStr.length()));
    if (!isViewOnly && needsUpdating && isEnabled() && text != null && text.length() < bgStr.length()) {
        FontMetrics fm = g.getFontMetrics();
        int w = fm.stringWidth(text);
        pnt = new Point(inner.left + w, inner.top + fm.getAscent());

        Rectangle r = g.getClipBounds();
        Dimension s = getSize();
        Insets i2 = getBorder().getBorderInsets(this);
        int x = i2.left - 1;
        int y = i2.top - 1;
        //int ww = s.width - i2.right + 1;
        int hh = s.height - i2.bottom + 1;

        String str = bgStr.substring(text.length(), bgStr.length());
        int bgW = fm.stringWidth(str);

        g.setClip(x + w, y, Math.min(x + bgW, g.getClipBounds().width - x), hh);

        g.setColor(textColor);
        g.drawString(str, pnt.x, pnt.y);

        g.setClip(r.x, r.y, r.width, r.height); // reset clip
    }

    //System.out.println(hashCode() + " isNew: " +isNew+"  valState: "+valState+"    isEnabled: "+isEnabled());
    // 3/2/09 - rods - removing !isNew from the condition
    //if (!isNew && valState == UIValidatable.ErrorType.Error && isEnabled())
    if (valState == UIValidatable.ErrorType.Error && isEnabled()) {
        UIHelper.drawRoundedRect((Graphics2D) g, isNew ? new Color(249, 249, 0) : valTextColor.getColor(),
                getSize(), 1);
    } else if (valState == UIValidatable.ErrorType.Incomplete && isEnabled()) {
        UIHelper.drawRoundedRect((Graphics2D) g, new Color(249, 249, 0), getSize(), 1);
    }
}

From source file:User.Interface.SupplierAdminRole.ReviewSalesJPanel.java

private void displayBarCharts() {

    //check if the supplier has products in the product list
    if (supplierAdminOrganization.getMedicalDeviceCatalog().getMedicalDeviceList().size() < 0) {
        JOptionPane.showMessageDialog(this, "No products found from selected supplier.", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return;/*from   w w w  . j  av a  2s. c  o  m*/
    }

    MedicalDevice[] product;
    product = new MedicalDevice[100];

    int numberOfProducts = supplierAdminOrganization.getMedicalDeviceCatalog().getMedicalDeviceList().size();
    DefaultCategoryDataset dataSetProduct = new DefaultCategoryDataset();

    for (int i = 0; i < numberOfProducts; i++) {
        product[i] = supplierAdminOrganization.getMedicalDeviceCatalog().getMedicalDeviceList().get(i);
        int soldQuantity = 0;
        soldQuantity = product[i].getSoldQuantity();
        String prodName = product[i].getDeviceName();
        dataSetProduct.setValue(soldQuantity, "Medical Device", prodName);
    }

    JFreeChart chartProduct = ChartFactory.createBarChart("Supplier Performance Report", "Products",
            "Number of Products Sold", dataSetProduct, PlotOrientation.VERTICAL, false, true, false);

    CategoryPlot p1 = chartProduct.getCategoryPlot();
    p1.setRangeGridlinePaint(Color.black);
    ChartFrame frame1 = new ChartFrame("Supplier Performance Report", chartProduct);
    frame1.setVisible(true);
    frame1.setSize(400, 400);
    Point pt1 = new Point(0, 0);
    frame1.setLocation(pt1);
}

From source file:edu.purdue.cc.bionet.ui.HeatMap.java

/**
 * The mouseClicked method of the MouseListener interface.
 * /*  www  . j  ava2s  . c  om*/
 * @param event The MouseEvent which triggered this action.
 */
public void mouseClicked(MouseEvent event) {
    if (mapPosition.contains(event.getPoint())) {
        Correlation clicked = this.getCorrelationFromPoint(new Point(event.getX(), event.getY()));
        if (clicked != null && this.range.contains(Math.abs(clicked.getValue(this.correlationMethod)))) {
            this.fireGraphMouseEvent(clicked, event);
        }
    }

}

From source file:business.ImageManager.java

public void doDrawPathPcAllyOrder(Graphics2D big, Point ori, Point dest) {
    final int x = 04 + 7 / 2 + 4 + 4;
    final int y = 22 + 13 / 2 - 3 - 2;
    doDrawPathOrdem(big, new Point((int) ori.getX() + x, (int) ori.getY() + y),
            new Point((int) dest.getX() + x, (int) dest.getY() + y), colorAllyOrdem);
}

From source file:com.mirth.connect.client.ui.ChannelSetup.java

/**
 * Shows the popup menu when the trigger button (right-click) has been pushed.
 *///from w  ww  .j  a  va  2 s  .  co  m
private void checkSelectionAndPopupMenu(java.awt.event.MouseEvent evt) {
    int row = destinationTable.rowAtPoint(new Point(evt.getX(), evt.getY()));

    if (evt.isPopupTrigger()) {
        if (row != -1) {
            destinationTable.setRowSelectionInterval(row, row);
        }
        showChannelEditPopupMenu(evt);
    }
}

From source file:it.unibas.spicygui.controllo.provider.intermediatezone.WidgetCreator.java

public Widget createFunctionalDependencyWidget(Scene scene, LayerWidget mainLayer, LayerWidget connectionLayer,
        JPanel pannelloPrincipale, Point point, GraphSceneGlassPane glassPane) {
    FunctionalDependencyWidget rootWidget = new FunctionalDependencyWidget(scene, point);
    CaratteristicheWidgetInterFunctionalDep caratteristicheWidget = new CaratteristicheWidgetInterFunctionalDep();

    caratteristicheWidget.setTgdView(false);

    caratteristicheWidget.setTreeType(Costanti.INTERMEDIE);

    rootWidget.getActions().addAction(ActionFactory.createConnectAction(connectionLayer,
            new ActionFunctionalDepConnection(connectionLayer, mainLayer, caratteristicheWidget)));
    rootWidget.getActions()//from ww w  . ja va 2s . com
            .addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderDeleteFunctionalDep(glassPane)));

    CaratteristicheBarra caratteristicheBarra = new CaratteristicheBarra(rootWidget, Costanti.INTERMEDIE_BARRA);
    IconNodeWidget barra = new IconNodeWidget(scene);
    barra.setImage(ImageUtilities.loadImage(Costanti.ICONA_MOVE));
    Point pointBarra = new Point(rootWidget.getPreferredLocation().x - Costanti.OFF_SET_X_WIDGET_BARRA,
            rootWidget.getPreferredLocation().y - Costanti.OFF_SET_Y_WIDGET_BARRA);
    barra.setPreferredLocation(pointBarra);
    IntermediateMoveProvider moveProvider = new IntermediateMoveProvider(pannelloPrincipale);
    barra.getActions().addAction(ActionFactory.createMoveAction(moveProvider, moveProvider));
    caratteristicheWidget.setWidgetBarra(barra);

    mainLayer.addChild(rootWidget, caratteristicheWidget);
    mainLayer.addChild(barra, caratteristicheBarra);

    glassPane.addFunctionalDependency(rootWidget);
    glassPane.addFunctionalDependency(barra);
    scene.validate();

    return rootWidget;
}

From source file:net.openbyte.gui.CreateProjectFrame.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Gary Lee
    button1 = new JButton();
    textField1 = new JTextField();
    label1 = new JLabel();
    comboBox1 = new JComboBox<>();
    label2 = new JLabel();
    comboBox2 = new JComboBox<>();
    label3 = new JLabel();
    button2 = new JButton();

    //======== this ========
    setTitle("Project Creation");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    setResizable(false);//w  ww .j  a  va2s .  c om
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    //---- button1 ----
    button1.setText("Create project");
    button1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button1ActionPerformed(e);
        }
    });
    contentPane.add(button1);
    button1.setBounds(new Rectangle(new Point(340, 170), button1.getPreferredSize()));
    contentPane.add(textField1);
    textField1.setBounds(10, 25, 245, textField1.getPreferredSize().height);

    //---- label1 ----
    label1.setText("Project Name");
    contentPane.add(label1);
    label1.setBounds(new Rectangle(new Point(10, 5), label1.getPreferredSize()));

    //---- comboBox1 ----
    comboBox1.setModel(new DefaultComboBoxModel<>(new String[] { "Minecraft Forge", "MCP", "Bukkit" }));
    comboBox1.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            comboBox1ItemStateChanged(e);
        }
    });
    contentPane.add(comboBox1);
    comboBox1.setBounds(10, 70, 245, comboBox1.getPreferredSize().height);

    //---- label2 ----
    label2.setText("Modification API");
    contentPane.add(label2);
    label2.setBounds(new Rectangle(new Point(10, 50), label2.getPreferredSize()));

    //---- comboBox2 ----
    comboBox2.setModel(new DefaultComboBoxModel<>(new String[] { "1.8.9", "1.7.10" }));
    contentPane.add(comboBox2);
    comboBox2.setBounds(10, 120, 245, comboBox2.getPreferredSize().height);

    //---- label3 ----
    label3.setText("Minecraft Version");
    contentPane.add(label3);
    label3.setBounds(new Rectangle(new Point(10, 100), label3.getPreferredSize()));

    //---- button2 ----
    button2.setText("Cancel");
    button2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button2ActionPerformed(e);
        }
    });
    contentPane.add(button2);
    button2.setBounds(new Rectangle(new Point(10, 170), button2.getPreferredSize()));

    { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < contentPane.getComponentCount(); i++) {
            Rectangle bounds = contentPane.getComponent(i).getBounds();
            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = contentPane.getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        contentPane.setMinimumSize(preferredSize);
        contentPane.setPreferredSize(preferredSize);
    }
    setSize(480, 240);
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:business.ImageManager.java

public void doDrawPathArmyOrder(Graphics2D big, Point ori, Point dest) {
    final int x = 30;
    final int y = 30;
    doDrawPathOrdemArmy(big, new Point((int) ori.getX() + x, (int) ori.getY() + y),
            new Point((int) dest.getX() + x, (int) dest.getY() + y), colorMineArmyOrdem);
}

From source file:fr.landel.utils.commons.CollectionUtils2Test.java

/**
 * Test method for//from   w  w w  .  j a  v  a  2  s.  c o m
 * {@link CollectionUtils2#transformIntoList(I[], Transformer)} .
 * {@link CollectionUtils2#transformIntoList(I[], Function)} .
 */
@Test
public void testTransformIntoListIArrayTransformerOfIO() {
    try {
        Point[] points = new Point[3];
        points[0] = new Point(1, 2);
        points[1] = new Point(2, 0);

        List<String> pointsList = CollectionUtils2.transformIntoList(points, TRANSFORMER);

        assertNotNull(pointsList);
        assertTrue(pointsList.size() > 0);
        assertThat(pointsList, Matchers.contains("1, 2", "2, 0", null));

        pointsList = CollectionUtils2.transformIntoList(points, FUNCTION);

        assertNotNull(pointsList);
        assertTrue(pointsList.size() > 0);
        assertThat(pointsList, Matchers.contains("1, 2", "2, 0", null));
    } catch (IllegalArgumentException e) {
        fail("The test isn't correct");
    }
}