Forcing a JWindow to pack/validate and resize

Hi,
I'm using a JWindow with some JComponents in it and I'm trying to set the font of this window and all of its components. After setFont() (which works) I want the JWindow to resize because the label sizes etc. changed with the new font.
I tried JWindow's pack() and validate() methods but the window keeps its old now incorrect size.
What can I do to recalculate the layout and to resize the window correctly?
Thanks
Frank

Your example works for me, too. But when I try (nearly) the same in my application
System.out.println(myPanel);
System.out.println(myWindow);
dialog.setFont(font);
myWindow.pack();
System.out.println(myPanel);
System.out.println(myWindow);
I get the following results:
JPanel[,0,0,113x149,invalid,hidden,layout=com.jgoodies.forms.layout.FormLayout,alignmentX=null,alignmentY=null,border=javax.swing.border.EtchedBorder@1be1041,flags=9,maximumSize=,minimumSize=,preferredSize=]
JWindow[win0,0,0,113x149,invalid,hidden,layout=java.awt.BorderLayout,rootPaneCheckingEnabled=true]
JPanel[,0,0,113x149,invalid,hidden,layout=com.jgoodies.forms.layout.FormLayout,alignmentX=null,alignmentY=null,border=javax.swing.border.EtchedBorder@1be1041,flags=9,maximumSize=,minimumSize=,preferredSize=]
JWindow[win0,0,0,0x-1,hidden,layout=java.awt.BorderLayout,rootPaneCheckingEnabled=true]
The panel seems to resized but in strange way. When I make it visible it has the old size.
myPanel is a panel in myWindow. I use myPanel from myWindow to show it in the ModalLayer of a dialog so one of myWindows panels has been added to the modal layer of dialog.
Frank

