import java.awt.*; import javax.swing.*; public class ThreeDRectangle extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.red); g2.draw3DRect(50, 50, 100, 50, true); } public static void main(String[] args) { JFrame frame = new JFrame("Draw 3D Rectangle Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ThreeDRectangle panel = new ThreeDRectangle(); frame.add(panel); frame.setSize(200, 200); frame.setVisible(true); } }This code creates a JFrame window with a JPanel that uses draw3DRect() to draw a 3D rectangle with a red border. This method belongs to the java.awt.Graphics package.