Screen Position & Scaling to Fit Window Size

Hi there!
I was hoping someone might be able to help me or point me in
the direction of help! I'm not sure if I'm asking a really stupid
question! I'm also not sure of what I'm asking for is called so
I've looked at existing examples on the web to illustrate my
questions.
I've come across this website (
http://www.toshiba-emi.co.jp/hikki/index_f.htm)
which features a swf which is displayed at 100% width and height,
and with no scaling.
Firstly, I was wondering how the background photo can be
rescaled depending on the window size, even with the noscale param?
Secondly, I'd like to know how the 'Last Update' box always
aligns to the bottom left and the title box always aligns to the
top left. Another website (
http://www.square-enix.co.jp/kingdom2fm/)
shows similar with elements snapping to the extremities of the
screen while the main content stays centred.
Thanks for taking the time to read this. I'd really
appreciate any help you can give me!
Andy

bmihura wrote:
I'm studying for the CLD and I notice that one of the requirements is this:
Develop block diagrams to fit a screen resolution of 1024 x 768.
When I create a new VI, its resolution is slightly too big: 1110 x 768.
When I create a subVI via the menu item Edit >> Create SubVI, it is way too small: 800 x 543.
For both methods of creating new VIs, I would like to specify both the screen position and window size. But if that is not possible in LabVIEW, I'd like a quick way to make this happen. I see some property nodes for VIs where I could write a subVI that could do this for the front panel, but that is awkward. And it does not apply to block diagrams.
Is there a clever way to do these things?
It doesn't mean the default size of the window. It means once your code is complete, your block diagram should be small enough that you can see all your code when its on a monitor of that resolution. Before you test, set your computer monitor resolution to 1024x768. Write your code. If all the code on your block diagram can be seen without scrolling, you will be fine. They won't measure this explicitly. They are basically just saying "you shouldn't have a huge block diagram."
CLA, LabVIEW Versions 2010-2013

Similar Messages

  • Missing zoom function - Zoom image to fit window size?

    Hi
    Can anyone tell me if it's possible to zoom the image so it fits the current document window size? (Not Fit-To-Screen, as this will change the doc window size)
    Thanks
    Steve

    I don't think there is a button per se for this like there is for Fit to Screen, but can use any of the numerous zoom functions to make the document fit inside the document window.

  • HT2506 Preview is now opening full screen always.  Want it window size

    All of a sudden, Preview is opening images in Full Screen only.  It used to open in a window.  I have looked everywhere to change this back from full screen to window size.  I have checked the Preferences and Get Info.  Please help and tell Apple to quit messing around with our apps.  :-)  So annoying.

    Press the escape (esc) key to exit full-screen mode. Close all windows. Quit and relaunch Safari. Does the same thing happen?

  • [MacOSX 10.10] [RDP 8.0.12] Remote screen does not match containing window size or monitor

    Hello. I am facing a very strange issue that I have never seen before. When I connect to a remote host, the host's screen does not match my client screen, and instead spills over into two monitors. This happens in full screen mode. When switching to windowed
    mode, only a portion of the remote host shows, the rest is a black screen.
    I would love to post example pics but this site wont let me until I verify my account, but I have no email asking me to do so...

    A few notes:
    - I have tried a restart.
    - I am running two displays, one is the built in 1440x900, one is an external 1920x1200
    - I am on OSX10.10.1
    - RDP is 8.0.12
    - I have tested this against Windows 7 Pro machines
    - This was working fine a week ago, just started this week.
    Graphics Properties Dump:
    Chipset Model: NVIDIA GeForce GT 650M
      Type: GPU
      Bus: PCIe
      PCIe Lane Width: x8
      VRAM (Total): 1024 MB
      Vendor: NVIDIA (0x10de)
      Device ID: 0x0fd5
      Revision ID: 0x00a2
      ROM Revision: 3682
      gMux Version: 1.9.23
      Displays:
    Color LCD:
      Display Type: LCD
      Resolution: 1440 x 900
      Pixel Depth: 32-Bit Color (ARGB8888)
      Mirror: Off
      Online: Yes
      Built-In: Yes
    HP LA2405x:
      Resolution: 1920 x 1200
      Pixel Depth: 32-Bit Color (ARGB8888)
      Main Display:
    Yes
      Mirror: Off
      Online: Yes
      Rotation: Supported

  • Software to restore apps window size and position after change in screen resolution

    I use a 27' iMac'10 with SL 10.6.8, running it at 2560x1440 screen resolution.
    Whenever I have to attend meetings via GoToMeeting or Webex and need to present, the resolution is too high, since most participants are on 15' laptops or even iPad's these days.  Therefore, I reset the screen resolution to 1600x900 for the time of the presentation.
    After the meeting is over, I reset the resolution back to 2560x1440.
    Problem: After the reset, all my apps are scaled and out of place, so I need to manually reset them to their original sizes and positions.  I use Divvy to make this a bit less painful, but still it's a manual chore.
    Is there any software out there that let's me restore my windows to the exact settings they were the last time before I changed screen resolution?

    I agree, the ability to remember window sizes and positions when switching between laptop and using the Thunderbolt display would be very useful.  It's like your Mac remembering the volume level depending on whether you have headphones plugged in or not.

  • How do I automatically make new front panels and block diagrams a certain size and screen position, like able to fit on a 1024 x 768 screen?

    I'm studying for the CLD and I notice that one of the requirements is this:
    Develop block diagrams to fit a screen resolution of 1024 x 768.
    When I create a new VI, its resolution is slightly too big: 1110 x 768.
    When I create a subVI via the menu item Edit >> Create SubVI, it is way too small: 800 x 543.
    For both methods of creating new VIs, I would like to specify both the screen position and window size. But if that is not possible in LabVIEW, I'd like a quick way to make this happen. I see some property nodes for VIs where I could write a subVI that could do this for the front panel, but that is awkward. And it does not apply to block diagrams.
    Is there a clever way to do these things?

    bmihura wrote:
    I'm studying for the CLD and I notice that one of the requirements is this:
    Develop block diagrams to fit a screen resolution of 1024 x 768.
    When I create a new VI, its resolution is slightly too big: 1110 x 768.
    When I create a subVI via the menu item Edit >> Create SubVI, it is way too small: 800 x 543.
    For both methods of creating new VIs, I would like to specify both the screen position and window size. But if that is not possible in LabVIEW, I'd like a quick way to make this happen. I see some property nodes for VIs where I could write a subVI that could do this for the front panel, but that is awkward. And it does not apply to block diagrams.
    Is there a clever way to do these things?
    It doesn't mean the default size of the window. It means once your code is complete, your block diagram should be small enough that you can see all your code when its on a monitor of that resolution. Before you test, set your computer monitor resolution to 1024x768. Write your code. If all the code on your block diagram can be seen without scrolling, you will be fine. They won't measure this explicitly. They are basically just saying "you shouldn't have a huge block diagram."
    CLA, LabVIEW Versions 2010-2013

  • My screen doesnt fit, i go to a website and the screen for example google is longer then my window size and i cant slide over to view the rest of the page

    i go to google, facebook or any other site and the dimensions for the webpage im on are longer then my actual window size so i can only see like half the page, i tried unistalling it then installing it again and same thing and i cant even view my bookmark tabs because there to far over to the right and i can maximize it but it still doesnt fit

    go to help at the top of your browser then click on restart with add-ons disabled, firefox will close then it will open up with just basic firefox, then you can swicth the add-ons back on and it should be ok, ive just done this myself and it worked

  • Flah Player Screen Position and Size Restrictions

    Hi All,
    I'm creating an interactive program which is to be used on
    Windows desktops through flash player rather than as a projector or
    html page. My problem is screen positioning and
    resize-restrictions.
    I want to be able to restrict the user from resizing the
    flash player; the stage size is currently set to 800x600 and I want
    to keep it that way on the desktop as I'm using photographs which
    when the player is resized is leaving blank bars down the sides
    (due to the photographs being 800x600).
    I'd also like to be able to position the flash player in the
    top-left hand corner of the screen.
    I'm not great at flash and have tried numerous things but
    can't get these to work, can anybody help?
    Regards,

    Hi
    This is possible, if you make your Flash file into a
    Projector file and
    bring it into Jugglor
    http://www.jugglor.com
    Download a FREE evaluation copy and look at
    Jugglor -> Setting Settings -> Windows Settings
    Here you have the restrictions as you require.
    Hope this helps.
    Regards
    FlashJester Support Team
    e. - [email protected]
    w. -
    http://www.flashjester.com
    There is a very fine line between "hobby" and
    "mental illness."

  • InDesign forgets window size and position when opening

    PC with Windows 7, CS 2014.
    I set up Illustrator so that it does not open full screen (I have a 27" monitor) so that I can have panels permanently open around the edges. Close Illustrator and re-open it and it remembers the last set window position.
    InDesign remembers the position of the open panels but opens the main window full screen every time, and it's really annoying having to resize and reposition the main window every time I load InDesign.
    I upgraded from an earlier version of Adobe CS and that older version of InDesign remembered the window size and position. Why did this change?
    Can this be fixed please?

    From the InDesign top menu have you tried going to Window/Application Frame to put the application in it's own resizable frame? That will hold the window to the same size each time you open an InDesign file.

  • Screen share window size is wrong following Mavericks upgrade

    Hi, I use screen share quite a bit, both over LAN but also over the internet and love the feature. I usually have no problems, but after the upgrade to Mavericks on my iMac and Mac Mini (Both 2011 models), I've started seeing problems with the window size of screen share.
    Going from my Mavericks iMac to my Lion Macbook pro, there's no problem, and my imac shows a screen share window that is the resolution of the MBP (1440x900). But if I do screen share from my iMac (2550x1440), to my Mac mini (Which is attached by HDMI to a HDTV at 1920x1080), the window gets continuously smaller on each session, and it is now stuck at what I would guess is 320x240.
    How can I change this size? I assume is has something to do with Mavericks horrible resolution handling, as I don't get a list of resolutions over HDMI anymore in System Preferences, which was nice and easy in pre-Mavericks OS'.

    Thanks, using the zoom button did actually improve quite a bit. It is not full resolution, but almost twice the size it was before and definitely usefull, thanks! Never though about doing that..
    Scaling manually doesnt work over the current max window resolution though.

  • Yosemite: How do I get back from full-screen to original window size?

    Okay, so today I used iPhoto for the first time since I reluctantly upgraded to Yosemite on Friday.
    iPhoto is one of the few apps I often take into full-screen mode, and so obviously I noticed today that they've kindly taken away the full-screen arrows in the top right-hand corner of the window in Yosemite.
    Posting a question about that in Support revealed the 'new improved' way to go full-screen, which is to click on the green traffic light in the top left-hand corner of the window.
    Fair enough, but how do I get my iPhoto window back to the size it was before I went full-screen? I tried clicking the green-button again, but that insists on the window being what I call 'maximised', ie. spread across the entire width of my desktop. I want to snap from full-screen back to the window size I had before going full screen.
    The arrows in the top right-hand corner used to do that perfectly well, but they're not there any more so I'm having to resort to laboriously re-sizing my window each time, which is far from ideal.
    Anyone able to advise me please?

    Do we know if it is iPhoto-specific, or do all app windows behave in this way?
    Actually, I suppose I could find that out for myself...

  • 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();
    }

  • Put my macbook pro to sleep. When I opened it, the desktop window is small and I can't resize it. All applications now run in the smaller size window.  Can't make it fill the screen. Just switched from windows.  Thank you.

    Put my macbook pro to sleep. When I opened it, the desktop window is small and I can't resize it. All applications now run in the smaller size window.  Can't make it fill the screen. Just switched from windows.  Thank you.

    Check to see if the resolution has been changed in System Preferences.
    Allan

  • How to adjust the window size in overview screen of a scorecard ?

    Hi Experts,
    In <i>SEM</i> application is it possible to adjust the size of the "<b><i>Perspective</i></b>" windows in the Overview screen of a <i>Scorecard</i> ?
    If possible how ?

    hi,
    If you change the window size of the script in the original language, it should reflect in the other languages.
    Please activate the script in english once again and see the spanish form again.
    @SAP_WIZ
    As far as chaniging window size is concerned, Please edit your script in ES and then change it.Or login in ES and then edit the script.
    This is not possible, because the original script is in english.
    Regards
    HM

  • Mail Signature: image size keeps changing to fit window

    When adding a logo image to a signature in mail, the image is not remaining the same size, it changes in size semingly to fit the width of the window that the email happens to be in. Mostly the image is showing larger than the window itself. We are having this problem on imac (snow leopard) and brand new macbook pro (mountain lion). I have tried using PNG and JPEG files but both have the same problem. Older signatures (2 years old) show the image correctly keeping it the same size. Any advice muchly appreciated : )

    I worked it out in the end - I had 2 things too big in my image settings; the canvas size (which was 14cm long!) and he DPI (which was 300dpi) I have since changed to approx 8cm long and 100DPI and it now displays the logo in the signature without increasing the size of it to fit the size of the window. My only issue now is trying to get the image to still show in the reply thread, so that when you look down the email conversation you can see the logo in each of the previous email signatures. This one is stumping me!

