🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Can't change cursor

#10846
From: Carlos Javier Castro Pena
Date: Mon, 09 Aug 1999 00:00
83 lines
3478 bytes
The following works for me:

this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
...
this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

Dave Sowerby wrote:

> The simplest of problems ..
>
> using setCursor appears to nothing whatsoever, ie.e the default cursor
> remains. To ensure I hadn't done somthing obscure, I generated a basic
> app using the wizard and added a couple of buttons to change cursor, but
> still nothing.  What have I missed?
>
> The code:
>
> package untitled3;
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> public class Frame1 extends Frame {
>         JButton jButton1 = new JButton();
>         JButton jButton2 = new JButton();
>
>         //Construct the frame
>   public Frame1() {
>                 enableEvents(AWTEvent.WINDOW_EVENT_MASK);
>                 try  {
>                         jbInit();
>                 }
>                 catch(Exception e) {
>                         e.printStackTrace();
>                 }
>         }
>
>         //Component initialization
>   private void jbInit() throws Exception  {
>                 jButton1.setText("jButton1");
>                 jButton1.setBounds(new Rectangle(4, 23, 115, 27));
>                 jButton1.addActionListener(new
> java.awt.event.ActionListener() {
>
>                         public void actionPerformed(ActionEvent e) {
>                                 jButton1_actionPerformed(e);
>                         }
>                 });
>                 this.getContentPane().setLayout(null);
>                 this.setSize(new Dimension(400, 300));
>                 this.setTitle("Frame Title");
>                 jButton2.setText("jButton2");
>                 jButton2.setBounds(new Rectangle(263, 73, 137, 27));
>                 jButton2.addActionListener(new
> java.awt.event.ActionListener() {
>
>                         public void actionPerformed(ActionEvent e) {
>                                 jButton2_actionPerformed(e);
>                         }
>                 });
>                 this.getContentPane().add(jButton1, null);
>                 this.getContentPane().add(jButton2, null);
>         }
>
>         //Overridden so we can exit on System Close
>   protected void processWindowEvent(WindowEvent e) {
>                 super.processWindowEvent(e);
>                 if(e.getID() == WindowEvent.WINDOW_CLOSING) {
>                         System.exit(0);
>                 }
>         }
>
>         void jButton1_actionPerformed(ActionEvent e) {
>     Cursor c=Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
>     this.getContentPane().setCursor(c);
>         }
>
>         void jButton2_actionPerformed(ActionEvent e) {
>     this.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
>
>         }
> }
Technical Details
Message-ID: <37AEF67A.FC4C6ED9@ittc.ukans.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37ABE950.2F89@virgin.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,82b4f2c4612deaa1
X-Google-Attributes: gid111d45,public
From: Carlos Javier Castro Pena <jcaspen@ittc.ukans.edu>
Subject: Re: Can't change cursor
Date: 1999/08/09
Message-ID: <37AEF67A.FC4C6ED9@ittc.ukans.edu>
X-Deja-AN: 510631352
Content-Transfer-Encoding: 7bit
References: <37ABE950.2F89@virgin.net>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Information and Telecommunication Technology Center
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing