SetBounds(0,0,-1,-1) make components disappear

Hi all,
I work with Sun One Studio 4, I designed a quite sophisticated form layout (only using Border and BoxLayout though) with a bgImage. It worked ok. Then I rewrote button texts. Almost all of the components disappeared (all from one of the main panels). I compared the working version with this new one (even the layout managers are the same), and found that there are 2 lines that differ, those ones that dimension the panels of my JLayeredPane. In the working:
jPanel1.setBounds(0, 0, 810, 610);
jPanel2.setBounds(0, 0, 324, 134);
in the erroneous:
imagenFondoPanel.setBounds(0, 0, -1, -1);
menuNavegadorPanel.setBounds(0, 0, -1, -1);
My questions:
1. What does the this latter semantic (the -1 s in the setBound) mean?
2. How can this ruin my working version?
3. Can absolute positioning appear only using Layout Managers?
Thank you for your answers,
Balint Erdi

the message signature is as follows:
public void setBounds(int x,
int y,
int width,
int height)
the first two parameters specify the location of the component
and the later two components specify the Width and height respectivly.
so setting them to -1, -1 makes no sense, because obviouslly your
component disappears

Similar Messages

  • Components disappearing

    hi...I got some components in an applet, for example...
    Button btn = new Button("Click");
    List list = new List(5,false);
    now in my init method, I don't want some flowLayout to TRY to control the location of my components,
    so I'm setting the flowlayout at null...
    but as soon as I do this, the components disappear...
    if I use a flowlayout like
    setLayout(new FlowLayout(FlowLayout.CENTER));it works, but my composants arent placed right...
    what's wrong ? isn't there a way for me to manually set the x/y of my components without them disappearing
    setFlowLayout(null)
    add(btn);
    btn.move(BTN_X,BTN_Y);
    add(list);
    list.move(LIST_X,LIST_Y);

    Layout managers are easy to learn to work with and some are very flexible in allowing you to place components just where you want them. They work well in resizing and in scrollpanes.
    If you try to do this on your own you may soon come to appreciate the layout managers.
    To get started, use setBounds to specify the location and size of your components in their container. To move them you can do:
        int dx = position change along x-axis;
        int dy = pixels;
        Rectangle r = myComponent.getBounds();
        myComponent.setBounds(r.x + dx, r.y + dy, r.width, r.height);
        parentComponent.revalidate();  -or- parentContainer.validate();
        parentComponent.repaint();Becoming proficient in layouts requires practice and patience.

  • There is a line showing on top of my ipod.  How can I hide it for make it disappeared?

    There is a line showing on top of my ipod.  How can I hide it for make it disappeared?

    Try a hard reset first.  To do this, press and hold both the Select (Center) and Menu buttons together long enough for the Apple logo to appear.
    The next step would be to restore the iPod to factory setting in iTunes.
    And if still no luck, it's likely a hardware issue/malfunction with the screen.
    B-rock

  • How to make Components Dragable

    How to make Components dragable and moveable?
    Is it posible?
    Thanks.

    There's no way currently to do that in Catalyst. Drag and drop functionality would have to be added over in Flash Builder after you export your project in FC.
    but you can of course "simulate" the D&D with a clever "On click, Play action sequence" interaction.
    Here some information on drag and drop in Flash Builder if you want to see how drag and drop is coded:
    http://www.adobe.com/devnet/flex/quickstart/adding_drag_and_drop/
    To simply drag objects around, you can use DragManager.doDrag():
    http://livedocs.adobe.com/flex/3/langref/mx/managers/DragManager.html# doDrag()
    Also, there's an interesting tutorial written by Krystal Higgins, showing how she simulated a drag and drop in Catalyst, which you might find useful:
    Simulated Drag and Drop in Flash Catalyst.
    Hope this helps,
    Chris

  • I have a black window that keeps coming up and telling me the various tasks that I am handeling. It came after opening a power point and now I cannot make it disappear. It frames all windows and programs that I open with a black line. Help please...

    I have a black window that keeps coming up and telling me the various tasks that I am handeling. It came after opening a power point and now I cannot make it disappear. It frames all windows and programs that I open with a black line. Help please...

    Go to System Preferences - Accessibility - Voiceover - turn off Voiceover. The shortcut is command-F5, so possibly you pressed that accidentally.
    Matt

  • How to make components appear and disappear dynamically.

    So I admit I am from the HTML world and have been able to
    dynamically control divs to make them visible and invisible, as
    needed. How do you do that in Flex/Flash?
    I have tried the "visible" attribute, but the component takes
    up the same space when invisible leaving a big hole in the page --
    very surprising. I have changed the height and width to zero (which
    works) but have not been able to restore the size (since I want it
    to be width=100% and it is expecting a number, not percentage.
    So how do you implement hidden divs in Flex.
    Thanks.
    Mike

    In Flex, there is a separation between "is this component
    visible" vs. "does this component take screen space." Similar to
    the difference in CSS between "mydiv.style.visibility = 'hidden'"
    and "mydiv.style.display = 'none'".
    In Flex:
    // make it invisible
    mything.visible = false;
    // make it not take up space onscreen
    mything.includeInLayout = false;

  • Components disappear after having moved them

    Hi again,
    I've created a JFrame which looks like this:
    This is all fine until you hit the big O (maximize). Here is the code I use for the button:
    if (source == maximize) {
                if (this.getBounds().width != (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth() & this.getBounds().height != (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()) {
                    this.setBounds(0, 0, (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(), (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight());
                } else {
                    this.setBounds(Integer.parseInt(p.getProperty("screen.x_pos")), Integer.parseInt(p.getProperty("screen.y_pos")), Integer.parseInt(p.getProperty("screen.x_bound")), Integer.parseInt(p.getProperty("screen.y_bound")));
                maximize.setIcon(over_maximize);
                updateScreen();
            }And here is the code for updateScreen:
    public void updateScreen() {
            // Reposition the components
            close.setBounds(this.getBounds().width - 23, 0,  23, 26);
            maximize.setBounds(this.getBounds().width - 47, 0,  24, 26);
            minimize.setBounds(this.getBounds().width - 69, 0,  22, 26);
        }When i hit the maximize button then, it properly resized, and the components are moved. I know they should be visible, but somehow they disappear. Here is a screenshot of what it looks like (i moved the X button to the edge to show you what i'm talking about.
    What am i doing wrong?
    MANY thanks in advance!

    Also I would limit the legth of each line of code. Its hard to read your code when you need to do horizontal scrolling all the time. One way to shorten you code is to do something like the following:
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Dimension screen = toolkit.getScreenSize();
    Now you can just use: screen.width and screen.height.

  • How To Make Text Disappear When Mouse is On a Button?

    Hello,  I'm completely new to Flash and well I need some help. I created a page that has static text in the center.
    The page has buttons on side and when I rollover a button text appears, but the problem is that when I rollover a button, the static text in the center is there and I want to hide it as I can't read anything because the texts are overlapped.
    How do I make the text in the center disappear/hide when I rollover a button and how do I make it reappear when the the mouse is off the button?
    I hope what I am explaining makes sense.

    You can assign onRollOver and onRollOut code to the buttons to make the text dispappear, but you'll need to make the text a movieclip with an instance name that you can use to target it to turn it invisible.  In the simple example below, the button has an instance name of "btn" and the text movieclip has an instance name of "text_mc"
    btn.onRollOver = function(){
          text_mc._visible = false;
    btn.onRollOut = function(){
          text_mc._visible = true;

  • HT5772 In the Podcasts, there are a tons of files downloadable from iCloud appearing in iTunes. How to make them disappear? Thanks

    When you register for a podcast, the list of past podacsts appears in the podcast. Sometime, ther's a ton of it. How to make them go?
    Thanks

    If you go to settings>music there should be a setting to show all music. Turn that off, and the cloud purchases should disappear. You may need to restart the phone to take efect

  • TheVolumeSettings Folder: How to make it disappear

    Hi, I was transferring a large folder from my computer hard drive to an external when I noticed this folder pop up on the external hard drive. When I click on it, it disappears, but I can't seem to delete it.
    Can anyone explain to me
    1) What the Volume Settings Folder is
    2) Why it came up after tranferring the files
    3) How to make it go away again
    Thank you very much!

    Hi R&R, and a warm welcome to the forums!
    1. iirc it's for Classic/OS9.
    2. What date/time does Get info say?
    3. I'd ignore it.

  • How to make dock disappear for certain apps?

    Is there a way to make my dock disappear, but only when a certain app is open? I work with Photoshop, on my 13" Macbook Pro, and to be honest, I need every tiny bit of screen space I can muster. I'd like it if Photoshop ran full screen, like iTunes for example, but it doesn't run fullscreen AND show the side palletes etc, I don't know why but I wish it did.
    Anyway, I was wondering, can I program my dock somehow, so that it will disappear whenever I click inside or open Photoshop, but when I quit or click out of Photoshop, it comes back?
    Is there a line of code I need to put into Terminal, or a 3rd party app or something? Anything will do
    Thanks

    Hello ThatSmartKidJack,
    You can set you dock to automatically go down and come back. and if you still see the sides of your desktop just resize your window by dragging the bottom right corner of your window. I also use Photoshop and I can see it almost full screen by hiding my dock. Hope that helps!

  • How to make components' size constant?

    I have a newbie question for you. How to make the size of components (button, combobox, etc...) constant? I mean they keep the same size as the users change window's size.
    Thanks.
    Sraiper

    You need to use a layout manager that respects the minimum and maximum size of the components and set the minimum and maximum sizes to be the size that you want the component to be. FlowLayout respects minimum and maximum, and so does BoxLayout. BorderLayout and GridLayout don't respect the min or max sizes. You can usually get what you want with a combination of layout managers. If you gave me a better idea of how you want to layout your components, and what you want the resizing behavior to be, then I could give you some more specific recommendations about the layouts you should use.
    Try making some ascii drawings.
    Example:
            small size window              large size window
        |                       |  |                                      |
        | []check     o radio   |  |  []check                             |
        | []check     o radio   |  |  []check                   o radio   |
        |             o radio   |  |                                      |
        |  ___________________  |  |                            o radio   |
        | |_____textfield_____| |  |                                      |
        |  ________   ________  |  |                            o radio   |
        | |_button_| |_button_| |  |                                      |
        |_______________________|  |  __________________________________  |
                                   | |____________textfield_____________| |
                                   |                 ________   ________  |
                                   |                |_button_| |_button_| |
                                   |______________________________________|Make sure you put
    before and
    after your drawings so the forum doesn't mess them up.

  • AS3, .htmltext,  .embedFont and/or .antiAliasType makes b disappear

    I've been trying to find a solution for this problem for a while and I still can't get a working solution. I've googled the problem and it looks like it's a known issue yet I still can't get a definitive fix that actually works.
    I create a dynamic text field that's populated with html text from an .xml file.  It looks like .embedFont and/or .antiAliasType makes the html <b> formatting disappear. I HAVE to have the bold text per client needs.
    Here's my code that was written based on posts I've seen online by other people with the same issue.
    "fontHelvetica" is a font that is in the .fla's library and it is the linkage name. 
    Every format works except the html <b>.
    How do I make the <b> work?
    Is there a definitive solution or a link to a site that has a working solution?
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFieldAutoSize;
    import flash.text.Font;
    var fontIntroDisclaim:Font = new fontHelvetica();
    var introDsclmFrmt:TextFormat = new TextFormat();
        introDsclmFrmt.font = fontIntroDisclaim.fontName;
        introDsclmFrmt.color = 0xFFFFFF;
        introDsclmFrmt.size = 16;
        introDsclmFrmt.letterSpacing = .1;
        introDsclmFrmt.leading = 01;
    var introDsclmTxt:TextField = new TextField();
        introDsclmTxt.width = 1150;
        introDsclmTxt.x = introDsclmTxt.y = 0;
        introDsclmTxt.multiline = true;
        introDsclmTxt.selectable = false;
        introDsclmTxt.wordWrap = true;
        introDsclmTxt.defaultTextFormat = introDsclmFrmt;
        introDsclmTxt.autoSize = TextFieldAutoSize.LEFT;
        introDsclmTxt.antiAliasType = AntiAliasType.ADVANCED;
        introDsclmTxt.embedFonts = true;
    introDsclmTxt.htmlText = ifxLandingDisclaimer;
    introDsclmTxt.setTextFormat(introDsclmFrmt);
    intro1_mc.introDisclaim_mc.addChild(introDsclmTxt);
    Thanks in advance for your response.
    Zak.

    Thanks for the response Kglad. You suggestion helped me to fix the issue.

  • Components disappeared after adding the image in.....

    Hello everyone,
    I add a image in my home page that is in swing .As soon as I add that image the components in another page disappeared.(Componenets like textField ,Label).But when I click on that page, those pages appears. I want to appear all those pages at the first time as they are working before adding the image .
    Please tell me the solution on my ID or provide the solution over here.
    Thanks
    Vivek Kumar Gupta

    wht do u mean by pages.. ??
    and I should suggest you to use..
    validate();
    after adding images..

  • Tab Access - can I make them disappear?

    I have recently started working with the access settings in Portal and am wondering if it's possible to make tabs invisible to users who don't have access to them? (I've noticed that you can make items invisible through item level security)
    For example, I have given a specific user access to only 3 out of 7 tabs along the top of my screen. However, when they log on, they are still able to see all 7 tabs - they can't access all of them, but I would rather they can't see them at all.
    Is this possible?
    Any suggestions would be appreciated.
    Jenny

    Hi Jenny,
    I also want disappear the tabs when the user logs in. I want the user shld be access to only that which they require.Suppose i have 3 tabs when user1 logs in i shld make him to see only two tabs i.e Home,Location and when user2 login i shld make him to see 2 tabs i.e Home,HR.I have already seen the tabs level acces but then also user1 login he see 3 tabs which is wrong.pls tell me how u have done.Pls properly give an example and proper steps wise.

Maybe you are looking for