Stop JPanel auto positioning and resizing in Netbeans

Hi,
I'm working on a Swing application in Netbeans. In my program I had several JPanels. At any one time, only one JPanel is visible.
I dragged my JPanels to the JFrame in the Swing editor. Each time the user clicks on the switch function button, another JPanel should be displayed.
However, the new panel does not display correctly. It remained at the position where I had dragged (randomly) on Netbeans, instead of the new size and location I set it to prior to setting it visible. I tried to tinker with it, and realized that Netbeans helped me reposition my JPanel back to its original position. For my function to work, I suspect I should disable auto positioning and resizing.
How do I turn it off?
Thanks in advance,
eddy05

eddy05 wrote:
That's what the JComponent.setSize() and JComponent.setLocation() do right, to resize and relocate JComponents and its subclasses.This only sets the properties of that particular JComponent. The layout manager of the container that holds it can choose to use these properties or not depending on what layout manager is being used.
I wanted to perform the above functions, but Netbeans' behaviour keeps interfering, hence my request on how the behaviour can be turned off =)By dropping a JPanel into your JFrame (the JFrame's contentPane actually), NetBeans is by default going to use the GroupLayout, and the properties of the JComponent noted above will be ignored. One solution alluded to above is to have the JFrame's contentPane use a null layout, but while this might work in the short run, in the long run it will hurt you. Better is to read up on the various layout managers available for your use in the Sun Swing tutorials and start to play with them in your code.

