With swing is it granted that conversion
paint (Graphics g) {
Graphics2D g2d = (Graphics2D) g;
......
}
will always work? Or there could be different graphics implementations, not only Graphics2D?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short answer is, yes it should work, unless you’re using some other JVM. I can’t remember since when exactly, but Swings paint engine will always use a Graphics2D instance to perform its component painting