0N/A/*
2362N/A * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/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.
0N/A */
0N/A
0N/A/**
0N/A * @test
0N/A * @bug 4061440
0N/A * @summary Checks that rounded rectangles print correctly.
0N/A * @author dpm
0N/A */
0N/A
0N/Aimport java.awt.*;
0N/Aimport java.awt.event.*;
0N/A
0N/Apublic class RoundedRectTest {
0N/A public static void main(String[] args) {
0N/A new RoundedRectTest().start();
0N/A }
0N/A public void start() {
0N/A new RoundedRectTestFrame();
0N/A }
0N/A}
0N/A
0N/Aclass RoundedRectTestFrame extends Frame implements ActionListener {
0N/A PrintCanvas canvas;
0N/A
0N/A public RoundedRectTestFrame () {
0N/A super("RoundedRectTest");
0N/A canvas = new PrintCanvas ();
0N/A add("Center", canvas);
0N/A
0N/A Button b = new Button("Print");
0N/A b.setActionCommand ("print");
0N/A b.addActionListener (this);
0N/A add("South", b);
0N/A
0N/A pack();
0N/A setVisible(true);
0N/A }
0N/A
0N/A
0N/A public void actionPerformed(ActionEvent e) {
0N/A String cmd = e.getActionCommand();
0N/A if (cmd.equals("print")) {
0N/A PrintJob pjob = getToolkit().getPrintJob(this, "RoundedRectTest",
0N/A null);
0N/A if (pjob != null) {
0N/A Graphics pg = pjob.getGraphics();
0N/A
0N/A if (pg != null) {
0N/A canvas.printAll(pg);
0N/A pg.dispose(); //flush page
0N/A }
0N/A
0N/A pjob.end();
0N/A }
0N/A }
0N/A }
0N/A}
0N/A
0N/Aclass PrintCanvas extends Canvas {
0N/A public Dimension getPreferredSize() {
0N/A return new Dimension(659, 792);
0N/A }
0N/A
0N/A public void paint (Graphics g) {
0N/A setBackground(Color.white);
0N/A g.setColor(Color.blue);
0N/A g.fillRoundRect(50, 50, 100, 200, 50, 50);
0N/A g.fillRoundRect(200, 50, 100, 100, 50, 50);
0N/A g.fillRoundRect(350, 50, 200, 100, 50, 50);
0N/A
0N/A g.fillRoundRect(50, 300, 100, 200, 41, 97);
0N/A g.fillRoundRect(200, 300, 100, 100, 41, 97);
0N/A g.fillRoundRect(350, 300, 200, 100, 41, 97);
0N/A
0N/A g.fillRoundRect(50, 550, 100, 200, 97, 41);
0N/A g.fillRoundRect(200, 550, 100, 100, 97, 41);
0N/A g.fillRoundRect(350, 550, 200, 100, 97, 41);
0N/A }
0N/A}