Package java.awt

Examples of java.awt.Canvas$CanvasBltBufferStrategy


        System.exit(0);
      }
    });

    // majd letrehozzuk a ra rajzolando canvast
    canvas = new Canvas();
    canvas.setSize(735, 645);
    this.add("Center", canvas);
    canvas.addKeyListener(new GameKeyListener());

    // beolvassuk a jatek hatteret
View Full Code Here


    /*
     * Class under test for void removeAll()
     */
    public void testRemoveAll() {
        addComponents();
        Component comp = new Canvas();
        layered.setLayer(comp, 5);
        // comp is not in JLayeredPane
        assertTrue("not empty", layered.getComponentCount() != 0);
        assertFalse("componentToLayer is not empty", layered.getComponentToLayer().isEmpty());
        layered.removeAll();
View Full Code Here

    /*
     * Class under test for void setLayer(Component, int, int)
     */
    public void testSetLayerComponentintint() {
        Component jcomp = new JPanel();
        Component comp = new Canvas();
        // test setLayer() for JComponent outside the container
        layered.setLayer(jcomp, 4, 0);
        assertEquals(4, layered.getLayer(jcomp));
        assertEquals(4, JLayeredPane.getLayer((JComponent) jcomp));
        assertFalse(layered.isAncestorOf(jcomp));
View Full Code Here

    /*
     * Class under test for void setLayer(Component, int)
     */
    public void testSetLayerComponentint() {
        Component jcomp = new JPanel();
        Component comp = new Canvas();
        // test setLayer() for JComponent outside the container
        layered.setLayer(jcomp, 4);
        assertEquals(4, layered.getLayer(jcomp));
        assertEquals(4, JLayeredPane.getLayer((JComponent) jcomp));
        assertFalse(layered.isAncestorOf(jcomp));
View Full Code Here

        // getLayer() for JComponent that doesn't exist in the container
        // but has layer in the property
        JLayeredPane.putLayer((JComponent) c, 5);
        assertEquals(5, layered.getLayer(c));
        // getLayer() for Component that doesn't exist in the container
        c = new Canvas();
        assertEquals(0, layered.getLayer(c));
        // getLayer() for Component from the containter
        layered.add(c, new Integer(3));
        assertEquals(3, layered.getLayer(c));
        // getLayer() for Component removed from the containter
View Full Code Here

    public void testGetDefaultLocale() {
    }

    public void testIsLightweightComponent() {
        JFrame mainFrame = new JFrame();
        Canvas button = new Canvas();
        JPanel jbutton = new JPanel();
        Panel awtPanel = new Panel();
        //        assertFalse(JComponent.isLightweightComponent(panel));
        //        assertFalse(JComponent.isLightweightComponent(button));
        //        assertFalse(JComponent.isLightweightComponent(jbutton));
View Full Code Here

    @Override
    protected CoordinateHandler createCoordinateHandler(JComponent parent, Point2D point, MouseEvent e) {
        logger.fine("Enter WSET.createCoordinateHandler, frame coords: mouseEvent = " + e);

        // Temporarily convert event from frame coords into canvas coords
        Canvas canvas = JmeClientMain.getFrame().getCanvas();
        JFrame frame = (JFrame) e.getSource();
        Point framePoint = e.getPoint();
        Point canvasPoint = SwingUtilities.convertPoint(frame, framePoint, canvas);
        e.translatePoint(canvasPoint.x - framePoint.x, canvasPoint.y - framePoint.y);

        logger.fine("Canvas coords, mouseEvent = " + e);

        InputManager.PickEventReturn ret = InputManager.inputManager().pickMouseEventSwing(e);
        if (ret == null || ret.entity == null || ret.destPickDetails == null) {
            logger.fine("WindowSwing miss");
            e.translatePoint(-(canvasPoint.x - framePoint.x), -(canvasPoint.y - framePoint.y));

            // OWL issue #71: if the previous event was on a swing window and
            // this one is not, generate a fake mouse event outside of the
            // last swing window to ensure that a MouseExit event is generated.
            if (lastWindow != null) {
                logger.fine("Exit swing");

                // request focus in main window
                InputManager.ensureKeyFocusInMainWindow();

                // send a fake mouse event to generate an exit
                final EmbeddedPeer targetEmbeddedPeer = lastWindow.getEmbeddedPeer();
                lastWindow = null;
                return new CoordinateHandler() {
                    public EmbeddedPeer getEmbeddedPeer() {
                        return targetEmbeddedPeer;
                    }

                    public Point2D transform(Point2D src, Point2D dst,
                                             MouseEvent event)
                    {
                        if (dst == null) {
                            dst = new Point2D.Float();
                        }
                       
                        dst.setLocation(-1, -1);
                        return dst;
                    }
                };
            } else {
                return null;
            }
        }
        logger.fine("WindowSwing hit");
        logger.fine("Pick hit entity = " + ret.entity);

        EntityComponent comp = ret.entity.getComponent(WindowSwing.WindowSwingViewReference.class);
        assert comp != null;
        final View2D view = ((WindowSwing.WindowSwingViewReference) comp).getView();
        WindowSwing windowSwing = (WindowSwing) view.getWindow();

        // Keep track of the last window we hit
        if (lastWindow == null) {
            logger.fine("Enter swing");
        }
        lastWindow = windowSwing;

        // TODO: someday: I don't think we need to set this anymore for drag events. But it doesn't hurt.
        final Vector3f intersectionPointWorld = ret.destPickDetails.getPosition();
        logger.fine("intersectionPointWorld = " + intersectionPointWorld);

        if (e.getID() == MouseEvent.MOUSE_PRESSED) {
            lastPressPointScreen = new Point(e.getX(), e.getY());

            lastPressEventHook = windowSwing.getEventHook();
            if (lastPressEventHook != null) {
                WindowSwing.EventHookInfo hookInfo = new WindowSwing.EventHookInfo(intersectionPointWorld,
                                                                                   e.getX(), e.getY());
                lastPressEventHook.specifyHookInfoForEvent(e, hookInfo);
            }
        }

        final EmbeddedPeer targetEmbeddedPeer = windowSwing.getEmbeddedPeer();
        CoordinateHandler coordinateHandler = new CoordinateHandler() {

            public EmbeddedPeer getEmbeddedPeer() {
                return targetEmbeddedPeer;
            }

            // Note: event is in frame coordinates
            public Point2D transform(Point2D src, Point2D dst, MouseEvent event) {

                logger.fine("event = " + event);
                logger.fine("src = " + src);

                Point pt;
                if (event.getID() == MouseEvent.MOUSE_DRAGGED) {

                    // We will need the event in canvas coordinates
                    Canvas canvas = JmeClientMain.getFrame().getCanvas();
                    JFrame frame = (JFrame) event.getSource();
                    Point framePoint = event.getPoint();
                    Point canvasPoint = SwingUtilities.convertPoint(frame, framePoint, canvas);
                    int canvasX = event.getX() + canvasPoint.x - framePoint.x;
                    int canvasY = event.getY() + canvasPoint.y - framePoint.y;
View Full Code Here

                Math.abs((fromLoc.z)-(toLoc.z))<=150) {
            //Cover Screen not needed
        } else {
            //attach cover screen
            final MainFrame mainFrame =  JmeClientMain.getFrame();
            final Canvas canvas = mainFrame.getCanvas();
            final CoverScreen coverScreenPanel = new CoverScreen(csd,canvas.getSize());
           
            try {
                //show cover screen in JDialog over the canvas panel
                SwingUtilities.invokeLater(new Runnable() {

                    public void run() {
                        dialog = new JDialog(mainFrame.getFrame(), "Child", false);
                        coverScreenPanel.setPreferredSize(canvas.getSize());
                        dialog.setSize(canvas.getSize().width
                                ,canvas.getSize().height);
                        dialog.setLocation(canvas.getLocationOnScreen().x
                                ,canvas.getLocationOnScreen().y);
                        JButton button = new JButton("Button");
                        button.addActionListener(new ActionListener() {
                          @Override
                          public void actionPerformed(ActionEvent e) {
                            dialog.dispose();
                          }
                        });
                        mainFrame.getFrame().addComponentListener(new ComponentAdapter() {

                            private void doChange() {
                                SwingUtilities.invokeLater(new Runnable() {
                                    public void run() {
                                        if (dialog != null && dialog.isVisible()) {
                                            Component cs = dialog.getComponent(0);
                                            Canvas canvas = mainFrame.getCanvas();
                                            cs.setPreferredSize(canvas.getSize());
                                            dialog.setSize(canvas.getSize().width, canvas.getSize().height);
                                            dialog.setLocation(canvas.getLocationOnScreen().x, canvas.getLocationOnScreen().y);
                                            dialog.pack();
                                            dialog.setVisible(true);
                                        }
                                    }
                                });
View Full Code Here

    @Override
    public void initialize(ServerSessionManager loginManager) {
        logger.fine("initializing HUD client plugin");

        Canvas canvas = JmeClientMain.getFrame().getCanvas();

        // Create the default HUD factory
        HUDFactory.setHUDFactorySPI(new WonderlandHUDFactory());

        // create the main Wonderland HUD
        //
        logger.fine("creating main HUD: " +
                DEFAULT_HUD_WIDTH + "x" + DEFAULT_HUD_HEIGHT +
                " at " + DEFAULT_HUD_X + ", " + DEFAULT_HUD_Y);
        final HUD wonderlandHUD = HUDFactory.createHUD(canvas.getSize(),
                DEFAULT_HUD_X, DEFAULT_HUD_Y, DEFAULT_HUD_WIDTH, DEFAULT_HUD_HEIGHT);
        wonderlandHUD.setName("main");

        // create the default HUD Manager factory
        HUDManagerFactory.setHUDManagerFactorySPI(new WonderlandHUDManagerFactory());

        // create a HUD manager instance to manage all the HUDs
        HUDManager manager = HUDManagerFactory.createHUDManager(canvas);

        // define how HUDs are laid out on the screen
        manager.setLayoutManager(new HUDAbsoluteLayoutManager(wonderlandHUD));

        // manage the main HUD
        manager.addHUD(wonderlandHUD);

        // create a component manager for the HUD components in this HUD
        HUDComponentManager compManager = new WonderlandHUDComponentManager(wonderlandHUD);

        // define the layout of HUD components in the Wonderland main HUD
        compManager.setLayoutManager(new HUDCompassLayoutManager(wonderlandHUD));

        // manage the components in the main HUD
        wonderlandHUD.addEventListener(compManager);

        // create a HUD for icons
        //
        logger.fine("creating icon HUD: " + DEFAULT_HUD_WIDTH + "x" + ICON_HUD_HEIGHT +
                " at " + DEFAULT_HUD_X + ", " + DEFAULT_HUD_Y);
        final HUD iconHUD = HUDFactory.createHUD(canvas.getSize(),
                DEFAULT_HUD_X, DEFAULT_HUD_Y, DEFAULT_HUD_WIDTH, ICON_HUD_HEIGHT);
        iconHUD.setName("icon");

        // manage the icon bar HUD
        manager.addHUD(iconHUD);
View Full Code Here

    screen = new Screen();
    tc = new TerrariaClone();
    thread = new Thread(Variables.tc);
    screenSize = Finals.SIZE_DEFAULT;
   
    Canvas c = new Canvas();
    fontDefault = new Font("Helvetica", Font.PLAIN, 12);
    fmDefault = c.getFontMetrics(fontDefault);
  }
View Full Code Here

TOP

Related Classes of java.awt.Canvas$CanvasBltBufferStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.