Java GUI problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babai678
    New Member
    • Oct 2007
    • 5

    #1

    Java GUI problem

    Hi,

    I have built a GUI with java swing on linux env.Within that there is a small rectangular area of green color. The problem is, any other linux window coming infront of that very rect. area , is changing its color.Evanif any other window is covering a part of it, is changing the color of that part of that very area.

    Can someone pls help me out to figure out where the problem lies along with possible solution.

    babai
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by babai678
    Hi,

    I have built a GUI with java swing on linux env.Within that there is a small rectangular area of green color. The problem is, any other linux window coming infront of that very rect. area , is changing its color.Evanif any other window is covering a part of it, is changing the color of that part of that very area.

    Can someone pls help me out to figure out where the problem lies along with possible solution.

    babai
    What is that small rectangular area of green color? A JFrame?
    Can we see the code you used?

    Comment

    • babai678
      New Member
      • Oct 2007
      • 5

      #3
      Originally posted by r035198x
      What is that small rectangular area of green color? A JFrame?
      Can we see the code you used?

      NO, its a JPanel.
      The code associated with that is quite big and scattered here and there.So , don't really know how to give it here.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by babai678
        NO, its a JPanel.
        The code associated with that is quite big and scattered here and there.So , don't really know how to give it here.
        Do you perform some sort of calculations in the paintComponent method of the
        JPanel that changes a Color value?

        kind regards,

        Jos

        Comment

        • babai678
          New Member
          • Oct 2007
          • 5

          #5
          Originally posted by JosAH
          Do you perform some sort of calculations in the paintComponent method of the
          JPanel that changes a Color value?

          kind regards,

          Jos
          In the paintComponent ( ) calculation are made only regarding the size of the area.
          Actually, depending on a particular variable the color is determined and then only the paintComponent( ) is called.

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by babai678
            In the paintComponent ( ) calculation are made only regarding the size of the area.
            Actually, depending on a particular variable the color is determined and then only the paintComponent( ) is called.
            Is that "depending on a particular variable the color is determined" calculation
            performed in the "paint()" method?

            Colors are not supposed to change "automagica lly" some piece of code is
            responsible for the change. The behaviour you described seems to be performed
            initiated from the AWT thread.

            kind regards,

            Jos

            Comment

            Working...