Resizing JComponent not displaying in packed frame

Please help, I'm trying to dynamically resize a dialog when a component expands/collapses, and when I set the component visible it is not firing a component resize event, as I believe I am setting minimum and preferred size properly. The code I am using is posted below. TriangleIcon is a triangle icon, which will point in any of the SwingConstants directions.
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
public class TestPackedFrame extends JDialog {
     public TestPackedFrame() {
          setModal(true);
          Container contentPane = getContentPane();
          contentPane.setLayout(new BorderLayout());
          PreviewPane previewPane = new PreviewPane(new JLabel("Display Hidden"));
          previewPane.addComponentListener(new ComponentAdapter() {
               public void componentResized(ComponentEvent e) {
                    pack();
          contentPane.add(previewPane,BorderLayout.CENTER);
          JButton closeButton = new JButton("Close");
          closeButton.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    setVisible(false);
          contentPane.add(closeButton,BorderLayout.PAGE_END);
     public static void main(String[] args) {
          JDialog.setDefaultLookAndFeelDecorated(true);
          Toolkit.getDefaultToolkit().setDynamicLayout(true);
          System.setProperty("sun.awt.noerasebackground", "true");
          TestPackedFrame frame = new TestPackedFrame();
          frame.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
          frame.pack();
          frame.setVisible(true);
          frame.dispose();
          System.exit(0);
class PreviewPane extends JComponent implements MouseListener {
     private boolean expanded;
     private JLabel arrowLabel;
     private Component view;
     public PreviewPane(Component view) {
          this(view, false);
     public PreviewPane(Component view, boolean expanded) {
          this.setLayout(new BorderLayout());
          arrowLabel = new JLabel("Preview", new TriangleIcon(true,
                    SwingConstants.EAST, 6), SwingConstants.LEFT);
          arrowLabel.addMouseListener(this);
          this.add(arrowLabel, BorderLayout.NORTH);
          this.view = view;
          setExpanded(expanded);
          this.add(view, BorderLayout.CENTER);
     public void setExpanded(boolean expanded) {
          this.expanded = expanded;
          view.setVisible(expanded);
          if (expanded)
               view.repaint();
     public boolean isExpanded() {
          return expanded;
     public void paint(Graphics g) {
          super.paint(g);
     public void mouseClicked(MouseEvent e) {
     public void mousePressed(MouseEvent e) {
          Object source = e.getSource();
          if (source == arrowLabel) {
               TriangleIcon currentIcon = (TriangleIcon) arrowLabel.getIcon();
               if (currentIcon.getDirection() == SwingConstants.EAST) {
                    arrowLabel.setIcon(new TriangleIcon(true, SwingConstants.SOUTH,
                              6));
                    setExpanded(true);
                    repaint();
               } else if (currentIcon.getDirection() == SwingConstants.SOUTH) {
                    arrowLabel.setIcon(new TriangleIcon(true, SwingConstants.EAST,
                              6));
                    setExpanded(false);
     public Dimension getMinimumSize() {
          Dimension arrowSize = arrowLabel.getMinimumSize();
          Dimension viewSize = isExpanded() ? view.getMinimumSize()
                    : new Dimension(0, 0);
          return new Dimension(Math.max(arrowSize.width, viewSize.width),
                    arrowSize.height + viewSize.height);
     public Dimension getPreferredSize() {
          Dimension arrowSize = arrowLabel.getPreferredSize();
          Dimension viewSize = isExpanded() ? view.getPreferredSize()
                    : new Dimension(0, 0);
          return new Dimension(Math.max(arrowSize.width, viewSize.width),
                    arrowSize.height + viewSize.height);
     public void mouseReleased(MouseEvent e) {
     public void mouseEntered(MouseEvent e) {
     public void mouseExited(MouseEvent e) {
}Edited by: stringman520 on Jan 27, 2008 1:20 AM

Here is the code for TriangleIcon. How could I call pack directly when the component is displayed? The PreviewPane doesn't receive the window object, so while I can pack the dialog directly when it is displayed, subsequent changes do nothing.
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Polygon;
import javax.swing.Icon;
import javax.swing.SwingConstants;
public class TriangleIcon implements Icon, SwingConstants {
     public static int DEFAULT_TRIANGLE_SIZE = 3;
     private boolean enabled;
     private int direction;
     private int triangleSize;
     public TriangleIcon() {
          this(false);
     public TriangleIcon(boolean enabled) {
          this(enabled,NORTH);
     public TriangleIcon(boolean enabled, int direction) {
          this(enabled, direction, DEFAULT_TRIANGLE_SIZE);
     public TriangleIcon(boolean enabled, int direction, int triangleSize) {
          this.enabled = enabled;
          this.direction = direction;
          this.triangleSize = triangleSize;
     public void paintIcon(Component c, Graphics g, int x, int y) {
          if (enabled) {
               g.setColor(Color.BLACK);
          } else {
               g.setColor(Color.LIGHT_GRAY);
          Polygon triangle = new Polygon();
          switch (direction) {
          case NORTH:
               triangle.addPoint(x, y + triangleSize);
               triangle.addPoint(x + triangleSize, y);
               triangle.addPoint(x + triangleSize * 2, y + triangleSize);
               triangle.addPoint(x, y + triangleSize);
               break;
          case EAST:
               triangle.addPoint(x, y);
               triangle.addPoint(x + triangleSize, y + triangleSize);
               triangle.addPoint(x, y + triangleSize * 2);
               triangle.addPoint(x, y);
               break;
          case SOUTH:
               triangle.addPoint(x, y);
               triangle.addPoint(x + triangleSize * 2, y);
               triangle.addPoint(x + triangleSize, y + triangleSize);
               triangle.addPoint(x, y);
               break;
          case WEST:
               triangle.addPoint(x + triangleSize, y);
               triangle.addPoint(x, y + triangleSize);
               triangle.addPoint(x + triangleSize, y + triangleSize * 2);
               triangle.addPoint(x+triangleSize,y);
               break;
          g.fillPolygon(triangle);
     public int getIconWidth() {
          switch (direction) {
          case NORTH:
          case SOUTH:
               return triangleSize*2;
          case EAST:
          case WEST:
               return triangleSize;
          return 0;
     public int getIconHeight() {
          switch (direction) {
          case NORTH:
          case SOUTH:
               return triangleSize;
          case EAST:
          case WEST:
               return triangleSize*2;
          return 0;
     public int getDirection() {
          return direction;
}

Similar Messages

  • Portal application not displaying correctly with frame size 125% in IE

    Dear Expert,
    We are facing issue in Portal (7.0) like, when I open the application "Products Coatings" in myWorkspace with Internet Explorer
    display size 100% the frame "xyz" is displayed correctly:But When I open the application "Product Coatings" in myWorkspace with Internet Explorer display size 125% the same frame is NOT displayed correctly.
    Someone can help me in closing this issue..
    Thanks,
    kundan

    Hi,
    How are you opening your portal application? Is it through iViews? Where are you setting the property as 125%?
    Thanks,
    Mahendran B.

  • Resized header not displaying properly

    Hello all. I'm using the Freestyle "About Me", "Movie", and "Blog" templates. I have resized the page from 700w to 730w. I then went into each template package and resized the 'navfill-v2.jpg', which is the header image, to be 730w instead of 700w so it would fit the created pages. The pages I created from that point displayed properly on my machine locally. That is, when I resized via Inspector from 700w to 730w, the header still fit all the way across. However, when I uploaded my site, the header displays back at its original size of 700w. The rest of the page displays properly at 730w. So, this leaves an ugly gap at the top right corner. My site is at: blogstationlive
    Any ideas? I've looked at the created CSS file, but I didn't see anything helpful. Thanks for your help!
    Mac Mini G4 Mac OS X (10.4.6) 1.42GHz/1GB RAM
    Mac Mini G4   Mac OS X (10.4.6)   1.42GHz/1GB RAM

    Someone asked about this same issue with the header image not too long ago. Here's the thread for your reference...
    http://discussions.apple.com/thread.jspa?messageID=2527130
    The bottom line is that these header images are hardcoded into the xml of the template, and apparently do not respond to changes in their dimensions, even though it may look like so within iWeb. The ultimate solution seems to be to edit the xml and change the dimensions there. The workaround may be to fill in the gap that you see on the right side with a solid color similar to the rest of the header image or maybe cut and paste a block of the same image in there.
    If you find this information useful, please take the time to provide me with feedback by marking my reply as "solved" or "helpful" using those little buttons that you see in the title bar of this reply. I'd really appreciate it!

  • KW 7.0 Contents are not displayed in Content Frame

    Hi Experts,
    We are currently setting up the KW.70 on a new machine - we went through the SAP-installation guide respecting all the OSS-notes.
    I've imported DVD 1 & 2 (EN Training) and when I try to display the training in KW I see nothing.
    Would appreciate any help you can give
    Prasad

    Hello,
    I think, you missed to define in oact the relationship between category QMM with your content repository REX_QM_MANUAL  and category KWNET with your content repository REX_KWNET. at default the content repository SAPDEFAULT is assigned to the two categories.
    Hope that helps
    Frank

  • With You Tube Adobe Flash Player not display in full frame

    Hello,
    I have Adobe Flash player 11.8.800.97 with google chrome latest version.
    When I read a video with You tube i cannot enlarge picture in full frame, it give me a largest screen about 1/4 of my screen on the top left corner and the rest is black?
    I check the version of all software, of Chrome, I clear the cache...What else?
    Thank's for your help
    Illioucha

    There are two different versions of Flash, one version for IE (ActiveX) and another version for all other browsers (Plugin version). You need to install the Plugin version,
    1.Download the Flash setup file from here: <br />
    [http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe Adobe Flash - Plugin version]. <br />
    Save it to your Desktop.<br />
    2. Close Firefox using File > Exit <br />
    then check the Task Manager > Processes tab to make sure '''firefox.exe''' is closed, <br />
    {XP: Ctrl+Alt+Del, Vista: Shift+Ctrl+ESC = Processes tab}
    3. Then run the Flash setup file from your Desktop.
    * On Vista and Windows 7 you may need to run the plugin installer as Administrator by starting the installer via the right-click context menu if you do not get an UAC prompt to ask for permission to continue (i.e nothing seems to happen). <br />
    See this: <br />
    [http://vistasupport.mvps.org/run_as_administrator.htm]

  • Why did the Share dialogue change from display in a frame to not displayed in a frame

    Hello,
    SharePoint 2013 via TFS install package which installed SharePoint Central Administration v4 and a default SharePoint team site.  This is my system:
    When I initially started working with my default SharePoint Team Site (SharePoint - 80) and clicked on SHARE, I was able to see the Share dialogue in a
    popup frame.  I added a single user to the site.  I also stopped the site in order to start the Default Web site; I had to do that because I guess both sites are default installed
    with the same port number.  Then I stopped the Default Web site and restarted the default SharePoint Team Site.  I have no idea if these steps are related, I just thought I should mention them.
    I later noticed that the Share dialogue no longer appears in a pop-up.  Instead I get the following:
    Why did this change?  Can I change it back? (It's not important to me to change back, I just want to know if I can).  If not, why not?
    I also notice that this dialogue in a new window behaves oddly.  After I add a group or user and click Share, the new window returns to a blank page.  I have to close that page and reopen the Share dialogue to add another entity.  Is this
    normal?
    Thanks.
    Best Regards,
    Alan

    Not something i have observed.
    if you can recreate the issue. check what you see in event log and ULS logs.
    also share fiddler \ httpwatch traces

  • ADF web pages not getting displayed inside the frame

    I am working with an Oracle Application called "Oracle Transportation Management"...to which our Development Group have asked to log an issue to this forum thread. Please let us know if you can assist:
    Client has added an external link to an ADF web page in OTM and when they click the link, it gives an error message saying it cannot be displayed within frame. Per the client, if they add frame busting to the deployment descriptor, it makes other screens in OTM to open in new window.
    ERROR:
    Warning: Unable to load content in a frame. Frame content will load at the top level.
    we tried setting "oracle.adf.view.rich.security.FRAME_BUSTING" to "never", but this makes all selections open in a new window.
    How do we correct this?

    Hi,
    wrong forum. If this is an existing application that you are not developing then the problem needs to be tracked by the application owner. If this happens to be Oracle Applications then you can use one of their forums here on OTN. Note that normally setting frame bursting to never indeed should solve the problem
    Note: This context parameter is ignored and will behave as if it were set to never when either of the following context parameters is set to true
    org.apache.myfaces.trinidad.util. ExternalContextUtils.isPortlet
    oracle.adf.view.rich.automation.ENABLED
    Frank
    Edited by: Frank Nimphius on Oct 27, 2010 7:43 AM

  • Custom fields not display in SRM5.5 Basic Data Frame

    Hello Everybody,
          I am working on SRM5.5 Server which i have to add two custom fields in Basic Data Frame..
         No field is display in basic data frame After I added those fields in INCL_EEW_PD_ITEM_CSF_SC and INCL_EEW_PD_ITEM_CSF.
        I added these fields by help of 672960 OSS notes..
       Add also when i execute the program BBP_DYNPROS_GENERATE where I entered the program name as SAPLBBP_PDH_CUF and execute but non of them is working fine..
      Is there anything else do i need to display custom fields in basic data frame??
    I have one more question..
      When you logon through SAPGUI and goto BBPSC01 t.code where you see lots of fields in basic data frame such as unloading point and all.. But those all fields does not display when you logon through WebURL..
      I checked is there any BAdi such CUF or Screenvarient or some Badi has been actived but non of the Badi has been implemented..
      To display all the fields which are display in GUI Mode also should display in URL..
      To bring this functionality , What do i need to do?
      I appreciate if you answer these questions..
    Thanks,
    John.

    Hi Disha,
    We are trying to add custom fields to the Shopping Cart Header. We are using SRM 5.0. We added the fields to the structures "INCL_EEW_PD_HEADER_CSF_SC" & "INCL_EEW_PD_HEADER_CSF".  We are able to see the custom fields. But the issue is , we are able to see the custom fields in the Shopping Cart one step shop scenario. Whereas when we run the wizard which is a 3 step scenario, we are not able to see the custom fields.
    Technically speaking, the custom fields are visible for the ITS BBPSC01 & BBPSC03 , where as these custom fields are not visible for the ITS BBPSC02.
    Please let me know, if we need to append the fields to some other structure to be able to see them in the Shopping cart wizard also.
    I will be gald to provide any kind of info.
    Thanks in advance...

  • Frame line not display in next page of main window

    hi Xpert,
    I am creating layout in SAP SCRIpt,it working fine only the main window of next page  frame line is not display.
    i m define next page as a FIRST page and writing main window of first page following coding
    /:           POSITION XORIGIN '0.50' CM YORIGIN '7.75' CM
    /:           SIZE HEIGHT '17' CM WIDTH '19.25' CM
    /:           BOX  FRAME 10 TW
    when i run the program first page are coming properly and only when i go in second page of output then main window lines not displaying.
    please guide me how to solve this problem.
    Regards,
    pravin

    Hi Praveen,
    In that case why you have to make the main window in the first page and secondry window.
    You can use it as manin window itself. Print the total amount in the main window itself in the first page. and copy that main window to the second page.
    In the first page under the main window create a text. and there u print the total value and text.
    Now copy the main window to the second page..only COPY DONT CREATE NEW.
    In the second page now under the main window create the table to print the line items. What every u add in the second page main window it will come in the first age also in the smartforms. But it will nto get printed in the first page.After the text to print the totals call the COMMAND option and call next page in that.
    Hope you got me..
    Regards
    Ansari

  • Page will not display properly with inline Frames

    I have a html page that will not display properly in Dreamweaver. I have a basic understanding of html and want to be able to edit a website in Dreamweaver that was given to me. It looks fine in a browser, but in Dreamweaver some of the content is missing and displays the following message, "Your browser does not support inline frames or is currently configured not to display inline Frames". I was able to open it without any problems using Microsoft Front Page, so is it possible to view and edit it in Dreamweaver?

    Without seeing your page, I'm guessing that your page contains server-side includes, iframes and  scripts to other files on the server that populate page with content on the server's end.  You can't see it in DW because you don't have all the files in your DW local site folder.  You said this views fine in FP.  Was your page created in FP with FP proprietary tools?
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • Hey Gurus I've just shot a seminar, three cameras, Cannon's reasonably new XA20HD's. File format 1920X1080 MP4 17mbs 25 frames. Am running PremProCS6. I import the files into Prem, they come in ok but will not display. Got a yellow bar and a yellow Media

    Hey Gurus I've just shot a seminar, three cameras, Cannon's reasonably new XA20HD's. File format 1920X1080 MP4 17mbs 25 frames. Am running PremProCS6. I import the files into Prem, they come in ok but will not display. Got a yellow bar and a yellow Media Pending screen. What the? Have to cut this stuff soon! Wont even import into Media Encoder. Says there are no usable streams in the media! Just saw a podcast title about stress in the editing business. Better listen to the one! Any help would be most appreciated. J.

    Copy ALL contents of SD card to a folder on edit hard drive. not just video clips, everything. Then in Premiere, import using Media Browser (tab at lower left of Premiere screen). This usually does the trick. There is metadata contained in the SD card files that is needed, not just the video clips alone.
    Thanks
    Jeff Pulera
    Safe Harbor Computers

  • Outlook web login screen not displaying correctly on Exchange 2007 service pack install

    Hello everyone,
    I believe our exchange server installed a service pack 3 update and after rebooting the server, we noticed that the Outlook web access login screen is not displaying correctly.  The page looks white with some black X's (I think that's where the
    pictures/background images used to be).  We tried to restart the ISS service with no luck.  I would appreciate any help you guys can provide.
    Thanks,
    Brian Kourdou

    Hi,
    I have seen this issue in another similar thread, that issue was solved by re-creating the OWA virtual directory.
    Please try the following steps to solve this issue.
    Open EMC, navigate to Server Configuration -> Client Access, under Outlook Web App tab, double-click owa (default web site) properties.
    Then check InternalURL, ExternalURL, Forms-Based Authentication settings ect
    Open EMS, use Get-OwaVirtualDirectory get the list of virtual directories and identify the directory which is giving the problem.
    Remove it with this command
    Remove-OwaVirtualDirectory “owa (Default Web Site)”
    Now create it again with the following command
    New-OwaVirtualDirectory -OwaVersion “Exchange2007″ -Name “owa (Default Web Site)”
    Then configure the “owa” virtual directory settings like InternalURL, ExternalURL, Forms-Based Authentications etc… & check the OWA by logging with some test users.
    Best Regards.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Lynn-Li
    TechNet Community Support

  • Format Trigger - do not display frame if multiple FIELDs are 0

    Hello,
    I am having trouble creating a format trigger to NOT display a frame if a multiple fields within the frame are 0.0
    The field is named F_number1, F_number2, F_number3
    The frame is called M_numberframe
    All 3 of the fields listed have to be 0.0 in order to not display the frame. If only one is 0 then they still all three need to show.
    Thanks!

    Hello
    The field is named F_number1, F_number2, F_number3These are actually field name's. You will have to write the source name in the format trigger.
    Let say F_NUMBER1 is having souce as my_field1, F_NUMBER2 = my_field2, F_NUMBER3 = my_field3 then
    Go to the frame's PL/SQL Editor by selecting and pressing F11 and write the as below...
    IF :my_field1=0 AND :my_field2=0 AND :my_field3=0 THEN
      RETURN FALSE;
    ELSE
      RETURN TRUE;
    END IF;-Ammad

  • ESS benefits and payment not displaying after support pack update

    Hi All,
    After the latest HR support pack update ESS benefits and payment not displaying
    SAP ECC 604 EPH5
    SAP_ABA 702
    SAP Kernel :  720_EXT_REL
    Kernel Patch number : 439
    Netweaver portal version - 7.30
    please help
    Regards
    Rahul

    Hi Siddharth & Jwala,
    the issue got fixed, by changing the order of Payment above the Benefits
    1. i made some options to be disabled & enabled in both benefits and payment
    2. Then in the portal i could see the benefits and payment
    3. inside the benefits & payment i was able to see two option 1 is for benefits & other is for payment
    4. we only wanted payment functionality to be displaying
    5. so i tried to hide the benefits then noting was getting displayed in the portal
    6. finally i changed the order of the payment just above the benefits
    then then i was able to see the benefits and payment inside that i was able to see the payment where i was able to see the payslip
    i am not sure what i have done but i is working but please let me know what the problem was actually
    Regards
    Rahul

  • In formcentral, why does the "proceed to checkout" button not work? on IE I get error " This content cannot be displayed in a frame...

    In formcentral, why does the "proceed to checkout" button not work? on IE I get error " This content cannot be displayed in a frame. To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame ". On Chrome I get nothing but loading.

    Hi,
     This error is generally specific to Internet Explorer and has two possible causes. The most likely explanation is that your browser has unusual browser security settings. I would recommend you try
    resetting your security settings to defaults (varies by version but all essentially the same). You may also have to turn off
    Protected Mode which is enabled by default on some systems. If you’re seeing this error (or a version of it) outside Internet Explorer, you may have a server-level setting that is preventing your content from being framed.
    Reference:https://social.technet.microsoft.com/Forums/exchange/en-US/1460c5a5-6242-4402-9f6b-bc581bf56478/content-cannot-be-displayed-in-a-frame-when-trying-to-add-item?forum=sharepointgeneral
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Eric Tao
    TechNet Community Support

Maybe you are looking for

  • My iPod 5th gen was working fine and now it won't turn on.

    This morning I was listening to music on it and everything, it was working absolutely fine and went to take a shower, so I locked it. When I came back, it would not respond at all. Like it is on the off screen, with nothing on it. I bought it off a f

  • Problem in Batch Updation After posting

    Hi Experts Currently we are having a problem with one-step stock transfer. We want do automatic GR (Goods Reciept) during PGI (Post Goods Issue) for a delivery. We have done some coding in exit EXIT_SAPLIE01_007 so that even we have XXX batch during

  • MousePaint help!!!!

    I am currently learning how I can use the mouse paint, though the functions are working perfectly however there is some visible but not opaque "duplicates" of the actions' display (for example - combobox "duplicates" when that combobox is clicked and

  • 10.7.4 update problems

    After latest update (10.7.4) having all kinds of problems.  Connecting to Timecapsule, Word doc to printer, opening Preview.  Very glitchy... anyone else?

  • Archive Utility error

    Hi All, Just got the problem with Archive Utility. Getting Error 2, no such a directory. It works great with other applications Any ideas? Thanks /xxx