Flickerring Problem With JPopUpMenu

Hello Friends,
In my application made in Java i show a JPopUpmenu on a JINternalFrame in a DekstopPane which is further kept in JFrame. The contents of the PopUpMenu may vary as according to the various places where the mouse is clicked. Sometimes when the mouse may be clicked on the lower part of the applciation some part of the PopUpmenu goes out of the visible area of the screen. For that after showing the popupmenu i get the height of the popup menu and shift it accordingly so that its length doesnt go out of the viewable area. It works fine but the problem is that it gives a little flicker. And alsoo of i try to set the position before showing the pop up menu i am not able to do so because before calling the show() method of the popUPmenu i am getting the height and width of the pop up menu. Please help me out.
Any type of pointers and links would be highly helpful.
Thanks in Advance
Vikram.

HI!
it didnt work
here is the code snippet
          popupClass.pack();
          popupClass.requestFocus();          
          java.lang.System.out.println(" HEIGHTTTTT "+popupClass.getHeight());
          int Height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
          int Width = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
          if ((DiagramInternalPane)getParent() != null)
               if(((mouseY+popupClass.getHeight()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getVerticalScrollBar().getValue()+AsterixApplet.getFrame().getY()) > Height-160) && ((mouseX+popupClass.getWidth()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getHorizontalScrollBar().getValue()+AsterixApplet.getFrame().getX()) > Width-20))
                    popupClass.show(comp,mouseX-popupClass.getWidth(), mouseY-popupClass.getHeight());
               else
                    if((mouseY+popupClass.getHeight()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getVerticalScrollBar().getValue()+AsterixApplet.getFrame().getY()) > Height-160)
                         popupClass.show(comp,mouseX, mouseY-popupClass.getHeight());
                    if((mouseX+popupClass.getWidth()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getHorizontalScrollBar().getValue()+AsterixApplet.getFrame().getX()) > Width-20)
                         popupClass.show(comp,mouseX-popupClass.getWidth(), mouseY);     
          if(getParent() != null)     
               getParent().repaint();
          popupClass.show(comp,mouseX, mouseY);                
          java.lang.System.out.println(" HEIGHTTTTT AAAAAAAAAAAAAAAA"+popupClass.getHeight());
Before caluing the show() , method i am getting the height as 0 and only after calling the show method i am getting the actual height. Is it a java bug or something ?
Anyway thanks for all ur help

