• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JXLayer类的典型用法和代码示例

java 2次浏览

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

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

示例1: processKeyEvent

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
public void processKeyEvent(java.awt.event.KeyEvent e, JXLayer<? extends V> l) {
    if (e.getID() != KeyEvent.KEY_PRESSED) {
        // We are only interested in KEY_PRESSED event.
        return;
    }
    final int code = e.getKeyCode();
    switch(code) {
        case KeyEvent.VK_LEFT:
            this.updateTraceInfosIfPossible(-1);
            break;
        case KeyEvent.VK_RIGHT:
            this.updateTraceInfosIfPossible(+1);
            break;
    }
}
 

开发者ID:lead4good,
项目名称:open-java-trade-manager,
代码行数:17,
代码来源:ChartLayerUI.java

示例2: maybeShowPopup

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void maybeShowPopup(MouseEvent event) {
          if (event.isPopupTrigger()) {
              popup.removeAll();
              updatePopupMenu(popup);

              // get the tranform model and the transform of the combobox container
              Container container = ReportGrid.this.getParent();
              while (!(container instanceof JXLayer)) {
                  container = container.getParent();
              }
              JXLayer parentLayer = (JXLayer) container;
              DefaultTransformModel parentModel = (DefaultTransformModel) ((TransformUI) parentLayer.getUI()).getModel();
              AffineTransform parentTransform = parentModel.getTransform(parentLayer);

              Point point = SwingUtilities.convertPoint(event.getComponent(), event.getPoint(), parentLayer);
              parentTransform.transform(point, point);

              //Show the popup relative to JXLayer
              popup.show(parentLayer, point.x, point.y);                
          }
      }
 

开发者ID:nextreports,
项目名称:nextreports-designer,
代码行数:23,
代码来源:ReportGrid.java

示例3: paintLayer

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void paintLayer(Graphics2D g2, JXLayer<? extends T> jxl) {
    super.paintLayer(g2, jxl);
    g2.setPaintMode();    // Make sure XOR is turned off

    if (dataCoordinator.getVideoFrame() != null) {

        if (boundingBox != null) {

            // Draw the bounding box
            g2.setPaint(Color.MAGENTA);
            g2.setXORMode(Color.WHITE);
            g2.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[] { 2, 2 },
                    2));
            g2.draw(boundingBox);
            g2.setPaintMode();
        }
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:20,
代码来源:AnnotationLayerUI.java