Maybe you are looking for

  • Yoga 2 Pro: boot failure and touchscreen unresponsive

    I've had my Yoga 2 for about a week and a half and for the most part I love it. First problem has been occasional (maybe 4-5 times) "Boot Failure", or something along those lines, on startup. Every time after restarting it it has worked fine. Also ju

  • I just installed mountain lion on my early 2011 mac pro i can not get my apple tv 2 to be detected for airplay

    Pretty much the title can not detect my apple tv2 through my early 2001 macbook pro that i just installed mountain lion. Im even have a apple time capsule thats both connected to these two device. My Itunes detects the apple tv and even tested itunes

  • Third Party Filters in PSE 13

    Hi, I have been using PSE 10 for some time now, and have been using 3rd party filters/plugins in the editor (Topaz Labs, DXO ViewPoint, Perfect Effects). As these other tools were installed after I installed PSE 10, I could see them listed at the bot

  • Payer need to be change after created billing document

    Hi all, They created some orders..... orders-delivery-billing documents created. now we came to know the payer is wrong but the documents are not relased to accounting..... how can i do if issue like this....if i change  the payer in customer master?

  • Get iCloud contacts on my mac

    Ok im sure there must be a simple solution here. I am trying to sync everything on icloud with outlook mac, contacts/cal/notes etc, but I believe outlook will only sync with what is on my mac. Everything is in icloud and in my mac address book, i hav