297N/A/*
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
297N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
297N/A *
297N/A * This code is free software; you can redistribute it and/or modify it
297N/A * under the terms of the GNU General Public License version 2 only, as
297N/A * published by the Free Software Foundation.
297N/A *
297N/A * This code is distributed in the hope that it will be useful, but WITHOUT
297N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
297N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
297N/A * version 2 for more details (a copy is included in the LICENSE file that
297N/A * accompanied this code).
297N/A *
297N/A * You should have received a copy of the GNU General Public License version
297N/A * 2 along with this work; if not, write to the Free Software Foundation,
297N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
297N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
297N/A */
297N/A
297N/A/*
297N/A * @test
297N/A * @bug 6692979
297N/A * @summary Verify no crashes with extreme shears.
297N/A */
297N/A
297N/Aimport javax.swing.*;
297N/Aimport java.awt.*;
297N/Aimport java.awt.font.*;
297N/Aimport java.awt.geom.*;
297N/Apublic class Shear extends Component {
297N/A
297N/A public static void main(String[] args) {
297N/A JFrame f = new JFrame();
297N/A f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
297N/A f.getContentPane().add("Center", new Shear());
297N/A f.pack();
297N/A f.setVisible(true);
297N/A }
297N/A
297N/A public Dimension getPreferredSize() {
297N/A return new Dimension(400,300);
297N/A }
297N/A
297N/A public void paint(Graphics g) {
297N/A Graphics2D g2 = (Graphics2D)g;
297N/A
297N/A g.setColor(Color.white);
297N/A g.fillRect(0,0,400,300);
297N/A g.setColor(Color.black);
297N/A Font origFont = new Font(Font.DIALOG, Font.BOLD, 30);
297N/A for (int i=0;i<=360;i++) {
297N/A double sv = i*180.0/Math.PI;
297N/A AffineTransform tx = AffineTransform.getShearInstance(sv, sv);
297N/A Font font = origFont.deriveFont(tx);
297N/A g.setFont(font);
297N/A GlyphVector gv =
297N/A font.createGlyphVector(g2.getFontRenderContext(), "JavaFX");
297N/A //System.out.println(gv.getVisualBounds());
297N/A g.drawString("JavaFX", 100, 100);
297N/A }
297N/A }
297N/A}