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?

Similar Messages

  • 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

  • C7280 - Cannot scan. Error message says another program has control over the device

    I opened the HP Device Manager to do a scan. I accepted the settings and the scan started. But part way through the scan, I stopped the scan as I realized that I wanted to change the resolution. I quit the Device Manager  and restarted it but when I did, I got an error message saying:
    "The function you have requested cannot be performed because another program has control over the device".
    I don't have anything else open and so I can't work out what program has control over the printer.
    C7280 Prtinter. Mac OSX 10.7.
    This question was solved.
    View Solution.

    I was thinking that if you stopped the process in mid-scan that there may be some background processes still running. Rebooting usually stops those processes.
    No, you will not have to do this each time.  Next time, though, it may be easier to just let the scan complete and the do another scan at whatever setting you want.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Capture a user's mouse control over the player

    There is video streaming using RTP to the QuickTime viewer in a web page
    The major issue is that the z-index of the player seems to be infinite, not allowing mouse events to be captured over the top of the player
    Is there anyway to get around this? I'd like to use javascript to *capture a user's mouse control over the player if possible.*

    mgulesian, you might want to query the system properties.
    System.getProperty("user.name")Please note that this property is subject of security constraints (and there're good reasons for this, read the Java Tutorial, Trail: Essential Java Classes, Lesson: Accessing System Resources for details). For example, web applications running inside Tomcat are not allowed to query this property by default. Think twice before doing this, you have been warned!
    HTH, Markus

  • How do I split a voice memo into two so I can send it if it is over the size limit?

    I recorded several voice memos that are over the size limit for sending them from my iPhone 5 in an e-mail. Is there a way to split them into 2 smaller files?

    Is this what you're doing:
    To trim the recording click the Trim Memo button. You will see a blue progress bar with a yellow handle on the left and on the right. Drag the handles to set the start and end of the clip. Press the play button to confirm it sounds ok then press the large Trim Voice Memo to finalize your cut.
    !http://www.iclarified.com/images/tutorials/3882/14927/14927.jpg!

  • Playback control over the video live.

    I can not to see playback control over the video live.
    I have to image attachet that I do not can to see.
    can you can help me?

    There is a freeware out there http://www.download3000.com/download_5285.html

  • My podcasts download over the size it says ***? and my normal podcasts get cut off somewhere in the middle *** is this ****? someone help before i move to android

    my podcasts download over the size it says ***? and my normal podcasts get cut off somewhere in the middle *** is this ****? someone help before i move to android

    If your country's iTunes Store allows you to redownload purchased tracks, I'd delete your current copies of the dodgy tracks and try redownloading fresh copies. For instructions, see the following document:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    Otherwise, I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the items that are not playing properly. If you can't see "Report a Problem" next to the items, click the "Report a problem" button. Now click the "Report a Problem" links next to the items.

  • 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. "

  • [SOLVED] Image going over the size of my TV

    I just upgraded my TV to a 47'' panasonic SmartTV from my old LV 32'' one.
    I connect it via HDMI for video playback and xbmc use: The video card is a nVidia GT 240
    The problem I'm facing is, at 1080p @ 60Hz, the image goes over the edges of the TV, like is bigger than the tv itself, so you lose some inches from each side.
    At 720, the image looks to fit right but this is not the desired resolution.
    I use nvidia-settings in order to tweak xorg.conf, but I had to add some options by hand for the fonts to have 96dpi.
    Can anyone help me to find the solution for this?
    I have a windows partition for gaming and when I booted it up for testing i faced the same issues.....
    Thanks!!
    Last edited by Xi0N (2013-07-21 20:14:23)

    The problem is the TV itself. I have no idea why, but regular HD TVs usually cut a few pixels from each side, doing a slight zoom in. This is called overscan. You can usually disable this in the TV settings by setting the image size to "fullscreen" instead of 16/9.
    Some quick Googling gave me this article, it seems pretty detailed (I'm learning myself right now why all TVs do this).

  • I want to control how the user navigates the folio

    I am just getting started and would like some information on how to control how the user will navigate the folio. I will be using this to make a lesson for students and don't want them to be able to skip ahead for answers. Do you have any suggestions on tutorials, books or steps to keep control of how the end user navigates from page to page? I do not want the automatic swipe to work, I want to have an article, then a quiz, when the quiz is finished, then they are able to go to the next page. Make sense?
    Thanks!

    There's no official way to disable swipes. One trick we've seen some customers do is to:
    1) Enable side hotzones and set them very, very, small
    2) Enable the bottom hotzone and set it very, very, small
    3) Hide the top HUD bar (a new feature in v25)
    Then if you put a full-page overlay on the page that will generally block the swipe gestures and should get you close to what you want. But it's definitely a hack.
    Neil

  • My startup disc is full and I want to find out the size of trash and junk in mailbox before dumping trash & junk

    I have gotten this message saying that my startup disc is full.
    I know I need to dump the trash can on my home screen and I have done that.
    I know that there is both trash and junk in my mail app that I will dump also but I am curious as to the size of the trash and junk in mail but I don’t see how to find the sizes.
    Its nice that the Junk tells me that there are 739 messages but it doesn’t say what the size of all of them is.
    Do you know how i can see what the file sizes are for trash and Junk in Mail?
    I know I can just delete them and see how much this yellow bar decreases but that seems like a crude way to see what the file sizes are that I have deleted.
    If you have an answer for how to find out the file sizes of the Mail trash and junk I would like to know how to do it.
    I have the latest version 10.9.4 on my Mac Air.

    do you have the Size Column selected in the View pulldown?

  • What would be the simplest way to view and take control over the internet?

    Hi All:
    Can some one tell me what would be the best and simplest way to connect from my laptop to another laptop through the internet?
    I have DYNdns running on the second laptop and have a host name assigned to that system for it to update the IP since the system uses different internet connections. The services that I would like to be able to have are the viewing and controlling of the system. I've read some where in this NG that if I have a copy of ARD admin. installed on that system also, it would be one way to do it... can some one verify this and please let me know if there are any specific settings I need to have on either one of the systems.
    I can connect to the second laptop while in my home network with no problem and perform all tasks. when trying to connect through the internet.. the system shows offline .
    Both systems are identical in hardware an software, Intel 2.16, 2G's RAM, OS X ver 10.5.2 all up to date and ARD 3.2
    Yes, I'm new to ARD and yes I'm searching the NG and the net. but I figure it doesn't hurt to ask since time is limited.
    All help greatly appreciated ..
    TIA
    Oscar A.

    To be able to connect to a workstation from outside it's network, the ports that ARD uses must be open on both ends of the connection. ARD uses ports 3283 and 5900 so those must be open.
    If your workstations get their addresses from an NAT device rather than being "real", the ports also need to be forwarded in the router to the workstation's internal IP address. ARD uses port 3283 for the reporting and updating function, so if your Macs are getting their IP addresses through NAT, since you can only forward a port to a single workstation, you can only get reports, push package/files to etc. for a single workstation.
    ARD uses the VNC protocol for observation and control, though, and there are a range of IP addresses for that protocol, starting with 5900. ARD uses 5900 by default, so that port would be forwarded to the first workstation. You would, I believe, need to install VNC servers on the systems (since the ARD client cannot listen on any port other than 5900 while VNC servers can be set for other ports such as 5901, 5902, etc. You would then forward 5901 to the second workstation (and on to 5902, 5903, etc.). You can then use the following information:
    Remote Desktop 2: How to specify a port number for a VNC client
    to connect.
    The only other options are: 1) to run the ARD administrator on a workstation on the network, and then take control of that system from outside, either via VNC or another copy of ARD, or 2) set up a virtual private network (VPN) so that when you connect from outside, your admin system is officially part of the local network.
    Hope this helps.

  • Are there any controls over the yellow cycle bar?

    Hello to all! I wonder if there are any means [shortcuts] of getting the yellow cycle bar to be placed at any chosen point of one's track? Presently I am using the cursor to drag and place it at the desired place, and also have to tug at its ends to resize it. Having become used to FCPX's 'shortcuts' which are so easy to use, I would love to know whether there are any shortcuts to place the yellow bar where we want it [say, place the skimmer at that point and click upon the mouse!]

    "You can drag songs".  Mac 101.  That was the key.  I immediately dragged my "Bluegrass" Smart Playlist into the Up Next box and "Viola"! 
    Thanks. 

  • Remote control over the Internet?

    Hi,
    I was under the impression that there was a way to use Zenworks to
    remote
    control via the Internet.
    I'm a consultant and support several NetWare 6 installations and would
    love to be able to use Zenworks to support my clients from here.
    The only way I have seen so far is either to remote control a
    workstation
    with something like PC Anywhere and run Console One remotely.
    Did I miss something?
    Is anyone doing this? How can I do this?
    Thanks
    Willem

    you're probably thinking of ZfD4.x, where you can remote control by
    just specifying the IP address.
    Shaun Pond
    Novell Support Connection SysOp

  • Better control over the creation of thumbnails

    While i have nothing against the current method of generating thumbnails with ADDT, I feel we need better controls as to how our thumbnails are created. By all means, the current option of generating thumbnails on the fly can remain, but I feel we need a tab on the image upload behaviour that allows us the developers to determine how our thumbnails are created.
    This will mainly happen during the image upload process. For example, in order to get uniform thumbnails, a developer could decide that he wants to crop his thumbnails to a certain size so that they can look good in a gallery. This i feel will come in pretty handy for those who are using Spry to create a photo gallery. At the moment, the one way you can create thumbnails on upload is to create a custom trigger and enter the required code to be executed after the file has been uploaded.
    So this feature will be welcomed i feel by many who are not too happy with the current method of generating thumbnails.

    I agree.
    Well said Emmanuel since the ADDT thumbnails are only created when requested by the display thumbnail server behavior. So some additional flexibility would be welcome. For example, when you do not wish to use the server behavior. Till then, we just have to use a custom trigger and to some ADDT users, thats advanced stuff.
    Cheers.

