Center a Fixed Size Marquee ?

I am using CS2 and would like to place a fixed size marquee on an image and center it to an image. Does anyone know how I can do this please ?

This is more accurate.
Create guides at 50% horizontal and 50% vertical.
Draw a rectangular marquee approximately.
Preass Ctrl+T to transform the selection.
Enter the X and Y sizes in the options bar.
Drag the marquee to align the centre point with the intersection of the guides.
Press Enter.

Similar Messages

  • Its seems impossible to center a fixed size image on a container

    Hi,
    I have a fixed sized JPanel that I want to add to the center of a container. I would like my JPanel's center to be fixed to the center of the container.
    I have tried to use GridBagLayout with a GridbagConstraint like follows:
    GridBagLayout gridbag = new GridBagLayout();
    getContentPane().setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.fill = c.CENTER;
    SubPanel subPanel = new SubPanel();
    gridbag.setConstraints(subPanel, c);
    getContentPane().add(subPanel);
    setSize(400, 500);
    setVisible(true);
    But this results in the upper left corner of my JPanel being put in the center of the container. Does anyone know how to get the center of my JPanel being placed in the center?
    The following two suggestions does not work:
    1) This solution put my panel two the right of the center:
    this.setLayout( new Flowlayout( Flowlayout.CENTER ) );
    this.add( subPanel );
    2) This does only work in the special case that the width of my panel is a third of the width of the container:
    Use GridLayout and set the grids, when you add your panel it Should size the cells equal to your largest component which would be the JPanel, then just add blank JLabels to the other cells and add your subpanel to the center cell.

    this is some sample code. It has not been compiled like this, but there should only be minor problems. if it does not work, just post a message...
    ok, here we go:
    import javax.swing.*;
    import java.awt.*;
    public class CenterLayout implements LayoutManager2 {
    // make sure that only one child is added to the container
    public void addLayoutComponent(Component comp, Object constraints) {
    if( comp.getParent().getComponentCount() > 1 )throw new RuntimeException("only one child allowed for this layout");
    // as big as you want...
    public Dimension maximumLayoutSize(Container target) {
    return new Dimension( Integer.MAX_VALUE, Integer.MAX_VALUE);
    public float getLayoutAlignmentX(Container target) {
    return .5f;
    public float getLayoutAlignmentY(Container target) {
    return .5f;
    public void invalidateLayout(Container target) {
    public void addLayoutComponent(String name, Component comp) {
    addLayoutComponent(comp, name);
    public void removeLayoutComponent(Component comp) {
    // this assumes that the preferred size is the preferred size of the single child plus insets...
    public Dimension preferredLayoutSize(Container parent) {
    Insets insets = parent.getInsets();
    int w = insets.left + insets.right;
    int h = insets.top + insets.bottom;
    if (parent.getComponentCount() > 0 ) {
    Dimension childSize = parent.getComponent(0).getPreferredSize();
    return new Dimension(childSize.width + w, childSize.height + h );
    } else {
    return new Dimension(w,h);
    // this assumes that the minimum size is only the minimum size of the single child. if you want insets
    // considered for minimum size, add them here
    public Dimension minimumLayoutSize(Container parent) {
    if (parent.getComponentCount() > 0 ) {
    return parent.getComponent(0).getMinimumSize();
    } else {
    return new Dimension(0,0);
    // this is the important stuff, calculating childs
    // position. It always sets the child to its
    // preferred size and centers it.
    // there may be better strategies handling the case
    // that the containers dimension are smaller than its
    // childs dimensions. you may peek, if the child may be
    // scaled to fit in considering the minimum size of the child.
    // once started, layoutmanager can be improved with
    // more sophisticated algorithms ever on, go and paly
    // around with it :-)
    public void layoutContainer(Container parent) {
    if( parent.getComponentCount() > 0 ){
    Component child = parent.getComponent(0);
    Insets insets = parent.getInsets();
    Dimension size = parent.getSize();
    size.width = size.width - insets.left - insets.right;
    size.height = size.height - insets.top - insets.bottom;
    // put in child scaling here, if needed
    child.setSize(child.getPreferredSize());
    int x = insets.left + (int) ( (size.width - child.getWidth() )/2);
    int y = insets.top + (int) ( (size.height - child.getHeight() )/2);
    child.setLocation(x,y);
    public static void main(String[] args ) {
    JFrame f = new JFrame();
    f.getContentPane().setLayout(new CenterLayout() );
    f.getContentPane().add( new JButton("hello") );
    f.setSize( 200, 200 );
    f.setVisible(true);
    }

  • Best way to create a fixed size centered Panel?

    I'm trying to figure out what the best way is to create a fixed size Panel that stays positioned in the center of its parent component/panel, even as the frame is resized. Is there a way to do this with some layout or will I need to write some code to reposition my panel each time the frame is resized?
    Thanks
    Jonathan

    This approach seems good. One thing I'm wondering, why does the GridBagLayout draw my Panel based on the preferred size and not the bounds? If I want to do some sort of fancy painting with my panel, I'll probably have to set the bounds as well I'd think.
    jonathan
    Here's a way. I won't go so far as to say "best",
    but it gets the
    job done. You need to control the layout of the
    parent in order for
    any solution to work -- some layouts will ignore the
    preferred,
    maximum, and minimum sizes of their components.
    import java.awt.*;
    import javax.swing.*;
    public class CenterTest {
         public static void main(final String[] argv) {          
              final JPanel fixedPanel = new JPanel();
    fixedPanel.setPreferredSize(new Dimension(100,
    0, 100));
              fixedPanel.setBackground(Color.BLUE);
    final JPanel panel = new JPanel(new
    ew GridBagLayout());
              panel.setBackground(Color.CYAN);
              panel.add(fixedPanel);
              final JFrame frame = new JFrame("GridBagLayout");
              frame.getContentPane().add(panel);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
              frame.setSize(200, 200);
              frame.setVisible(true);

  • Fixed size panel

    How can I put a fixed size JPanel to the center of an container (f.ex. JFrame) so that if the container is resized the size of the panel doesn't change but its location will be in the center of resized container. And if the container gets smaller than panel there will become scrollbars.

    Have GridBagLayout for the frame.Use setPreferredSize on the Panel.So even if the frame resizes it will still be in the center and size won't change too since GridBagLayout respects component's preferredsizes.For scrolling you need to add the JPanel to a JScrollPane and add the JScrollPane to the Frame.
    Ranga.

  • How to resize a jpg/gif file to a fix size using jimi ?

    I have search from the web and didn't find any example on doing this.
    Can any one give example on how to resize a jpg image. let say 120x240
    to a fixed size 40x40 ?
    thank you

    Hi.
    When you got that image in form of a file, just load it and invoke the image's getScaledInstance(...)-method.
    Here's how it could work:
    import java.awt.*;
    public class Test {
    public static void main(String[] argv) {
      // define where the image comes from:
      URL toImage = new URL("file:/C:/test.jpg");  // or the like
      // get the image:
      Image image = Toolkit.getDefaultToolkit().createImage(toImage);
      // scale the image to target size (40x40 here):
      Image smallImage = image.getScaledInstance(40, 40, Image.SCALE_DEFAULT);
      // you might want to do other things like displaying it afterwards
    }HTH & cheers,
    kelysar

  • Fixed size regions in Apex 4.0

    It is possible to create a fixed size regiion - that is only using half of the screen height to have a report (and having a bar to on the right to move up/down) ?
    I'm going to use it for a 2+ master-detail report.
    regards
    Mette

    Hi Mette,
    what region template and which theme are you exactly using? For most region templates you can pass in additional style attributes with the "Region Attributes" property in the "Attributes" section of a region definition.
    So for example you could use
    style=\"height:500px;overflow-y:scroll\"(remove the \ out of the code example)
    Regards
    Patrick

  • Hyper-V 2012 R2 - Fixed Size VHDX Have VMs Paused Due to Disk Space Shortage

    I am running Hyper-V Server 2012 R2 (Server Core).  I have an SSD boot drive and a 10 Tb Storage Space HDD (Double Pairty - RAID6) where all VMs are stored.
    I have one VM setup with an expanding VHDX file.  It is setup with thin provisioning for 2 Tb and about 1.5 Tb is currently used.  The VM paused due to physical disk space (SS drive) being low.  I turned off this VM and tried to start a different
    VM that has two fixed size VHDX files (also on the SS drive).  This second VM would not start either.  I got the same error message, as occurred on the first VM, about the physical disk space being low.  There was about 10-20 Mb of physical
    space left of my SS HDD when these errors occurred.
    Given the first VM is setup with an expanding VHDX that makes sense to me that at some point there may not be enough physical disk space for the VM to expand and continue to run.
    But given my second VM is using a fixed VHDX it doesn't make sense to me that I cannot get this VM to start.  Even if the Storage Space disk were completely full I would expect this VM to be able to start?
    Thanks for any assistance you can provide.
    Theokrat

    Hi Theokrat,
    "The HDD was setup with approximately 5 Tb storage pool as double parity."
    "My first VM has a 4 Tb fixed VHDX. Thus there was only about
    1 Tb free space left for the second VM."
    "And for the VMs I'm asking about I set up those options to point to my HDD which is the D drive."
    So, there are two VMs (the first VM has 4TB disk , the
    second VM has 1TB disk )and all of the VMs'  files
    are stored on the 5TB HDD (the 1TB VHDx is dynamical) .
    You turned off the second VM when it was paused due to lacking of disk space (before this the first VM is off ).
    When you start the first VM , it still can not start and the error arose again ,right ?
    If there is no any other factor led to disk usage increasing , I think the issue might be the startup memory of first VM is larger than or equal to the second VM's .
    Please try to check that , if it is true , you can try to set lower memory for the first VM then start it again .
    Best Regards
    Elton JI
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to set fixed size for inputfile text field

    Hi all,
    I am using inputfile component to test file uploading so I created a simple upload page. When I finished upload the file, the input text field will "shrink" its size and change the size to adjust the file name. Is there any way to set a fix size for input text field?
    Here is some part of the code:
    <af:form id="f1" usesUpload="true">
    <af:panelHeader text="File Uploader" id="ph1">
    <af:inputFile label="File to upload" id="if1" autoSubmit="true" valueChangeListener="#{fileBean.fileUpdate}"
    value="#{fileBean.file}" partialTriggers="if1"
    columns="50"/>
    </af:panelHeader>
    <af:commandButton text="Save" id="cb1"/>
    FileBean:
    public void fileUpdate(ValueChangeEvent valueChangeEvent) {
    RichInputFile inputFileComponent = (RichInputFile)valueChangeEvent.getComponent();
    UploadedFile newFile = (UploadedFile)valueChangeEvent.getNewValue();
    UploadedFile oldFile = (UploadedFile)valueChangeEvent.getOldValue();
    Thanks,
    Jerry

    you can set columns attribute in af:inputfile. Please see highlighted area i have inserted to you code
    <af:form id="f1" usesUpload="true">
    <af:panelHeader text="File Uploader" id="ph1" columns = "34" >
    <af:inputFile label="File to upload" id="if1" autoSubmit="true" valueChangeListener="#{fileBean.fileUpdate}"
    value="#{fileBean.file}" partialTriggers="if1"
    columns="50"/>
    </af:panelHeader>
    <af:commandButton text="Save" id="cb1"/>

  • How to set a fixed size window, so that moving 2D pictures wouldnt go off?

    Hi
    I dont if this question has been asked or no & also not sure if its right to be posted here as my problem is a java 2D graphics problem in swing environment.
    I want to know is how can i set the window to a fixed size with boundaries such that my graphics 2D picture in the swing window will not go off the edges of window when i do some transformations with the 2D picture.
    For e.g:
    so far ive got a frame window of size 350 by 350 with my 2D picture inside it made up of shapes etc...
    when i apply some transformation to it (moving it) for a distance it goes disappeared off window beyond 350 and will come back if i move it back.
    So how do i restrict the window so that when picture reaches the edge, it will not be able to move any further?
    Do i set some specific bounds to the JFrame?
    i hope i've explained it properly
    Thanks

    In a 2D coordinate system the horizontal values are represented by some letter, usually x. In the same coordinate system the vertical values are classically represented by y.
    Note: In your code, if you wish, you can replace x and y with anything you desire--p and q or perhaps jeff and alice or any variable name you wish, but for simplicity, and usually ease of understanding because almost everyone has had 100's of math problems drilled into their head with (x, y), x and y are used as convention.
    In Java the screen coordinates run from 0 to the width-1 for x and 0 to height-1 for y of the component you are using to display.
    So logically when you have a value of x or y that goes beyond the addressable bounds of your display, then you have to make some type of adjustment--when your value dips below 0, you reset it to 0, when your value goes above what ever width-1 or height-1 then you have to set that value to width-1 or height-1.
    This all assumes that when you hit the wall, floor, or ceiling you stick there until you change directions--if you wish to wrap then you set your value to the opposite bound--so if you go below 0, you would then pop out back in on the right side--your appropriate x would be set to width-1 instead of 0 and in the case of y going below 0 your y would be set to height-1. This is also to say that when you descend below your minimum, then you would pop back out on the opposite side you went out on--so x greater then width-1 would get set to 0 and y greater than height-1 would get set to 0.
    That is not even a start on if you want to include elastic collisions, angle of impact, any type of deceleration force, or anything else.
    In any case... I would recommend that you add more math to your studies, I've never met an engineer or computer science grad that said: "Wow, I really regret taking all that math in college (or HS), I never use it."

  • Fixed Size Thread Pool which infinitely serve task submitted to it

    Hi,
    I want to create a fixed size thread pool say of size 100 and i will submit around 200 task to it.
    Now i want it to serve them infinitely i.e once all tasks are completed re-do them again and again.
    public void start(Vector<String> addresses)
          //Create a Runnable object of each address in "addresses"
           Vector<FindAgentRunnable> runnables = new Vector<FindAgentRunnable>(1,1);
            for (String address : addresses)
                runnables.addElement(new FindAgentRunnable(address));
           //Create a thread pool of size 100
            ExecutorService pool = Executors.newFixedThreadPool(100);
            //Here i added all the runnables to the thread pool
             for(FindAgentRunnable runnable : runnables)
                    pool.submit(runnable);
                pool.shutdown();
    }Now i wants that this thread pool execute the task infinitely i.e once all the tasks are done then restart all the tasks again.
    I have also tried to add then again and again but it throws a java.util.concurrent.RejectedExecutionException
    public void start(Vector<String> addresses)
          //Create a Runnable object of each address in "addresses"
           Vector<FindAgentRunnable> runnables = new Vector<FindAgentRunnable>(1,1);
            for (String address : addresses)
                runnables.addElement(new FindAgentRunnable(address));
           //Create a thread pool of size 100
            ExecutorService pool = Executors.newFixedThreadPool(100);
            for(;;)
                for(FindAgentRunnable runnable : runnables)
                    pool.submit(runnable);
                pool.shutdown();
                try
                    pool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
                catch (InterruptedException ex)
                    Logger.getLogger(AgentFinder.class.getName()).log(Level.SEVERE, null, ex);
    }Can anybody help me to solve this problem?
    Thnx in advance.

    Ravi_Gupta wrote:
    *@ kajbj*
    so what should i do?
    can you suggest me a solution?Consider this thread "closed". Continue to post in your other thread. I, and all others don't want to give answers that already have been given.

  • Fixing Size of Column in Cross Tab

    Plz tell me how to fix Size of column.in my case the data in column is not fixed so the output in PDF shows different size of Columns.I want want to fix them.
    plz help
    thanks in advance

    You can call (on your table) getColumnModel().getColumn(i).setWidth(), but that information is lost once you call tableStructureChanged in your table model. To solve this problem I use my own TableModel, which sets the with of the columns every time they are created:
    public class MColumnModel extends DefaultTableColumnModel {
         private int [] widths;
        public MColumnModel(int[] widths) {
              super();
              this.widths = widths;
         public TableColumn getColumn(int index) {
              TableColumn column = super.getColumn(index);
              if (column == null)
                   return column;
              column.setPreferredWidth(metaWidths [index]);
              return column;
    }Be sure to call setColumnModel before you call setModel on your table.
    The widths are relative. If you want to set absolute widths, you have to call
                   table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);Regards
    Der Hinterwaeldler

  • CL_GUI_DOCKING_CONTAINER with fix size

    Hi!
    Is it possible to create instance of CL_GUI_DOCKING_CONTAINER with fix size?

    lv_style = cl_gui_control=>ws_child + cl_gui_control=>ws_border + cl_gui_control=>ws_visible.
        CREATE OBJECT docking
          EXPORTING
            repid                       = repid
            dynnr                       = dynnr
            side                        = docking->dock_at_top
            ratio                       = 80
            style                       = lv_style
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6

  • Is it possible to make a fixed size page in muse, so it doesn't resize?

    I want to make a fixed size page (pic1),
    but there always an extra space on the bottom… pic2

    Thank you for reply - I will check it out…
    Date: Wed, 18 Dec 2013 09:07:46 -0800
    From: [email protected]
    To: [email protected]
    Subject: Is it possible to make a fixed size page in muse, so it doesn't resize?
        Re: Is it possible to make a fixed size page in muse, so it doesn't resize?
        created by Zak Williamson (Adobe) in Help with using Adobe Muse CC - View the full discussion
    Assuming the screenshots are of the same page, the one that's taller is either taller because the minimum page height has been changed or due to some page content (that's not marked as a Footer Item) being located in the new space. This may be an empty text frame or the transparent area of a widget, text frame or other object.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5941664#5941664
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5941664#5941664
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5941664#5941664. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Help with using Adobe Muse CC at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How to set the fix size jframe window

    when I run the jframe ,the jframe window size is very small
    1)how to set the fix size jframe window??
    2)how to set the jframe cannot change the window size??
    thx~~

    1. You can set the size by calling JFrame's method setSize. There are two versions of this method: (1) setSize(int width, int height) and (2) setSize(Dimension d). Note, that when you use this method to set the frame size, you don't have to call JFrame's pack method.
    2. JFrame has a method called setResizable(boolean resizable) which you can call with the argument false.
    Without any ill intent, these questions are regarding something that is very easily answered by looking at the documentation for the JFrame class. I suggest to anyone working with swing to at least look briefly through the base classes they're extending before giving up. In my experience it is always more gratifying to figure things out on my own than asking someone. But please don't take this the wrong way, I respect people who seek out help in order to further their knowledge, instead of just giving up.

  • Message Popup - making it fixed size?

    I'm wondering if there is a way to make the default message popup a fixed size?  I have different error message boxes and subsequently, they are all different sizes.  Anyone know a relatively easy way of doing this?  creating a custom step is not preferred.
    thanks
    [DL]
    Solved!
    Go to Solution.

    Hi DanielJL,
    There isn't a way to make the default popup a fixed size. However, as you mentioned, this can be done relatively easily through a LabVIEW Action Step (or other adapter). If you need help knowing how to do that, feel free to let us know.
    Best,
    John M
    National Instruments
    Applications Engineer

Maybe you are looking for

  • Error while creating external operation in Routing

    Hi Freinds, I am creating an external operation in a routing and I enter the purchasing info record which is created for the material. But when I try to enter this info record in the external operation then I get the Error: "Enter info record without

  • Adhoc query custom field selection

    Hi Experts, In adhoc query, we have added a custom field and we find that it is giving correct output.  However, we want to make the "selection" box appear and we don't know how to do it.  Would you have instructions? If we add standard/ready-made fi

  • How to generate alert from Mapping

    Hello, I know how to generate alrets by configuring ALRTCATDEF, Alert Configuration. I want to know how we can generate alert from mapping for ex.. If a=b then send the message and if a!=b then failed the message and throw and alert. In java or XSLT

  • Can any app be downloaded and used on the new OS Mountain Lion?

    Can any app from the app store be used on the new Mountain Lion OS? Or is only the iMessage, Notes e.c.t...?

  • Problem with 10G R2 installation (OUI - 10133 Invalid Staging Area) on W2K3

    I'm getting a strange error installing 10G R2 Database on a Windows 2003 server. I get "OUI - 10133 Invalid Staging Area. There are no top level components for Windows NT, Windows 2000 available for installation in this staging area." This happens wh