Package com.mucommander.ui.viewer

Examples of com.mucommander.ui.viewer.FileFrame


     
      return menuBar;
    }

    private synchronized void loadImage(AbstractFile file) throws IOException {
        FileFrame frame = getFrame();
        frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
   
        int read;
        byte buffer[] = new byte[1024];
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        InputStream in = file.getInputStream();
        while ((read=in.read(buffer, 0, buffer.length))!=-1)
            bout.write(buffer, 0, read);

        byte imageBytes[] = bout.toByteArray();
        bout.close();
        in.close();

        this.scaledImage = null;
        this.image = imageViewerImpl.getToolkit().createImage(imageBytes);

        waitForImage(image);

        int width = image.getWidth(null);
        int height = image.getHeight(null);
        this.zoomFactor = 1.0;
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

        while(width>d.width || height>d.height) {
            width = width/2;
            height = height/2;
            zoomFactor = zoomFactor/2;
        }
   
        if(zoomFactor==1.0)
            this.scaledImage = image;
        else
            zoom(zoomFactor);
     
        checkZoom();
        frame.setCursor(Cursor.getDefaultCursor());
    }
View Full Code Here


        //AppLogger.finest("Image loaded "+image);
    }
 
 
    private synchronized void zoom(double factor) {
        FileFrame frame = getFrame();

        frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));

        this.scaledImage = image.getScaledInstance((int)(image.getWidth(null)*factor), (int)(image.getHeight(null)*factor), Image.SCALE_DEFAULT);
        waitForImage(scaledImage);

        frame.setCursor(Cursor.getDefaultCursor());
    }
View Full Code Here

        frame.setCursor(Cursor.getDefaultCursor());
    }

    private void updateFrame() {
      FileFrame frame = getFrame();

        // Revalidate, pack and repaint should be called in this order
        frame.setTitle(this.getTitle());
        imageViewerImpl.revalidate();
        frame.pack();
        frame.getContentPane().repaint();
    }
View Full Code Here

TOP

Related Classes of com.mucommander.ui.viewer.FileFrame

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.