×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Yts 95
Added: Feb 27, 2021 5:02 AM
Modified: Feb 27, 2021 5:06 AM
Views: 4748
Tags: no tags
  1. class jPanelGradient_sidemanue extends JPanel {
  2.         protected void paintComponent (Graphics g){
  3.             Graphics2D g2d = (Graphics2D) g;
  4.             int width = getWidth();
  5.             int height = getHeight();
  6.            
  7.             Color color1 = Color.BLACK;
  8.             Color color2 = new Color(86,180,211);
  9.             GradientPaint gp = new GradientPaint(0,20,color1,180,height,color2);
  10.             g2d.setPaint(gp);
  11.             g2d.fillRect(0,0, width, height);
  12.         }}