Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #26868

Re: Basic 2d graphics in Java

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Basic 2d graphics in Java
Date Thu, 12 Dec 2013 17:42:07 -0500
Organization A noiseless patient Spider
Lines 50
Message-ID <l8de66$2ei$1@dont-email.me> (permalink)
References <527c86f0-1b3d-4103-bd42-a5dcd9ade567@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 12 Dec 2013 22:43:18 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="6b9e92482af47766954d85fb77d372f5"; logging-data="2514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Mxw4mFjOf1/Pro3BK+eN26ujYkDErZiU="
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10
In-Reply-To <527c86f0-1b3d-4103-bd42-a5dcd9ade567@googlegroups.com>
Cancel-Lock sha1:GukwE9qfrAAAJF7+9ncE976XlJA=
Xref csiph.com comp.lang.java.programmer:26868

Show key headers only | View raw


On 12/12/2013 11:45 AM, tomcees_pc@yahoo.com wrote:
> Hello:
>
> I'm working through re-learning java and would like to solicit some help.
>
> Can anyone share some simple java code to:
>
> 1.  Set up a small (say 320w x 240h) 2d window.
> 2.  Set(color) and Read (color) of pixels within this window.
>
> TIA for your help,
> TomC
>
Just cause so many are heaping on Swing lately.

package pixel.test;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelReader;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class PixelTest extends Application {
	
   WritableImage image = new WritableImage(320,240);
   PixelReader pixelReader = image.getPixelReader();
   PixelWriter pixelWriter = image.getPixelWriter();

   //setPixel and readPixel left as an exercise

   @Override
   public void start(Stage primaryStage) {
     ImageView imageView = new ImageView();
     imageView.setImage(image);
     StackPane root = new StackPane();
     root.getChildren().add(imageView);
     Scene scene = new Scene(root, 320, 240);
     primaryStage.setTitle("Pixel Test");
     primaryStage.setScene(scene);
     primaryStage.show();
   }

   public static void main(String[] args) {
     launch(args);
   }
}

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Basic 2d graphics in Java tomcees_pc@yahoo.com - 2013-12-12 08:45 -0800
  Re: Basic 2d graphics in Java markspace <markspace@nospam.nospam> - 2013-12-12 09:39 -0800
  Re: Basic 2d graphics in Java lipska the kat <"lipskathekat at yahoo dot co dot uk"> - 2013-12-12 19:07 +0000
    Re: Basic 2d graphics in Java Joerg Meier <joergmmeier@arcor.de> - 2013-12-12 20:43 +0100
      Re: Basic 2d graphics in Java lipska the kat <"lipskathekat at yahoo dot co dot uk"> - 2013-12-12 19:47 +0000
  Re: Basic 2d graphics in Java lipska the kat <"lipskathekat at yahoo dot co dot uk"> - 2013-12-12 20:14 +0000
    Re: Basic 2d graphics in Java tomcees_pc@yahoo.com - 2013-12-12 12:37 -0800
  Re: Basic 2d graphics in Java Jeff Higgins <jeff@invalid.invalid> - 2013-12-12 17:42 -0500

csiph-web