Defining non-Component objects with size and location using Swing

I am attempting to write a program which will be able to manipulate (display, move, resize) objects in a Swing window which are not necessarily components. These "Window"s are defined by a Window interface which defines a Window as any object which has a size and a location (effectively a rectangular area). This would ideally allow me to perform operations such as drawing an arbitrary picture on a Jpanel, for example, wrap that drawing in a rectangular area, and then be able to resize it/move it about as a separate panel. In order to do this I believe I would have to override the paint() method, although I'm not completely sure. If anyone has any suggestions of a proper way to override the method or know a proper way to attack this problem, I would greatly appreciate it.
Thanks,
Adrian

It's hard to say since it's not quite clear what you're doing but:
1) if these objects are not necessarily components, that's fine, but you're not trying to add them to the basic GUI framework, are you? If you want to do something like this, then probably the best thing is to have a particular component that knows how to handle these objects, and then have a clean separation between components and non-components at that level. So this component would maintain and display a collection of those non-component objects, but no other component would be expected to know anything about them, and the non-component objects wouldn't know about any components at all.
2) it might be helpful to give all the non-component objects a method that looks like this:
void drawSelf(Graphics g);and that this method would tell the object to draw itself on that Graphics object. The object might also have an "offset" value, essentially an x,y position, and it would draw itself relative to that position.

