< prev index next >
src/demo/share/jfc/J2Ddemo/java2d/demos/Mix/Stars3D.java
Print this page
*** 1,8 ****
/*
*
! * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
--- 1,8 ----
/*
*
! * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*** 65,75 ****
* multi-colored rectangles and then render the 3D text shape.
*/
@SuppressWarnings("serial")
public class Stars3D extends ControlsSurface {
! private static Color colors[] = { RED, GREEN, WHITE };
private static AffineTransform at = AffineTransform.getTranslateInstance(-5,
-5);
private Shape shape, tshape;
private Shape ribbon;
protected int fontSize = 72;
--- 65,75 ----
* multi-colored rectangles and then render the 3D text shape.
*/
@SuppressWarnings("serial")
public class Stars3D extends ControlsSurface {
! private static Color[] colors = { RED, GREEN, WHITE };
private static AffineTransform at = AffineTransform.getTranslateInstance(-5,
-5);
private Shape shape, tshape;
private Shape ribbon;
protected int fontSize = 72;
*** 97,108 ****
Font font = new Font(Font.SERIF, Font.BOLD|Font.ITALIC, fontSize);
shape = font.createGlyphVector(frc, text).getOutline();
tshape = at.createTransformedShape(shape);
PathIterator pi = shape.getPathIterator(null);
! float seg[] = new float[6];
! float tseg[] = new float[6];
GeneralPath working = new GeneralPath(Path2D.WIND_NON_ZERO);
float x = 0, y = 0; // Current point on the path
float tx = 0, ty = 0; // Transformed path point
float cx = 0, cy = 0; // Last moveTo point, for SEG_CLOSE
--- 97,108 ----
Font font = new Font(Font.SERIF, Font.BOLD|Font.ITALIC, fontSize);
shape = font.createGlyphVector(frc, text).getOutline();
tshape = at.createTransformedShape(shape);
PathIterator pi = shape.getPathIterator(null);
! float[] seg = new float[6];
! float[] tseg = new float[6];
GeneralPath working = new GeneralPath(Path2D.WIND_NON_ZERO);
float x = 0, y = 0; // Current point on the path
float tx = 0, ty = 0; // Transformed path point
float cx = 0, cy = 0; // Last moveTo point, for SEG_CLOSE
*** 245,255 ****
g2.setColor(BLUE);
g2.draw(shape);
}
! public static void main(String argv[]) {
createDemoFrame(new Stars3D());
}
static class DemoControls extends CustomControls implements ActionListener {
--- 245,255 ----
g2.setColor(BLUE);
g2.draw(shape);
}
! public static void main(String[] argv) {
createDemoFrame(new Stars3D());
}
static class DemoControls extends CustomControls implements ActionListener {
*** 304,315 ****
Thread.sleep(999);
} catch (Exception e) {
return;
}
int length = getSize().width / 4;
! int size[] = { length, length };
! String str[] = { "OpenJDK", "J2D" };
while (thread == me) {
for (int i = 0; i < str.length; i++) {
demo.fontSize = size[i];
tf2.setText(String.valueOf(demo.fontSize));
tf1.setText(demo.text = str[i]);
--- 304,315 ----
Thread.sleep(999);
} catch (Exception e) {
return;
}
int length = getSize().width / 4;
! int[] size = { length, length };
! String[] str = { "OpenJDK", "J2D" };
while (thread == me) {
for (int i = 0; i < str.length; i++) {
demo.fontSize = size[i];
tf2.setText(String.valueOf(demo.fontSize));
tf1.setText(demo.text = str[i]);
< prev index next >