Similar Messages

  • After moving and resizing control, some controls don't redraw properly as the cursor passes over them.

    I have a top-level VI with three panes (two splitters).  One of the panes contains nested tab controls.  One of the tab pages contains six XY-graphs, a table and some decorations.
    I use a subVI to resize and relocate the tabs and contained controls.  All this is working fine, and everything looks fine after the resizing is complete.
    The problem is when the cursor passes over certain controls (the chart legends and the table column headers for example), they redraw with gray boxes.  The problem only occurs after enlarging the window from its minimum size.  It goes away if the window is resized back down to minimum.
    Anything that causes the window to redraw, like another resize or minimize/restore, properly refreshes the screen.
    Has anyone seen this problem, and have a workaround?
    The problem exists in development environment or built in LV 9.01 or LV 2010.
    Thanks!
    Matt Dennie
    Attachments:
    Resize Redraw Problem.zip ‏125 KB
    Resize Redraw Problem.JPG ‏210 KB

    Thanks again for taking a look at my problem.
    force redraw - This is apparently only available in LV2010.  I did give at a try, but it did not prevent the problem, nor did it correct the problem once the gray boxes appeared.
    disable updates (on a graph) - This apparently only applies to 3-D graphs, which is not what I am using in this case.
    disable front panel updates - I tried disabling updates before moving/resizing the front panel controls, then re-enabling updates afterwards.  The problem is exactly the same as before.  Once the move/resize is complete, passing the mouse over the table column headers or the graph plot legend results in the gray boxes.
    I would appreciate any other suggestions you may have. 
    Again... the problem is not that the moving and resizing don't work.  They work fine.  But once the resizing is complete, passing the mouse over the legend or table column headers causes gray boxes to appear.
    Thanks!
    -- Matt

  • ORADC problem on Windows 2000 with Service pack 1 and service pack 2

    Hi,
    I have a VB application running on NT4.0 workstations. It uses
    ORADC control to talk to ORACLE 7.3 When I load it on Windows
    2000 with service pack 1 or service pack 2, I encounter some
    problems.
    The ORADC control is used in most of the VB forms and the
    Refresh method of the ORADC conrol is used to refresh the APEX
    TRUE DBGRID PRO control. When this action is executed, I receive
    a run time error
    "Method Refresh of object '_DORADC' failed Err#: -2147417848
    It works fine when no service pack is applied on Win2K.
    Can anyone tell me what's going on?
    Thanks

    satheesh_p wrote:
    Thanks for your reply.
    When I checked the system requirements. I couldn't find information on windows 2003 service pack 2
    link http://www.adobe.com/products/coldfusion/systemreqs/.
    Whether your OS is windows 2003 with service pack 2?
    Are you sure coldfusion 8 will work on windows 2003 with service pack 2?
    Regards,
    Satheesh.
    Well it was there, if you understand the naming properly:
    ColdFusion 8 system requirements
            Windows
    Intel® Pentium® II or AMD Athlon processor
    Microsoft®
    Windows® 2000 Professional with Service Pack 3; Windows 2000 Server,
    Advanced Server, or Datacenter Server with Service Pack 3; Windows
    Server® 2003 Web, Standard, or Enterprise Edition with Service Pack 1
    and R2; Windows Server® 2008; Windows XP Professional or Home Edition;
    or Windows Vista®
    R2 is the "offical" Microsoft name for service pack 2.

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

  • Photoshop CC: Have a template that I moved image into.  Image is too small.  How do I resize the image while in the template?  Or must I go to original image file and resize there again and again until I get the right fit?

    I have a template that I am able to plug different pictures into at different times.  The problem is that when I plug an image into that template, I find that the image is either too big or too small.  Is there a way to plug the image into the template and resize the image (and not the template itself) OR will I have to go to the file with the original image and resize it there and then try to plug it in to the template to see if it fits------and if it does not fit, go back to the original file with the image and resize it again and see if that fits---and so on and so on...........?  I have tried the" image size" option but it's hit or miss------mostly miss!
    Thanks!

    Read up on Smart Objects. It looks like you have no idea as to how to create and use them.
    Jut create a Smart Object from the layer containing whatever it image it is that you are "plugging into your template".  But you do need to learn the application at its most basic levels.
    Photoshop is a professional level application that makes no apologies for its very long and steep learning curve.  You cannot learn Photoshop in a forum, one question at a time.
    Or is it possible that you don't even have Photoshop proper but the stripped-down Photoshop Elements?"
    If the latter is the case, you're in the wrong forum.  This is not the Elements forum.
    Here's the link to the forum you would want if you're working in Elements.:
    https://forums.adobe.com/community/photoshop_elements/content
    If you do have Photoshop proper, please provide the exact version number of that application and of your OS.
    (edited for clarification)

  • Packing status and delivery status

    What are the fields for packing status and delivery status?

    Hi,
    Please check tables VBUK (header status) and VBUP (item status).
    VBUK-LFSTK ((Delivery status)
    VBUK-PKSTK (Overall packing status of all items)
    VBUP-LFSTA (Delivery status)
    VBUP-PKSTA (Packing status of item)
    Regards,
    Ferry Lianto

  • My pc windows vista home system and Windows Vista Ultimate both service pack 2 and itunes do not recognize the ipod touch 4g, ios 5

    my pc windows vista home system and wndows vista ultimate boht service pack 2 and itunes do not recognize or do not see the ipod touch 4g ios 5. why'??'

    Windows Firewall is on.
    iTunes is NOT enabled in Windows Firewall.
    We'd better check on that, kris. If you enable iTunes in your Windows firewall, does that help with your connection? See the following document for instructions:
    How to enable iTunes in the Windows XP Firewall
    EDIT: Drat ... gave you the link to the wrong document. Try this one instead for your Vista:
    How to enable iTunes in the Windows Vista and Windows 7 Firewall
    Message was edited by: b noir

  • I'm trying to install iCloud on my PC running Windows Vista with Service Pack 2 and I get a message that the set up program is not a valid win32 file.

    I'm trying to install iCloud on my PC running Windows Vista with Service Pack 2 and I get a message that the set up program is not a valid win32 file. Can anyone help me with this?

    What is the exact error message?

  • How to enable Validate and Export in FDM task

    Hi everyone
    I am working with setting up an FDM Task to Import, Validate and Export data to HFM.
    The Task is able to import data to FDM, but I cannot make the process start the Validate and Export functions. If I do the process manually, then data is imported to HFM succesfully.
    Am I missing something in the scripts or do I need to enable some feature in FDM?
    Action Script:
    Sub BatchLoadLedgerTrans()
    'Declare Local Variables
    Dim lngProcessLevel
    Dim strDelimiter
    Dim blnAutoMapCorrect
    'Initialize Variables
    lngProcessLevel = 50   'Import
    strDelimiter = "_"
    blnAutoMapCorrect = 0
    'Create the file collection
    Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter), FileName)
    'Execute a Standard Serial batch
    BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), , CBool(blnAutoMapCorrect)
    End Sub Integration Script:
    Function LedgerTrans_EDW_to_HFM(strLoc, lngCatKey, dblPerKey, strWorkTableName)
    Dim objSS 'ADODB.Connection
    Dim strSQL 'SQL String
    Dim rs 'Recordset
    Dim rsAppend 'tTB table append rs Object
    'Initialize objects
    Set cnSS = CreateObject("ADODB.Connection")
    Set rs = CreateObject("ADODB.Recordset")
    Set rsAppend = DW.DataAccess.farsTable(strWorkTableName)
    cnss.open "Provider=SQLNCLI11; Data Source=10.250.200.10; Initial Catalog=EDW; User ID=FDM-user; Password=MyPassword"
    cnss.CommandTimeout = 0
    'Create query String - VIEW
    strSQL = "Select * "
    strSQL = strSQL & "FROM EDW.hfm.ledgertranstable "
    'Get data
    rs.Open strSQL, cnSS
    'Check For data
    If rs.bof And rs.eof Then
    RES.PlngActionType = 2
    RES.PstrActionValue = "No Records To load!"
    Exit Function
    End If
    'Loop through records And append To tTB table In location’s DB
    If Not rs.bof And Not rs.eof Then
    Do While Not rs.eof
    rsAppend.AddNew
    rsAppend.Fields("PartitionKey") = RES.PlngLocKey
    rsAppend.Fields("CatKey") = lngCatKey ' PlngCatKey
    rsAppend.Fields("PeriodKey") = dblPerKey ' PlngCatKey
    rsAppend.Fields("DataView") = "YTD"
    rsAppend.Fields("CalcAcctType") = 9
    rsAppend.Fields("Account") = rs.fields(2).Value
    rsAppend.Fields("Desc1") = rs.fields(2).Value
    rsAppend.Fields("Entity") = rs.fields(6).Value
    rsAppend.Fields("ICP") = rs.fields(8).Value
    rsAppend.Fields("Amount") = rs.fields(14).Value
    rsAppend.Fields("UD1") = rs.fields(5).Value
    rsAppend.Fields("UD2") = rs.fields(9).Value
    rsAppend.Fields("UD3") = rs.fields(10).Value
    rsAppend.Fields("UD4") = rs.fields(7).Value
    rsAppend.Fields("UD5") = rs.fields(13).Value
    rsAppend.Update
    rs.movenext
    Loop
    End If
    'Records loaded
    RES.PlngActionType = 6
    RES.PstrActionValue = "SQL Import successful!"
    'Assign Return value
    LedgerTrans_EDW_to_HFM = True
    End Function Best regards
    Frederik
    Edited by: Frederik Andersen on Jun 1, 2013 1:32 AM

    Found the solution.
    The variable lngProcessLevel should be set to "12" to execute the full Import, Validate and Export.
    Best regards
    Frederik

  • Help needed in Drag and Drop and  resizing of image icons

    Hi all,
    I'm doing a project on Drag and Drop and resizing of image icons.
    There is one DragContainer in which i have loaded the image icons and i want to drop these image icons on to the DropContainer.
    After Dropping these icons on to the DropContainer i need to resize them.
    I have used the Rectangle object in resizing.
    The problem now i'm facing is when i drag, drop and resize an image icon and when i try to drag, drop a second image icon the first image icon gets erased.
    can any one help me in fixing this error.
    if u want i can provide the source code.
    thanks in advance
    murali

    the major restrictions in its implemented only in
    jdk1.1.Why!

  • Firefox 4 Beta has problem when printing shipping pages from Amazon Marketplace, it shows and prints strange symbols instead of the packing slip and the label. Do you have any idea why is that?

    Well, I installed it 2 days ago and yesterday when I tried to print a packing slip and a label for Amazon customers it printed so many strange symbols that were nothing like what they are supposed to be, not even close. When I printed it with another browser it was all fine, so it is obviously a problem of the new version of my favorite browser. Probably something with the encoding, but since I'm not a computer geek, I cannot give more info. :(

    '''If you go the the menu and click "Print Preview" then it will show normally, and will print correctly from there. You must do it this way the first time you try to print though, if you try to print (using the print command) and it is messed up, then it shows it messed up in the preview. It's not a cure, but works for now until this bug is fixed.'''

  • Hi, i have new computer as my old one packed in and i have lost everything. how do i now sync my i pod without losing the music i manually put there by cd,(no longer have some of the cd's) ?

    Hi, I have had to purchase new computer as my old one packed in and i have lost my entire music library. How can I sync my I-Pod touch without losing the music on it that was put there through importing cd's as i no longer have some of the cd's but really want to keep that music?

    See this excellent user tip from another forum member turingtest2 outlining the different methods and software available to help you copy content from your iPod back to your PC and into iTunes.
    Recovering your iTunes library from your iPod or iOS device
    Hopefully you take the time to back up these files regularly in the future.
    B-rock

  • Upload and Resize Image not inserting filename in database

    I have a form that I created using the insert record form wizard. One of the fields is a file field and my form enctype is set to multipart/form-data. I then used the upload and resize image behavior and set the parameters. When testing the form the file uploads to the correct directory but no entry is made into the database for that particular field. The other fields are entered into the database just fine. If it helps, here is the code generated before the  tag:
    <br />
    <br /><?php require_once('../../Connections/test.php'); ?>
    <br /><?php<br />// Load the common classes<br />require_once('../../includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('../../includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("../../");<br /><br />// Make unified connection variable<br />$conn_test = new KT_connection($test, $database_test);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />//start Trigger_ImageUpload trigger<br />//remove this line if you want to edit the code by hand <br />function Trigger_ImageUpload(&$tNG) {<br />  $uploadObj = new tNG_ImageUpload($tNG);<br />  $uploadObj->setFormFieldName("picture");<br />  $uploadObj->setDbFieldName("picture");<br />  $uploadObj->setFolder("../images/");<br />  $uploadObj->setResize("true", 120, 0);<br />  $uploadObj->setMaxSize(1500);<br />  $uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png, bmp");<br />  $uploadObj->setRename("auto");<br />  return $uploadObj->Execute();<br />}<br />//end Trigger_ImageUpload trigger<br /><br />// Make an insert transaction instance<br />$ins_team = new tNG_insert($conn_test);<br />$tNGs->addTransaction($ins_team);<br />// Register triggers<br />$ins_team->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");<br />$ins_team->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$ins_team->registerTrigger("END", "Trigger_Default_Redirect", 99, "../team.php");<br />$ins_team->registerTrigger("AFTER", "Trigger_ImageUpload", 97);<br />// Add columns<br />$ins_team->setTable("team");<br />$ins_team->addColumn("id", "NUMERIC_TYPE", "POST", "id");<br />$ins_team->addColumn("sort", "NUMERIC_TYPE", "POST", "sort");<br />$ins_team->addColumn("name", "STRING_TYPE", "POST", "name");<br />$ins_team->addColumn("title", "STRING_TYPE", "POST", "title");<br />$ins_team->addColumn("description", "STRING_TYPE", "POST", "description");<br />$ins_team->addColumn("picture", "FILE_TYPE", "FILES", "picture");<br />$ins_team->setPrimaryKey("id", "NUMERIC_TYPE");<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rsteam = $tNGs->getRecordset("team");<br />$row_rsteam = mysql_fetch_assoc($rsteam);<br />$totalRows_rsteam = mysql_num_rows($rsteam);<br />?>

    If the reason is about memory, warning message should be happened when upload the image, because "show thumbnail" means resize at second time, how come you failed to resize the picture that system let it upload succeed at the first time by the same resize process?
    upload procedure
    a.jpg: 2722x1814, 1.2mb
    upload condition: fixed width 330px, 1.5mb
    "upload and resize" a.jpg -> file upload -> "resize engine" -> passed (but not work and no warning message)
    "show thumbnail" a.jpg -> "resize engine" -> failed (not enough memory)
    it doesn't make sense.
    and you miss an important key point, I upload the same picture myself, and resize work, so I said it happened at random, and that's why I am so worried.

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

  • I have Windows XP, 32 bit version 2002 Svc Pack 2 and when trying to download iTunes 10.5 I am getting the following "The older version of Bonjour cannot be removed.  Contact your tech."  I've tried a good number of remedies to no avail.  Can anyone help?

    I have Windows XP, 32 bit version 2002 Svc Pack 2 and when trying to download iTunes 10.5.1 I am getting the following "The older version of Bonjour cannot be removed.  Contact your technical support."  I've tried a good number of remedies to no avail.  Can anyone help?

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If you are running 64-bit Windows and the above steps haven't helped try installing the version of iTunes that can be downloaded from this support document. iTunes 12.1 for Windows (64-bit — for older video cards)
    If you still have no luck try reinstalling iTunes 12.0, links in the user tip.
    tt2

Maybe you are looking for