Similar Messages

  • Set size and location of  a component

    Hello,
    Does anyone familiar with this org.netbeans.lib.awtexttra.AbsoluteConstraints(). I want to set the size and location of the component, and I know this org netbeans can provide this function.
    getContentPane().add(chkTausta, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, -1, -1));
    chkRakkennus.setSelected(true);
    chkRakkennus.setText("Rakennukset");
    then it comes an error that org.netbeans.lib.awtextra.AbsoluteConstraints()cannot be resolved. Does anyone know what�s the reason. Do I have to download other version of Java. I have Jre1.6.0?
    Does anybody knows is there another way to set size of component. For example, if I use borderlayout, and put a button to the west, then how can I set the location and size of the button?
    Thanks a lot for you help.
    Clare

    org.netbeans.lib.awtextra.AbsoluteConstraints isn't part of the JDK. I suggest you don't use that at all. Let a LayoutManager do the resizing.
    Have a look at the [Layout tutorial|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html] especially gridBagLayout

  • Finder window size and location not remembered

    I have OS X 10.10 installed.
    When I press Cmd/shift/H to open a finder window showing my home folder I get the default location and size for the window.  I resize and relocated the window and close it.  When I press that key combination again, the window is now showing the new size and location I previous set.  Unfortunately, when I restart the computer, this modification is lost and when I press that key combination the window opens with the default size and location.
    I have used the key combination of Cmd/Shift/A to open a finder window showing Applications and Cmd/Shift/U to open a finder window showing the Utilities folder.  I have been successful in resizing and relocating these windows, and having the system remember my modifications after a restart.  It appears to only be the Cmd/Shift/H combination that is faulty.
    Any ideas how to fix this problem?

    Paddster7,
    You could try trashing the hidden file inside the folder that stores some of its positioning and size settings.
    To show your hidden files.
    Launch ( Terminal ) -> Paste in the following ( defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder ) -> Press Return.
    Open the ( Offending Folder ) -> Delete ( .DS_Store ) -> Restart -> Move folder how you want to to stay -> Restart -> Did it stay?
    To reverse your hidden files back to hidden.
    Launch ( Terminal ) -> Paste in the following ( defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder ) -> Press Return.
    Supporting Articles
    http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/
    http://en.wikipedia.org/wiki/.DS_Store
    Hope that helps,
    Weston

  • What Preferences Control Window Size and Location?

    I have a number of windows that over time have taken on weird sizes and locations. For example, a print window habitually shows up with the print button underneath the dock, forcing me to move the window to click on the options.
    Is there a preference I can trash--or anything else I can do--to return the sizes and locations of windows to something resembling normal?

    That's done by each individual application.
    Many will remember where the window last was, and re-open it in the same place & size.
    Find the preference file for the app in question (probably in <your home folder>/Library/Preferences folder), quit the app, rename the file (append "old") to the end, and start the app again.
    The window should open in a default location; move/and or resize it, close the app and open it again. If that fixes the problem, trash the "old" file and re-enter any other preferences.
    If it doesn't fix it, you've probably got the wrong file. Close the app. If there's a new version of the file you renamed, delete it. Remove the "old" from the previous one.

  • Camera Raw cache size and location

    I've been using ACR for about 3 years now, and today it occurred to me that I'm not that sure I know what the cache is actually used for. I mean, I know what a cache is, but what is ACR caching, and why?
    I use Bridge for most of my photo work, displaying high quality thumbnails and previews, often full-screen ("monitor-sized previews" by default). Bridge has its own cache, which I understand contains jpegs of thumbnails, previews, and 100% views. Does ACR's cache have any bearing on Bridge's behaviour and performance, especially with thousands of raw images?
    What sort of size and location of ACR cache should I be using - what factors do I need to consider?

    Hi,
    I'm still not sure what size of cache I should use, and what are the advantages and disadvantages of bigger or smaller ACR caches.
    Maybe Eric can tell something indeep about the impact of a large cache.  I'm not sure about that myself, but don't believe a larger cache is a real disadvantage, as long the disk on which it reside is maintained: defrag often). Since Bridge and ACR work hand in hand here, it might depend to your workflow and to your hardware. Sorry, I can't give a clear answer here.
    As said I would put it just large enough for a certain number of RAW or some weeks work. Means, when there is a chance I'ld touch a certain RAW in six weeks again, than six weeks * x images per day I shoot.
    Not sure if you are a Pro. I'm not and usually have not much new images every month.  I always was fine with the default settings.
    I don't work with Bridge and open one RAW after another in ACR, or maybe 20+ in a row when doing panorama ;-)
    But Bridge has to do a lot of work on the fly when it generates the previews for all new RAW in a folder, like: "read the image from HDD", "process it by ACR, "write Bridge previews and metadata to HDD", "write to ACR cache " - not necessarily in this order.
    And it seems it does this and some additional steps always (not only when first time reading RAW), because it f.e. needs to check if there are already processing information in ACR database or XMP file for a RAW or if they have been created in "meantime". Means ACR settings could have be changed after Bridge did a first time generation of the cache data, maybe because the RAW was openene directly via PS or by another app.
    this process is fairly processor-dependent, especially now that ACR uses more sophisticated processing in version 6, and, depending on ACR defaults, this can be significantly slower than in previous versions.
    And Bridges eats huge amount of memory as well - seems it holds a lot of information in memory before flushing it to disk.
    After reading this post of yours I made a test with my 12k RAW the other day. I tried to let Bridge create previews for all of them in one step, but it ended up complaining that there is not enough memory after ~ half an hour.
    Bridge appears to generate previews unnecessarily sometimes, because every image is already cached.
    See above. Bridge/ACR checks for updated processing information in XMP or ACR database and metadata updates. If it find some it might need to rebuild its cached image.
    Why would I need to reset the cache with a new monitor profile? Surely this is not applied to cache JPEGs?
    You are right, sorry I mixed things up here :-(  I meant ACR camera profiles. Aside that I changed monitor profile a lot over the last weeks doing some tests, and after that Bridge often refused to start until the cache was purged…
    Your suggestion of a larger cluster size is very interesting, and I may try this when I have some spare time.
    All my disks meant for storing large files (images, music, scratch, temp-file) are formated with a larger cluster size. It speeds things up a bit.
    Supposedly Lightroom's catalogue system is superior, but I am yet to be convinced that putting all my XMP data in one basket is a good idea.
    Of course LR shares ACR's cache. I don't know much about LR, but I believe XMP are not only kept in one basket here, right? They are written to the images and in case of RAW to XMP files. Otherwise there wouldn't be an interoperability between LR and Bridge. Similar to Bridge LR stores previews in it own "cache" which is as well a folder and file based "database". Check "preferences".
    But as said I use another DAM, in which’s database all data needed for searching is kept, but I also write all metadata (IPTC,XMP) to the images, even for RAW files. By this I don't need a large ACR cache and also don't have XMP files around, which I hate. When saying database, I mean a real database, not a collection of files which are kept on disk. ;-)
    Aside other advantages, I can take my database with me on vacations and can work on my images like I do at home. I have all my keywords and categories with me in one file and when back, I just copy the database to my desktop.

  • Use JFreeChart or Component object with RMI

    I am trying to pass a JFreeChart object or a java.awt.Component object from a server to a client. I thought RMI would be the solution, but I get a "java.lang.NoClassDefFoundError: org/jfree/chart/JFreeChart" error when trying to run the server. I believe the problem is that the JFreeChart is not an Interface and so can not be used in a Remote Invocation. So, the problem would be the same with a Component Object.
    JFreeChart and Component are Serializable object, so I thought there may be a way to remotely use them or pass and recreate them from a server to a client.
    Does someone can help me here to figure out what I could do?

    sure you can pass instances through RMI, but that doesn't prevent you from needing the required jars for the product on both client and server.
    So make sure both client and server have the jfree jars installed in the classpath of their applications when you run the application.

  • Default size and location, dialog boxes

    how can I set default size and location of dialog boxes? I have tried several things to no avail,
    thanks in advance

    1. You could create your own subclass of Dialog/JDialog with your defaults set automatically
    2. You could create a DialogFactory that creates Dialogs (pretty much the same as 1)

  • Opening Multiple Folders (Sizes and Locations)

    In selecting multiple folders and opening them all, is there a setting available or something a person manually does to when you open the folders they all open with the same size window and/or pattern? When I open multiple folders up they open up in random sizes and locations on my desktop.

    There's no built in way of doing what you want. You might give Default Folder X a try.  I've not used it so don't know if it will do what you want.  You may have to write an Applescript to do what you want.

  • Weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Cannot export non clusterable object with jndiName ]

    Hi,
    I am trying to deploy an EJB module have 4-5 EJB's on weblogic 8.1 through JBuilder.
    I am getting following error during deployment.
    Exception:weblogic.management.ApplicationException: prepare failed for Sample.jar
         Module: Sample.jar     Error: Exception preparing module: EJBModule(Sample.jar,status=NEW)
    Unable to deploy EJB: SampleBean from Sample.jar:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Cannot export non
    clusterable object with jndiName ]
         at weblogic.utils.Debug.assertion(Debug.java:57)
         at weblogic.rmi.extensions.server.ServerHelper.exportObject(ServerHelper.java:272)
         at weblogic.ejb20.internal.BaseEJBHome.setup(BaseEJBHome.java:95)
         at weblogic.ejb20.internal.StatelessEJBHome.setup(StatelessEJBHome.java:67)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.prepare(ClientDrivenBeanInfoImpl.java:979)
         at weblogic.ejb20.deployer.EJBDeployer.setupBeanInfos(EJBDeployer.java:983)
         at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1283)
         at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:477)
         at weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:2962)
         at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1534)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1188)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031)
         at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2602)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2552)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2474)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Any clue?, what its talking about?
    Thanks
    Naresh

    Hi,
    I am trying to deploy an EJB module have 4-5 EJB's on weblogic 8.1 through JBuilder.
    I am getting following error during deployment.
    Exception:weblogic.management.ApplicationException: prepare failed for Sample.jar
         Module: Sample.jar     Error: Exception preparing module: EJBModule(Sample.jar,status=NEW)
    Unable to deploy EJB: SampleBean from Sample.jar:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Cannot export non
    clusterable object with jndiName ]
         at weblogic.utils.Debug.assertion(Debug.java:57)
         at weblogic.rmi.extensions.server.ServerHelper.exportObject(ServerHelper.java:272)
         at weblogic.ejb20.internal.BaseEJBHome.setup(BaseEJBHome.java:95)
         at weblogic.ejb20.internal.StatelessEJBHome.setup(StatelessEJBHome.java:67)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.prepare(ClientDrivenBeanInfoImpl.java:979)
         at weblogic.ejb20.deployer.EJBDeployer.setupBeanInfos(EJBDeployer.java:983)
         at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1283)
         at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:477)
         at weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:2962)
         at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1534)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1188)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031)
         at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2602)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2552)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2474)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Any clue?, what its talking about?
    Thanks
    Naresh

  • Tutorial on using a non-database object with ADF?

    I'm just starting with ADF and could use some advice. I'm making my way through the first ADF 11g tutorial ("Developing Rich Web Applications with Oracle ADF") and just want to make sure I'm headed in the right direction.
    While the tutorial is an excellent step-by-step explanation of how to bind database information to forms, I'm trying to figure out how to create an ADF web page that gets its fields created from an object (e.g. Java POJO). Is there a tutorial on this (Java object vs database object form creation)?
    Thanks

    Hi,
    See if the below link helps:
    http://technology.amis.nl/blog/3802/adf-11g-model-driven-display-properties-in-pojo-based-data-controls
    Sireesha

  • Remember size and location when opening saved document (CS5)

    Greetings,
    It would be nice to have a preference to remember screen rendered document size and location when saved, then the document opens at the last used size and location; I now reposition and resize every time I open my documents, which is often.
    Perhaps this feature has not been forgotten or omitted, maybe I just haven't found it yet?
    Garrett

    "I now reposition and resize every time I open my documents, which is often."
    Yeah, you said it... Which means that 100 times a day I curse Adobe for not including such a basic, fundamental capability.
    It's hard to believe that they do any testing by real users at all... How could they have missed this? And why haven't they immediately fixed it in a point update?

  • I had a gift card with money and I used it on iTunes now there isnt any money...

    I had a gift card with money and I used it on iTunes now there isnt any money how to i change my payment back to none? When I try downloading any app it say "Please enter password to review billing information" I want to change it back to "none"

    Sign into your account through the iTunes app and look for a None option in the Payment Method section.

  • I had an iphone 4s and it worked nice with facetime and imessage using my phone number but  it was stolen on December so I buy a new iphone 4s using the same cellphone number  but now imessage and facetime does not work with my number, it only works with

    I had an iphone 4s and it worked nice with facetime and imessage using my phone number but  it was stolen on December so I buy a new iphone 4s using the same cellphone number  but now imessage and facetime does not work with my number, it only works with my apple ID.   Please Help me I speak Spanish so  if my English is not ok  I´m sorry about it.
    Do you think that apple has to   reset in their database of the old serial number attached with my phone number and that’s why I can´t activate imessage and facetime with my number in the new iphone 4s?? 

    I understand all of this Meg; that is why I bought an Iphone; but never expected my phone not even give a at least a 24 or even 12 hours....I work 12 hour shifts and also would expect to have to charge each night but not twice a day or more.  I am not always somewhere I can charge my phone.
    Your points are true; however it doesn't help me......

  • How to send Email with Cc and Bcc using MailPackage

    Hi ,
    we are using Mail Package to send the Email using Mail Adapter.We have a requirement where we need to send Email with Cc and Bcc using Mail Package .
    Can we send Cc and Bcc using Mail Package ?
    Thanks
    Rajesh .

    HI Rajesh,
    There is a standard structure for Receiver Mail adopter which we can get from SAP market Place but it is not provided with CC if u want to use CC then you have to go with Dynamic Configuration.
    DynamicConfiguration configuration = (DynamicConfiguration) container.getTransformationParameters().getStreamTransformationConstants.DYNAMIC_CONFIGURATION);
    /*any other required fields*/
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "THeaderCC");
    configuration.put(key, "ccemail @ test.com");
    Regards
    Praveen Reddy
    Edited by: Maareddy Praveen Reddy on Aug 10, 2011 12:17 PM

  • How do I non-destructively sharpen, re-size and save my images if I'm using both LR & CS6?

    Hi guys {and gals}... 
    Ok... here is my dilemma. I am having an incredibly difficult time understanding the best way to sharpen, re-size and save my images for both posting on the web and giving them to clients. I completed my first paid photo shoot (yay!), but as I finished editing each image, I re-sized it and posted it on my FB photography page. I later learned from a fellow at my local print shop that this is a destructive and irreversible edit (not yay! ).
    So...  before I pull out every last strand of hair on my head, I REAALLLYYYY need to get a good grasp on how to do the following things so that I can establish a good workflow: 1. Sharpen my image well {w/ Smart Sharpen}. Does this have to be done on a flattened image... and isn't flattening irreversible?  2. Re-sizing my images for both web display and client work/printing. Is it true that once I set it to 72ppi for web display, that I lose a great deal of the detail and quality? Do I need to create a copy of the file and have 2 different image sizes?
    I am self taught, learning off the cuff through tutorials and constant error... and I just want so badly to have a smooth and beneficial work flow in place.
    Currently, my workflow is as follows...  1. Load images into LR and convert to DNG files  2. Quick initial edit & then send into PS CS6  3. Perform detailed/layered edit(s)  4. {I know I'm supposed to sharpen now, as the last step, but am afraid to permanently flatten my image in case I want to tweak the layers later..}  5. Save the file (unflattened)  6. Go back into LR and Export the file to the appropriate place on my hard drive
    So... at this point, my image is still at 300ppi {not appropriate for web display}, unflattened {I'm told flattened images are ideal for client work and printing} and not as sharp as I want it to be {because I don't know when to apply Smart Sharpen filter}.
    HELP!!!!!!! 
    Thanks in adavnce for "listening" to me ramble...
    ~ Devon

    There are a lot smarter guys on this forum than I so will let them give you ideas on the sharpen workflow.
    Is DNG the same as RAW in that all the edits are non-destructive?  With RAW all the edits are put on a separate XMP file and believe with DNG the XMP file is written to the image.  In this case would suggest you save the DNG then create a jpg to send to clients or on web.  A jpg will not save layers so it is by its nature flattened.
    Since you are new to this try this test to understand ppi.  Click on Image/image size. 
          Change Document size to inches. 
          Now uncheck "unsample image" as if this is checked all the pixels will be modified to adjust to the new size.  Unchecked no pixels will be changed.
          Now adjust the resolution from 72 to 300 ppi (pixels per inch).  Note that the Image Size in pixels does not change, but the document size changes.  This means resolution is unchanged.
          Now click "resample image" and change the resolution.  Note how the image size changes and document size stays the same.
    Bottom line quality of picture is the image size in pixels.  THe larger the numbers the higher the quality.

Maybe you are looking for

  • Phone not working after fully charged overnight

    Typically I use my phone (3G S) all day, plug it in before I go to sleep and when I wake up, I have a freshly charged phone...Sounds normal enough, right. Well, for about 2 weeks now I try to use my phone when I wake up, and it's pretty much non-func

  • Flex 4.5.1 iOS project with AIR 2.7

    Hi, A few things. This may be a mix of builder and sdk. I read that 4.5.1 Flex Mobile automatically used AIR 2.7  .  I have not done any overlaying b/c of this but my app on the device is slow. When I click a list item or Back button, it takes like 2

  • Using Radio Buttons in queries.

    Dear Experts, I am working on some queries which has radio button option in R/3. I need to develop the same queries in BI 7.0. Do i need to develop separate queries for each radio button  or is there any other option to do ? Say for instance, i need

  • Regading purchase order number range assign & migo no.range assign

    Hi, Can any body suggest me , Where we assign number range for Purchase order after creation of number range? And also where we define number range for MIGO posting, if any objects for that then give me deatils plz. Regards, Sohail

  • How to export in mov?

    How to export in mov ? In all other I have no problems. But the export in mov stops inn the first second. I checked all, I try all video-codecs-formats, quick-time player is ok . Any ideas ?