Total control over component placement?

Hi,
I've been messing around for a while with applets and got to something quite decent i think, it's a paint program that mimics the program "paint" from windows, without a few of the more advanced functions.
Anyways, i wanted to make myself a small program to help me code on some other programming projects, it's a simple program where you pick a file to write to and it writes in a certain format. But i've been trying to get full control over where i place my components, and no matter what i use (setBounds, setLocation, setSize) they just seem to be drawn one after the other and placed "randomly".
I made a frame and a content panel wich i used setContentPane on, but i still can't place my elements like i want to...
Can someone point me to a site that explains the whole layout system, or just explain to me how i need to set up my window frame + panel so that i can freely move components on it?

Here is the tutorial for using LayoutManagers:
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
You generally shouldn't try to set the position and size of components manually. It's usually much better to use a LayoutManager. If you really need to, here's how:
http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html
But bear in mind what is said here:
"Although it's possible to do without a layout manager, you should use a layout manager if at all possible. A layout manager makes it easier to adjust to look-and-feel-dependent component appearances, to different font sizes, to a container's changing size, and to different locales. Layout managers also can be reused easily by other containers as well as other programs.
If a container holds components whose size isn't affected by the container's size or by font and look-and-feel and language changes, then absolute positioning might make sense. Desktop panes, which contain internal frames, are in this category. The size and position of internal frames doesn't depend directly on the desktop pane's size. The programmer determines the initial size and placement of internal frames within the desktop pane, and then the user can move or resize the frames. A layout manager is unnecessary in this situation.
Another situation in which absolute positioning might make sense is that of a custom container that performs size and position calculations that are particular to the container, and perhaps require knowledge of the container's specialized state. This is the situation with split panes. "

