Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9088543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:55:38+00:00 2026-06-16T21:55:38+00:00

I’m trying to make an applet that displays a Jzy3D graph that’s manipulable. Currently

  • 0

I’m trying to make an applet that displays a Jzy3D graph that’s manipulable. Currently I’ve managed to get it to display the graph but I can’t affect it in anyway; this makes sense as the applet currently isn’t looking for any user input.

How am I supposed to pick up user input (the mouse moving, clicking, etc)? I suppose I could try to make a messenger class that picks up applet input and sends it to Jzy3D which then takes the movement and does things with it but that seems very complicated. Looking at the Community Discussion Board, it was suggested to use JOGLAppletLaucher. Is the point of that to bypass this problem? If so, how is it supposed to do so?

EDIT: I believe I understand now the point of JOGLAppletLauncher (and its succesor JNLPAppletLauncher) but the question of how to transmit user input still stands. Any ideas?

my current code:

package daniel.work;

import java.applet.Applet;

import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

import com.sun.opengl.util.JOGLAppletLauncher;

public class SimpleApplet extends JApplet {

  public void start(){
      try{
          SwingUtilities.invokeAndWait(new Runnable(){
              public void run(){

                  add(ScatterCanvas.generateCanvas());

              }
          });
      }
      catch(Exception e){
          System.out.println(e);
      }
  }
}

and

package daniel.work;

import java.awt.Canvas;

import org.jzy3d.chart.Chart;
import org.jzy3d.colors.Color;
import org.jzy3d.demos.AbstractDemo;
import org.jzy3d.demos.Launcher;
import org.jzy3d.maths.Coord3d;
import org.jzy3d.plot3d.primitives.Scatter;


public class ScatterCanvas extends AbstractDemo{

    public static Canvas generateCanvas(){
            // Create the dot cloud scene and fill with data
            int size = 2000;
            float x;
            float y;
            float z;
            float a;

            Coord3d[] points = new Coord3d[size];
            Color[]   colors = new Color[size];

            for(int i=0; i<size; i++){
                    x = (float)Math.random() - 0.5f;
                    y = (float)Math.random() - 0.5f;
                    z = (float)Math.random() - 0.5f;
                    points[i] = new Coord3d(x, y, z);
                    a = 0.25f + (float)(points[i].distance(Coord3d.ORIGIN)/Math.sqrt(1.3)) / 2;
                    colors[i] = new Color(x, y, z, a);
            }

            Scatter scatter = new Scatter(points, colors);
            chart = new Chart();
            chart.getScene().add(scatter);
            return (Canvas) chart.getCanvas();
    }


    protected static Chart chart;

    @Override
    public void init() throws Exception {
        // TODO Auto-generated method stub

    }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:55:39+00:00Added an answer on June 16, 2026 at 9:55 pm

    Got it! Here’s my code. I also changed my generateScatter to now return Chart “return chart” as opposed to ICavnas

    package myjogl;
    
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.SwingUtilities;
    
    import org.jzy3d.chart.Chart;
    import org.jzy3d.chart.controllers.mouse.ChartMouseController;
    import org.jzy3d.chart.controllers.thread.ChartThreadController;
    import org.jzy3d.plot3d.rendering.canvas.ICanvas;
    
    
    @SuppressWarnings("serial")
    public class JzyApplet extends JApplet implements ActionListener{
    
    private Chart chart = null;
    private ICanvas canvas = null;
    
    public void init(){
        try{
            SwingUtilities.invokeAndWait(new Runnable(){
                public void run(){
                    chart = ScatterCanvas.generateCanvas(); //this just returns a chart object with a scatter object
                    canvas = chart.getCanvas();
    
                    add((Component) canvas);                
                }
            });     
        }
        catch(Exception e){
            System.out.println(e);
        }   
    
        ChartMouseController mouse   = new ChartMouseController();
    
        chart.addController(mouse);
    
    
        ChartThreadController thread = new ChartThreadController();
        mouse.addSlaveThreadController(thread);
        chart.addController(thread);
    
        thread.start();
    
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {}
    
    public void zoom(){
        float value = canvas.getView().getBounds().getXmax()-10;
        canvas.getView().getBounds().setXmax(value);
        canvas.getView().shoot();
    }
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.