In today tutorial I am going to show you a simple Java code on how to create a 3D Rectangle. What I do here is to create a rectangle box on a JFrame with a few lines on code as follow.
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
public class JDemo3DRectangle extends JFrame {
public JDemo3DRectangle() {
setTitle("3D Rectangle");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void paint(Graphics grp) {
super.paint(grp);
final int WIDTH = 60, HEIGHT = 60;
grp.setColor(Color.YELLOW);
grp.fill3DRect(30, 130, WIDTH, HEIGHT, true);
}
public static void main(String[] args) {
JDemo3DRectangle frm = new JDemo3DRectangle();
frm.setSize(300, 300);
frm.setVisible(true);
}
}
If you compile and run the code you should see the below outcome!

Next Page :
Javascript replace method reviewJavascript replace method review
How to use Java Scanner ClassThis article will show you how to use Java Scanner Class with simple Java code.
Show text on JFrame with Java programShow text on JFrame with Java program!
The if…else statement in Java program‘The if…else statement in Java program’ article will show you an example to use the statement.
Java Scanner ClassJava Scanner class tutorial will show you how to create an instance of the scanner class and read in the input from the user then print out the sum of those inputs.
Creating and Using Interfaces in Java ProgramCreating and Using Interfaces in Java Program will show you how to write simple java program using Interfaces.

You couldn’t pay me to igonre these posts!