Similar Messages

  • What is the best way to move and resize layers?

    When I click on a layer to move and resize it in Elements 8 in Windows 7, it disappears.  After I go to Edit/Undo, it reappears.  What should I do?

    I have PSEv.8 and Windows 7, and the Editor works like a charm for me.
    Try the following:
    Open picture 1, duplicate the background layer.
    Open picture 2, make a selection of something in the picture with one of the selection tools, and then go to Edit>copy. This puts the selection on the clipboard.
    Go back to to picture 1, go to Edit>paste, and the selection will be on its own layer
    Use the move tool to position and resize the selection.
    The middle layer can be dragged to the top. Here, this process will obscure visibility of Layer 1, but you can drag the layer structure back, of course.
    http://www.pixentral.com/show.php?picture=1D3wrzjD5r24U8LfdTA1sdUb0zJOY0
    I opened a picture of the house on the lake, copied/pasted the "Slick Rock Divide" sign as per above. The layer structure is represented in the print screen.
    You should note that it is best if the resolution of the picture files is the same, or close to it.

  • Use of Java Swing +Applescript to move and resize Mac OS X windows using

    Here is an interesting use of Java on Mac OS X and Applescript to
    enable moving and resizing of windows using mouse and keyboard:
    [MoveResize tool|http://code.google.com/p/sandipchitalesmacosxstuff/#Move_and_resize_windows_on_Mac_OS_X]
    How it works:
    The implementation uses Applescript to get the front most window and
    it's bounds. It sends the bounds rectangle to a server implemented in
    Java over a socket connection. The Java server takes the screen shot
    of the full Desktop and uses it as the Image label (a JLabel with
    ImageIcon) as the content pane of an undecorated JFrame which has the
    same bounds as the Desktop. A JPanel with semitransparent background
    and a dark rounded rectangular border is given the same bounds that
    were received over the socket. This JPanel is added to the
    PALETTE_LAYER of the JFrame's layered pane - which makes it appear
    floating in front of the front window. A Mouse and a Key listener
    added to the JPanel allow moving and resizing of the JPanel. When the
    user types the ENTER key the JFrame is hidden and the new bounds of
    the JPanel are sent back to the Applescript over the socket connection
    which moves and resizes the front most window.
    Enjoy!
    Sandip
    Edited by: chitale on May 14, 2009 4:12 AM

    Copy the /Home/Documents/ folder to the NAS drive. That drive needs to support AFP or you may run into filename problems and/or other file related problems due to filesystem differences.
    Once the folder has been moved to the NAS select the folder on the NAS and CTRL- or RIGHT-click. Select Make Alias from the drop down menu. You should now have an alias named "Documents alias." On the Mac put the /Home/Documents/ folder in the Trash but don't delete it. Copy the alias file from the NAS to the /Home/ folder. Rename it to simply "Documents." Double-click on it to be sure it opens the folder on the NAS. If so you can empty the Trash. You're done.

  • Flah Player Screen Position and Size Restrictions

    Hi All,
    I'm creating an interactive program which is to be used on
    Windows desktops through flash player rather than as a projector or
    html page. My problem is screen positioning and
    resize-restrictions.
    I want to be able to restrict the user from resizing the
    flash player; the stage size is currently set to 800x600 and I want
    to keep it that way on the desktop as I'm using photographs which
    when the player is resized is leaving blank bars down the sides
    (due to the photographs being 800x600).
    I'd also like to be able to position the flash player in the
    top-left hand corner of the screen.
    I'm not great at flash and have tried numerous things but
    can't get these to work, can anybody help?
    Regards,

    Hi
    This is possible, if you make your Flash file into a
    Projector file and
    bring it into Jugglor
    http://www.jugglor.com
    Download a FREE evaluation copy and look at
    Jugglor -> Setting Settings -> Windows Settings
    Here you have the restrictions as you require.
    Hope this helps.
    Regards
    FlashJester Support Team
    e. - [email protected]
    w. -
    http://www.flashjester.com
    There is a very fine line between "hobby" and
    "mental illness."

  • How can I disable the auto resizing in NetBeans?

    Hello,
    how can I disable the auto resizing in NetBeans?
    I cannot resize nor displace components due to this automation.

    first what do u mean by auto resizing ? if u mean the layout that automatically aligns itself then ..... if that's yr question then u need to set the layout to null
    if using netbeans then right click on the the mainPanel and setlayout to null if eclipse the frame.getContent.setlayout(null);
    NetBean doesn't have a forum it has mailing list u can subscribe there
    http://www.netbeans.org/servlets/TLogin
    Edited by: raven_roy on Mar 12, 2008 2:58 AM

  • How to stop multiple auto-switching to address bar every time I open a new tab and try to type something anywhere outside of address bar?

    How to stop multiple auto-switching to address bar every time I open a new tab and try to type something anywhere outside of address bar? Like something just wants me to use that embedded search when u type something not-web-address in address bar and hit enter. And the most ridiculous thing is that it happens repeatedly on like every second, like I just move down from address bar and start typing again, but then again it switches me to address bar, and 3, 4 times like that. And the result is also that I can't see the address of that page.
    I think its has something to do with my AVG antivirus, because this started the same time some AVG Nation started to appear in every new tab i open (and thats also irritating me, I read about it here on support.mozilla.org and it seems that the only solution is to completely reinstall Firefox, but I dont want to lose all my settings) but when i type something in address bar and hit enter it opens the search results in Google.
    Please try to help me, I like Firefox but I must switch to Chrome until I fix this problem.
    Thanks in advance

    First, please update to Firefox 32. 22 is no longer support nor is it secure. Then let us know if you still have this problem. [[Update Firefox to the latest version]]

  • When sending email messages from iPhone,iMac, or iPad, email address automatically added to my contacts list on iPhone.  How do I trace this down and stop this auto addition of email addresses to my contacts list?

    I am not sure what generates the email address as a contact, be it the iPhone or iMac.  I use iCloud to sync up my contacts/address book.  This appears to happen when I am using Mac Mail on my iMac,  but I have no clue where to begin to look to stop this auto addition.  I have looked in Mail preferences on my iMac and in my iPhone settings, but have found nothing that "automatically add email address to contacts list". 
    Can anyone provide guidance?  Web search has been fruitless ( I am guessing I am not using the right key words for my search).

    Hey jpoolewarren!
    You can delete contacts by following the instructions in this link:
    Contacts at a glance - iPhone
    http://help.apple.com/iphone/7/#/iph3e0ca2db
    Delete a contact.  Go to the contact’s card, then tap Edit. Scroll down, then tap Delete Contact.
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • N72 Auto Cam and applications Start/Stop Problme

    Hi
    I got a problem with my N72, i cant understand what happened please help me to resolve it.
    Its Cam auto starting and stopping and other installed software applications as well with gap of short period of time. its not only disturbing me but also consuming battery rapidly

    Drag Garage Band to the trash.
    Go to: System Preferences > Account > Log In Items
    Use the +/- signs to add/delete programs started at log in.
    Joe

  • Photos get auto-cropped and ken burns. stop it.

    Trying to do a stop motion. don't need the photos to movie. Cant get imovie to stop auto cropping and ken burns-ing the photos on import from iphoto. Would be fine, but i can't bulk adjust them either, tired of going through frame by frame and putting it back to fit. help.

    When you start a new project, or to change a project you are currently working on, go to FILE/PROJECT PROPERTIES, and you can change the default behaviour for initial photo placement from Ken Burns to either FIT or CROP. Crop will make the photo fit the frame exactly by cropping off the top abd bottom. FIT will make the entire photo fit by letterboxing.
    If you make your photos have the same aspect ratio as your project (either 16:9 or 4:3), then FIT and CROP produce the same result, and nothing is lost from the photo.
    The FILE/PROJECT PROPERTIES will only change photos that you add going forward.
    To change a bunch of photos that are already there, change one photo using the Rotate, Crop, Ken Burns Tool. Then, with the photo still selected, EDIT/COPY.
    Now, select all the photos you want to change by holding down the Command Key as you click, so you can select multiple photos.
    Now, click EDIT/PASTE ADJUSTMENTS.../CROP ADJUSTMENTS.

  • While composing email, keep getting "Unable to save as a draft" every 30 seconds. I've disable auto save and it didn't help.How can I stop this message?

    While composing email, keep getting "Unable to save as a draft" every 30 seconds. I've disable auto save and it didn't help.How can I stop this message?

    Mike,
    Thank you for taking the time to look at my app. This is my last major stumbling block that I have to resolve for this and other forms in the app.
    Actually, I did use the Form Wizard for Auto DML to originally create the form. It was great. It created most of the Buttons, Items and Validations automatically (basically most of the page). I just needed to create some Processes and Computations. Two of which were the Processes to update the 'create_dt' and 'created_by' fields and 'update_dt' and 'updated_by' fields. The Create process updates the fields just fine.
    However, my problem seems to be that the Hidden 'create_dt' and 'created_by' fields aren't picking up the values from a record that is being editted. Then when I attempt to save the record those fields are NULL, causing the DB NOT NULL constraint to throw an exception for those fields. In the back of my mind I seem to remember seeing some post stating something to the effect that the information in fields with a Source Type of Database Column is just displayed and does not affect Session State items.
    Even with that, I am still wondering just why the 'created_by' Page Item shows the value that is in the DB record being updated, but the 'create_dt" does not (as can be seen in my first posting). It is the 'create_dt' Page Item (:P205_CREATE_DT) not having the DB records 'create_dt' info in it that appears to be the problem.
    Thanks,
    Tom

  • Stinking up the iPhone: auto-start and/or auto-stop iTunes playback

    The feature to auto-start and/or auto-stop iTunes playback is a disaster. A good idea poorly implemented perhaps, or maybe not possible to implement well. PLEASE PLEASE PLEASE give us a setting to turn this off! MANY MANY ENTRIES ACROSS MANY FORUMS! (e.g. Apple Discussions messageID=9937311) I will consider switching to another smartphone for this reason alone, it's that big a nuisance.

    Welcome to the discussions,
    you are not addressing Apple in these forums, we are all users here. Use this link to talk to Apple: http://www.apple.com/feedback/iphone.html

  • My address bar keep auto hiding and I cannot figure out how to stop it and keep it there, what do I do to stop this?

    I have to put my pointer to the top of the firefox page for my address bar to come down for me to type in an address. It auto hides and I want that disabled. How do I do this and fix this problem?

    Are you in full screen mode? Press F11 and see if that fixes it.

  • How do I stop iPhone Safari from dynamically resizing the visual viewport?

    Sorry I post this here, but I couldn't access the developer forums (no error given, it just keeps returning me to this page https://developer.apple.com/devforums/) I'm not even sure wether that's been moved here and it's just the redirection non working.
    I need to Stop iPhone Safari from dynamically resizing the visual viewport, or in other words, to stop it from trying to "fit" the layout into the viewport.
    Why?
    Because any recalculation javascript does on absolutely positioned elements makes the whole site super IRRESPONSIVE.
    I don't know wether the issue is the element going out the already-set layout viewport (which triggers the page resizing to fit the visual viewport) or just the calculations being made constantly, but I can stop the calculations from happening when not "touching" the screen, but I need a way to stop the page resizing.
    I tried setting the viewport width to 1040px, as my layout width, and it fixed the header's width being narrower than the body (or shifted left?), but the whole page is still resized with every motion-frame (one every 3 seconds, due to overloading the redrawing engine)
    Is there a way to prevent that?

    No, that link doesn't solve it. It just says the same is found everywhere online.
    There's probably no way to do it, as per their way they "accidentally" omitted the oposite case: the page being wider than 980. They only mention what to do if the site is narrower. Something I learned is big companies (with reputation management) could let you run in circles for years no answer rather than telling you something is not possible.
    I'm the developer (can't access the dev forums, don't know why) and I DID setup the viewport, scale and other properties but none of them stopped from re-fitting the new re-sized layout in the viewport. They just ensure the "initial" view.
    I think the feature I'm looking for must be achieved with some JavaScript function targeting Safari-proprietary variable/property… if even possible.
    I just had to make things never reaching the edge until somebody contributes something useful

  • Prime Infra 2.1, AP Auto Positioning

    Hi Forum,
    Ive a situation that our site needs to assign the AP (Access Point) into the existing NMS (Prime Infrastructure 2.1). ive already built the floor as the figure below. so ive many AP on site, how could I make it auto positioning. because, its hundred AP, cant manage all and needs to re-survey if the PI cant have ability to solve this.
    hope anyone already implement this case. any comment i appreciate that.
    regards,

    Location Accuracy Tool
    You can analyze the location accuracy of non-rogue and rogue clients, interferers, and asset tags by using the Location Accuracy tool.
    By verifying for location accuracy, you are ensuring that the existing access point deployment can estimate the true location of an element within 10 meters at least 90% of the time.
    The Location Accuracy tool enables you to run either of the following tests:
    Scheduled Accuracy Testing—Employed when clients, tags, and interferers are already deployed and associated to the wireless LAN infrastructure. Scheduled tests can be configured and saved when clients, tags, and interferers are already prepositioned so that the test can be run on a regularly scheduled basis.
    On-Demand Accuracy Testing—Employed when elements are associated but not pre-positioned. On-demand testing allows you to test the location accuracy of clients, tags, and interferers at a number of different locations. It is generally used to test the location accuracy for a small number of clients, tags, and interferers.
    Both are configured and executed through a single page.
    Enabling the Location Accuracy Tool
    NoteYou must enable theAdvanced Debug option in Prime Infrastructure to use the Scheduled and On-demand location accuracy tool testing features. The Location Accuracy tool does not appear as an option on the Operate > Operational Tools > Wireless menu when the Advanced Debug option is not enabled.
    To enable the advanced debug option in Prime Infrastructure:
    Step 1 In Prime Infrastructure, choose Operate > Maps .
    Step 2 Choose Properties from the Select a command drop-down list, and click Go .
    Step 3 Select the Enabled check box to enable the Advanced Debug Mode. Click OK.
    Note If Advanced Debug is already enabled, you do not need to do anything further. Click Cancel.
    Use the Select a command drop-down list to create a new scheduled or on-demand accuracy test, to download logs for last run, to download all logs, or to delete a current accuracy test.
    Note • You can download logs for accuracy tests from the Accuracy Tests summary page. To do so, select an accuracy test and from the Select a command drop-down list, choose either Download Logs or Download Logs for Last Run. Click Go.
    The Download Logs option downloads the logs for all accuracy tests for the selected test(s).
    The Download Logs for Last Run option downloads logs for only the most recent test run for the selected test(s).
    Scheduling a Location Accuracy Test
    Use the scheduled accuracy testing to verify the accuracy of the current location of non-rogue and rogue clients, interferers, and asset tags. You can get a PDF of the test results at Accuracy Tests > Results . The Scheduled Location Accuracy report includes the following information:
    A summary location accuracy report that details the percentage of elements that fell within various error ranges.
    An error distance histogram.
    A cumulative error distribution graph.
    An error distance over time graph.
    A summary by each MAC address whose location accuracy was tested noting its actual location, error distance and a map showing its spatial accuracy (actual vs. calculated location), and error distance over time for each MAC.
    To schedule a Location Accuracy test:
    Step 1 Choose Operate > Operational Tools > Wireless > Location Accuracy Tool.
    Step 2 Choose New Scheduled Accuracy Test from the Select a command drop-down list.
    Step 3 Enter a test name.
    Step 4 Choose an area type, a building, and a floor from the corresponding drop-down lists.
    Note Campus is configured as Root Area, by default. There is no need to change this setting.
    Step 5 Choose a beginning and ending time for the test by entering the days, hours, and minutes. Hours are entered using a 24-hour clock.
    Note When entering the test start time, be sure to allow enough time prior to the test start to position testpoints on the map.
    Step 6 Choose a destination point for the test results. (If you choose the e-mail option, you must first define an SMTP Mail Server for the target email address. Choose Administrator > Settings > Mail Server to enter the appropriate information.)
    Step 7 Click Position Testpoints .
    Step 8 On the floor map, check the check box next to each client, tag, and interferer for which you want to check location accuracy.
    When you check a MAC address check box, two icons appear on the map. One represents the actual location and the other represents the reported location. If the actual location for an element is not the same as the reported location, drag the actual location icon for that element to the correct position on the map. (You cannot drag the reported location.)
    Step 9 (Optional) To enter a MAC address for a client, tag, or interferer that is not listed, check the Add New MAC check box, enter the MAC address, and click Go .
    An icon for the newly added element appears on the map. If the element is on the location server but on a different floor, the icon appears in the left-most corner (in the 0,0 position).
    Step 10 When all elements are positioned, click Save.
    Step 11 Click OK to close the confirmation dialog box.
    You are returned to the Accuracy Tests summary page.
    Step 12 To check the test results, click the test name, click the Results tab in the page that appears, and click Download under Saved Report.
    Running an On-Demand Location Accuracy Test
    You can run an On-Demand Accuracy Test when elements are associated but not prepositioned. On-Demand testing allows you to test the location accuracy of clients, tags, and interferers at a number of different locations. It is generally used to test the location accuracy of a small number of clients, tags, and interferers. You can get a PDF of the test results at Accuracy Tests > Results . The On-Demand Accuracy Report includes the following information:
    A summary location accuracy report that details the percentage of elements that fell within various error ranges.
    An error distance histogram
    A cumulative error distribution graph
    To run an On-Demand Accuracy Test:
    Step 1 Choose Operate > Operational Tools > Wireless > Location Accuracy Tool.
    Step 2 From the Select a command drop-down list, choose New On demand Accuracy Test.
    Step 3 Enter a test name.
    Step 4 Choose an area type, a building, and a floor from the corresponding drop-down lists.
    Note Campus is configured as Root Area, by default. There is no need to change this setting.
    Step 5 Choose a destination point for the test results. (If you choose the e-mail option, you must first define an SMTP Mail Server for the target email address. Choose Administrator > Settings > Mail Server to enter the appropriate information.)
    Step 6 Click Position Testpoints.
    Step 7 To test the location accuracy and RSSI of a particular location, select client, tag, or interferer from the drop-down list on the left. A list of all MAC addresses for the selected option (client, tag, or interferer) is displayed in a drop-down list to the right.
    Step 8 Choose a MAC address from the drop-down list, move the red cross hair to a map location, and click the mouse to place it.
    Step 9 From the Zoom percentage drop-down list, choose the zoom percentage for the map.
    The X and Y text boxes are populated with the coordinates based on the position of the red cross hair in the map.
    Step 10 Click Start to begin collection of accuracy data, and click Stop to finish collection. You must allow the test to run for at least two minutes before stopping the test.
    Step 11 Repeat Step 11 to Step 14 for each testpoint that you want to plot on the map.
    Step 12 Click Analyze Results when you are finished mapping the testpoints, and then click the Results tab in the page that appears to view the

  • Components' position and size

    I've noticed that awt and swing components have methods which are supposed to resize and move them directly, without using LayoutManagers (methods like setX(), setY(), setLocation(), setSize(), reshape() etc).
    But when I try to use them, the component always stays the same. Let's say I have a single component on a Frame, so it takes all the available space. I don't seem to be able to resize and then move it using the above methods.
    Or do I miss something? Is there any way that I could lay my components out on a container just by using these methods, or do I need to do something for them to work?
    Thanks in advance. =D

    Hirsch wrote:
    But why is that, that
    Container.setLayout(null);
    should never be used?I suppose that absolute statements should never be made. null layout has its place (in fact, some here such as navy coder use it exclusively), but many if not most of us prefer to use the layout managers for many reasons. They automate the placement of your components, they make it much easier to create resizeable applications, they make it safer to create GUIs that will be used in multiple environments where different screen sizes are possible.
    For example, suppose you create a program that displays JRadioButtons like so:
    import java.awt.GridLayout;
    import javax.swing.ButtonGroup;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    public class FuPanel2
      private static void createAndShowUI()
        String radioLabels[] =
          "Fubar", "Snafu", "Bohica"
        // create a JPanel for jradiobuttons and have it use gridlayout
        JPanel radioPanel = new JPanel(new GridLayout(0, 1, 5, 5));
        ButtonGroup btnGrp = new ButtonGroup();
        for (int i = 0; i < radioLabels.length; i++)
          JRadioButton rBtn = new JRadioButton(radioLabels);
    btnGrp.add(rBtn);
    radioPanel.add(rBtn);
    JFrame frame = new JFrame("FuPanel2");
    frame.getContentPane().add(radioPanel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    public static void main(String[] args)
    java.awt.EventQueue.invokeLater(new Runnable()
    public void run()
    createAndShowUI();
    You'll notice that the JPanel that holds the JRadioButtons uses the GridLayout. If I want to add another JRadioButton, "Tarfu", all I have to do is add the String to the array and another radiobutton is produced and placed in the right location. I don't have to worry about setting sizes or positions of anything as it's all done for me:
        String radioLabels[] =
          "Fubar", "Snafu", "Bohica", "Tarfu" // have added "Tarfu"
        };Edited by: Encephalopathic on Aug 10, 2008 4:58 AM

Maybe you are looking for