Similar Messages

  • Want total control over the size of a button

    What do I do if I want to control the size of a button completely and not let something else do it for me automatically? What layoutmanagers allow me to completely control the size and which do not?

    For total control over the button size, call container.setLayoutManager(null). This, however, disables all automatic layout; not only will you have control over the size of your button, you'll have control over its position and the size and position of all other components in that container. You'll also have the responsibility to set them.
    While this is desirable in some circumstances, you normally want to use a LayoutManager. These managers allow your code to be modified with greater ease and handle a lot of the work for you.
    You can always call jbutton.setPreferredSize(new Dimension(x,y));[b] to attempt to communicate to the LayoutManager the size that you would like the button to be. [b]jbutton.setMinimumSize and jbutton.setMaximumSize are also useful. (These calls assume the existence of a field jbutton which contains an instance of the class JButton.)
    These, however, only work if the LayoutManager honors your requests; it is quite possible for a LayoutManager to ignore your sizing requests on the objects it is laying out. Most of the managers that Sun provides respect the requests their users make, but many third-party LayoutManagers aren't capable of doing so for one reason or another.
    Yet another solution is to write your own LayoutManager. The interface is relatively simple. I personally have been working on a project in which a workspace allows users to move components around. Because of this, the component has to stay where the user put it, although its size should be adjusted according to its needs. I had to write my own LayoutManager for this because none of those that Sun provided properly suited my needs.
    Which way would you like to tackle this?

  • Step by step Create a Desktop Administrator to have full and total control over desktops only

    I have been trying to setup a Desktop Admin so that the group has full and total control over all desktops. I am using SCCM 2012 SP1. I have found very little documentation that explains in detail on how to set this up. I have read about role based access,
    but found nothing that explains in detail how to setup an administrator that can do everything but only with desktop machines, not servers.

    Hi John and Matthew,
    Great link John, thank you for that.  I did follow the instructions to a "T", but the Desktop Admin is still having problems.  He is trying to image a new machine (so it is not in the collection yet). When he tries to import it by using the "Import
    Computer Information Wizard", he gets to the "Choose Target Collection" tab, selects the "Browse" button, but cannot see any collections.  I have verified (using the instructions that Matthew provided - thank you) that he is a "Full Administrator" for
    the Desktop collections and folders where they are located.
    Could you please tell me what I am missing?
    Ken

  • How do you take total control over serialization???

    Please read this whole post before answering because Ive asked this question twice and people keep telling me things I already know.
    ok I posted this b4 and people dont seem to get it so Ill explain everything i know about serialization. To serialize an object you call the writeObject(Object o) from the ObjectOutputStream class. The Object must inherit Serializable (an empty interface). I read in a java book I have that if you put a method with the signature: "private void writeObject(ObjectOutputStream out) throws IOException" into your Serializable class, ObjectOutputStream will call this instead of using its default serialization method. However, when I did this, I started by making my writeObject method empty. Even with it empty I got errors about fields in my class not being Serializable. According to the book however, it should be trying to Serialize them right? So Im guessing that its doing both the default Serialization process and my method (or maybe not even my method). Can someone please tell me how to do this correctly??

    idk I didnt implements externalizable because I dont wanna complicate this nemore I just wanna find out why it wont work. I cant post my code because its huge. But basically, I have a JTabbedPane subclass with a Vector of SetPanes in it. SetPane has a field parent which is of type Experiment (the tabbedpane). When I try to Serialize the Experiment, I first got errors because I had JMenu's in my SetPane. to fix this I tried a custom serialization. didnt work. So then I did wat you said, called the function directly. that worked as far as I know (except I had to lose the parent field cause it was recursive). It worked until I had to deserialize it. There is no way to "call the function directly" when your deserializing so I got totally lost. Thats why Im trying to figure out how to use custom serialization the way my book tells me but it wont work!!!

  • MacBook Pro: I have no control of my trackpad, it's jumping all over the place ???

    Pointer began moving around on it's own. I have no control over it and it makes my MBP useless. I haven't added anything new, help??

    Check to be sure it is clean.
    Look hard at your MacBook. Is the battery bulging? This puts pressure underneath the trackpad, and can cause it to malfunction.
    Do you have a mouse plugged in as well? The mac will combine inputs from trackpad and mouse, so an additional mouse may make the cursor go all over the place.

  • My cursor is moving all over the place like someone else is controlling it, it has gone thru my mail and deleted everything. Sometimes it works ok, what should I look at?

    My cursor is moving all over the place and it is almost acting like someone else is controlling the track pad. When I was opening and deleting mail this morning and I stopped on an email I wanted to read it went ahead and deleted it and all the others that hadn't been opened yet.What should I look at to fix this problem, I already tookk it to a computer repair that couldn't find a virus of any sort. And, it sometimes works fine.

    Kacia
    Have you tried adjusting the tracking and scrolling speeds for the trackpad? You can find that in Sys Preferences.
    You may also want to reset the PRAM. To do this shutdown the machine. Hold down with your left hand the option and command keys, power the machine on and immediately with your right hand hold down the P key with your little finger and the R key with your index finger, so you have the option+command keys and the P and R keys held down, wait until you hear the Apple chime twice then release all keys, let the machine boot up. Try this and see if it helps. If you contiune to have this issue I would suggest taking it to the Apple store ASAP and have a Genius remedy this issue. Hope this may help.
    Joseph

  • Suddenly: "F12" opens Dashboard, NO vol control, but low background noice; multiple instances of items in dropdown menus; "frames" appearing all over the place.  Corrupt OS, HD failing, or virus??? 10.5.8 OS MacBook.  Thank you, all!!!

    a couple of weeks ago, suddenly:
    "F12" now opens Dashboard, NO vol control, but low background noice sounds like a radio broadcast yet it's hardly audible; F10, F11, F12 not responding as Volume control keys;
    multiple instances of items in dropdown menus in Safari and Mail;
    black "frames" appearing all over the place in Safari and Mail.
    corrupt OS, HD failing, or virus???
    10.5.8 OS MacBook. 
    Thank you, all!!!

    black frames showing up on the desktop, too; like when Mail minimizes to the Dock, a black frame shows up outlining where Mail was on the desktop ...
    has anyone ever seen anything like this ... ever ???
    Thank you, all.

  • Re: More control over html tags needed

    I have trying for a while to find an elegant solution to printing reports in such a way as to have headers and footers repeated on every printed page.
    <BR><BR><BR>
    The two main solutions seem to be either using PDF (using FOP) or controlling the size of the regions anually (by hardcoding heights etc.). I am confident that with more control over the html tags (or the ability to place my own) around certain areas the problem could be solved very simply with CSS.
    <BR><BR><BR>
    What I would like is a way to change the way that Apex treats table headers.
    <BR><BR><BR>
    Presently it places the headers within a tbody tag and the uses th for every column. Ideally I would like to see this changes from tbody to thead. Given that the chances of this happening in the near future are minimal (not something that I am upset about as it would not be logical to change such things every time someone wants things to suite them better), I would like to be able to place a tag either before or after the tbody tag.
    <BR><BR><BR>
    Something like:
    <BR><BR><BR>
    div id="tableheaders"
    <BR><BR><BR>
    If anyone knows how to do this your help will be greatly appreciated. Given that, printing repeated headings can be controlled relatively simply.

    Hello Andrew,
    I believe the following might be of help - placing <thead> and </thead> around headers
    Regards,
    Arie.

  • My mouse keeps jumping all over the place and i dont know why!

    My trackpad doesnt allow me to fully control the mouse on the screen! it keeps jumping all over the place and i dont knw why! i updated my computer yesterday and it was working fine but by the end of the night it started to not function properly again.                   

    A fairly well known flaw that occurs to some trackpads. See here: http://support.apple.com/kb/TS1449

  • It is a suggestion on Adobe Dreamweaver:  Could you change the setting of the page or template; to a free platform?  example; move: images, tables and other elements all over the place covering the page. in order to facilitate the user in the design envir

    It is a suggestion on Adobe Dreamweaver:
    Could you change the setting of the page or template; to a free platform?
    example; move: images, tables and other elements all over the place covering the page. in order to facilitate the user in the design environment.
    free
    Thank you for your attention

    Adobe has been trying this and the product is called Muse ( Web design software | Download free Adobe Muse CC trial ).  It doesn't give you the control over the code that most developers prefer but it could help bridge the gap for design if that is what you are looking for.

  • Better control of the placement of the copyright notice in exported image

    When exporting from Lightroom and enabling the copyright overlay, the placement of the copyright notice depends on the original orientation of the camera, making it possible to end up in the top right of the image. I would like it to always end up in the same corner of the actual exported image. Also, some control over the font and color would be nice!

    Is sort of annoying. Not sure if it can be changed. I known when I download movies and put them in iTunes it tries to sync and I wait for it to try and I click the little X in the status window to stop it. Reason being, I want to first add the Artwork and set some other tags. Then I go hit the manual sync button.
    I agree it is a bit of a pain.

  • How to get more control over DVR recordings

    Looking for some advice on how to make sure the DVR records (and keeps) the episodes I want.  
    An example:
    I want to record a series that is still producing new episodes, but is also in repeats in syndication.  For example, Big Bang Theory.  This has new episodes each week on CBS, but has about twenty or so repeats each day on TBS.
    Due to the high number of repeats, any new episodes pretty quickly get overwritten by the repeats.  So is there a way to record both first-run and repeat episodes, but prevent the first-runs from getting overwritten before I can watch them?

    GRubinstein1 wrote:
    I have no idea if the format has recently been changed or what the issue is, but when I try to get more control over my DVR recordings, I can't. What I mean by that is that I cannot alter "First-Run and Repeats" to "First-Run Only," I cannot specify the specific channel to record on, I cannot say how many episodes I want it to keep, etc. Here is a step-by-step guide of what I do and what the problem is:
    I press the "menu" button on the remote. I scroll down to DVR. I select the option of "manage series recordings." I select one of my shows. I'll use "Masters of Sex" as my example. I select "Masters of Sex." It's at this point where I get a problem. When I select "Masters of Sex," the only option I get is to cancel the series. No option to only record first-runs. No option to keep only 3 episodes instead of 5. No option to change it so it saves until I manually record it. Nothing. I've tried not selecting "Masters of Sex" and instead using the right arrow button to scrol over to the settings of the show. But nothing happens when I do that. It doesn't give me access to these options. This is incredibly frustrating because not only do the shows delete automatically at a certain point, but it records EVERY SINGLE AIRING OF EVERY SINGLE SHOW I RECORD. This means I have to go through several times a day to the "Scheduled Recordings" section and delete scheduled recordings of shows I have already seen. It's absolutely ridiculous, particularly for cable shows, which air episodes frequently throughout the week. Please help me if you can.
    Put simply, I cannot change the settings on how I record each show.
    Try the Box's Menu/customer support/tops support tools/Fix Fios TV option. (exact working may be different on your box)

  • Does anyone know how the cutout filter works and is there a way of achieving the same effect without using filters to get more control over final look?

    does anyone know how the cutout filter works and is there a way of achieving the same effect without using filters to get more control over final look?

    Several ways to get similar results.  Image > Adjustments > Posturize with low values similar to what you'd use n Cutout.  This is the most flexible way I can think of as you keep the image in RGB mode with layers intact.  A more radical approach would be to reduce bit depth using Indexed Colour.  You'll need to experiment with settings, try changing Forced to Primaries, and Matte to Foreground Color.  There's no going back from this route, although you can change the mode back to RGB to re-enable layers, adjustment layers etc.
    A nice thing about the Filter gallery filters is that you can change the layer to a Smart object with all the control that gives you.
    Now if only this forum could filter out bizarre content.

  • Music library after data recovery - ID3 tags all over the place

    Hi,
    For a short time there i was using my external drive as my music library, while i sorted enough space ot run it from C:
    However, that didn't last long and i was asked if i wanted to reformat the drive.
    Using Easeus I was able to recover the mp3s. But they're all over the place i.e songs labelled as one thing will be something else, about 70% of the time. Also some songs randomly chnage to others.
    Is there any method i can use to resolve any of this, without re-doing my entire collection?
    thanks for any suggestions
    matt

    The best option is to recover from backup, but I guess you don't have one. You can also recover from an iPod if you have one:
    http://discussions.apple.com/message.jspa?messageID=9990366#9990366
    Failing that, are you certain that the tags are wrong in the actual files, the tags are part of the file, so I am surprised if they were changed if you were able to recover the files successfully. It is hard to see how they could be messed up if the file is OK unless something else messed with them.
    I am afraid you have a lot of work ahead of you. You might be able to use a tag editor to get tags from the internet - MP3 tag is an example, but I think the tracks need to be arranged into CDs for this to work.
    There is also something called PicardTagger which is supposed to use the audio footprint of the file to identify it, but I have no experience with it myself.
    http://musicbrainz.org/doc/PicardTagger

  • HT1926 I was prompted to install iTunes 11.1.4 this morning. It failed (first time EVER) with the comment that 'msvcr80.dll' was not available. Upon searching for that .dll in my computer, I found it to be all over the place! Thoughts?

    I've NEVER had a version update fail. I did go to 'Tools' and download for a manual install of this update as the info screen suggested. It, too, failed. After searching for the 'missing' msvcr80.dll on my computer, I found it all over the place!
    Ran a malware & virus scan with nothing evil popping up.
    Tried going back to a restore point before a previous update and doing the install. It failed.
    OS: Vista Home Premium x64, SP2 (and current with all MS updates)
    Now I'm pretty nervous re: syncing with ANYTHING-especially my iPod that has all my music I teach from at work.

    Solving the iTunes Installation Problems in Windows
    1. Apple has posted their solution here: iTunes 11.1.4 for Windows- Unable to install or open - MSVCR80 issue.
    2. If the Apple article does not fully resolve the problem for you, then try Troubleshooting issues with iTunes for Windows updates - MSVCR80.

Maybe you are looking for