Package com.agifans.picedit.gui.frame

Examples of com.agifans.picedit.gui.frame.PictureFrame


        this.setFocusable(false);
       
        // Load the preferences saved the last time the application was closed down.
        loadPreferences();
       
        this.activePictureFrame = new PictureFrame(this, prefs.getInt("ZOOM_FACTOR", 3), "Untitled");
        this.activePictureFrame.setLocation(20, 20);
        try {
            this.activePictureFrame.setSelected(true);
        } catch (PropertyVetoException e) {
        }
View Full Code Here


                return shouldPaintOffscreenImage;
            }

            public void run() {
                // Check if selected PictureFrame needs to process mouse motion.
                PictureFrame selectedPictureFrame = (PictureFrame)getDesktopPane().getSelectedFrame();
                if (selectedPictureFrame != null) {
                    selectedPictureFrame.getMouseHandler().checkForMouseMotion();
                }
               
                // The off screen parts of the picture panel rendering don't need to be refreshed as often.
                if (shouldPaintOffscreenImage()) {
                  getPictureFrame().getPicturePanel().paintOffscreenImage();
View Full Code Here

     * Gets the currently active PictureFrame.
     *
     * @return The currently active PictureFrame.
     */
    public PictureFrame getPictureFrame() {
        PictureFrame selectedFrame = (PictureFrame)this.desktopPane.getSelectedFrame();
        if (selectedFrame != null) {
            activePictureFrame = selectedFrame;
        }
       
        return activePictureFrame;
View Full Code Here

    public void selectNextPictureFrame() {
        JInternalFrame[] allPictureFrames = desktopPane.getAllFrames();
        if ((allPictureFrames == null) || (allPictureFrames.length == 0)) {
            // If there are no frames currently on the desktop then we create a blank one for
            // the purposes of resetting the tool bar, status bar and picture code list.
            activePictureFrame = new PictureFrame(this, prefs.getInt("ZOOM_FACTOR", 3), "Untitled");
            switchPictureCodeList();
           
        } else {
            // Otherwise proceed with selecting the next picture frame.
            desktopPane.selectFrame(true);
View Full Code Here

        // whereas the ComponentListener only gets them after the resize.
        frame.getContentPane().addHierarchyBoundsListener(new HierarchyBoundsAdapter(){
            @Override
            public void ancestorResized(HierarchyEvent e) {
                // Start by checking that the internal frame will fit and adjust if required.
                PictureFrame pictureFrame = app.getPictureFrame();
                Dimension desktopSize = app.getDesktopPane().getSize();
                int newWidth = Math.min(desktopSize.width, pictureFrame.getWidth());
                int newHeight = Math.min(desktopSize.height, pictureFrame.getHeight());
                pictureFrame.setSize(new Dimension(newWidth, newHeight));
               
                // Now check to see if we need to move it to keep within the viewable area.
                int newTop = pictureFrame.getY();
                int newLeft = pictureFrame.getX();
                if ((pictureFrame.getX() + pictureFrame.getWidth()) > desktopSize.width) {
                    newLeft = desktopSize.width - pictureFrame.getWidth();
                }
                if ((pictureFrame.getY() + pictureFrame.getHeight()) > desktopSize.height) {
                    newTop = desktopSize.height - pictureFrame.getHeight();
                }
                if ((newLeft != pictureFrame.getY()) || (newTop != pictureFrame.getX())) {
                    pictureFrame.setLocation(new Point(newLeft, newTop));
                }
            }          
        });
       
        app.getDesktopPane().selectFrame(true);
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                PictureFrame pictureFrame = app.getPictureFrame();
                pictureFrame.resizeForZoomFactor(app.getEditStatus().getZoomFactor());
            }
        });
    }
View Full Code Here

            windowMenu.removeAll();
            JInternalFrame[] pictureFrames = application.getDesktopPane().getAllFrames();
            if (pictureFrames != null) {
                // Add each of the PictureFrames on the desktop to the Window menu.
                for (int frameNum=0; frameNum < pictureFrames.length; frameNum++) {
                    final PictureFrame pictureFrame = (PictureFrame)pictureFrames[frameNum];
                    JCheckBoxMenuItem windowMenuItem = new JCheckBoxMenuItem("" + (frameNum + 1) + " " + pictureFrame.getTitle());
                    windowMenuItem.setSelected(pictureFrame.isSelected());
                    windowMenuItem.setMnemonic((char)(0x30 + frameNum));
                    windowMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            // If a window is selected from the menu, switch to that window.
                            try {
                                pictureFrame.setSelected(true);
                            } catch (PropertyVetoException e1) {
                            }
                        }
                    });
                    windowMenu.add(windowMenuItem);
View Full Code Here

        JDesktopPane desktop = application.getDesktopPane();

        // Work out the next number to use for the default Untitled picture name.
        int maximumUntitledFrameNum = 0;
        for (JInternalFrame frame : desktop.getAllFrames()) {
            PictureFrame pictureFrame = (PictureFrame)frame;
            // Untitled picture frames are those without a picture file associated.
            if (pictureFrame.getEditStatus().getPictureFile() == null) {
                String frameTitle = pictureFrame.getTitle();
                if (frameTitle.contains("Untitled")) {
                    int untitledFrameNum = 1;
                    if (!frameTitle.endsWith("Untitled")) {
                        untitledFrameNum = Integer.parseInt(frameTitle.substring(frameTitle.indexOf("Untitled") + 9));
                        if (untitledFrameNum > maximumUntitledFrameNum) {
                            maximumUntitledFrameNum = untitledFrameNum;
                        }
                    }
                    if (untitledFrameNum > maximumUntitledFrameNum) {
                        maximumUntitledFrameNum = untitledFrameNum;
                    }
                }
            }
        }
        StringBuilder defaultPictureName = new StringBuilder("Untitled");
        if (maximumUntitledFrameNum > 0) {
            defaultPictureName.append(" ");
            defaultPictureName.append(maximumUntitledFrameNum + 1);
        }
       
        // Now create the new PictureFrame.
        PictureFrame newPictureFrame = new PictureFrame(application, application.getEditStatus().getZoomFactor(), defaultPictureName.toString());
        int initialFrameIndent = 20 + (desktop.getAllFrames().length * 25);
        newPictureFrame.setLocation(initialFrameIndent, initialFrameIndent);
       
        // Add to the desktop, start up the mouse motion timer and then autoselect.
        desktop.add(newPictureFrame);
        try {
            newPictureFrame.setSelected(true);
        } catch (PropertyVetoException e) {
        }
    }
View Full Code Here

TOP

Related Classes of com.agifans.picedit.gui.frame.PictureFrame

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.