Position panel in centre of another panel

This is one of those things that should be straightforward, but just isn't working out that way.
I have a JPanel called PanelA.
Prompted by a user action, I just want to add another (smaller) JPanel called PanelB in the centre of PanelA.
I've tried using a BorderLayout on PanelA, and doing this :
PanelA.add(PanelB, BorderLayout.CENTER);but this adds PanelB at the top of PanelA.
Does anyone know how I can just have this smaller panel appear dead-centre in the larger panel?

if you have licence for Borland JBCL library (VerticalFlowLayout)
you can use this code here.
public static final void addToPanel(Container xy, JPanel x, String title) {
    String name = x.getName();
    if (name == title) {
      System.err.print("ERROR PANEL IS ALREADY THERE");
      return;
    clearPanel(x);
    EtchedBorder border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white,
                                            new Color(148, 145, 140));
    TitledBorder titledBorder1;
    titledBorder1 = new TitledBorder(border1, title);
    JPanel pan = new JPanel();
    JPanel pan2 = new JPanel();
    JPanel containerPanel = new JPanel();
    pan2.setLayout(new FlowLayout());
    VerticalFlowLayout vertical = new VerticalFlowLayout();
    vertical.setAlignment(VerticalFlowLayout.MIDDLE);
    pan.setLayout(vertical);
    containerPanel.setBorder(titledBorder1);
    containerPanel.add(xy, BorderLayout.CENTER);
    pan2.add(containerPanel);
    pan.add(pan2);
    x.add(pan, BorderLayout.CENTER);
    x.validate();
    x.repaint();
    // x.setName(title);
    x.updateUI();

Similar Messages

  • What happened to the "size and position" panel in Photohop CC?

    What happened to the "size and position" panel for printing in Photoshop CC?

    It's still there in photoshop cc 2014.
    Which operating system are you using?

  • Help with DW & FW8 nav position in vertical centred page

    I have a FW8 CSS navbar which is contained within a wrapper
    div for a horizontally and vertically centred page (table layout).
    Works ok in Firefox and looks ok in IE but when IE browser is
    resized the navbar isn't staying in place. I've changed the
    position elements but can't get the combination right. Can anyone
    help please?

    For what it's worth,
    td img {
    /* Another Mozilla/Netscape bug with making sure our images
    display
    correctly
    display: block;
    this is not a Moz bug. It's an IE one. Moz is displaying
    images according
    to the standards - it's IE that is creating your problems.
    And what you
    have done here is to bludgeon Moz into compliance by making
    an image
    something it's not.... For what it's worth.
    With regard to the FW menus, I have decided not to help
    people with them.
    I'm sorry, but since MM created them this way against the
    advice of their
    many consultants, I think they need to support their
    creation. Just look at
    that stupid mess of CSS....
    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
    ==================
    "Mdsign" <[email protected]> wrote in
    message
    news:[email protected]...
    >I have a FW8 CSS navbar which is contained within a
    wrapper div for a
    > horizontally and vertically centred page (table layout).
    Works ok in
    > Firefox
    > and looks ok in IE but when IE browser is resized the
    navbar isn't staying
    > in
    > place. I've changed the position elements but can't get
    the combination
    > right.
    > Can anyone help please?
    >
    > html, body, #wrapper {
    > background-color: #E8EFF7;
    > height:100%;
    > margin: 0;
    > padding: 0;
    > border: none;
    > text-align: center;
    > }
    >
    > td img {
    > /* Another Mozilla/Netscape bug with making sure our
    images display
    > correctly
    > */
    > display: block;
    > }
    >
    > #FWTableContainer841513528 {
    > /* The master div to make sure that our popup menus get
    aligned correctly.
    > Be
    > careful when playing with this one. */
    > position:relative;
    > margin:0px;
    > width:750px;
    > height:30px;
    > text-align:left;
    > }
    >
    > #MMMenuContainer0314150012_0 {
    > /* This ID is related to the master menu div for menu
    > MMMenuContainer0314150012_0 and contains the important
    positioning
    > information
    > for the menu as a whole */
    > position:relative;
    > left:188px;
    > top:30px;
    > visibility:hidden;
    > z-index:300;
    > }
    >
    > #MMMenu0314150012_0 {
    > /* This class defines things about menu
    MMMenu0314150012_0's div. */
    > position:absolute;
    > left:0px;
    > top:0px;
    > visibility:hidden;
    > background-color:transparent;
    > width:148px;
    > height:110px;
    > }
    >
    > .MMMIFVStyleMMMenu0314150012_0 {
    > /* This class determines the general characteristics of
    the menu items in
    > menu
    > MMMenu0314150012_0 */
    > width:148px;
    > height:22px;
    > voice-family: "\"}\"";
    > voice-family:inherit;
    > width:140px;
    > height:14px;
    > }
    >
    > .MMMIVStyleMMMenu0314150012_0 {
    > /* This class determines the general characteristics of
    the menu items in
    > menu
    > MMMenu0314150012_0 */
    > width:148px;
    > height:22px;
    > voice-family: "\"}\"";
    > voice-family:inherit;
    > width:140px;
    > height:14px;
    > }
    >
    > #MMMenu0314150012_0_Item_0 {
    > /* Unique ID for item 0 of menu MMMenu0314150012_0 so we
    can set its
    > position
    > */
    > left:0px;
    > top:0px;
    > }
    >
    > #MMMenu0314150012_0_Item_1 {
    > /* Unique ID for item 1 of menu MMMenu0314150012_0 so we
    can set its
    > position
    > */
    > left:0px;
    > top:22px;
    > }
    >
    > #MMMenu0314150012_0_Item_2 {
    > /* Unique ID for item 2 of menu MMMenu0314150012_0 so we
    can set its
    > position
    > */
    > left:0px;
    > top:44px;
    > }
    >
    > #MMMenu0314150012_0_Item_3 {
    > /* Unique ID for item 3 of menu MMMenu0314150012_0 so we
    can set its
    > position
    > */
    > left:0px;
    > top:66px;
    > }
    >
    > #MMMenu0314150012_0_Item_4 {
    > /* Unique ID for item 4 of menu MMMenu0314150012_0 so we
    can set its
    > position
    > */
    > left:0px;
    > top:88px;
    > }
    >
    > #MMMenuContainer0314150012_0 img {
    > /* needed for Mozilla/Camino/Netscape */
    > border:0px;
    > }
    >
    > #MMMenuContainer0314150012_0 a {
    > /* Controls the general apperance for menu
    MMMenuContainer0314150012_0's
    > items, including color and font */
    > text-decoration:none;
    > font-family:Verdana, Arial, Helvetica, sans-serif;
    > font-size:10px;
    > color:#6699cc;
    > text-align:left;
    > vertical-align:middle;
    > padding:4px;
    > background: url("mmmenu2_148x22_up.gif") #e6eef7;
    > font-weight:normal;
    > font-style:normal;
    > display:block;
    > position:absolute;
    > }
    >
    > #MMMenuContainer0314150012_0 a:hover {
    > /* Controls the mouse over effects for menu
    MMMenuContainer0314150012_0 */
    > color:#cc0000;
    > background: url("mmmenu2_148x22_over.gif") #e6eef7;
    > }
    > #MMMenuContainer0314145458_1 {
    > /* This ID is related to the master menu div for menu
    > MMMenuContainer0314145458_1 and contains the important
    positioning
    > information
    > for the menu as a whole */
    > position:absolute;
    > left:467px;
    > top:30px;
    > visibility:hidden;
    > z-index:300;
    > }
    >
    > #MMMenu0314145458_1 {
    > /* This class defines things about menu
    MMMenu0314145458_1's div. */
    > position:absolute;
    > left:0px;
    > top:0px;
    > visibility:hidden;
    > background-color:transparent;
    > width:113px;
    > height:22px;
    > }
    >
    > .MMMIFVStyleMMMenu0314145458_1 {
    > /* This class determines the general characteristics of
    the menu items in
    > menu
    > MMMenu0314145458_1 */
    > width:113px;
    > height:22px;
    > voice-family: "\"}\"";
    > voice-family:inherit;
    > width:105px;
    > height:14px;
    > }
    >
    > #MMMenu0314145458_1_Item_0 {
    > /* Unique ID for item 0 of menu MMMenu0314145458_1 so we
    can set its
    > position
    > */
    > left:0px;
    > top:0px;
    > }
    >
    > #MMMenuContainer0314145458_1 img {
    > /* needed for Mozilla/Camino/Netscape */
    > border:0px;
    > }
    >
    > #MMMenuContainer0314145458_1 a {
    > /* Controls the general apperance for menu
    MMMenuContainer0314145458_1's
    > items, including color and font */
    > text-decoration:none;
    > font-family:Verdana, Arial, Helvetica, sans-serif;
    > font-size:10px;
    > color:#6699cc;
    > text-align:left;
    > vertical-align:middle;
    > padding:4px;
    > background: url("mmmenu1_113x22_up.gif") #e6eef7;
    > font-weight:normal;
    > font-style:normal;
    > display:block;
    > position:absolute;
    > }
    >
    > #MMMenuContainer0314145458_1 a:hover {
    > /* Controls the mouse over effects for menu
    MMMenuContainer0314145458_1 */
    > color:#cc0000;
    > background: url("mmmenu1_113x22_over.gif") #e6eef7;
    > }
    >

  • Can Care Centre install another language into 5800...

    My phone is purchased in Malaysia, and I'm using original firmware which only support input in Malaysian language, Indonesian language, English and Simplified Chinese.
    I wish I can TYPE Traditional Chinese (Hong Kong) on my phone (it's able to display both traditional & simplified Chinese, actually I can also input Traditional Chinese by handwriting but I found that typing is easier to me than handwritting)
    So can anyone tell me if I can ask the Nokia Care Centre to install language pack into my phone so that I will be able to do so?
    Great thanks!!!!!!!!!!!
    p/s I prefer to input by stroke, not pinyin, and I want Chinese (Hong Kong), not Chinese (Taiwan)^_^
    Solved!
    Go to Solution.

    Care center can install language packs.. but it may be related to the regiononly..Also there may be a cost involved.. and the worst thing is any firmware update will remove it...
    --------------------------------------------------​--------------------------------------------------​--------------------------------------------------​--If you find this helpful, pl. hit the White Star in Green Box...

  • Advice on how to design this style of icons

    I am very new to AI and want to develop some icons for Android OS (Please see the image below as an example of what I am referring to).
    It seems they all have a similar style -- simple, clean, drop shadows around the icon, and linear gradients.
    1. Are the gradients lighter on top and darker on bottom (I can not tell for sure)? Is the effect to make them seem like they are being top lit?
    2. Can anyone recommend some tips for making my icons appear consistent with the style displayed in the attached file?
    Thanks!

    Stan,
    You have different options to create all sorts of gradients and similar transitions.
    One is the normal linear and radial gradients, possibly with careful positioning of stops/centre.
    Another one is blends which may take on more kinds of shapes.
    Yet another one is gradient meshes.
    A special case is the radar/conic/conical gradient
    http://forums.adobe.com/message/3032428
    http://forums.adobe.com/message/1273721
    The helpfile can help at least some of the way.

  • LabVIEW 2010 Window Size/Panel Size Run-Time VI properties - unexpected behavior

    I have used the VI Properties Windows Run-Time Position - Panel Size and VI Properties - Window Size to set the desired display size for use on the application PC.
    A strange thing happens, when I first open the application window, it is smaller than the specified Window Size and Panel Size (both set to 1064 x 728).  However, if I click on a horizontal border the window's vertical size snaps instantly to the 728 pixel value and the horizontal size in unchanged, still smaller than the 1064 value specified.  When I click on a vertical border, the horizontal size changes to the specified value.
    I don't believe this is how these properties were intended to work.  They should open the application in a window sized as specified.  
    Is this a known problem?  Is there a workaround.

    I regret that I cannot post my employers' proprietary code.  I have tried to duplicate the problem with a publicly distributed VI and been unable to do so.  
    I believe now that it is possible my VI was "straddling" two monitors when I made the initial changes.  
    Later compilations were made using different VI properties and do not show this problem.
    I have attached a file showing the relevant VI property settings used in the aberrant VI compilation.
    Attachments:
    vi properties used.JPG ‏58 KB

  • Help with a scrolling flash panel

    Hello, Ive used the excellent tutorial to create a scrolling thumb panel (http://library.creativecow.net/articles/brimelow_lee/scrolling_thumbnail_panel/video-tutor ial.php)
    It works brilliantly and I have movie thumbs linking to a flash player. It all works fine, what Im needing help with is to change the scrolling.
    At current it scrolls up and down according to where I have set the 'line', I would like it to scroll up and down near the top and the bottom, rather than all the time (effectively creating a dead zone in the middle). I cant figure out how to change the code to get this to behave as required.
    Please Help!
    Below is the code used:
    panel.onRollOver = panelOver;
    function panelOver() {
    this.onEnterFrame = scrollPanel;
    delete this.onRollOver;
    var b = stroke.getBounds(_root);
    function scrollPanel() {
    if(_ymouseb.yMax || _xmouseb.xMax) {
    this.onRollOver = panelOver;
    delete this.onEnterFrame;
    if(panel._y >= 278) {   //FIRST BUTTON 'Y' POSITION
    panel._y = 278;
    if(panel._y <= -177) { //CHANGE '229' TO THE 'Y' POSITION OF THE LAST BUTTON IN THE 'PANEL' MOVIE, POSITIONED VISIBLE WITHIN THE BOARDERS.
    panel._y = -177;
    var ydist = _ymouse - 251; //POSITION ON STAGE OF UP/DOWN SCROLLING 'LINE'
    panel._y += -ydist / 150;   //SPEED OF SCROLLING (LOWER = HIGHER)

    use:
    panel.onRollOver = panelOver;
    function panelOver() {
    this.onEnterFrame = scrollPanel;
    delete this.onRollOver;
    var b = stroke.getBounds(_root);
    function scrollPanel() {
    if(_ymouseb.yMax || _xmouseb.xMax) {
    this.onRollOver = panelOver;
    delete this.onEnterFrame;
    if(panel._y >= 278) {   //FIRST BUTTON 'Y' POSITION
    panel._y = 278;
    if(panel._y <= -177) { //CHANGE '229' TO THE 'Y' POSITION OF THE LAST BUTTON IN THE 'PANEL' MOVIE, POSITIONED VISIBLE WITHIN THE BOARDERS.
    panel._y = -177;
    var ydist = _ymouse - 251; //POSITION ON STAGE OF UP/DOWN SCROLLING 'LINE'
    if(_ymouse>lowerY || _ymouse<upperY){
    if((_ymouse>lowerY){
    ydist=_ymouse-lowerY;  // define lowerY
    } else {
    ydist=_ymouse-upperY;  // define upperY
    } else {
    ydist=0;
    panel._y += -ydist / 150;   //SPEED OF SCROLLING (LOWER = HIGHER)

  • How to position published Flash in centre of browser?

    Hello,
    I have a basic Flash file that has been created for me to edit, however when I publish it sits in the top left of the screen - how can I change this so it positioned in the centre.
    Thanks,

    This is pretty much a html problem and depends a lot how your site is structured.
    For absolute centering (horizontal + vertical) on an empty html page use sth. like this in the css of your Html-wrapper
    @charset "utf-8";
    /* CSS Document */
    .center {
       width: [insert stage width of your flash file];
       height: [insert stage heightof your flash file];
       position: absolute;
       left: 50%;
       top: 50%;
       margin-left: [insert half of the negative stage width of your flash file];
       margin-top: [insert half of the negative stage height of your flash file];

  • Robot class and positioning the cursor

    I have an application where I have a number of panels on the screen and using an editable field wish to enter coordinates to position the Cursor to on another panel.
    ie, using grid coordinates on a map. Using the robot class I am able to position the cursor on the other panel but as soon as I move the mouse the cursor jumps back to the original position on the screen where the first panel with the editable field was. It is like only a picture of the cursor was drawn at the new coordinates and the real cursor is still at the old podition. It is important to this application that if the cursor is moved it stays where it has been moved to and actually is there and not just appearing to be there. I am using jdk 1.3 on Intel Solaris 2.8. Any help on this issue would be helpful and appreciated

    Maybe you can use the mouse move event to position the mouse to where you had moved the cursor to.
    for example
    1.the mouse is at point 100,100
    2. you move the cursor from your code to point 0,0
    3. the user starts to move the mouse
    4. you code gets that event and repositions the cursor to the last place where it was, that is at 0,0

  • Aarrrghh - can't find image size and position in captivate 8!

    I was using Captivate 8 and it was under a tab in properties (don't remember the name of the "sub-tab").
    Now, I'm using a newly downloaded version and cannot find size and position (x, y, width, length, etc.).
    This should NOT be so hard
    Any suggestions?

    Totally agree, don't like the UI change neither. One of the reasons I'm happy to know all moving and resizing shortcuts by heart, they still work in CP8. But wouldn't it be wonderful to have rulers?
    Shortcut Keys: Moving and Resizing Objects - Captivate blog
    It is not as simple neither, because it is in a different location for a normal and for a responsive project.
    For the normal project it is under the Options tab, for responsive projects you need the Position panel, both for Size and Location.

  • Arabic diacritics positioning in InDesign

    How can I position the Arabic diacritic (Kasra) below the character? At the moment the Diacritic automatically positions itself above the character by default, Some Arabic scripts use this particular diacritic below the character.
    Is there a way to change this using InDesign without having to manually move each instance of the character using the diacritics positioning panel?
    Regards
    Saj

    Can't say that I've ever noticed this myself. What language is the text marked as? What language is it? What font? If it's script-dependent and the font is well-designed, then you should be able to select the text, change the language, and have the kasra change position. But I thought that kasra positioning was conditional. (I can't read any langage that uses the script, beyond the basi 100 words, for what it's worth.)
    Are you keying this yourself? Someone who e.g. knew how to key only the fatha might use it in place of the kasra, for example. I have worked with many translators who were great writers but terrible typists, if you know what I mean, and who used any number of terrible workarounds to account for their lack of facility keying Arabic into their word processors.

  • Give absolute position and size to components

    When I do something like
    getContentPane().add(new Panel()); then the panel is spread all over the frame. How can I say something like "put the panel at position (10, 10) and its size should be (200, 100) no matter what size my frame is"?

    here ya go ...
    //create and add a JPanel ...
    JPanel panel = new JPanel();
    getContentPane().add(panel);
    //you can do it this way: (all in one)
    panel.setBounds(X-Position,Y-Position,Width,Height);
    //or this way: (seperate)
    panel.setLocation(X-Position,Y-Position);
    panel.setSize(Width,Height);

  • Where is "Display" in "Position"

    Folks
    I'm a newbie to DW and following David Powers' excellent tutorials at https://helpx.adobe.com/creative-cloud/learn/start/dreamweaver.html, but in the one "Style the navigation bar" he demonstrates going to the "position" in "Layout" and selecting "Display">Block, but in my newly downloaded Dreamweaver CC there is no "Display" in the position panel, just "float, clear, overflow-x, overflow-y, visibility, z-index and opacity" whereas in David's tutorial "display" is between overflow-y and visibility.  Is "display" now in a different location in the latest DW?
    Thanks, and regards
    Roy

    Scroll up in the Layout tab of the Properties in the CSS Designer, it should be 7th from the top.
    One drawback of "The Creative Cloud gives you new features as they're available" is that those new features are sometimes reorganizations of windows and menus. A video that was good 6 months ago, might be slightly wrong now.

  • Check on Multiple entries in the same positions

    Hullo all!
    Can anyone pls tell me as to how can i keep a check on multiple entries (i.e.persons) occupying the same position?
    i mean that if a position is 100% staffed, then there should be an error popped up when another personnel no. is being assigned to the same position.
    And if the position is staffed 60%, then another personnel no. should be accepted on the same position only if the staffing percentage is allotted as 40%.
    is this an ABAP development? and if so, what all tables are to be referred etc? what is the logic?

    Hi ,
    Please download the note from transaction "SNOTE" (Cntrl + F8 / Download SAP Note). I can send you the note if you can share your email id.
    An extract from note for your reference :-
    Number 502182
    Version 0004
    Processor
    Processing Status new
    Implement. Status Cannot be implemented
    Language EN
    Short Text Holder relationship, staffing percentage, working time
    Component PA-OS Organizational Structure
    Long Text
    Symptom
    In Organizational Management, difficulties exist concerning the creation of the staff
    assignments. The interaction of holder relationship, staffing percentage working time
    of the employee and planned working time of the position is not clear.
    Effects on subsequent processes, for example, the integration of Cost Distribution are
    not clear.
    Other terms
    Integration of Cost Distribution, IT1018, IT0027
    Reason and Prerequisites
    Solution
    The following text should explain the interaction of holder relationship, working time
    of the employee, planned working time of the position and the integration of Cost
    Distribution.
    Contents:
    1. The holder relationship
    2. The staffing percentage
    3. The staff assignment from the viewpoint of the position
    4. The working time at the position
    5. The working time of the employee
    6. The relationship characteristics of the holder relationship
    7. Dependent processes (Integration of Cost Distribution)
    =======================================================================
    1. The holder relationship
    Relationship between position and position holder (employee), infotype 1001, subtype
    A008
    Allowed relationships:
    (See system table T777E)
    A Work center A 008 Holder P
    A Work center A 008 Holder US
    BP Business partner B 008 Holder S
    P Person B 008 Holder A
    P Person B 008 Holder S
    S Position A 008 Holder BP
    S Position A 008 Holder P
    S Position A 008 Holder US
    US User B 008 Holder A
    US User B 008 Holder S
    SAP Note Nr. 502182 10/05/2007 Page 1
    Time constraint:
    (See system table T777Z)
    A 1001 Relationships A008 Holder 3
    S 1001 Relationships A008 holder 3
    P 1001 Relationships B008 holder 3
    That means:
    <b>o An employee can be assigned to several positions at the same time.
    o A position can be assigned to several holders at the same time.</b>
    Reward points, if this was helpful.

  • How to use position hierarchy for approval in custom workflow ?

    Dear All,
    I have created a custom workflow which fires when ever a new supplier site is created.
    Now I want to add approval hierarchy in this flow. For that I want to use Position Hierarchy.
    I have not find useful resources for doing that. Can you please help me?
    Regards,
    Rubayat

    Hi;
    Please review:
    How to Create a New Position Hierarchy [ID 437489.1]
    Adding Positions to a Hierarchy from Another Business Group [ID 356127.1]
    How To Determine Position Controlled Organizations In The Hierarchy? [ID 549628.1]
    How Does One Create and/or Update Position and Position Hierarchy in HR Using an API? [ID 736443.1]
    Using AME, How To Create Approval Routing To a Certain Position In HR Position Hierarchy [ID 1501433.1]
    Regard
    Helios

Maybe you are looking for

  • SAP (ECC 6.0) - Erro de rejeição (Engrenagem)

    Boa tarde a todos, Gostaria de compartilhar um cenário de erro ocorrido no ambiente de produção do cliente (pós-GoLive) onde implementamos recentemente Nota Fiscal Eletrônica. Para um determinado cenário enviado para SEFAZ/SP foi retornado o código d

  • Server 2008 and MS Access 2007 Scheduled Task

    I have a Server 2008 with MS Access 2007 installed. I created a task that is designed to lanuch Access, open a designated database, and run a macro. The macro calls a function within the database that generates a series of reports in PDF format for u

  • Macbookair SuperDrive Supported in bootcamp win 7

    Macbookair Superdrive is only supported for system without a drive ex mac mini, MBA and MBP retina I am surprise that i tested on my Imac intel 3.1 bootcamp win7 - It supported both drive internal and external connected to USB. Some window user frien

  • Revaluation not picking up all documents

    Hi The revaluation program is not picking up all foreign currency GRIR documents.  I've checked and the exchange rates are different and the items are open, but when we run the revaluation program it skips certain documents.  Has anyone ever come acc

  • BPM webservice scenario

    Hi All, Could you please provide some sample BPM webservice scenario for the Approval process? Actually, don't want to get top to bottom info. for this request, prefer to have just layout info. Regards Sara