Restrict window size reduction up to a certain size

Hi,
I didn't know how to search for this, hence sorry if it has been answered before.
My question is not about window resizing which is easy via
setResizable() method.
I 've noticed that some complex dialog boxes do not allow to descrease their size after a specified value. See e.g., JBuilder's Project Properties dialog box; you can increase its size as much as you want, but when you try to reduce its size, after a certain size it isn't reducing any more.
How can you do that? Is it something that has to do with JWindow or with the layout it's using (GridBagLayout I guess)?
Thanks in advance.
John.

I was very fustrated with that problem so I came up with a "solution". I never actually needed that kind of feature but the very idea that it wasn't available in the api bothered me.
I probably shoud be shot for that but here goes :import javax.swing.*;
import javax.swing.event.MouseInputListener;
import java.awt.*;
import java.awt.event.*;
* <dl>
* <dt><b> Creation date :</b></dt>
* <dd> 22 nov. 2004 </dd>
* </dl>
* @author Pierre LE LANNIC
public class MinimumSizedDialog {
     private Dimension theMinimumSize;
     private JDialog theDialog;
     private class ResizePanel extends JPanel implements MouseInputListener {
          private int theDirection;
          private Point theFirstPoint;
          private Dimension theStartDragDimension;
          private Cursor thePreviousCursor;
          private Cursor theResizeCursor;
          public ResizePanel(int direction) {
               super();
               theDirection = direction;
               // for debug purposes only
               setOpaque(true);
               setBackground(Color.RED);
               addMouseListener(this);
               addMouseMotionListener(this);
               switch(theDirection) {
                    case SwingConstants.EAST :
                         theResizeCursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
                         break;
                    case SwingConstants.SOUTH :
                         theResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
                         break;
          public Dimension getPreferredSize() {
               Dimension dim = super.getPreferredSize();
               Dimension pref = dim;
               // width / height should be 2 . 10 is just to make the panel more obvious.
               switch(theDirection) {
                    case SwingConstants.EAST :
                         pref = new Dimension(10, dim.height);
                         break;
                    case SwingConstants.SOUTH :
                         pref = new Dimension(dim.width, 10);
                         break;
               return pref;
          public void mouseClicked(MouseEvent e) {}
          public void mouseEntered(MouseEvent e) {
               thePreviousCursor = getCursor();
               setCursor(theResizeCursor);
          public void mouseExited(MouseEvent e) {
               if (thePreviousCursor != null) {
                    setCursor(thePreviousCursor);
                    thePreviousCursor = null;
          public void mousePressed(MouseEvent e) {
               theFirstPoint = getPointOnScreen(e.getPoint());
               theStartDragDimension = theDialog.getSize();
          public void mouseReleased(MouseEvent e) {}
          public void mouseDragged(MouseEvent e) {
               Point current = getPointOnScreen(e.getPoint());
               switch(theDirection) {
                    case SwingConstants.EAST :
                         horizontalResize(current);
                         break;
                    case SwingConstants.SOUTH :
                         verticalResize(current);
                         break;
          public void mouseMoved(MouseEvent e) {}
          private void horizontalResize(Point aNewPoint) {
               int diff = aNewPoint.x - theFirstPoint.x;
               final Dimension newDim = new Dimension(theStartDragDimension.width + diff,
                                                               theStartDragDimension.height);
               if (validateDimension(newDim)) {
                    theDialog.setSize(newDim);
                    theDialog.validate();
          private void verticalResize(Point aNewPoint) {
               int diff = aNewPoint.y - theFirstPoint.y;
               Dimension newDim = new Dimension(theStartDragDimension.width,
                                                        theStartDragDimension.height + diff);
               if (validateDimension(newDim)) {
                    theDialog.setSize(newDim);
                    theDialog.validate();
          private Point getPointOnScreen(Point aPoint) {
               Point p = new Point(aPoint);
               SwingUtilities.convertPointToScreen(p, ResizePanel.this);
               return p;
     public MinimumSizedDialog(Frame anOwner, Container aUserContentPane, Dimension aMinimumSize) {
          theDialog = new JDialog(anOwner, MinimumSizedDialog.class.getName(), true);
          theDialog.setResizable(false);
          final JPanel parentContentPane = new JPanel(new BorderLayout());
          parentContentPane.add(new ResizePanel(SwingConstants.EAST), BorderLayout.EAST);
          parentContentPane.add(new ResizePanel(SwingConstants.SOUTH), BorderLayout.SOUTH);
          parentContentPane.add(aUserContentPane, BorderLayout.CENTER);
          theDialog.setContentPane(parentContentPane);
          theMinimumSize = aMinimumSize;
     public JDialog getDialog() {
          return theDialog;
     private boolean validateDimension(Dimension aDimension) {
          if (aDimension.width < theMinimumSize.width) return false;
          if (aDimension.height < theMinimumSize.height) return false;
          return true;
     private static void test() {
          final JFrame frame = new JFrame(MinimumSizedDialog.class.getName());
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JButton launchButton = new JButton("showDialog");
          frame.setContentPane(launchButton);
          JPanel panel = new JPanel();
          panel.setPreferredSize(new Dimension(500, 500));
          final JDialog testDialog = new MinimumSizedDialog(frame, panel, new Dimension(300, 300)).getDialog();
          launchButton.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    testDialog.pack();
                    testDialog.setVisible(true);
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    frame.pack();
                    frame.show();
     public static void main(String[] args) {
          test();
}As you can see, there is still a LOT of room for improvement. I just hope it might help somebody out there.

Similar Messages

  • Restricting users from uploading files greater than certain size in Kpro

    Hi,
    How can we restric users from uploading files in SAPoffice which are greater than certain size (5MB)?
    Awaiting for reply.

    Hello Gino,
    you go to Tcode DC10, in the define document type,
    there is a option file size, this gives you restriction , only if you are not using KPro and content server.
    If you are using Kpro and content server, then please do the enhancement (SE80, package ,CV)
    With the help of this you can restrict and put the warinig message if your original size is exceed.
    Thanks & Regards,
    nitin
    Award point if useful

  • Restricting users froms uploading files greater than certain size in km.

    Hi,
           How can we restric users to upload files in KM which are greater than certain size (5MB)?Awaiting for reply.

    Hi,
       It is out of standard you must develop your own upload command (SAP Developer Studio).
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/knowledge management and collaboration developers guide.html
    Patricio.

  • How can i keep the indesign window to stay a certain size?

    How can i keep the indesign window to stay a certain size? After writing files the Indesign window defaults to original size and I need it to stay a certain size. Can anyone help?
    Thank you
    Ray Jimenez

    Hi, the only possibility I can see is making multiple copies of...
    /System/Library/Components/KeyboardViewer.component/Contents/SharedSupport/Keybo ardViewerServer.app
    And running one in each Space.

  • Cursor changes to X shape at certain sizes

    I currently am running Photoshop CS6 on Windows 7. When I am using the Brush or Pencil tools, sometimes the Cursor will change to a curved X shape. This appears to happen at certain sizes (between 65px to250px) and then goes back to the normal circle shape when larger or smaller. The brush itself paints normally but there are times where I need to know exactly what areas it is going to color. I am using the default brushes, no custom ones.
    I have attached a picture of what the cursor looks like when it changes:
    How do I make it so that this does not occur?

    How are your Photoshop cursor settings set and does this happen for all brush types tips etc,

  • Does photo size reduction for e-mailing degrade photos?

    In using iPhoto to send photos by e-mail one has the option of reducing the size of these photos from actual size to small, medium, or large size in order to transmit them more quickly, but what effect does this size reduction have on the quality of the photos?
    I suspect that the size reduction degrades the images, but I have not been able to obtain any sort of definitive information on this subject, even when I contacted Apple tech help. Is there some knowledgeable person on board who can give us the story on this issue?
    I like the idea of transmitting photos as fast as possible, but not if it means degrading the images by reducing their size to speed up the e-mail process.
    Bob

    Smtr,
    Thanks for your helpful reply. I wasn’t concerned about the original photo retained in my library, but only about the reduced-size copy transmitted by e-mail.
    I’m amazed at how much one can reduce the photo size for transmitting by e-mail. I just randomly selected a 3.3 MB JPEG image which can be squeezed down to only 63 KB by selecting the Small size in the Mail Photo window. I calculate that the reduced size photo would be only 1/52 the size of the original. I assume that the 63 KB image would be a very poor candidate for producing a print! I also assume that the 63 KB image, when viewed by the recipient on his monitor, would be a lot smaller than it would be if I sent him a copy at Actual Size.
    Suppose the the recipient’s e-mail system could not handle the Actual Size 3.3 MB photo, so I send him a Large copy (414 KB) or a Medium copy (122 KB). Would either of those reduced-size photos produce a decent print as small as 4 X 6? I am trying to get a feel for how far I could squeeze down the size of one of my photos for e-mail transmittal before it becomes unsuitable for producing even a small print.
    Comments?
    Bob

  • 16x9, 300ppi, 75mb tiff file, LR converts to 1mb jpg.  Export in LR 5 is being done at 100%, no file size reduction.

    I've got a 16x9, 300ppi, 75mb tiff file that LR converts to 1mb jpg.  Export in LR 5 is being done at 100%, no file size reduction.  Can't figure out why it is downsizing so small?  Even upsized to 420ppi in PS and the export was still only 2mb. Stock agency wants 3mb .jpg minimum. Any help appreciated.  Thanks.

    Using PS CS6 with NO changes applied to the original TIFF the JPEG file size is 8.686 MB. The slightly larger file size is due to metadata differences between LR and PS.
    Both Adobe applications (PS CS6 and LR 5.71) are producing near identical and much larger highest quality JPEG files. PS 12 Quality is the same as LR 100.
    SUGGESTION:
    1) Close LR and rename your LR Preferences file by adding the extension .OLD to it:
    Mac OS X
    Preferences
    /Users/[user name]/Library/Preferences/com.adobe.Lightroom5.plist.OLD
    Windows 7 & 8
    Preferences
    C:\Users\[user name]\AppData\Roaming\Adobe\Lightroom\Preferences\Lightroom 5 Preferences.agprefs.OLD
    Reopen LR and it will create a new Preferences file. Try the JPEG Export again using the same settings as I have posted.
    2) If still no change I suggest uninstalling LR, delete the new LR Preferences file created in step #1 above, keep the .OLD Preferences file, and reinstall LR 5.71.
    3) If all is well now close LR and try restoring you original Preferences file by renaming the new Preferences file something like .OLD.OLD and removing .OLD from the original file.

  • Amazingly inefficient file size reduction

    I have some Texinfo documents that are regularly updated and from which HTML and PDF documentation is then produced. The PDF as it comes from Texinfo is about 850 pages, contains a lot of small graphics, and is about ~50Mb in size. When I use Acrobat (v9.5.1 running on Windows 7 x64) to reduce the file size, the process takes in excess of 12 hours to complete, and when I look at processes in Task Manager when the file size reduction has completed, I can see that the acrobat.exe process has read 61Gb and written 11Gb. At the end of the process, the PDf has been reduced from 50Mb to around 30Mb.
    The machine on which Acrobat is running is not at all underpowered - it has an Intel core i7 CPU and 12Gb of RAM. Any suggestions on possibilities for speeding up the file size reduction. The excessively long processing time is not a one-off aberration - I've run the file size reduction half a dozen times now over a few months, and it takes this long to reduce the file size on every occasion.

    Hi jamesfb,
    You can do so by resizing your image. It will be under the More (&) menu> image size

  • How can i keep zoomed in a certain size different sites without having to zoom in every time each site?

    when i open Firefox, the size of the letters is small and i can't see well. i zoom in a certain size, but when i open a new site the letters return to their previous size.. how can i preserve a certain size off letters without having to do the same thing (zoom in ) every time i open a new site? the analysis at my laptop is 1920*1080..

    The Firefox [https://support.mozilla.com/en-US/kb/Page+Zoom Page Zoom] feature does a domain by domain level of saving the users preferred zoom level settings, there is no default Page Zoom level setting in Firefox, as with some other browsers.
    Try the Default FullZoom Level extension: <br />
    https://addons.mozilla.org/en-US/firefox/addon/6965
    Or the NoSquint extension: <br />
    https://addons.mozilla.org/en-US/firefox/addon/2592/

  • I have a early 2008 Macbook Pro, need to up grade the hard drive so that I can add a windows environment what is the largest drive that I can put in this computer? Is the storage size the constraint or the physical size of the drive? Or a combination?

    I have a early 2008 Macbook Pro, need to up grade the hard drive so that I can add a windows environment what is the largest drive that I can put in this computer? Is the storage size the constraint or the physical size of the drive? Or a combination?

    The largest capacity HDD that you can install is the HGST 1.5 TB HDD:
    http://eshop.macsales.com/item/HGST/0J28001/
    Any 2.5" 9.5mm thick SATA HDD will fit and operate in your MBP, regardless of capacity.
    Ciao.
    Message was edited by: OGELTHORPE

  • Disable fields in search help restriction window

    Hi Experts,
    Here is the situation:
    I have created the new search help for material number and assigned this search help in my module pool program.
    As soon as user press F4 button on material number , it will display search help restrictions window with 4 fields ( material, material type, plant, plant status).
    I have set default value for the material type in search help itself. But I would like to disable this field.
    I mean .... user should not enter any other values other than my default value. So I should disable the material type field in searh help restrictions window.
    Pls help me.
    Thanks
    Raghu

    Hi Vinod,
    In the FM F4IF_INT_TABLE_VALUE_REQUEST, pass exporting parameter callback_form = 'SUB_CALL_BACK'.
    Define the sub routine with the SUB_CALL_BACK with below logic
            FORM SUB_CALL_BACK TABLES record_tab STRUCTURE seahlpres
                                                   CHANGING shlp      TYPE           shlp_descr
                                                                     callcontrol TYPE DDSHF4CTRL.
                   callcontrol-MULTISEL = 'X'.           
             ENDFORM.
    Hope it helps.
    Regards
    Gangadhar

  • I am on a Windows 7 OS attempting to reduce pdf size with my Adobe Acrobat Standard XI & Pro.  The application keeps timing out and  at the Subsetting embedded fonts portion and the application gives "Adobe Acrobat has stopped working" and then closes.  T

    I am on a Windows 7 OS attempting to reduce pdf size with my Adobe Acrobat Standard XI & Pro.  The application keeps timing out and  at the Subsetting embedded fonts portion and the application gives "Adobe Acrobat has stopped working" and then closes.  The document is 275 pages.  Is there something I can do to stop this?

    Hi Ricci,
    Since when are you facing this issue? Did you tried system restore to a date before this problem occured.
    Does acrobat stop working when you open this specific pdf file or with any pdf file that you open?
    Regards,
    Rahul

  • Photo image : size reduction software

    HI !
    I want to reduce sizes of photo images i.e. jpeg, gif files of few GB's into less than 100KB. Need free / paid software compatible to MAC OS X 10.6.8.

    Do you really mean image files of a few Gigabites? I doubt there are many apps that can handle that size of an image file and the machine would have to have many GBs of memory to even consider using it? Was that a type and you mean a few MBs?
    Going from 2 GB down to 100 KB or less is nearly impossible and still get a decent image.  This is an 4.3 MB file compressed to 100 KB with no reduction in the image (pixels) size.
    This is the original file:
    Click on them to see what they look like full sized.  The edited version is showing pixelation in the sky and other areas.
    This was done with iResize at 15% quality (jpeg compression) level. It was the only file resize I had that would get it down below 300 KB.  Even Photoshop CS3 couldn't get it down below 230 KB.

  • PDF File Size Reduction

    Currently, I am using Adobe Reader XI, but am looking for a version that allows for the reduction of the PDF file size.  This is especially useful when e-mailing documents.  Can anyone suggest the best version to keep the editing functions (ex. PDF to Word), but add the reduction capabilities?
    Thanks.

    Bill-
    Thanks so much.
    I’ll take a look at upgrading to Acrobat and see if that will do the trick.
    I appreciate the response.
    Thanks again.
    Ed Perne
    Corporate Director, Human Resources & Risk Management
    11500 W. Olympic Boulevard, Suite 345
    Los Angeles, CA  90064
    (p) 310-235-2745, ext. 408
    (f) 310-943-1600

  • What kind of processing does "export" do?  (i.e., why the huge size reduction of the .mov?)

    I have a .mov video I imported into imovie 11.  All I did was add a title bar at the beginning.  The original video size was 2.35GB.  The exported .mov is 985MB.  Why the size reduction?  What processing happens on export?  Does it affect quality.  It was originally 1080p, 24 fps, .mov file from my video camera.

    iMovie converted your file to a "more compressed" codec on export.  Most likely when iMovie imported your video file, it converted your video file to AIC, a native codec that iMovie works with comfortably on high definition video (before importing into iMovie, your video file could be also quite small).  AIC file takes a lot of space.  Exported video files are for viewing, not for editing, so by default iMovie compresses the file to reduce the size.  In fact you can change the default settings on export in iMovie (in menu "Share", "Export using Quicktime...").
    Yes it affects quality, but usually you won't notice the difference.  It depends on your viewing facility.  Unless you have a high-end projector with 150' high-end screen, or a great video card with Eizo monitor, don't bother.  In any case, you can always adjust the iMovie export settings to satisfy your eyes.

Maybe you are looking for

  • ITunes won't work, please help

    Hello Apple Discussions. I've been having trouble with my iTunes account. Every time I try to open the program it tells me that an error has occurred and has to close. I've been reading through what other people have tried to get around this problem,

  • Upconverting Receiver?

    Hello, I seem to be confusing myself with a home theater set up. I recently bought a Samsung 46" (LN46B640 - I don't believe this model runs 5.1 surround via optical) and I am trying to understand what I need to put together a decent home theater sys

  • Closed last Monday....all moved in!!!

    After three years of working hard, cleaning up report, being responsible with spending, on time payments, and a little bit of patience, I just closed on my first house. Conventional mortgage with a good interest rate and a fast closing.  The first we

  • Solaris Cluter 3.2 for SAP

    Hello All, My SAP production environment needs to be running under Solaris Cluster 3.2. I am thinking of T5440 servers - 2 in number and StorageTek 6140. The agents available for SAP on Solaris Cluster 3.2 are: Sun Cluster HA for SAP (failover or sca

  • Oracle 9i(9.2.0.5.0) - Oracle Text Upgrade

    I am using Oracle 9i(9.2.0.5.0) database with Oracle text 9.2.0 (if this is the default version installed with this version of the DB - I am not an DBA so I was not able to check it so far). I need to extend the file types support for MS Office 2003