Similar Messages

  • Facing "Display Flickering" problem with my 15" macbook pro(A1286)while swapping the desktops and closing the tabs.....need help...reply soon

    Suggest Solution for this Display Flickering problem ....

    Hi, I read the post about calibration and I probably do that a little too often TBH! As I get so little time out the battery and mainly use my MBP on my lap, usually with the power supply near by, it gets charged to full, run to empty to the point of sleep, or sometimes it even cuts out and then is recharged to full again, so I really think it's new battery time. I've seen non Apple Official ones for between £35 and £65 that have 3 year warranties and state they are around 5200mh but am unsure due to reviews.
    Later...
    Anyway's I have now ordered a non Apple replacement from Amazon for about £35 and it has several good reviews and 4.5 out of 5 stars so I'll see if it works and report back. If it doesn't I'll send it back and get the Official Apple one.
    Message was edited by: Missy Steph

  • Flickering problem with Apple TV

    I am suddenly having flickering problems after updating Apple TV.  The box has worked fine for several months though I did have this same problem when I first got it in February.  I have a Panasonic 37' viera.  I have unplugged both the TV and the Apple TV box, reset it a number of times.  Don't know what to do.

    I'm having the same issue, albeit right out of the box.  I hooked up my Apple TV according to the instructions, have no other issues with my wifi, and the HDMI and power cables are all securely connected.  My TV's also a Samsung, experiecing the same "flickering" of audio.  In addition, during set-up, the screen was also flickering to white while inputting my wifi info.
    Am hoping swapping it out in store will fix the problem. I was so excited to get my AppleTV in the mail and everything else Apple-to-TV has been working great. (I had my ancient black MacBook -turning 6 in June- hooked up with zero connectivity problems.)  Wondering if this will be an ongiong issue? Had decided against AppleCare for such an inexpensive addition to my home, but maybe I should re-think that decision...

  • Flickering problem with R9 270X 4G LE

    I am having a problem with a flickering screen during and 2D operation, everything is fine during any 3D operations(ie. gaming). I assume from reading other forum posts that I need to update my bios even though LiveUpdate says that its good. My S/N is 602-V303-20SB1403059248. Any help would be appreciated.

    I think that I have attached the file you are wanting. Thanks for your help. Pitcairn.zip (96.75 kB - downloaded 13 times.)

  • Flickering problem with live viewing with IMAQ Image Display

    Hi everyone,
    I am trying to write a program to do live imaging with Andor camera. I am using some examples from Andor. The images are acquired in sequence and send into IMAQ Image Display and also Intensity Graph. There is minimal flickering issue in the Intensity Graph but there is very bad flickering problem in IMAQ Image Display. Perhaps I misunderstand how to optimize the vision tools. Does anyone know how to overcome this issue? I have attached the code that I am testing. Thanks in advance.
    Best regards,
    Han Yen
    Solved!
    Go to Solution.
    Attachments:
    iXonRTA_live_0.0.1.vi ‏70 KB

    You can use Vision Assistant to test our vision functions. Vision Assistant is really meant to prototype - it does not have all teh functionality of Vision Development Module and is not as flexible as we don't allow you access to all the settings for every function.
    I recommend starting in Vision Assistant and then porting over to LabVIEW or C (whatever you are most comfortable with)...this is built-in functionality. There is nothing wrong with using Vision Assistant to do live imaging, just that you run into limitations and you will only be able to use this code on computers that have Vision Assistant.
    Hope this helps.
    --Michelle
    Instrument Control R&D
    National Instruments
    Instrument Control
    Machine Vision

  • Problems with JPopupMenu

    Hi :
    I have a problems with a JPopupMenu.
    I have a JTable in a modal JDialog with some rows and I want to make some action with some rows so I make JPopupMenu visible with right click (no problem) but, when it reachs the JDialog border, it appears cut because it can't paint out of JDialog limits.
    What can I do to watch the entire JPopupMenu ? It's urgent.
    Thanks.
    Miquel

    This is because the Popupmenu is a lightweight component (which can't display beyond the borders of the window), try myPopup.setLightWeightPopupEnabled(false); that makes all popups in your app heavyweight.

  • Brightness/Flickering problem with left hand side of 2011 iMac display

    Hi,
    My 2011 iMac has recently developed a fault with the left hand side of the display flickering and being very dark. I've googled this and found that many other people seem to have this issue. As per other forum posts, if I apply a little pressure to the bottom left of the screen then this temporarily resolves itself, but this is obviously not a permanent solution.
    I'm not happy as my £1500 iMac is only 18 months old, and I've been told from an authorised apple repair centre, that it's going to cost £600 to fix.
    I've spent the best part of an hour trying to call apple to speak to a human being, but the automated voice menu wants to charge me £35 before even putting me through. Does anyone have a phone number which would allow me to speak to a real person so I can make a complaint?
    Paul.

    Sounds like it will be an international call (and sounds like you have all the local numbers), but you might try calling Cupertino and then ask for customer support
    408-996-1010
    Unless there were some repair program for this issue, if it's out of warranty, I doubt you'll get very far with it.

  • Flickering problem with applet

    After doing a programming lab assignment, with no work, I decided to modify one of the completed programs, which was a pong-like game. Anyways, after changing it to a white on black setup, I now get major flickering. One of the previous programs was to animate something without it flickering using a buffered image. So I converted it over, but it had no effect.
    import java.applet.Applet;
    import java.awt.*;
    public class PongGame2 extends Applet
         int paddleX, paddleY, ballX, ballY, incX, incY, score, appletWidth, appletHeight;
         Image virtualMem;
         Graphics gBuffer;
         public void init()
              ballX = 10;
              ballY = 10;
              incX  = 3;
              incY  = 3;
              score = 0;
              appletWidth = getWidth();
              appletHeight = getHeight();
              virtualMem = createImage(appletWidth, appletHeight);
              gBuffer = virtualMem.getGraphics();
         public void paint(Graphics g)
              draw(g, paddleX, paddleY, ballX, ballY);
              ballX += incX;
              ballY += incY;
              if (incY > 0 && ballY > 580-incY)
                  incY = -incY;
              else if (incY < 0 && ballY < 2*incY)
                  incY = -incY;
              if (ballY < paddleY && ballY >= paddleY-20 && ballX > paddleX && ballX < paddleX+100)
                   incY = -incY;
              if (ballY > paddleY + 10 && ballY < paddleY + 20 && ballX > paddleX && ballX < paddleX+100)
                  incY = -incY;
              if (incX > 0 && ballX > 780-incX)
                  incX = -incX;
              else if (incX < 0 && ballX < 2*incX)
                  incX = -incX;
              if (ballY < 1)
                   score++;
               try
                    Thread.sleep(7);
               catch(InterruptedException ex)
              repaint();     
         public boolean mouseMove(Event e, int x, int y)
              paddleX = x-50;
              paddleY = y-10;          
              repaint();
              return true;
         public boolean mouseIdle(Event e, int x, int y)
              repaint();
              return true;
         public void createBackground(Graphics g)
              gBuffer.setColor(Color.black);
              gBuffer.fillRect(0,0,800,600);
              gBuffer.setColor(Color.white);   
              gBuffer.drawString("Score: " + score/5,200,20);
         public void draw(Graphics g, int paddleX, int paddleY, int ballX, int ballY)
              createBackground(g);
              gBuffer.setColor(Color.white);
              gBuffer.fillRect(paddleX,paddleY,100,20);
              gBuffer.fillOval(ballX,ballY,20,20);
              g.drawImage(virtualMem,0,0,this);
    }

    Petes1234, thanks!
    It works perfectly now, and without having warnings of using deprecated features. It took me a while though to find how to set this up, and proper methods.
    Here's the code right now:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;
    public class JavaPongGame1 extends JApplet implements MouseMotionListener
         int paddleX, paddleY, ballX, ballY, incX, incY, score;
         public void init()
              ballX = 10;
              ballY = 10;
              incX  = 3;
              incY  = 3;
              score = 0;
              addMouseMotionListener(this);
         public void paint(Graphics g)
              draw(g, paddleX, paddleY, ballX, ballY);
              ballX += incX;
              ballY += incY;
              if (incY > 0 && ballY > 580-incY)
                  incY = -incY;
              else if (incY < 0 && ballY < 2*incY)
                  incY = -incY;
              if (ballY < paddleY && ballY >= paddleY-20 && ballX > paddleX && ballX < paddleX+100)
                   incY = -incY;
              if (ballY > paddleY + 10 && ballY < paddleY + 20 && ballX > paddleX && ballX < paddleX+100)
                  incY = -incY;
              if (incX > 0 && ballX > 780-incX)
                  incX = -incX;
              else if (incX < 0 && ballX < 2*incX)
                  incX = -incX;
              if (ballY < 1)
                   score++;
              try
                    Thread.sleep(7);
               catch(InterruptedException ex)
              repaint();
         public void mouseMoved(MouseEvent e)
              paddleX = e.getX()-50;
              paddleY = e.getY()-10;          
              repaint();
              e.consume();
         public void mouseDragged(MouseEvent e)
         public void createBackground(Graphics g)
              g.setColor(Color.black);
              g.fillRect(0,0,800,600);
              g.setColor(Color.white);   
              g.drawString("Score: " + score/5,200,20);
         public void draw(Graphics g, int paddleX, int paddleY, int ballX, int ballY)
              createBackground(g);
              g.setColor(Color.white);
              g.fillRect(paddleX,paddleY,100,20);
              g.fillOval(ballX,ballY,20,20);
    }

  • Flickering problem with loadMovie()

    Hi
    I am developing an application in which i need to call
    external swf files in my movieclips.
    When i load an external swf file in to movieclip some
    flickering effect take place.
    so is there any solution to overcome this problem.
    Thanks In Advance.......

    I think that I have attached the file you are wanting. Thanks for your help. Pitcairn.zip (96.75 kB - downloaded 13 times.)

  • Flickering problem with 2011 macbook pro unibody

    I have a 17" 2011 Macbook Pro Unibody and when I connect the computer to the TV via Mini Display Port (HDMI), the TV is either not receiving any signal, or screen is flickering, however, my other 13" 2010 Macbook Pro Unibody has no problem when connected to the TV.  Does anyone know the reason to the problem?

    I had the same problem, and I cant say which fixed it, but i deleted the plist file then reset the pram and it worked
    Quit System Preferences and delete...
    Users/yourname/Library/Preferences /com.apple.systempreferences.plist
    and to reset the pram reset the puter and before the chime hold alt+command+p+r and keep holding until you hear the chime a second time...
    really hope this helps

  • Problem with JPopupMenu and JTree

    Hi,
    Is there any way to have different JPopupMenu for every node.
    When I right click on the treenode there is popup menu have a "*JCheckBoxMenuItem*". By default the value of that checkbox is false. Now when i try to right click on a particular node and select the checkbox the selected value gets applied to rest of all nodes also.
    How can i just set the value of the checkbox to one perticular node.
    my code is
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    public class TreePopupMenuTest {
      public JComponent makeUI() {
        JTree tree = new JTree();
        tree.setComponentPopupMenu(new TreePopupMenu());
        JPanel p = new JPanel(new BorderLayout());
        p.add(new JScrollPane(tree));
        p.setPreferredSize(new Dimension(320, 240));
        return p;
      class TreePopupMenu extends JPopupMenu {
        private TreePath path;
        private JCheckBoxMenuItem compress=new JCheckBoxMenuItem("Compress");
        public TreePopupMenu() {
          super();
          add(compress);
          compress.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ie) {
                            if(compress.getState()){
                                 compress.setState(true);
                                    System.out.println("compress clicked");
                            else{
                                 compress.setState(false);
                                    System.out.println("uncompress");
        public void show(Component c, int x, int y) {
          JTree tree = (JTree)c;
          path = tree.getPathForLocation(x, y);
          if(path!=null && path==tree.getAnchorSelectionPath()) {
            super.show(c, x, y);
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() { createAndShowGUI(); }
      public static void createAndShowGUI() {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new TreePopupMenuTest().makeUI());
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }Please help me as soon as possible.
    Thanks.
    Edited by: Kavita_S on Apr 23, 2009 11:49 PM

    Hi,
    Do you know this link?
    [How to Use Trees|http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html]
    Please help me as soon as possible.Sorry that I'm not good at English, I don't understand what you mean.
    Anyway, here's a quick example:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    public class TreePopupMenuTest3 {
      public JComponent makeUI() {
        JTree tree = new JTree();
        tree.setComponentPopupMenu(new TreePopupMenu());
        JPanel p = new JPanel(new BorderLayout());
        p.add(new JScrollPane(tree));
        p.setPreferredSize(new Dimension(320, 240));
        return p;
      class TreePopupMenu extends JPopupMenu {
        private TreePath path;
        private JCheckBoxMenuItem compress = new JCheckBoxMenuItem("Compress");
        public TreePopupMenu() {
          super();
          add(compress);
          compress.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ie) {
              if (compress.getState()) {
                System.out.println("compress clicked");
                setSelectedPath(path, true);
              } else {
                System.out.println("uncompress");
                setSelectedPath(path, false);
        public void show(Component c, int x, int y) {
          JTree tree = (JTree)c;
          path = tree.getPathForLocation(x, y);
          if (path!=null && path==tree.getAnchorSelectionPath()) {
            compress.setState(isSelectedPath(path));
            super.show(c, x, y);
      class MyData {
        public boolean flag;
        public String name;
        public MyData(String name, boolean flag) {
          this.name = name;
          this.flag = flag;
        @Override public String toString() {
          return name;
      //private Set<TreePath> selectedPath = new HashSet<TreePath>();
      private void setSelectedPath(TreePath p, boolean flag) {
        //if (flag) selectedPath.add(p);
        //else    selectedPath.remove(p);
        DefaultMutableTreeNode node =
              (DefaultMutableTreeNode)p.getLastPathComponent();
        Object o = node.getUserObject();
        if (o instanceof MyData) {
          ((MyData)o).flag = flag;
        } else {
          node.setUserObject(new MyData(o.toString(), flag));
      private boolean isSelectedPath(TreePath p) {
        //return selectedPath.contains(p);
        Object o =
              ((DefaultMutableTreeNode)p.getLastPathComponent()).getUserObject();
        return (o instanceof MyData)?((MyData)o).flag:false;
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
            createAndShowGUI();
      public static void createAndShowGUI() {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new TreePopupMenuTest3().makeUI());
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

  • Flickering Problem with ITunes

    As I roll my cursor over ITunes, Itunes flickers black. Sometimes I lose the bars across the top and sides, sometimes I lose the main/center ITunes screen, sometimes I lose ITunes altogether. No matter which turns black, it takes several clicks of the mouse to get the screen back, only to have the entire process to start again on the next click of the mouse.
    The black flicker is extremely troublesome and delays all of the uses of ITunes and makes watching TV Shows and Movies impossible.

    I have experienced this when copying audio books.  Even a space makes a difference in any field.
    Check your "Get Info" settings.  These settings must be EXACTLY the same for that album.

  • ALV flickering problem

    Hi,
    I have  flickering problem with ALV control (cl_gui_alv_grid).  My alv grid  control is not in edit mode.
    I am using ALV grid for event planning with drag drop operations, so there may be 1000+ rows sometimes at grid.
    Also I call refresh_table_display with soft_refresh and is_stable='XX.'
    (I call cfw=>set_new_ok_code to trigger PBO. refresh_table_display is being called at PBO )
    It flickers just a second or two after drop_complete but it is critical for usability.
    I think flickering happens because of scrolling, so I used set_scroll_via_id but nothing changed.
    Thanks.

    Hi Manu,
    I tried not to trigger PBO (Called refresh_table_display at PAI, commented set_new_ok_code)
    It does not help..
    (Same behaviour : se38-> BC_ALV_TEST_GRID_PERFORMANCE.Increase record count to 5000.Run.
    Scroll to the bottom of list.)
    Thank you..

  • Problems with ATI Radeon HD 2600, electrical interference or flickering pix

    Problems with ATI Radeon HD 2600, electrical interference or flickering pixels
    I have a Macro 8 core purchased just 4 months ago with the ATI Radeon HD 2600. Just started getting what looks like electrical interference or flickering pixels all over the screen. It gets worse and worse to the point where i see and cant work then clears up for an hour and then comes back.
    If I change the resolution from 1680x1050 to 1600x1200 everything looks fine and the problem goes away.
    Monitor works fine on two other computers, driver is up to date.
    Would like to upgrade at some point just disappointed that I’m already having problems.
    Any suggestions would be very helpful, in the mean time I’ll searching the forums.
    Thanks,

    When you called Applecare or went to a Genius bar were they of no help?

  • MDIChildren flickering problem while switching between child form with dockstyle.fill and borderstyle.none

    I have an mdi applicaton in Visual studio 2010 (.Net framework 4.0). I'm having a flickering problem when user switch between an MDI Child form. I'm declaring the child form then setting the borderstyle.none at design time and dock property to fill
    through programming and make them a MDIChildren before I show them so that it takes up the entire space of the MDI Parent window without being maximized (client request). 
    i don't want to display control box(minimize, maximize,close) of child form in mdi parent form. (client request)
    The problem is that when the child form is being displayed it is briefly shown in it's default size with icon and control box before being resized to fill the available area on the MDI Parent form. When a Child Form loads, you can see it in it's original
    size (the size from Design-time) then all this flickering while maximizing .
    In other words, child form show up in the client area of the MDIForm, not maximized, with a caption, very shortly, before they are finally filling the client area. there is a short flicker when a new form is created and displayed. This process is most noticeable
    with a not-so-powerful PC or there are lots of control inside child form.
    below is my code to show child form 
       MyChild1 c1 = new MyChild1();
                                c1.MdiParent = MdiMainParent;
                                c1.Dock = DockStyle.Fill;
       c1.Show(); 
    how can i solved the problem of flickering issue?
    I tried many options which i have described below
    1.double buffering.
    2.set style property to child form
          this.SetStyle(ControlStyles.UserPaint, true);
          this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
          this.SetStyle(ControlStyles.DoubleBuffer, true); 
    3. override below method in each child form
    protected override CreateParams CreateParams
                get
                    CreateParams cp = base.CreateParams;
                    cp.ExStyle |= 0x02000000;
                    return cp;
    4. override below method in each child form
      const int WM_NCPAINT = 0x85;
            const int WM_SIZE = 0x05;
            protected override void WndProc(ref Message m)
                if (m.Msg == WM_NCPAINT)
                    if (this.WindowState == FormWindowState.Maximized)
                        return;
                if (m.Msg == WM_SIZE)
                    if (this.WindowState == FormWindowState.Maximized)
                        return;
                base.WndProc(ref m);
    but I didn't see any effects.  please someone help me to resolve flickering issue. thanks in advance.

    Hi hardikvaishnav,
    This is a known issue which has been reported to Microsoft Connect. Unfortunately, this issue will not fix due to stability issues around MDI. For more details, see 
    https://connect.microsoft.com/VisualStudio/feedback/details/97787/border-of-mdi-child-form-flashes-up-despite-formborderstyle-none.
    You might use a user control or panel instead.
    Best Regards,
    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

Maybe you are looking for

  • Cannot pick up calls on wait, Cannot make a second call holding the first call

    I have a really weird problem with my iPhone 5S. (iOS 7.1) 1. When I am on a call, I am not able to pick up a second call that is on wait. I can see the second call, I can hear the beep sounds but as soon as I pick up, the call freezes in 00.00 time,

  • ALV with colors

    Hello, Does anyone know how I can change the color of a row in ALV? Like the zebra from in standard R/3. thanks, Vishal

  • RSS Feed not validating "Undefined item element: itunes:order"

    I've been trying to submit my RSS feed to iTunes but it won't validate. I hosted the podcast on Podomatic and used Feedburner to create the RSS feed. When I checked the link on FeedValidator it gives me the error Undefined item element: itunes:order.

  • Data Guard  demo

    hi frinedf i need Data Guard DEmo perfect helpp me

  • Exporting from Dreamweaver to Photoshop/AE

    Hey all! I'm brand new to dreamweaver because I work more with design and motion graphics than the web. However, I'm making a video consisting of several websites and instead of doing a complete design from scratch, I'm wanting to get the code from a