Setting a fixed width and a changing height for a component within a panel

Alright guys here's my next question. I'm now having trouble trying to figure out how to only resize the height of a JTabbedPane yet keep the width fixed. In other words, as the JPanel its in changes in size, I'd like to have the width of my tabbed pane stay a certain value yet let the height of it adjust to the panel's height as it changes. Is there a way to somehow extract the panel's height into a int or something and then when using the setPreferredSize() function simply implement this retrieved value into the function's height parameter? I've tried messing around with Dimensions and getHeight() functions and the sort but to no success. For instance, within the constructor of one of my JFrames using System.out.println(this.getHeight()); prints 0, when of course this is not the case in reality for the frame's height. The panel's changing size is due to the user resizing the window its in. In one of my previous threads in this forum I learned how to use a GridLayout (it was 2 rows and 1 column in size) to keep the height of the top area in a BorderLayout fixed, yet as the user resized the window, the layout would stretch the area width-wise accordingly. However, that was because I had 2 cells in the layout to control, and I know this wouldn't work with only 1. Any ideas?

You still apparently haven't read the tutorial on using Layout Managers to understand the capabilites of each Layout Manager.
For instance, within the constructor of one of my JFrames using
System.out.println(this.getHeight()); prints 0, when of course this is not the case in reality for the frame's heightComponents don't have a size until the GUI is visible on the screen. That is until you've done a pack(), or a setVisible( true ). You should never be using setSize().
Layout Managers use setPreferredSize() ,setMinimumSize() and setMaximumSize() as suggestions for determining the layout. Although most layout managers don't use all the suggestions, which is why you need to read the tutorial to find out how the layout managers work.
I'm now having trouble trying to figure out how to only resize the height
of a JTabbedPane yet keep the width fixedWell, I don't understand the requirement. The preferred size of a tabbed pane is equal to the preferred size of the largest tab added to the tabbed pane. So I don't understand the concept of artificially changing the vertical height.
Anyway reread the tutorial on "How to Use the Border Layout". Two of the 5 areas respect the width of the component but alter the height to fill all the available space.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

