πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8567

Re: setCursor action

#8567
From: JPBallet
Date: Tue, 08 Aug 2000 00:00
77 lines
3178 bytes
Hello,
that is a part of my code
public class CadreExpo extends JWindow{

  CardLayout cardLayoutWest = new CardLayout(); // a Cardlayout with a lot
of JPanel
  .........................................................................
  JPanel jPanelImageWest = new JPanel(); // One of JPanel
  JButton jButSatFrIr= new JButton();   // JButton within JPanelImageWest
  JButton jButSatFrVisible = new JButton();// idem
  JButton jButPreiso24 = new JButton(); // idem
  .............................................................
.................................................................
public CadreExpo() {
..........................
    try  {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
   // i put a default HAND_CURSOR  here
   jButSatFrVisible.setCursor(new Cursor(Cursor.HAND_CURSOR));
   jButSatFrIr.setCursor(new Cursor(Cursor.HAND_CURSOR));
    jButPreiso24.setCursor(new Cursor(Cursor.HAND_CURSOR));
..................................
}

....

  void jButSatFrVisible_mouseEntered(MouseEvent e) {
       jButSatFrVisible.setBackground(Color.blue);
       jButSatFrVisible.setForeground(Color.white);
  }

  void jButSatFrVisible_mouseExited(MouseEvent e) {
       jButSatFrVisible.setBackground(new Color(255,206,49));
      jButSatFrVisible.setForeground(Color.black);
  }

  void jButSatFrIr_mouseEntered(MouseEvent e) {
       jButSatFrIr.setBackground(Color.blue);
       jButSatFrIr.setForeground(Color.white);
  }

  void jButSatFrIr_mouseExited(MouseEvent e) {
       jButSatFrIr.setBackground(new Color(255,206,49));
      jButSatFrIr.setForeground(Color.black);
  }


}

When the mouse is over a JButton, i have the HAND-CURSOR, but the original
cursor appear only when it leave the JPanel or when it go into a JButton
where no setCursor(new Cursor(Cursor.HAND_CURSOR));
is defined. it does not change when it leave the JButton.
i don't know if my explanation is clear???
JP Ballet

John P. McGrath a οΏ½crit dans le message ...
>On Mon, 7 Aug 2000 08:42:13 +0200, JPBallet wrote:
>
>> Thank's that works fine. But the cusor don't change when
>> it exit the JButton but when it enter into the next JButton.
>> When rollover the JPanel they are no change!!!
>> Why?
>
>It works for me (with other JComponents), and without seeing your source
>code, it is not possible to tell why it does not work for you.  If you
>produce a small runnable example that demonstrates the problem, I will
>take a look at it for you.
>
>--
>Regards,
>
>John McGrath
Technical Details
Message-ID: <8moi7d$3k82@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8m6dop$ees2@bornews.borland.com> <MPG.13f159f46c3573f8989a84@forums.borland.com> <8mll0d$1ch9@bornews.borland.com> <MPG.13f9450a48c6a3a1989a99@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,a9095c28cba148d7
X-Google-Attributes: gid111d45,public
From: "JPBallet" <jean-pierre.ballet@meteo.fr>
Subject: Re: setCursor action
Date: 2000/08/08
Message-ID: <8moi7d$3k82@bornews.borland.com>
X-Deja-AN: 655766517
References: <8m6dop$ees2@bornews.borland.com> <MPG.13f159f46c3573f8989a84@forums.borland.com> <8mll0d$1ch9@bornews.borland.com> <MPG.13f9450a48c6a3a1989a99@forums.borland.com>
Organization: METEO-FRANCE
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: borland.public.jbuilder.java.swing