Maybe you are looking for

  • Using scanjet2400 with windows 8.1 64 bit os

    I was using HP Scanjet 2400 with my desktop with os wnxp. Recenctly I bought a new desktop with os of window 8.1 64 bit. After installation and configuring , I find the system is not recognising the scanner and instead it is displaying some new nomen

  • How can I customize Navigator in JClient

    I want to customize the navigator in a form in JClient so that I can use Insert button and a new row will be insert at the end of a table so I can add data. Can you show me the way???

  • Ora-00257:Archive error

    Hello Everyone, ORA-00257: archiver error. Connect internal only, until freed. My Question is why oracle is not allowing to connect as normal database user like Scott during archive log is full, as i know archive log is generate during ddl/dml statem

  • Using a repeater in a custom FileInfo Panel --data binding error

    When I developed a custom FileInfo panel in Flex Builder 3, I could use an array to populate a checkBox control inside a repeater, and it worked. Now, using Flash Builder 4, data binding with <mx:Repeater> doesn't seem to work, resulting in an empty

  • Why isn't my screen turning sideways on the iPhone 4s.

    Why isn't my screen rotating horizontally? The portrait lock is not on and I have even turned it off and on. It still doesn't work. I have also turned my phone off and tried it. I know that the app supports it because it has since I have bought it. T