/*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
/**
* An interactive test of the Graphics.drawArc and Graphics.fillArc
* routines. Can be run either as a standalone application by
* typing "java ArcTest" or as an applet in the AppletViewer.
*/
@SuppressWarnings("serial")
public void init() {
setLayout(new BorderLayout());
}
public void destroy() {
}
public void start() {
controls.setEnabled(true);
}
public void stop() {
controls.setEnabled(false);
}
}
}
f.setVisible(true);
}
return "An interactive test of the Graphics.drawArc and \nGraphics."
+ "fillArc routines. Can be run \neither as a standalone "
+ "application by typing 'java ArcTest' \nor as an applet in "
+ "the AppletViewer.";
}
}
@SuppressWarnings("serial")
boolean filled = false;
for (int i = 1; i <= hlines; i++) {
}
for (int i = 1; i <= vlines; i++) {
}
if (filled) {
} else {
}
int sx = 10;
}
this.startAngle = start;
repaint();
}
}
@SuppressWarnings("serial")
implements ActionListener {
@SuppressWarnings("LeakingThisInConstructor")
b = new Button("Fill");
b.addActionListener(this);
add(b);
b = new Button("Draw");
b.addActionListener(this);
add(b);
}
try {
} catch (NumberFormatException ignored) {
start = 0;
}
try {
} catch (NumberFormatException ignored) {
extent = 0;
}
}
}
@SuppressWarnings("serial")
}
// Consume non-digit KeyTyped events
// Note that processTextEvent kind of eliminates the need for this
// function, but this is neater, since ideally, it would prevent
// the text from appearing at all. Sigh. See bugid 4100317/4114565.
//
super.processEvent(evt);
return;
}
char c = kevt.getKeyChar();
// Digits, backspace, and delete are okay
// Note that the minus sign is allowed, but not the decimal
== '\u002d')) {
super.processEvent(evt);
return;
}
}
// Should consume TextEvents for non-integer Strings
// Store away the text in the tf for every TextEvent
// so we can revert to it on a TextEvent (paste, or
// legal key in the wrong location) with bad text
//
// The empty string is okay, too
super.processTextEvent(te);
return;
}
}
// Returns true for Integers (zero and negative
// values are allowed).
// Note that the empty string is not allowed.
//
try {
return true;
} catch (NumberFormatException ignored) {
return false;
}
}
}