示例4: processMouseMotionEvent

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseMotionEvent(me, jxl);

    if ((me.getID() == MouseEvent.MOUSE_MOVED) && selectedLineStart && !selectedLineEnd) {
        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
        int w = jxl.getWidth();
        int h = jxl.getHeight();

        /*
         * Create crosshair
         */
        line.reset();
        if ((point.y <= h) && (point.x <= w)) {
            Point2D componentPoint = jxl.getView().convertToComponent(lineStart);
            line.moveTo(componentPoint.getX(), componentPoint.getY());
            line.lineTo(point.x, point.y);
        }

        // mark the ui as dirty and needed to be repainted
        setDirty(true);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:24,
代码来源:MeasurementLayerUI.java

示例5: updateMeasurementPath

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 * Resets the path of measurement lines and comment location based on the size of the underlying componenet
 * @param measurementPath
 * @param jxl
 */
private void updateMeasurementPath(MeasurementPath measurementPath, JXLayer<? extends T> jxl) {

    Measurement measurement = measurementPath.measurement;
    GeneralPath generalPath = measurementPath.generalPath;
    generalPath.reset();

    Point2D imagePoint0 = new Point2D.Double(measurement.getX0(), measurement.getY0());
    Point2D componentPoint2D0 = jxl.getView().convertToComponent(imagePoint0);
    generalPath.moveTo(componentPoint2D0.getX(), componentPoint2D0.getY());

    Point2D imagePoint1 = new Point2D.Double(measurement.getX1(), measurement.getY1());
    Point2D componentPoint2D1 = jxl.getView().convertToComponent(imagePoint1);
    generalPath.lineTo(componentPoint2D1.getX(), componentPoint2D1.getY());

    double cx = ((componentPoint2D0.getX() + componentPoint2D1.getX()) / 2) + 5;
    double cy = (componentPoint2D0.getY() + componentPoint2D1.getY()) / 2;
    measurementPath.commentPoint.setLocation(cx, cy);

}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:25,
代码来源:MeasurementLayerUI.java

示例6: processMouseMotionEvent

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseMotionEvent(me, jxl);
    if ((me.getID() == MouseEvent.MOUSE_MOVED) && (pointsIC.size() > 1)) {
        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);

        currentPointCC.setLocation(point.getX(), point.getY());
        int w = jxl.getWidth();
        int h = jxl.getHeight();

        bridgeCC.reset();
        if ((point.y <= h) && (point.x <= w) && (point.y >= 0) && (point.x >= 0)) {
            java.awt.geom.Point2D start = jxl.getView().convertToComponent(pointsIC.get(0).toJavaPoint2D());
            java.awt.geom.Point2D end = jxl.getView().convertToComponent(pointsIC.get(pointsIC.size() -
                1).toJavaPoint2D());
            bridgeCC.moveTo(start.getX(), start.getY());
            bridgeCC.lineTo(currentPointCC.getX(), currentPointCC.getY());
            bridgeCC.lineTo(end.getX(), end.getY());
        }

        // mark the ui as dirty and needed to be repainted
        setDirty(true);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:25,
代码来源:AreaMeasurementLayerUI2.java

示例7: paintLayer

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param g2
 * @param jxl
 */
public void paintLayer(Graphics2D g2, JXLayer<? extends T> jxl) {
    super.paintLayer(g2, jxl);

    // --- Draw and label existing measurements for selected observations
    g2.setPaint(paint);
    g2.setStroke(stroke);
    for (AreaMeasurementPath path : areaMeasurementPaths) {
        try {
            updateAreaMeasurementPath(path, jxl);
            String comment = path.areaMeasurement.getComment();
            g2.draw(path.generalPath);
            g2.setFont(lineFont);
            if (!Strings.isNullOrEmpty(comment)) {
                g2.drawString(comment, (float) path.commentPoint.getX(), (float) path.commentPoint.getY());
            }
        }
        catch (Exception e) {
            log.warn("Problem with drawing area measurement path", e);
        }
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:27,
代码来源:JXAreaMeasurementPainter.java

示例8: processMouseEvent

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseEvent(MouseEvent me, JXLayer<? extends T> jxl) {

    //System.out.println(getClass().getSimpleName() + ".processMouseEvent -> MouseEvent: " + me.getID());
    super.processMouseEvent(me, jxl);
    boolean dirty = false;
    for (JXPainter<T> painter : painters) {
        painter.processMouseEvent(me, jxl);
        if (painter.isDirty()) {
            dirty = true;
        }
    }
    if (dirty) {
        setDirty(dirty);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:17,
代码来源:MultiLayerUI.java

示例9: processMouseMotionEvent

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent me, JXLayer<? extends T> jxl) {

    //System.out.println(getClass().getSimpleName() + ".processMouseMotionEvent -> MouseEvent: " + me.getID());
    super.processMouseMotionEvent(me, jxl);
    boolean dirty = false;
    for (JXPainter<T> painter : painters) {
        painter.processMouseMotionEvent(me, jxl);
        if (painter.isDirty()) {
            dirty = true;
        }
    }
    if (dirty) {
        setDirty(dirty);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:17,
代码来源:MultiLayerUI.java

示例10: processMouseMotionEvent

点赞 3

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param me
 * @param jxl
 */
@Override
public void processMouseMotionEvent(MouseEvent me, JXLayer jxl) {

    if ((me.getID() == MouseEvent.MOUSE_MOVED) || (me.getID() == MouseEvent.MOUSE_DRAGGED)) {
        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
        int w = jxl.getWidth();
        int h = jxl.getHeight();

        if ((point.y <= h) && (point.x < w)) {
            circle = new Ellipse2D.Double(point.x - radius, point.y - radius, diameter, diameter);
        }

        // mark the ui as dirty and needed to be repainted
        setDirty(true);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:22,
代码来源:JXTargetPainter.java

示例11: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void paintLayer(Graphics2D g2, JXLayer<? extends V> layer) {
    super.paintLayer(g2, layer);
    
    if (this.mainTraceInfo.getPoint() == null) {
        return;
    }

    final Object oldValueAntiAlias = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    final Color oldColor = g2.getColor();

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setColor(COLOR_BLUE);
    final int BALL_RADIUS = 8;
    g2.fillOval((int)(this.mainTraceInfo.getPoint().getX() - (BALL_RADIUS >> 1) + 0.5), (int)(this.mainTraceInfo.getPoint().getY() - (BALL_RADIUS >> 1) + 0.5), BALL_RADIUS, BALL_RADIUS);

    for (TraceInfo indicatorTraceInfo : this.indicatorTraceInfos) {
        final Point2D point = indicatorTraceInfo.getPoint();
        if (null == point) {
            continue;
        }
        g2.fillOval((int)(point.getX() - (BALL_RADIUS >> 1) + 0.5), (int)(point.getY() - (BALL_RADIUS >> 1) + 0.5), BALL_RADIUS, BALL_RADIUS);
    }

    g2.setColor(oldColor);
    
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldValueAntiAlias);
    this.drawInformationBox(g2, layer);
}
 

开发者ID:lead4good,
项目名称:open-java-trade-manager,
代码行数:30,
代码来源:ChartLayerUI.java

示例12: processEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
private void processEvent(MouseEvent e, JXLayer layer) {
    if (MouseEvent.MOUSE_DRAGGED == e.getID()) {
        return;
    }

    final Point mousePoint = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), layer);
    if (this.updateMainTraceInfo(mousePoint)) {
        //this.updateIndicatorTraceInfos(this.mainTraceInfo.getDataIndex());
        this.setDirty(true);
    }
}
 

开发者ID:lead4good,
项目名称:open-java-trade-manager,
代码行数:12,
代码来源:ChartLayerUI.java

示例13: getLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 * @return
 */
protected JXLayer<JImageUrlCanvas> getLayer() {
    if (layer == null) {
        layer = new JXLayer<JImageUrlCanvas>(getImageCanvas());
        layer.setUI(layers.get(0));    // Add first layer in the list as the default UI.
        setSettingsPanel(layers.get(0).getSettingsBuilder().getPanel());
    }

    return layer;
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:13,
代码来源:ImageAnnotationFrame.java

示例14: main

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
     *
     * @param args
     */
    public static void main(String[] args) {

        final Injector injector = (Injector) Lookup.getGuiceInjectorDispatcher().getValueObject();
        ToolBelt toolBelt = injector.getInstance(ToolBelt.class);

        // Layout components
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());

        // Load image
        URL url = frame.getClass().getResource("/images/BrianSchlining.jpg");
        final JImageUrlCanvas label = new JImageUrlCanvas(url);

        // Create JXLayer
        MeasurementLayerUI<JImageUrlCanvas> layerUI = new MeasurementLayerUI<JImageUrlCanvas>(toolBelt,
                new CommonPainters<JImageUrlCanvas>(new JXHorizontalLinePainter<JImageUrlCanvas>(label),
                new JXCrossHairPainter<JImageUrlCanvas>()));
        JXLayer<JImageUrlCanvas> layer = new JXLayer<JImageUrlCanvas>(label);
        layer.setUI(layerUI);


//        frame.addComponentListener(new ComponentAdapter() {
//
//            public void componentResized(ComponentEvent e) {
//                label.setSize(frame.getWidth(), frame.getHeight());
//                frame.repaint();
//            }
//
//        });

        frame.add(layer, BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
    }
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:40,
代码来源:MeasurementLayerUIDemo.java

示例15: main

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
public static void main(String[] args) {
    // Layout components
    final JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    // Load image
    URL url = frame.getClass().getResource("/images/BrianSchlining.jpg");
    final JImageUrlCanvas label = new JImageUrlCanvas(url);

    MultiLayerUI<JComponent> layerUI = new MultiLayerUI<JComponent>();
    JXLayer<JComponent> layer = new JXLayer<JComponent>(label);
    layer.setUI(layerUI);

    JXPainter<JComponent> painter = new JXHorizontalLinePainter<JComponent>(label) { {
        setDistances(Arrays.asList(0.20, 0.50, 0.80));
    }};
    layerUI.addPainter(painter);

    painter = new JXCrossHairPainter<JComponent>();
    layerUI.addPainter(painter);



    frame.add(layer, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:29,
代码来源:JXHorizontalLinePainterDemo.java

示例16: processMouseMotionEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseMotionEvent(me, jxl);

    switch (me.getID()) {
    case MouseEvent.MOUSE_DRAGGED:

        // Draw bounding box
        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
        int x1 = (int) Math.round(point.getX());
        int y1 = (int) Math.round(point.getY());
        int x0 = (int) clickPoint.getX();
        int y0 = (int) clickPoint.getY();
        int w = Math.abs(x1 - x0);
        int h = Math.abs(y1 - y0);

        int x = Math.min(x0, x1);
        int y = Math.min(y0, y1);
        if (boundingBox == null) {
            boundingBox = new Rectangle2D.Double(x, y, w, h);
        }
        else {

            // Minimize he redraw area
            boundingBox.setRect(x, y, w, h);
        }

        setDirty(true);
        break;
    default:

    // Do nothing

    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:36,
代码来源:AnnotationLayerUI.java

示例17: processMouseEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseEvent(me, jxl);
    if (me.getID() == MouseEvent.MOUSE_RELEASED) {
        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
        JImageUrlCanvas imageCanvas = jxl.getView();
        Point imagePoint = AwtUtilities.toPoint(imageCanvas.convertToImage(point));
        sourcePoints.add(imagePoint);
        setDirty(true);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:12,
代码来源:PointAdditionLayerUI.java

示例18: processMouseMotionEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseMotionEvent(me, jxl);

    if ((me.getID() == MouseEvent.MOUSE_MOVED) || (me.getID() == MouseEvent.MOUSE_DRAGGED)) {

        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
        JImageUrlCanvas imageCanvas = jxl.getView();

        if (imageCanvas.getImageRectangle().contains(point)) {
            Point imagePoint = AwtUtilities.toPoint(imageCanvas.convertToImage(point));
            Point componentPoint = AwtUtilities.toPoint(imageCanvas.convertToComponent(imagePoint));
            coordinateString = "(SRC[" + point.x + ", " + point.y + "] Image[" + imagePoint.x + ", " +
                    imagePoint.y + "] DST[" + componentPoint.x + ", " + componentPoint.y + "])";
            coordinatePoint = point;
        }
        else {
            coordinateString = null;
            coordinatePoint = null;
        }

        // mark the ui as dirty and needed to be repainted
        setDirty(true);
    }


}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:28,
代码来源:PointAdditionLayerUI.java

示例19: newMeasurement

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 * Creates a measurement from the current parameters
 * @param comment
 * @param jxl
 * @return
 */
private Measurement newMeasurement(String comment, JXLayer<? extends T> jxl) {

    int x0 = (int) Math.round(lineStart.getX());
    int y0 = (int) Math.round(lineStart.getY());
    int x1 = (int) Math.round(lineEnd.getX());
    int y1 = (int) Math.round(lineEnd.getY());

    return new Measurement(x0, y0, x1, y1, comment);
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:16,
代码来源:MeasurementLayerUI.java

示例20: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void paintLayer(Graphics2D g2, JXLayer<? extends T> jxl) {
    super.paintLayer(g2, jxl);
    g2.setPaintMode();    // Make sure XOR is turned off


    // --- Draw and label existing measurements for selected observation
    g2.setPaint(Color.GREEN);
    g2.setStroke(new BasicStroke(2));
    for (MeasurementPath path : measurementPaths) {
        try {
            updateMeasurementPath(path, jxl);
            String comment = path.measurement.getComment();
            g2.draw(path.generalPath);
            g2.setFont(lineFont);
            g2.drawString(comment, (float) path.commentPoint.getX(), (float) path.commentPoint.getY());
        }
        catch (Exception e) {
            log.warn("Problem with drawing measurement path", e);
        }
    }
    g2.setPaintMode();

    // --- Paint lineStart
    g2.setStroke(new BasicStroke(2));
    g2.setPaint(Color.RED);
    final int markerOffset = markerDiameter / 2;
    if (selectedLineStart) {
        Point2D lineStartPoint = jxl.getView().convertToComponent(lineStart);
        Point componentPoint = AwtUtilities.toPoint(lineStartPoint);
        int x = componentPoint.x;
        int y = componentPoint.y;
        Ellipse2D marker = new Ellipse2D.Double(x - markerOffset, y - markerOffset, markerDiameter, markerDiameter);
        g2.draw(marker);
        g2.draw(line);
    }


}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:40,
代码来源:MeasurementLayerUI.java

示例21: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
public void paintLayer(Graphics2D g2, JXLayer<? extends A> jxl) {
    g2.setStroke(stroke);
    g2.setPaint(Color.MAGENTA);
    //g2.setXORMode(Color.GREEN);
    int w = jxl.getWidth();
    int h = jxl.getHeight();
    for (HorizontalLine line : horizontalLines) {
        line.update(w);
        g2.draw(line.path);
    }
    g2.setPaintMode();
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:14,
代码来源:JXHorizontalLinePainter.java

示例22: main

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param args
 *
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    JFrame frame = new JFrame("DEMO");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    JPanel panel = new JPanel(new BorderLayout());

    URL url = frame.getClass().getResource("/images/BrianSchlining.jpg");
    BufferedImage image = ImageIO.read(url);
    JLabel label = new JLabel(new ImageIcon(image));

    MultiLayerUI<JComponent> layerUI = new MultiLayerUI<JComponent>();
    JXPainter painter = new JXCrossHairPainter();
    layerUI.addPainter(painter);
    layerUI.addPainter(new JXTargetPainter<JComponent>());

    JXGridPainter<JComponent> gridPainter = new JXGridPainter<JComponent>();
    gridPainter.setPixelHeight(image.getHeight());
    gridPainter.setPixelWidth(image.getWidth());
    gridPainter.setPixelDistance(20);
    gridPainter.setAngle(45D * Math.PI / 180D);
    layerUI.addPainter(gridPainter);


    JXLayer<JComponent> layer = new JXLayer<JComponent>(label);
    layer.setUI(layerUI);

    panel.add(layer, BorderLayout.CENTER);
    frame.add(panel, BorderLayout.CENTER);

    frame.setSize(image.getWidth(), image.getHeight());
    frame.setLocationByPlatform(true);
    frame.setVisible(true);


}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:43,
代码来源:MultiLayerUIDemo.java

示例23: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param gd
 * @param jxl
 */
@Override
public void paintLayer(Graphics2D gd, JXLayer<? extends A> jxl) {
    gd.setStroke(stroke);
    gd.setPaint(Color.GRAY);
    gd.setXORMode(Color.WHITE);
    gd.draw(crosshair);
    gd.setPaintMode();
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:14,
代码来源:JXCrossHairPainter.java

示例24: processMouseMotionEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param me
 * @param jxl
 */
@Override
public void processMouseMotionEvent(MouseEvent me, JXLayer jxl) {
    if ((me.getID() == MouseEvent.MOUSE_MOVED) || (me.getID() == MouseEvent.MOUSE_DRAGGED)) {
        Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
        int w = jxl.getWidth();
        int h = jxl.getHeight();

        /*
        * Create crosshair
        */
        crosshair.reset();

        if (point.y <= h) {
            crosshair.moveTo(0, point.y);
            crosshair.lineTo(w, point.y);
        }

        if (point.x <= w) {
            crosshair.moveTo(point.x, 0);
            crosshair.lineTo(point.x, h);
        }

        // mark the ui as dirty and needed to be repainted
        setDirty(true);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:32,
代码来源:JXCrossHairPainter.java

示例25: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void paintLayer(Graphics2D g2, JXLayer<? extends T> jxl) {
    super.paintLayer(g2, jxl);
    for (JXPainter<T> painter : painters) {

        //log.debug("Painting: " + painter);
        painter.paintLayer(g2, jxl);
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:10,
代码来源:MultiLayerUI.java

示例26: main

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
     *
     * @param args
     */
    public static void main(String[] args) {

        // Layout components
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());

        // Load image
        URL url = frame.getClass().getResource("/images/BrianSchlining.jpg");
        final JImageUrlCanvas label = new JImageUrlCanvas(url);

        // Create JXLayer
        PointAdditionLayerUI<JImageUrlCanvas> layerUI = new PointAdditionLayerUI<JImageUrlCanvas>();
        JXLayer<JImageUrlCanvas> layer = new JXLayer<JImageUrlCanvas>(label);
        layer.setUI(layerUI);

//        frame.addComponentListener(new ComponentAdapter() {
//
//            public void componentResized(ComponentEvent e) {
//                label.setSize(frame.getWidth(), frame.getHeight());
//                frame.repaint();
//            }
//
//        });

        frame.add(layer, BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
    }
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:34,
代码来源:PointAdditionLayerDemo.java

示例27: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param g2
 * @param jxl
 */
@Override
public void paintLayer(Graphics2D g2, JXLayer<? extends A> jxl) {

    // --- Paint
    g2.setStroke(new BasicStroke(2));
    g2.setPaint(Color.WHITE);

    List<GeneralPath> lines = buildLines();
    for (GeneralPath line : lines) {
        g2.draw(line);
    }

}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:19,
代码来源:JXGridPainter.java

示例28: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param gd
 * @param jxl
 */
@Override
public void paintLayer(Graphics2D gd, JXLayer<? extends A> jxl) {
    gd.setXORMode(Color.WHITE);
    gd.draw(circle);
    gd.setPaintMode();
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:12,
代码来源:JXTargetPainter.java

示例29: processMouseEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseEvent(MouseEvent e, JXLayer<? extends V> layer) {
    super.processMouseEvent(e, layer);
    this.processEvent(e, layer);
}
 

开发者ID:lead4good,
项目名称:open-java-trade-manager,
代码行数:6,
代码来源:ChartLayerUI.java

示例30: processMouseMotionEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent e, JXLayer<? extends V> layer) {
    super.processMouseMotionEvent(e, layer);
    this.processEvent(e, layer);
}
 

开发者ID:lead4good,
项目名称:open-java-trade-manager,
代码行数:6,
代码来源:ChartLayerUI.java

示例31: JXLayerTest

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
public JXLayerTest() throws HeadlessException {
    setTitle( "Test" );
    setSize( 700, 300 );

    JPanel content = new JPanel( new GridLayout( 1, 2 ) );

    JXLayer<JComponent> layer = new JXLayer<JComponent>( createPanel( "High-contrast", "With high-contrast filter" ) );
    BufferedLayerUI<JComponent> bufferedLayerUI = new BufferedLayerUI<JComponent>();
    BufferedImageOpEffect imageOpEffect = new BufferedImageOpEffect( new HighContrastOp() );
    bufferedLayerUI.setLayerEffects( imageOpEffect );
    layer.setUI( bufferedLayerUI );


    content.add( createPanel( "Regular", "Without high-contrast filter" ) );
    content.add( layer );

    setContentPane( content );

    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

    setVisible( true );
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:23,
代码来源:JXLayerTest.java

示例32: createPopup

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
protected ComboPopup createPopup() {
    BasicComboPopup popup = new BasicComboPopup(comboBox) {

        @SuppressWarnings("unchecked")
        public void show() {

            // get the tranform model and the transform of the combobox container
            Container comboContainer = comboBox.getParent();
            while (!(comboContainer instanceof JXLayer)) {
                if (comboContainer == null) {
                    return;
                }
                comboContainer = comboContainer.getParent();
            }
            JXLayer parentLayer = (JXLayer) comboContainer;
            DefaultTransformModel parentModel = (DefaultTransformModel) ((TransformUI) parentLayer.getUI()).getModel();
            AffineTransform parentTransform = parentModel.getTransform(parentLayer);

            //compute width of text
            int widest = getWidestItemWidth();

            //Get the box's size
            Dimension popupSize = comboBox.getSize();

            //Set the size of the popup
            popupSize.setSize(widest + (2 * padding), getPopupHeightForRowCount(comboBox.getMaximumRowCount()));

            //Compute the complete bounds , take care if there is a border
            Border border = comboBox.getBorder();
            int left = 0;
            int bottom = 0;
            if (border != null) {
                Insets insets = border.getBorderInsets(comboBox);
                left = insets.left;
                bottom = insets.bottom;
            }
            Rectangle popupBounds = computePopupBounds(left, comboBox.getBounds().height-bottom, popupSize.width, popupSize.height);

            //Set the size of the scroll pane
            Dimension dim = parentTransform.createTransformedShape(popupBounds).getBounds().getSize();           
            list.setPreferredSize(new Dimension(dim.width, list.getPreferredSize().height));
            scroller.setMaximumSize(dim);
            scroller.setPreferredSize(dim);
            scroller.setMinimumSize(dim);

            //Cause it to re-layout
            list.invalidate();

            //Handle selection of proper item
            int selectedIndex = comboBox.getSelectedIndex();
            if (selectedIndex == -1) {
                list.clearSelection();
            } else {
                list.setSelectedIndex(selectedIndex);
            }

            //Make sure the selected item is visible
            list.ensureIndexIsVisible(list.getSelectedIndex());

            //Use lightweight if asked for
            setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());

            // use the same transform model for the base JXLayer and the popup JXLayer
            JXLayer layer = TransformUtils.createTransformJXLayer(list, parentModel, new QualityHints());
            scroller.setViewportView(layer);

            // apply transform for popup top left point
            Point point = new Point(left, comboBox.getHeight()-bottom);
            point = SwingUtilities.convertPoint(comboBox, point, parentLayer);
            parentTransform.transform(point, point);
                                                           
            //Show the popup relative to JXLayer
            show(parentLayer, point.x, point.y);

        }
    };
    popup.getAccessibleContext().setAccessibleParent(comboBox);
    return popup;
}
 

开发者ID:nextreports,
项目名称:nextreports-designer,
代码行数:80,
代码来源:SteppedComboBoxUI.java

示例33: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param g2
 * @param jxl
 */
@Override
public void paintLayer(Graphics2D g2, JXLayer<? extends A> jxl) {

    //To change body of implemented methods use File | Settings | File Templates.
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:11,
代码来源:AbstractJXPainter.java

示例34: processMouseEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param me
 * @param jxl
 */
@Override
public void processMouseEvent(MouseEvent me, JXLayer<? extends A> jxl) {

    //To change body of implemented methods use File | Settings | File Templates.
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:11,
代码来源:AbstractJXPainter.java

示例35: processMouseMotionEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param me
 * @param jxl
 */
@Override
public void processMouseMotionEvent(MouseEvent me, JXLayer<? extends A> jxl) {

    //To change body of implemented methods use File | Settings | File Templates.
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:11,
代码来源:AbstractJXPainter.java

示例36: processMouseEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseEvent(me, jxl);
    Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
    switch (me.getID()) {
    case MouseEvent.MOUSE_PRESSED:
        Point2D imagePoint = jxl.getView().convertToImage(point);

        if ((imagePoint != null) && (image != null)) {
            int x = (int) Math.round(imagePoint.getX());
            int y = (int) Math.round(imagePoint.getY());
            if (x < 0) {
                x = 0;
            }
            if (x > image.getWidth()) {
                x = image.getWidth();
            }
            if (y < 0) {
                y = 0;
            }
            if (y > image.getHeight()) {
                y = image.getHeight();
            }
            imagePoint.setLocation(x, y);

            if (!selectedLineStart) {

                // --- On first click set lineStart value
                lineStart.setLocation(imagePoint);
                selectedLineStart = true;
                setDirty(true);
            }
            else {

                // --- On second click set lineEnd value, generate association, set measuring property to false
                lineEnd.setLocation(imagePoint);
                selectedLineEnd = true;

                Measurement measurement = newMeasurement(null, jxl);
                setDirty(true);

                // Notify listeners
                MeasurementCompletedEvent event = new MeasurementCompletedEvent(measurement, observation);
                for (MeasurementCompletedListener listener : measurementCompletedListeners) {
                    listener.onComplete(event);
                }

                resetUI();

            }
        }
    default:

    // Do nothing
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:57,
代码来源:MeasurementLayerUI.java

示例37: processMouseEvent

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
@Override
protected void processMouseEvent(MouseEvent me, JXLayer<? extends T> jxl) {
    super.processMouseEvent(me, jxl);
    Point point = SwingUtilities.convertPoint(me.getComponent(), me.getPoint(), jxl);
    switch (me.getID()) {
    case MouseEvent.MOUSE_PRESSED:
        java.awt.geom.Point2D imagePoint = jxl.getView().convertToImage(point);
        int x = (int) Math.round(imagePoint.getX());
        int y = (int) Math.round(imagePoint.getY());
        if ((me.getClickCount() == 1) && (me.getButton() == MouseEvent.BUTTON1)) {
            if (image != null) {
                if (x < 0) {
                    x = 0;
                }
                if (x > image.getWidth()) {
                    x = image.getWidth();
                }
                if (y < 0) {
                    y = 0;
                }
                if (y > image.getHeight()) {
                    y = image.getHeight();
                }

                pointsIC.add(new org.mbari.geometry.Point2D<Integer>(x, y));
                setDirty(true);
            }
        }
        else if ((me.getClickCount() == 2) || (me.getButton() != MouseEvent.BUTTON1)) {
            if ((pointsIC.size() > 2) && (observation != null)) {

                // --- Publish action via EventBus
                AreaMeasurement areaMeasurement = newAreaMeasurement(null);
                AddAreaMeasurementEvent event = new AddAreaMeasurementEvent(observation, areaMeasurement);
                EventBus.publish(event);
            }
            resetUI();
            setObservation(observation);
        }
    default:

    // Do nothing
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:45,
代码来源:AreaMeasurementLayerUI2.java

示例38: paintLayer

点赞 2

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
/**
 *
 * @param g2
 * @param jxl
 */
@Override
public void paintLayer(Graphics2D g2, JXLayer<? extends T> jxl) {
    super.paintLayer(g2, jxl);
    for (Observation observation : observations) {
        if ((observation.getX() != null) && (observation.getY() != null)) {
            Point2D imagePoint = new Point2D.Double(observation.getX(), observation.getY());
            Point2D componentPoint2D = jxl.getView().convertToComponent(imagePoint);
            if (componentPoint2D != null) {
                Point componentPoint = AwtUtilities.toPoint(componentPoint2D);
                int x = componentPoint.x;
                int y = componentPoint.y;

                g2.setStroke(markerStyle.getStroke());
                g2.setPaint(markerStyle.getColor());

                // Draw the annotation
                int armLength = markerStyle.getArmLength();
                GeneralPath gp = new GeneralPath();
                gp.moveTo(x - armLength, y - armLength);
                gp.lineTo(x + armLength, y + armLength);
                gp.moveTo(x + armLength, y - armLength);
                gp.lineTo(x - armLength, y + armLength);
                g2.draw(gp);

                // Write the concept name
                g2.setFont(markerStyle.getFont());
                if (drawConceptName) {
                    x = x + 5;
                    g2.drawString(observation.getConceptName(), x, y);
                }

                // Write time code
                if (drawTimecode) {
                    FontMetrics fontMetrics = g2.getFontMetrics();
                    String timecode = observation.getVideoFrame().getTimecode();
                    Rectangle2D rect = fontMetrics.getStringBounds(timecode, g2);
                    y = (int) (y + rect.getHeight() + 5);
                    g2.drawString(timecode, x, y);
                }

            }
        }
    }
}
 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:50,
代码来源:JXObservationsPainter.java

示例39: paintLayer

点赞 1

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
void paintLayer(Graphics2D g2, JXLayer<? extends A> jxl); 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:2,
代码来源:JXPainter.java

示例40: processMouseEvent

点赞 1

import org.jdesktop.jxlayer.JXLayer; //导入依赖的package包/类
void processMouseEvent(MouseEvent me, JXLayer<? extends A> jxl); 

开发者ID:hohonuuli,
项目名称:vars,
代码行数:2,
代码来源:JXPainter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)