JRectangle
/* Copy Code */
import javax.swing.*;
import java.awt.*;
public class GetGraphics extends Canvas {
public void paint(Graphics gr) {
gr.fillRect( 300, 50, 200, 80);
Color txtcolor=new Color(0,255,0);
setForeground(txtcolor);
Color bgcolor=new Color(255,255,255);
setBackground(bgcolor);
}
public static void main(String[] args) {
GetGraphics rect=new GetGraphics();
JFrame frame=new JFrame("JRectangle");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(rect);
frame.setSize(800,600);
frame.setVisible(true);
}
}
/* end */
JRectangle
/* Copy Code */
import javax.swing.*;
import java.awt.*;
public class GetGraphics extends Canvas {
public void paint(Graphics gr) {
gr.fillRect( 300, 50, 200, 80);
Color txtcolor=new Color(0,255,0);
setForeground(txtcolor);
Color bgcolor=new Color(253,88,88);
setBackground(bgcolor);
}
public static void main(String[] args) {
GetGraphics rect=new GetGraphics();
JFrame frame=new JFrame("JRectangle");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(rect);
frame.setSize(800,600);
frame.setVisible(true);
}
}
/* end */
JRectangle
/* Copy Code */
import javax.swing.*;
import java.awt.*;
public class GetGraphics extends Canvas {
public void paint(Graphics gr) {
gr.fillRect( 300, 50, 200, 80);
Color txtcolor=new Color(255,0,174);
setForeground(txtcolor);
Color bgcolor=new Color(0,228,245);
setBackground(bgcolor);
}
public static void main(String[] args) {
GetGraphics rect=new GetGraphics();
JFrame frame=new JFrame("JRectangle");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(rect);
frame.setSize(800,600);
frame.setVisible(true);
}
}
/* end */
JRectangle
/* Copy Code */
import javax.swing.*;
import java.awt.*;
public class GetGraphics extends Canvas {
public void paint(Graphics gr) {
gr.fillRect( 300, 50, 3000, 300);
Color txtcolor=new Color(151,140,207);
setForeground(txtcolor);
Color bgcolor=new Color(0,0,0);
setBackground(bgcolor);
}
public static void main(String[] args) {
GetGraphics rect=new GetGraphics();
JFrame frame=new JFrame("JRectangle");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(rect);
frame.setSize(800,600);
frame.setVisible(true);
}
}
/* end */
JRectangle
/* Copy Code */
import javax.swing.*;
import java.awt.*;
public class GetGraphics extends Canvas {
public void paint(Graphics gr) {
gr.fillRect( 300, 50, 199000, 8000);
Color txtcolor=new Color(0,255,0);
setForeground(txtcolor);
Color bgcolor=new Color(255,255,255);
setBackground(bgcolor);
}
public static void main(String[] args) {
GetGraphics rect=new GetGraphics();
JFrame frame=new JFrame("JRectangle");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(rect);
frame.setSize(800,600);
frame.setVisible(true);
}
}
/* end */
JRectangle
/* Copy Code */
import javax.swing.*;
import java.awt.*;
public class GetGraphics extends Canvas {
public void paint(Graphics gr) {
gr.fillRect( 300, 50, 200, 80);
Color txtcolor=new Color(141,113,53);
setForeground(txtcolor);
Color bgcolor=new Color(255,255,255);
setBackground(bgcolor);
}
public static void main(String[] args) {
GetGraphics rect=new GetGraphics();
JFrame frame=new JFrame("JRectangle");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(rect);
frame.setSize(800,600);
frame.setVisible(true);
}
}
/* end */