Fit the image to window width, window height and  the window size

hi all
here we wrote the code for "fit the image to window width, window height and the window size". we are facing some problems in it. and all these operations have to perform even after zooming operations are done.if the below code doesnt satisfy kindly provide appropriate code .
thanks .
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.File;
import javax.swing.filechooser.FileFilter;
import java.awt.geom.*;
public class DP extends JFrame implements ActionListener,
                                           MouseListener,
                                           MouseMotionListener {
    private final int PEN_OP = 1;
    private final int CLEAR_OP = 2;
    private int radius;
    private int radius1;
    private int mousex = 0;
    private int mousey = 0;
    private int prevx = 0;
    private int prevy = 0;
    private boolean initialFreeHand = true;
    private boolean initialLine = true;
    private boolean initialEraser = true;
    private int Orx = 0;
    private int Ory = 0;
    private int OrWidth = 0;
    private int OrHeight = 0;
    private int drawX = 0;
    private int drawY = 0;
    private int polyX = 0;
    private int polyY = 0;
    private int eraserLength = 5;
    private int udefRedValue = 255;
    private int udefGreenValue = 255;
    private int udefBlueValue = 255;
    private int opStatus = PEN_OP;
    private int colorStatus = 1;
    private double zoomPercentage=10;
    private Color mainColor = new Color(0, 0, 0);
    private Color xorColor = new Color(255, 255, 255);
    private Color userDefinedColor =
        new Color(udefRedValue, udefGreenValue,udefBlueValue);
    private JButton openButton = new JButton("open");
    private JButton closeButton = new JButton("close");
     private JButton zoominButton = new JButton("ZoomIn");
     private JButton zoomoutButton = new JButton("ZoomOut");
     private JButton zoomto100Button = new JButton("ZoomTo100");
     private JButton fwwButton = new JButton("Fit window width");
     private JButton fwhButton = new JButton("Fit window height");
     private JButton fwButton = new JButton("Fit the window");
    private JButton clearButton = new JButton("Clear");
    private JTextField colorStatusBar = new JTextField(20);
    private JTextField opStatusBar = new JTextField(20);
    private JTextField mouseStatusBar = new JTextField(10);
    private JPanel controlPanel = new JPanel(new GridLayout(18, 1, 0, 0));
    JToolBar jToolbar = new JToolBar();
    private Container container;
    private JScrollBar horizantalSlide=new JScrollBar();
    public BufferedImage image;
    BufferedImage bgImage;
//    public ImageIcon icon=null;
    JFileChooser fileChooser;
    DrawPanel drawPanel = new DrawPanel(bgImage,zoomPercentage);
    public DP() {
        super("WhiteBoard");
        fileChooser = new JFileChooser(".");
        container = getContentPane();
        container.setBackground(Color.white);
        container.setLayout(new BorderLayout());
        container.add(jToolbar,BorderLayout.NORTH);
        container.add(horizantalSlide);
        jToolbar.add(openButton);
        jToolbar.add(closeButton);
          jToolbar.add(zoominButton);
          jToolbar.add(zoomoutButton);
          jToolbar.add(zoomto100Button);
          jToolbar.add(fwwButton);
          jToolbar.add(fwhButton);
          jToolbar.add(fwButton);
        jToolbar.add(clearButton);
        colorStatusBar.setEditable(false);
        opStatusBar.setEditable(false);
        mouseStatusBar.setEditable(false);
        controlPanel.setBackground(Color.white);
        drawPanel.setBackground(Color.white);
        container.add(controlPanel, "West");
        container.add(drawPanel, "Center");
        openButton.addActionListener(this);
        closeButton.addActionListener(this);
          zoominButton.addActionListener(this);
          zoomoutButton.addActionListener(this);
          zoomto100Button.addActionListener(this);
          fwwButton.addActionListener(this);
          fwhButton.addActionListener(this);
          fwButton.addActionListener(this);
        clearButton.addActionListener(this);
        drawPanel.addMouseMotionListener(this);
        drawPanel.addMouseListener(this);
        addMouseListener(this);
        addMouseMotionListener(this);
        opStatusBar.setText("FreeHand");
        colorStatusBar.setText("Black");
    public void actionPerformed(ActionEvent e) {
        if(e.getActionCommand().equals("open"))
            showDialog();
        if(e.getActionCommand().equals("close"))
            closeDialog();
          if(e.getActionCommand().equals("ZoomIn"))
               drawPanel.zoom(1);
          if(e.getActionCommand().equals("ZoomOut"))
               drawPanel.zoom(-1);
          if(e.getActionCommand().equals("ZoomTo100"))
               drawPanel.zoom(+10);
          if(e.getActionCommand().equals("Fit window width"))
               drawPanel.fitwindowwidth();
          if(e.getActionCommand().equals("Fit window height"))
               drawPanel.fitwindowheight();
          if(e.getActionCommand().equals("Fit the window"))
               drawPanel.fitthewindow();
        if (e.getActionCommand() == "Clear")
            opStatus = CLEAR_OP;
        switch (opStatus) {
            case CLEAR_OP:
                clearPanel();
    private void showDialog() {
        if(fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
            File file = fileChooser.getSelectedFile();
            try {
                bgImage = ImageIO.read(file);
            } catch(IOException e) {
                System.out.println("IO error: " + e.getMessage());
            clearPanel();
    private void closeDialog() {
        drawPanel.setVisible(false);
        drawPanel.repaint();
    public void clearPanel() {
        opStatusBar.setText("Clear");
        Graphics g = image.getGraphics();
        g.setColor(drawPanel.getBackground());
        g.fillRect(0, 0, drawPanel.getBounds().width, drawPanel.getBounds().height);
        if(bgImage != null)
            g.drawImage(bgImage, 0, 0, this);
        g.dispose();
        drawPanel.repaint();
    public boolean mouseHasMoved(MouseEvent e) {
        return (mousex != e.getX() || mousey != e.getY());
    public void setActualBoundry() {
        if (mousex < Orx || mousey < Ory) {
            if (mousex < Orx) {
                OrWidth = Orx - mousex;
                drawX = Orx - OrWidth;
            } else {
                drawX = Orx;
                OrWidth = mousex - Orx;
            if (mousey < Ory) {
                OrHeight = Ory - mousey;
                drawY = Ory - OrHeight;
            } else {
                drawY = Ory;
                OrHeight = mousey - Ory;
        } else {
            drawX = Orx;
            drawY = Ory;
            OrWidth = mousex - Orx;
            OrHeight = mousey - Ory;
    public void setGraphicalDefaults(MouseEvent e) {
        mousex = e.getX();
        mousey = e.getY();
        prevx = e.getX();
        prevy = e.getY();
        Orx = e.getX();
        Ory = e.getY();
        drawX = e.getX();
        drawY = e.getY();
        OrWidth = 0;
        OrHeight = 0;
    public void mouseDragged(MouseEvent e) {
        updateMouseCoordinates(e);
        switch (opStatus) {}
    public void mouseReleased(MouseEvent e) {
        updateMouseCoordinates(e);
        switch (opStatus) {}
    public void mouseEntered(MouseEvent e) {
        updateMouseCoordinates(e);
    public void updateMouseCoordinates(MouseEvent e) {
        String xCoor = "";
        String yCoor = "";
        if (e.getX() < 0)
            xCoor = "0";
        else {
            xCoor = String.valueOf(e.getX());
        if (e.getY() < 0)
            xCoor = "0";
        else {
            yCoor = String.valueOf(e.getY());
        mouseStatusBar.setText("x:" + xCoor + " y:" + yCoor);
    public void mouseClicked(MouseEvent e) { updateMouseCoordinates(e); }
    public void mouseExited(MouseEvent e) { updateMouseCoordinates(e); }
    public void mouseMoved(MouseEvent e) { updateMouseCoordinates(e); }
    public void mousePressed(MouseEvent e) { updateMouseCoordinates(e); }
    public static void main(String[] args) {
        DP wb = new DP();
        wb.setDefaultCloseOperation(EXIT_ON_CLOSE);
        wb.setSize(1024,740);
        wb.setVisible(true);
    private class DrawPanel extends JPanel {
        private double m_zoom = 1.0;
        private double m_zoomPercentage;
        private BufferedImage m_image;
        double theta = 0;
        double thetaInc = Math.PI/2;
        public DrawPanel(BufferedImage imageb,double zoomPercentage) {
            m_image = imageb;
            m_zoomPercentage = zoomPercentage / 100;
        protected void paintComponent(Graphics g) {
            Graphics2D g2d=(Graphics2D)g;
            if(image == null)
                initImage();
            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                 RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            double x = (1.0 - m_zoom)*getWidth()/2.0;
            double y = (1.0 - m_zoom)*getHeight()/2.0;
            AffineTransform at = AffineTransform.getTranslateInstance(x, y);
            at.rotate(theta,m_zoom*getWidth()/2,m_zoom*getHeight()/2);
            at.scale(m_zoom, m_zoom);
            g2d.drawRenderedImage(image, at);
  public void zoom(int inc) {
        m_zoom += inc * m_zoomPercentage;
        repaint();
          public void fitwindowwidth()
            int w1=drawPanel.getWidth();
            int h1=drawPanel.getHeight();
            BufferedImage image2=image.getScaledInstance(w1,h1,Image.SCALE_DEFAULT);
            drawPanel.setPreferredSize(new java.awt.Dimension(100,image2.getImage().getHeight(null)));
           drawPanel.repaint();
          public void fitwindowheight()
       BufferedImage image2=image.getScaledInstance(500,680,1); 
       drawPanel.setImage(iicon);
       drawPanel.setPreferredSize(new java.awt.Dimension(100,image2.getImage().getHeight(null)));
       drawPanel.repaint();
          public void fitthewindow()
       BufferedImage image2=image.getScaledInstance(1000,680,1);
       drawPanel.setPreferredSize(new java.awt.Dimension(100,image2.getImage().getHeight(null)));
       drawPanel.repaint();
        private void initImage() {
            int w = getWidth();
            int h = getHeight();
            image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = image.createGraphics();
            g2.setPaint(getBackground());
            g2.fillRect(0,0,w,h);
            g2.dispose();
}

thank you for giving reply.
your code is very helpful to us.but i couldn't integrate it in my code.here's my code.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.File;
import javax.swing.filechooser.FileFilter;
import java.awt.geom.*;
public class IS extends JFrame implements ActionListener,
                                           MouseListener,
                                           MouseMotionListener {
    private final int PEN_OP = 1;
    private final int CLEAR_OP = 2;
     private     final int DISTORT = 3;
    private final int SCALE   = 4;
    private final int FIT     = 5;
    private final int FILL    = 6;
    int scaleMode = SCALE;
    private int radius;
    private int radius1;
    private int mousex = 0;
    private int mousey = 0;
    private int prevx = 0;
    private int prevy = 0;
    private boolean initialFreeHand = true;
    private boolean initialLine = true;
    private boolean initialEraser = true;
    private int Orx = 0;
    private int Ory = 0;
    private int OrWidth = 0;
    private int OrHeight = 0;
    private int drawX = 0;
    private int drawY = 0;
    private int polyX = 0;
    private int polyY = 0;
    private int eraserLength = 5;
    private int udefRedValue = 255;
    private int udefGreenValue = 255;
    private int udefBlueValue = 255;
    private int opStatus = PEN_OP;
    private int colorStatus = 1;
    private double zoomPercentage=10;
    private Color mainColor = new Color(0, 0, 0);
    private Color xorColor = new Color(255, 255, 255);
    private Color userDefinedColor =
        new Color(udefRedValue, udefGreenValue,udefBlueValue);
    private JButton openButton = new JButton("open");
    private JButton closeButton = new JButton("close");
     private JButton zoominButton = new JButton("ZoomIn");
     private JButton zoomoutButton = new JButton("ZoomOut");
     private JButton zoomto100Button = new JButton("ZoomTo100");
     private JButton fwwButton = new JButton("Fit window width");
     private JButton fwhButton = new JButton("Fit window height");
     private JButton fwButton = new JButton("Fit the window");
    private JButton clearButton = new JButton("Clear");
    private JTextField colorStatusBar = new JTextField(20);
    private JTextField opStatusBar = new JTextField(20);
    private JTextField mouseStatusBar = new JTextField(10);
    private JPanel controlPanel = new JPanel(new GridLayout(18, 1, 0, 0));
    JToolBar jToolbar = new JToolBar();
    private Container container;
    private JScrollBar horizantalSlide=new JScrollBar();
    public BufferedImage image;
    BufferedImage bgImage;
//    public ImageIcon icon=null;
    JFileChooser fileChooser;
    DrawPanel drawPanel = new DrawPanel(bgImage,zoomPercentage);
    public IS() {
        super("WhiteBoard");
        fileChooser = new JFileChooser(".");
        container = getContentPane();
        container.setBackground(Color.white);
        container.setLayout(new BorderLayout());
        container.add(jToolbar,BorderLayout.NORTH);
        container.add(horizantalSlide);
        jToolbar.add(openButton);
        jToolbar.add(closeButton);
          jToolbar.add(zoominButton);
          jToolbar.add(zoomoutButton);
          jToolbar.add(zoomto100Button);
          jToolbar.add(fwwButton);
          jToolbar.add(fwhButton);
          jToolbar.add(fwButton);
        jToolbar.add(clearButton);
        colorStatusBar.setEditable(false);
        opStatusBar.setEditable(false);
        mouseStatusBar.setEditable(false);
        controlPanel.setBackground(Color.white);
        drawPanel.setBackground(Color.white);
        container.add(controlPanel, "West");
        container.add(drawPanel, "Center");
        openButton.addActionListener(this);
        closeButton.addActionListener(this);
          zoominButton.addActionListener(this);
          zoomoutButton.addActionListener(this);
          zoomto100Button.addActionListener(this);
          fwwButton.addActionListener(this);
          fwhButton.addActionListener(this);
          fwButton.addActionListener(this);
        clearButton.addActionListener(this);
        drawPanel.addMouseMotionListener(this);
        drawPanel.addMouseListener(this);
        addMouseListener(this);
        addMouseMotionListener(this);
        opStatusBar.setText("FreeHand");
        colorStatusBar.setText("Black");
    public void actionPerformed(ActionEvent e) {
        if(e.getActionCommand().equals("open"))
            showDialog();
        if(e.getActionCommand().equals("close"))
            closeDialog();
          if(e.getActionCommand().equals("ZoomIn"))
               drawPanel.zoom(1);
          if(e.getActionCommand().equals("ZoomOut"))
               drawPanel.zoom(-1);
          if(e.getActionCommand().equals("ZoomTo100"))
               drawPanel.zoom(+10);
          if(e.getActionCommand().equals("Fit window width"))
               //drawPanel.fitwindowwidth();
          drawPanel.scaleImage(0,0,0,0);
          if(e.getActionCommand().equals("Fit window height"))
          drawPanel.scaleImage(0,0,0,0);
          if(e.getActionCommand().equals("Fit the window"))
          drawPanel.scaleImage(0,0,0,0);
        if (e.getActionCommand() == "Clear")
            opStatus = CLEAR_OP;
        switch (opStatus) {
            case CLEAR_OP:
                clearPanel();
    private void showDialog() {
        if(fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
            File file = fileChooser.getSelectedFile();
            try {
                bgImage = ImageIO.read(file);
            } catch(IOException e) {
                System.out.println("IO error: " + e.getMessage());
            clearPanel();
    private void closeDialog() {
        drawPanel.setVisible(false);
        drawPanel.repaint();
    public void clearPanel() {
        opStatusBar.setText("Clear");
          int w = image.getWidth();
        int h = image.getHeight();
        Graphics g = image.getGraphics();
        g.setColor(drawPanel.getBackground());
        g.fillRect(0, 0, w, h);
        if(bgImage != null) {
            int x = (w - bgImage.getWidth())/2;
            int y = (h - bgImage.getHeight())/2;
            g.drawImage(bgImage, x, y, this);
        g.dispose();
        drawPanel.repaint();
    public boolean mouseHasMoved(MouseEvent e) {
        return (mousex != e.getX() || mousey != e.getY());
    public void setActualBoundry() {
        if (mousex < Orx || mousey < Ory) {
            if (mousex < Orx) {
                OrWidth = Orx - mousex;
                drawX = Orx - OrWidth;
            } else {
                drawX = Orx;
                OrWidth = mousex - Orx;
            if (mousey < Ory) {
                OrHeight = Ory - mousey;
                drawY = Ory - OrHeight;
            } else {
                drawY = Ory;
                OrHeight = mousey - Ory;
        } else {
            drawX = Orx;
            drawY = Ory;
            OrWidth = mousex - Orx;
            OrHeight = mousey - Ory;
    public void setGraphicalDefaults(MouseEvent e) {
        mousex = e.getX();
        mousey = e.getY();
        prevx = e.getX();
        prevy = e.getY();
        Orx = e.getX();
        Ory = e.getY();
        drawX = e.getX();
        drawY = e.getY();
        OrWidth = 0;
        OrHeight = 0;
    public void mouseDragged(MouseEvent e) {
        updateMouseCoordinates(e);
        switch (opStatus) {
    public void mouseReleased(MouseEvent e) {
        updateMouseCoordinates(e);
        switch (opStatus) {}
    public void mouseEntered(MouseEvent e) {
        updateMouseCoordinates(e);
    public void updateMouseCoordinates(MouseEvent e) {
        String xCoor = "";
        String yCoor = "";
        if (e.getX() < 0)
            xCoor = "0";
        else {
            xCoor = String.valueOf(e.getX());
        if (e.getY() < 0)
            xCoor = "0";
        else {
            yCoor = String.valueOf(e.getY());
        mouseStatusBar.setText("x:" + xCoor + " y:" + yCoor);
    public void mouseClicked(MouseEvent e) { updateMouseCoordinates(e); }
    public void mouseExited(MouseEvent e) { updateMouseCoordinates(e); }
    public void mouseMoved(MouseEvent e) { updateMouseCoordinates(e); }
    public void mousePressed(MouseEvent e) { updateMouseCoordinates(e); }
    public static void main(String[] args) {
        IS wb = new IS();
        wb.setDefaultCloseOperation(EXIT_ON_CLOSE);
        wb.setSize(1024,740);
        wb.setVisible(true);
    private class DrawPanel extends JPanel {
        private double m_zoom = 1.0;
        private double m_zoomPercentage;
        private BufferedImage m_image;
        double theta = 0;
        double thetaInc = Math.PI/2;
        public DrawPanel(BufferedImage imageb,double zoomPercentage) {
            m_image = imageb;
            m_zoomPercentage = zoomPercentage / 100;
        protected void paintComponent(Graphics g) {
               super.paintComponent(g);
            Graphics2D g2d=(Graphics2D)g;
            if(image == null)
                initImage();
            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                 RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                          int w = getWidth();
                int h = getHeight();
              int iw = image.getWidth();
              int ih = image.getHeight();
              if(scaleMode == SCALE) {
            double x = (w - m_zoom*iw)/2;
            double y = (h - m_zoom*ih)/2;
            AffineTransform at = AffineTransform.getTranslateInstance(x, y);
            at.rotate(theta,m_zoom*getWidth()/2,m_zoom*getHeight()/2);
            at.scale(m_zoom, m_zoom);
            g2d.drawRenderedImage(image, at);
               else {
            scaleImage(w, h, iw, ih);
          private void scaleImage( int w, int h, int iw, int ih) {
                         Graphics2D g2d = image.createGraphics();
        double xScale = (double)w/iw;
        double yScale = (double)h/ih;
        AffineTransform at = new AffineTransform();
        if(scaleMode == DISTORT) {
            double x = (w - xScale*iw)/2;
            double y = (h - yScale*ih)/2;
            at.setToTranslation(x, y);
            at.scale(xScale, yScale);
        } else {
            double scale = (scaleMode == FIT) ? Math.min(xScale, yScale)
                                              : Math.max(xScale, yScale);
            double x = (w - scale*iw)/2;
            double y = (h - scale*ih)/2;
            at.setToTranslation(x, y);
            at.scale(scale, scale);
        g2d.drawRenderedImage(image, at);
  public void zoom(int inc) {
        m_zoom += inc * m_zoomPercentage;
        repaint();
        private void initImage() {
            int w = getWidth();
            int h = getHeight();
            image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = image.createGraphics();
            g2.setPaint(getBackground());
            g2.fillRect(0,0,w,h);
            g2.dispose();
}

Similar Messages

  • In Aperture 3 creating a book using Formal theme and in Edit Layout I can move but not resize the image box even though handles appear and the manual says I should be able to. Help      image boxt

    Can I resize image boxes with the displayed handles as the User Manual suggests I can, when creating a book in Aperture 3 using the Formal Theme (with the beveled mask) and in Edit Layout mode?  I can move the box with the yellow guidelines, but those handles will not move to allow me to adjust size.  If I delete the box and add a photobox, I can resize, but I loose those nice beveled masks!

    Well I tried on my wife's MB and it worked fine, but keeps the same aspect ratio. Nearly there. I tried the local Apple outlet, but they had just taken Aperture off the demo machine .
    However, I have discovered that I can use the "right click" option for 'photo aspect ratio' and it will resize the box to accomodate my pictures.  By fiddling I can select an alternative ratio and/or picture and change the size of the frame up or down and try to get an appropriate size and ratio, e.g. if I have a small landscape picture, I can pop in a bigger square picture (it gets cropped) then choose a portrait mode (cropped differently) then pop in my landscape picture (still cropped, but bigger size), then use the option 'photo aspect ratio', I get it uncropped and bigger.  Not a really satisfactory work around, but better than nothing. 
    By combining they fiddling with aspect ratios and the pinch/squeeze routine - on the MB (or via Lion and a track pad I assume) - I should get there.
    Pity those pesky handles don't work!!
    Thanks folks for the help

  • PS CS5 Extended on Windows -  When trying to use the clone stamp and/or healing brush as soon as I move the cursor over the image I get an exact copy of the existing layer that moves around the window with the movement of the clone stamp/healing brush.  W

    PS CS5 Extended on Windows
    When trying to use the clone stamp and/or healing brush as soon as I move the cursor from the toolbar over to the image I get an exact copy of the existing layer that moves around the window with the movement of the clone stamp/healing brush.  This just started tonight.  What's causing this weird behaviour?

    What are the settings in Window > Clone Source?

  • Can I run the 64 bit version of Mountain Lion and the 32 bit version of windows 7 using parallels on the same computer

    I purchased a Macbook Pro and it has the 64 bit version of Mountain Lion, I also downloaded Parallels desktop 7, and want to download Windows 7. I need to know if I can use the 32 bit version of wodnws 7 and the 64 bit version of Mountain Lion at the same time on the same computer.

    here's the 32 bit installer, 2014 release of Photoshop CC: Separate 32-bit/64-bit installation
    Return, cancel, or exchange an Adobe order

  • I am going to buy a mac mini i7 with 3 thunderbolt displays for forex trading. the question is if i use bootcamp and run windows on the mac mini will the displays still run the same way as if i was running it on Lion?

    I am going to buy a mac mini i7 with 3 thunderbolt displays for forex trading. the question is if i use bootcamp and run windows on the mac mini will the displays still run the same way as if i was running it on Lion?

    No idea if Windows will do it, but you can run Windows without Bootcamp & have OSX available at the same time, which should give you all the Monitors that OSX uses.
    Parallels...
    http://www.parallels.com/
    VmWare Fusion...
    http://www.vmware.com/mac

  • How do you change the language of the dictionary on Safari from English (US) to (UK)? I'm using Windows 7 Home Premium and the latest version of Safari for Windows that I know of. Cheers in advance

    How do you change the language of the dictionary on Safari from English (US) to (UK)? I'm using Windows 7 Home Premium and the latest version of Safari for Windows that I know of. Cheers in advance

    92matt wrote:
    Cheers for the quick response, but do you know whow I would do that?
    Apologies I'm not the most technical of people!
    Open Regional and Language Options by clicking the Start button , clicking Control Panel, clicking Clock, Language, and Region, and then clicking Regional and Language Options.
    Lupunus

  • HT2311 After waiting 27 minutes while the new iTunes supposedly downloaded onto my computer, the Finder window did not appear, and the iTunes.mpkg icon didn't appear on my desktop (where downloads usually go).  What do I do?

    After waiting 27 minutes while the new iTunes supposedly downloaded onto my computer, the Finder window did not appear, and the iTunes.mpkg icon didn't appear on my desktop (where downloads usually go).  I also looked for the new iTunes by clicking on my Hard Drive icon but didn't see it there either.  I only see the icon for the old iTunes.  What do I do?

    The exclamation mark means that the app has lost the link to the actual file.
    First step: try and make sure the iPhoto Library is working correctly:
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.

  • HT1473 when ever i am about to add the file i double click on it and the the box with the documents disapears (windows 7)

    when ever i am about to add the file i double click on it and the box just dissapears does anyone else have this issue? please help me if you did!

    Make sure you are viewing your image at 100%. At smaller views, pixels and layers and the way they interact are approximate interpolations and won't show you the actual pixel-for-pixel changes.

  • Wpf/webbrowser:-how to get height,width,scroll height and scroll width of render html/xhtml/xml pages.

    hi I am using to web browser control to get  height,width,scroll height and scroll width in wpf c#.
    Could You please tell me how to achive this information if .pages contain this css on body.
     style="-webkit-column-width:800px;  margin-right:800px; -moz-column-width: 800px; column-width: 800px; -webkit-column-gap: 0px; -moz-column-gap: 0px; column-gap: 0px; -webkit-column-rule: 0px solid #000;-moz-column-rule: 0px solid #000;column-rule:
    0px solid #000; height:800px; overflow:visible !important; ; margin:0px; -moz-margin:0px;-webkit-margin:0px;display:block;"
    I have to get height,width,scroll height and scroll width  on on complete event.
    this is MainWindow.xaml page
    <Window x:Class="WPFWebBrowserInvokeScript.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="820" Width="820" Loaded="Window_Loaded">
        <Grid>
            <WebBrowser HorizontalAlignment="Left"
       Height="800"
       Margin="10,10,0,0"
       VerticalAlignment="Top"
       Width="800"
       Name="MainBrowser"/>
            <!--<Grid x:Name="grid1"></Grid>-->
        </Grid>
    </Window>
    this  MainWindow.xaml.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.IO;
    namespace WPFWebBrowserInvokeScript
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            public MainWindow()
                InitializeComponent();
            private void Window_Loaded(object sender, RoutedEventArgs e)
                string strHtml = "";
                using (StreamReader sr = new StreamReader("D:/epubunzip/ePub2_Sample03a_USgovernment_SE_Gr9-12_EN_U1/OPS/9780547451381_c01.html"))
                    strHtml = sr.ReadToEnd();
                    strHtml = strHtml.Replace("<body>", "<body  style=\"-webkit-column-width:800px; overflow:visible !important;  -moz-column-width: 800px; column-width: 800px; -webkit-column-gap:
    0px; -moz-column-gap: 0px; column-gap: 0px; -webkit-column-rule: 0px solid #000;-moz-column-rule: 0px solid #000;column-rule: 0px solid #000; height:800px; ; margin:0px; -moz-margin:0px;-webkit-margin:0px;display:block;\">");
                    string str = "<script> function execScript(){return document.body.scrollWidth;}</script></head>";
                    strHtml = strHtml.Replace("</head>", str);
                    byte[] bytes = Encoding.UTF8.GetBytes(strHtml);
                    MemoryStream ms = new MemoryStream();
                    ms.Write(bytes, 0, bytes.Length);
                    ms.Position = 0;
                    MainBrowser.NavigateToStream(ms);
                    //MainBrowser.NavigateToString(strHtml);
                    MainBrowser.LoadCompleted += new LoadCompletedEventHandler(MainBrowser_LoadCompleted);
            void MainBrowser_LoadCompleted(object sender, NavigationEventArgs e)
    //here I am trying to get  height,width,scroll height and scroll width
    //It's gtting wrong info
              WebBrowser webBrowser = (WebBrowser)sender;
                //mshtml.htmld webDocument = (mshtml.HTMLDDElement)webBrowser.Document;
                //mshtml.HTMLBody webBody = (mshtml.HTMLBody)webDocument;
                //    var dd = webDocument.InvokeScript("execScript");
                //    //  string script = "document.body.style.overflow ='hidden'";         
                //    // var dd = webDocument.InvokeScript("execScript", new Object[] { script, "JavaScript" });
                //    var elems = webBrowser.Document.GetElementsByTagName("body");
                //    System.Windows.Forms.HtmlElement webBody = (System.Windows.Forms.HtmlElement)webDocument.Body;
           

    >>if i am rendering html from MemoryStreamor string in webbrowser control in wpf It's not applying this css
    Yes it does. If you for example add background-color: yellow; to the stlyle you will see that the page turn yellow:
    strHtml = strHtml.Replace("<body>", "<body style=\"-webkit-column-width:800px; background-color: yellow; overflow:visible !important; -moz-column-width: 800px; column-width: 800px; -webkit-column-gap: 0px; -moz-column-gap: 0px; column-gap: 0px; -webkit-column-rule: 0px solid #000;-moz-column-rule: 0px solid #000;column-rule: 0px solid #000; height:800px; ; margin:0px; -moz-margin:0px;-webkit-margin:0px;display:block;\">");
    If the styles doen't get applied as expected it is a browser issue. The WebBrowser control emulates Internet Explorer in IE7 rendering mode by default.  You will have to change some registry settings to change this behaviour. Please refer to the following
    links for more information:
    http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/cf66e0cd-ab6f-45b8-b230-1d78f26670d2/opening-links-from-wpf-webbrowser-control-in-default-browser-instead-of-ie?forum=wpf
    -moz-column-width only works in FireFox for example.
    You may also navigate to an actual page and inject some javascript function that for example adds the styles to the body element dynamically or set the style properties of the body element directly:
    private void Window_Loaded(object sender, RoutedEventArgs e)
    MainBrowser.Navigate(@"E:/Epubs/ePub2_Sample05_Biology_SampleChapter_EN/OPS/ch01.xhtml");
    MainBrowser.LoadCompleted += new LoadCompletedEventHandler(webb_DocumentCompleted);
    private void webb_DocumentCompleted(object sender, NavigationEventArgs e)
    WebBrowser webBrowser = (WebBrowser)sender;
    dynamic doc = webBrowser.Document;
    //int _scrollWidth = (int)webBrowser.InvokeScript("execScript");
    //mshtml.HTMLDocument webDocument = (mshtml.HTMLDocument)webBrowser.Document;
    mshtml.HTMLScriptElement script = (mshtml.HTMLScriptElement)doc.createElement("script");
    script.setAttribute("type", "text/javascript");
    script.innerHTML = "function doSomething(){ /* do something here... */ }";
    //add script to the head
    dynamic head = doc.getElementsByTagName("head")[0];
    head.appendChild(script);
    mshtml.HTMLBody body = (mshtml.HTMLBody)doc.getElementsByTagName("body")[0];
    body.style.background = "yellow";
    //set any body.style property here...
    webBrowser.InvokeScript("doSomething");
    That's about it as far as WPF is concerned.
    Please remember to mark helpful posts as answer and/or helpful.

  • HT201401 My iphone 4s turned off properly but when I went to put it back the apple icon came on and then an image I have never seen before of a ubs pointiing towards the word itunes in a circle.  And the phone no longer goes beyond this message.  meltdown

    My phone started acting up and I noticed my text messages were not being sent.  So I turned my iphone off.  My iphone 4s turned off properly but when I went to put it back the apple icon came on and then an image I have never seen before of a UBS pointiing towards the word itunes in a circle.  And the phone no longer goes beyond this message.  I try to turn it off and on again and same message over and over.  If I hit the any button on the phone nothing happens. Does anyone know what this means or seen this itunes messaging ?  meltdown? Please help.

    Hello Raja,
    Thank you so much for your response.  I had these photos backed up on iCloud but, had I not, its good to have an alternate solution as the one you suggested.  Actually, I went to the Apple store today and yes, you are absolutely correct Restoring in iTunes will result in permanent loss of photos unless backed up somewhere such as iCloud or other solution.  Well, what they did was restore the phone in itunes ( I did not have iTunes downloaded to my computer which is why it did not work when I went to do it myself, I needed to go to the iTunes site and go to the download iTunes button because my windows based HP laptop does not come with itunes already downloaded).  This retoration process took a while and I was forced to upgrade to the latest 7.1 iOS software which I was not too happy about -sometimes you like the way things work now :-)  Anyhow, they said this restoration request happens as a result of a software update (which I was NOT in progress of an update or doing an update) or sometimes when you remove the power cable too quickly from the iphone (which I do not recall doing this either but...). Since I had backed up on iCloud all of the photos were downloaded back on my iphone 4s.  Best of all was that my phone was back up and runnning and there was NO CHARGE at the apple store for this service of restoring my phone.  Well, I just wanted to share the results and I appreciate all the responses and support I received.  Thank you kindly.

  • HT201386 how can I find the Image number of a particular photo in the Photos app included with iPad Air?

    how can I find the Image number of a particular photo in the Photos app included with iPad Air?

    Hello yamacutta,
    Thanks for using Apple Support Communities.
    The Photos app will not show you the actual file name of the photo.  However when you go through the image import process on your computer, you should be able to see both the thumbnail of the photo, as well as the filename of the image.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support
    Take care,
    Alex H.

  • How can I widen the vertical scroll bar width in Firefox and Thunderbird?

    How can I widen the vertical scroll bar width in Firefox and Thunderbird?

    Hello,
    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Did this fix your problems? Please report back to us!
    Thank you.

  • How do I delete photos in the photo stream? The images remained despite I removed them on the macbook pro.

    how do I delete photos in the photo stream? The images remained despite I removed them on the macbook pro.

    Open itunes, connect ipod, select what you want on the iphone, sync.

  • I am having problems opening images renerated in lightroom5 into cs6. Cs6 bridge does not see the lightroom libarary. If I open lightroom and right clik the image, edit in cs6, 6 opens but the picture doesnot follow. What is going on? Give me a hand.

    I am having problems opening images renerated in lightroom5 into cs6. Cs6 bridge does not see the lightroom libarary. If I open lightroom and right clik the image, edit in cs6, 6 opens but the picture doesnot follow. What is going on? Give me a hand, thanks.

    What edition of LR 5? What edition of ACR does PSCS 6 contain. If they are not parallel (same edition number x in [5 or 8].x ), is LR making a tiff or psd rendition of the image?

  • Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Try this -> http://support.apple.com/kb/TA38632?viewlocale=en_US

Maybe you are looking for

  • APEX 3.0 Printing fails Acrobat could not open file

    I like the new printing tab in Apex 3.0 but I have already stumbled across a problem. If I put text in the "Page Header" with a page item: REPORT for &P9_USER The report errors when opening in Acrobat: Acrobat Reader could not open 'Report[1].pdf bec

  • Webservice being called multiple times throws strange error

    This is something that just started occurring and doesn't make much sense to me. Using JDK 1.7 and doing the following: FlashlineRegistryTr registry = new FlashlineRegistryTrServiceLocator().getFlashlineRegistryTr(lUrl); ((Stub)registry).setMaintainS

  • Segment field in Postings

    Hi all of you Could any suggest me how to fill the segment field in automatic postings like AFAB and AIBU as Document splitting is activated and we dont have assignment the segment in PCtr master data. Thanks & Regards Ramki

  • File Sync problem

    I have an odd problem Whenever I am in the office, some files will not sync through the desktop app. However, when I leave and access any other network, they sync. Are there any specific ports or something that CC's file sync uses that I should be aw

  • Unanswered calls

    I am about to go over the minutes in my plan (which we NEVER do) due to hundreds of unanswered calls. Because of job issues, we have been getting an unusual humber of phone calls from bill collectors, which we don't answer, and I have purposefully le