Similar Messages

  • How to set a minimum width and height for a stage or scene?

    Hello,
    Does anyone how to set a minimum width and height for a stage or scene?
    I tried listening for width/height property value changes and then adjust the width/height if necessary, but that causes unpleasant flickering of the window.
    In JavaFX 2.1 beta SDK for Mac OS, the Stage class has setMinWidth() and setMinHeight() functions which work very well.
    I'm wondering what's the equivalent way to do that when using the FX SDK for Windows.
    Any help is appreciated!
    Thanks.

    I was wondering how to enforce a minimum stage size with JavaFX 2.0.3.The same flickering way you are currently doing it. See: http://javafx-jira.kenai.com/browse/RT-15200 "Need a way to set the minimum size of a window"

  • Fix width and height of accordion

    Hi All
    I am building an application using jquery accordion on region 3 of page 0. In each subregion I have a treeview and when a node is choosen shows details about this node. My issue is how to fix width and height of accordion. I tried with jquery tabs instead of accordion and I put this on region header 'style=\"overflow-x:auto;display:block;max-width:340px;min-width:340px;overflow-y:auto;max-height:450px;min-height:450px;";" ', and closing tag at region footer and it worked.
    Any idea?
    Thanks a lot.
    Ricardo
    Theme: 13
    EPG
    Version: 4.0.2.00.06

    Hi Jitu
    Thank you for your replay but it didn't work as I need.
    I made the following test. I put on region attribute \style="width:350px;". When each subregion of accordion has only a treeview, it didn't work. When I created another subregion into accordion with a simple report, it worked fine.
    I don't know what is going on and also how to fix it.
    Any other idea?
    Ricardo

  • Switching from delimited to fixed width and had to retype 115 column names

    Hi we run 2012 enterprise.  I just changed a delimited flat file over to fixed width and had to retype all 115 column names.  Is there a way to preserve at least some of what ssis already knows (eg col names) in the flat file connection when
    this kind of changeover is occuring?  

    Thx Mike.  I appreciate your help so dont take this the wrong way.  
    Lets be honest.  This kind of behavior and some of the others I've posted recently when it comes to switching in and amongst flat file formats (fixed,unicode,unnecessary data type conversion etc etc) in ssis cannot possibly be by "design". 
    You might think I'm arrogant but hear me out.  As a graduate from one of the better engineering schools in the US and having earned a BSCS from that school, my thinking is that even a first year college student would design this little part of
    ssis in a more flexible fashion.  And the sad part is that legacy mainframe technologies from way way back baked this kind of flexibility into their products without add ins.  SSIS is purportedly .net technology and as such should follow the
    most fundamental rules of OO which include flexibility and reusability. 
    We should be more careful about the term "by design".  I believe this is actually a limitation which I'm sure would have been dealt with had there been more time, money and experience invested.  One of my other posts cites a recommendation (from
    ssis) that displays along with one of these flat file errors and has something to do with dt_ntext.  But the recommendation actually doesnt work.  So are we going to say that a recommendation that doesnt work is also by design?  I dont think
    so.  By design infers "for valid reasons".   And I dont believe there are any valid reasons for this/these behaviors.   If there are , pls share.

  • How to set a fixed width for a box

    Hi there,
    Struggling here.... must admit. 
    I need a solution whereby I can set a fixed width for a box that is grouping two buttons.  I suppose generally, I want to know how to set a fixed width for anything element.
    See the picture below.  I want the two buttons to stay the same distance apart, and I want the grouped buttons to stay the same distance from the right edge of the window, even as a user resizes the window.
    This is what happens when you reduce the size of the window .....
    I would like to stop this from happening.
    I can't figure out how accomplish keeping the parent div a fixed width, and a fixed position from the right side of the window, so the buttons won't overlap.
    Perhaps I'm doing the whole thing wrong. 
    I mean, is there a way to accomplish this without grouping the buttons?  That is, make the buttons fixed width, fixed distance apart from each other, and fixed distance from the right side of the window, even as the user resizes the page?
    I am trying to accomplish this using the Min/Max width settings, but given that there are so many different units to choose from, and the fact that when I place a button or box on the screen, it seems to be creating that button or box with a percentage-based width, I don't know how many pixels to set it to.... sigh....
    Many thanks in advance for your help.
    Sam

    Okay after much futzing I figured out at least part of the solution I need, but if someone knows of a more efficent way to do this please let me know. 
    I set a fixed minimum width in pixels for both of the buttons at 156px.
    I then made the left button float left and the right button float right.
    I then made the parent div for the buttons float right.
    That made the buttons stay the same size.
    The only thing I need to figure out how to do now is make the parent div stay a consistent distance in pixels from the right.  I tried setting a right margin but that didn't work.  As you size the window down, the div gets closer to the edge, until it passes it.  

  • How to set Jspx page width and hight programatically ?

    Hi All ;
    i need to browse a jspx page has Different width & hight sizes ;
    Please Can SomeOne tell me ow to set Jspx page width and hight programatically ?
    Regards;

    In that case you need to use JavaScript.
    Resizing the browser window in JavaScript is done by using window.resizeTo(400, 400);
    I
    Thanassis

  • Export and import change document for user master data

    Dear Gurus,
    I have two queries on change document for user master data:
    1. Are there any approaches to export and import change document for user master data?
    We often do system copy from PRD to QAS for UAT and troubleshooting. Before system copy we export the user master data from QAS and then import after the copy process. We would like to keep the change document for user master data on QAS from being refreshed from PRD for security reason.
    2. Change document for Role change in QAS
    When the role is created or modified in DEV and then transported to QAS, the role change document doen't include this change log. The role change document in QAS only records those role changes directly made in QAS.
    Could you advise this is by SAP design or are there any approaches to record this transported role change  in the role change document in QAS?
    Thanks
    YBY

    1. Perhaps you want to consider a system copy to a "virtual system" for UAT?
    2. Changes in QAS (as with PROD as well) will give you the delta. They should ideally be clean... You need to check the source system.
    Another option is to generate the profiles in the target system. But for that your config has to be sqeaky clean and in sync, including very well maintained and sync'ed Su24 data.
    Cheers,
    Julius

  • Where to make changes to calendar height, width, and misc changes

    Apex 4.2
    I have a page with a calendar on it. I have several issues with formatting the data within each cell. Currently, I use a substitution string to place the id in the calendar cell. Clicking the id will link to another page. What I notice is that for each id on a calendar cell (or date), it lists them one under the other. Is there any way to list them side by side? Also, I need to make changes to the calendar cells. I would like to expand the width and the height, but am not sure where to do this. Can anyone point me in the right direction of where to put this, and what to put to expand the height and width. Thanks in advance.

    In regard to the cell size, if using Chrome or FF you can use the Inspect Element tool to locate the relevant class for the table the makes the calendar - it will be the TD that already has a height defined. Then you could add the required CSS in the inline page properties.
    Details will depend on your theme.

  • Layers-fixed width and/or embeding in a table

    I have been setting up a site and am trying to use one, the
    other or both techniques. For a specific design I wanted to use
    layers with a fixed width. I assign the width in the properties but
    when I enter text it does not wrap, instead the layer expands. Then
    I thought I could keep the layer from expanding by embeding it in a
    table cell. The layer does not seem to care that it is in a table
    cell. The layer expands regardless of anything I have done so far.
    Is there anybody that can help with this issue or am I out of
    luck?
    Thanks in advance.

    > I assign the width in the properties but when I enter
    text it does not
    > wrap
    Try adding a space to the text you enter.
    > Then I thought I could keep the layer from
    > expanding by embeding it in a table cell.
    Never put a layer directly into a table cell. You will get
    browser
    rendering differences when you do this.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "layers" <[email protected]> wrote in
    message
    news:e9o95u$gv8$[email protected]..
    >I have been setting up a site and am trying to use one,
    the other or both
    > techniques. For a specific design I wanted to use layers
    with a fixed
    > width.
    > I assign the width in the properties but when I enter
    text it does not
    > wrap,
    > instead the layer expands. Then I thought I could keep
    the layer from
    > expanding by embeding it in a table cell. The layer does
    not seem to care
    > that
    > it is in a table cell. The layer expands regardless of
    anything I have
    > done so
    > far.
    >
    > Is there anybody that can help with this issue or am I
    out of luck?
    >
    > Thanks in advance.
    >

  • ADF Faces - Change style for menuTab component

    How to change color for menuTab components (selected and enabled)?
    I do not want to create new style, all I need is just change some colors and fonts for default oracle style.
    I was able to change color for table, overridinf some styles in my css-file, but overriding
    <af_menuTabs_selected> and <af_menuTabs_enabled> did not work, because on generated html-page menuTab components do not use any styles. Is there any workaround to change color of that component?
    Thanks.

    public String commandButton_action() {
    ot_msg.setValue("Hello");
    AdfFacesContext.getCurrentInstance().addPartialTarget(ot_msg);
    The code above works fine but I nead also, in the method, to generate a excel file with JXLS librairie.
    The file can takes a long time to download and thus I want to change the value of outputText while the file is generating and not after.
    How can I do that ?
    Thanks

  • How to set mutable cell width and height in a jlist?

    Hello,
    i wrote a jlist cell renderer object to able to render a jlabel for the unselected items and a wide and high jpanel with images when an item is selected.
    The jlist render all items at the same dimension.
    How can i change this built-in behavior?
    i printed the items preferedsize:
    java.awt.Dimension[width=340,height=140]
    java.awt.Dimension[width=275,height=75]
    java.awt.Dimension[width=275,height=75]
    java.awt.Dimension[width=275,height=75]
    java.awt.Dimension[width=275,height=75]
    java.awt.Dimension[width=275,height=75]
    java.awt.Dimension[width=275,height=75]
    Message was edited by:
    fazekaim
    ok, i give for every index pos a fix jpanel object, and it is working.
    What i would like is a mouse selection and the selected item/cell should be rendered by a component with different dimension (containing more information). but this doesn't work.
    Is it possible, that the JList cashes the cells dimensions???
    Message was edited by:
    fazekaim
    Message was edited by:
    fazekaim

    i just want to change a cell for another when i click on it.
    there are names in the jlist. after having click on one of them, a description panel could be appears in the list instead of the short name. it' a simple ui effect, i think.
    is there any other way than write a custom jlist implementation?

  • How to set the BARCODE width and length for label printing..

    Hi All,
    How to set the Code 39 barcode label format in the sizxe of 0.20" * 1.4". By default while printing barcode size exceeds my current requirement. Please let me know to customize the size of barcode labels.
    Thanks.

    I don't know what you mean by "Code 39" because my Output Designer software doesn't offer that barcode (or do you mean "code 3 of 9?). In any case, are you trying to control the size of the text (which is what I think of when you refer to "label")? If you are, then just change the font & size. If you are wanting to modify the physical characteristics of the barcode itself (height & length for a certain number of characters) then you are probably out of luck. Or at least in for some trial & error.
    There are a series of "barcode.xxx" files in the 'config' folder where Output Designer was installed to. These are text files that contain the physical characteristics of the various barcodes for various printers. The parameters that you would be interested in is the height and width of the bars (black & white). For example, a barcode might be defined as .400 high with narrow bars 3 "dots" wide, wide bars 9 "dots" wide and white space the same or different. Presumably changing these values would affect the generated barcode. For example, in this example the wide bars are 3 times the width of the narrow bars so I would assume that relationship would have to remain. To make the resulting barcode shorter you would then use 2 for the narrow and 6 for the wide.
    You would have to make the change in the file(s) that would be used for your printer(s).
    There are four width values for each of the parameters. Most of the barcodes only use 2 but some have 4. I'm assuming that when there are 4, like in "4 8 12 16", that the barcode definition has 4 different widths of bars and/or spaces.
    There is no guarantee that the scanning hardware & software will "see" and interpret the resulting barcode correctly.

  • Overage Fees - Upgrade Plan and then change back for only $20 - and no change to contract?

    I am on the Nationwide 700 minute family plan with two lines and finally on a month to month contract.  Just saw on my account that I am over my allowance by 67 minutes ($30.15) and I still have five days until my billing cycle ends.  
    I called VzWireless and the lady on the phone said that there is a way to minimize the overage expense this one time.  According to her, if I "upgrade" my voice plan to the 1400 minute plan before the 21st of the month I will end up not having to pay any overage fees on the peak hours (at least $30 as of writing this with five days to go) and would only have to pay the difference in plans which works out to be an extra $20.  She also said she could "future date" an order to move my plan back to my normal 700 minutes after the bill is issued on the 21st so that I would not have to maintain the more expensive plan.
    Frankly, this sounds too good to be true -  I mean why wouldn't every Tom, Dick, and Harry that goes over on their minutes do this then?  Maybe I am the only person who has not figured this out?  The whole reason I am over on minutes this month is because I got caught in a Directv/U-Verse teaser scam and had to call each company's customer support lines and ended up on hold for hours!  Needless to say I am skeptical...
    Is there any merit to this?  Is it true that I can change my plan without renewing to another two year contract?  Are there hidden fees? Can I trust Verizon?  

    Yes, this is true.
    You can change your plan to the 1400 minute plan prior to the end of your billing cycle. Just make sure that this change is "backdated" to the beginning of the billing cycle you are currently in, so that you have those 1400 minutes available to you for this entire cycle. You will then not go over your allowance.
    After your current billing cycle ends, you can change your minute plan back to the 700 min plan.
    I don't know if I would want the CS rep to do both changes at the same time, as this leads to more likely of a mixup which may impact you in a negative way. Might be better to do one at a time.
    Edit: This practice has been around for awhile. Unlike you, several people who have this service pointed out just like to complain that Verizon should just do this without being asked so that they would never incur overages. Those same people would then just complain that their bill increased without them giving permission to increase their minute allowance.

  • New voice features and voice changing options for ...

    Hello everyone!
    I am currently involved in a class project in which I am trying to understand whether companies like Skype would be interested in technology that can modify voice/call characteristics such as pitch and tone (for entertainment or audio improvement) or even add the possibility to use cartoon voices and so on. What do you guys think about this? 
    All the feedback is welcome!!
    Thank you!

    Hi, Mcastanheira, and welcome to the Community,
    Whilst Skype may not be providing for such a facility, I trust you are researching third-party developer software add-on's which might.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • How to set a default start and/or end date for New Events based on trigger date.

    I'm using the CalendarActivityListener to get current row when clicking on an existing event. As per previous posts this listener gives you access to event detail including Start Date, End Date, etc.
    However, what I want to do is to default the start (and end) dates for New Events based on the trigger date.
    I've tried the CalendarListener and can grab the Trigger Date from it - however, I can't see a way to pass this directly to the popup/dialog I'm using to create the new event.
    At present I'm putting the TriggerDate into the ADFContext session scope e.g. ADFContext.getCurrent().getSessionScope().put("TriggerDate",calendarEvent.getTriggerDate());
    Then, I've tried multiple approaches to try and "get" the TriggerDate from session scope to drop it into my new Calendar Event basically, I'm trying to default the InputField(s) associated with the Start Date using the value from the session - I've tried
    1. setting the default value for the InputField in the jspx using a binding expression i.e. value="#{sessionScope.TriggerDate}" - this actually sets the value appropriately when the jspx is rendered but, when I go to create I get a NPE and I can't debug. I assumed that it might be a Date type issue - it would appear that CalendarListener provides a date of type java.util.Date and that the StartDate attribute of my VO/EO/table is a DATE and therefore requires oracle.jbo.domain.Date so I tried casting it - to no effect
    2. Using a Groovy expression *(StartDate==null?adf.context.sessionScope.TriggerDate:StartDate)* in my calendar's EventVO to default the Start Date to the same result
    Any thoughts or ideas?

    John,
    Thanks for that suggestion - could not get it to work. However, I did manage a different approach. I finally determined the sequence of events in terms of how the various events and listeners fire (I think).
    Basically, the CalendarActivityListener fires, followed by the listener associated with the Calendar object's Create facet, followed finally by the CalendarEventListener - the final is where the TriggerEvent is available and then finally, control is passed to the popup/dialog in the Create facet. So, my approach of trying to set/get the TriggerDate in the user's HTTP session was doomed to failure because it was being get before it had been set :(
    Anyway, I ended up adding a bit of code to the CalendarEvent listener - it grabs the current BindingContext, navigates through the DCBindingContainer to derive an Iterator for the ViewObject which drives the calendar and then grabs the currently active row. I then do a few tests to make sure we're working with a "new" row because I don't want to alter start & end dates associated with an existing calendar entry and then I define the Start and End dates to be the Trigger Date.
    Works just fine. Snippet from the listener follows
    BindingContext bindingContext = BindingContext.getCurrent();+
    *if ( bindingContext != null )    {*+
    DCBindingContainer dcBindings = (DCBindingContainer) bindingContext.getCurrentBindingsEntry();+
    DCIteratorBinding iterator = dcBindings.findIteratorBinding("EventsView1Iterator");+
    Row currentRow = iterator.getCurrentRow();+
    if ( currentRow.getAttribute("StartDate") == null)+
    currentRow.setAttribute("StartDate", calendarEvent.getTriggerDate());+
    if (currentRow.getAttribute("EndDate")==null)+
    currentRow.setAttribute("EndDate", calendarEvent.getTriggerDate());+
    *}*

Maybe you are looking for

  • Installing itunes on my pc using windows 7 makes the disc drives disappear

    does anyone have a fix for this? I'm using a pc with windows 7, used to be able to uninstall itunes and the drives would reappear, now that doesn't work so I have no disc drives. Have tried everything (my computer friend has, for me) including a new

  • APP blocked vemdor account

    Hi all, When running APP, i faced this messeges 'Payment proposal could not be carried out' means payment proposal not completed. then i try to do manual payment thru f-53, system throwing error is " vendor account is blocked by payment run" How can

  • I'd like to create my own private WiFi network from a public WiFi network

    I am often in locations where there are open WiFi networks and I'd like to use an Express to create a private WiFi network from the available public one.? If the express can't do it on it's own can I add another router to make it work? I have etherne

  • Decimal places not visble depending on unit of measure

    Hi,    I have a fields in a table line that is a quantity field with 3 decimal places, I also have a unit of measure associated with that quantity. When my unit of measure is EA the quantity displays with 3 decimal places, but when the unit of masure

  • Joins for PO & RCV tables in R12

    Could you provide me joins for below tables rcv_shipment_headers rsh rcv_shipment_lines rsl rcv_transactions rct po_headers_all poh po_lines_all pol Thanks