Answers for "how to add background color in jframe"

1

how to set background color in jframe in java

package Exaple;

import java.awt.Color;

import javax.swing.JFrame;

public class Window {

	public static void main(String[] args) {
		
		JFrame frame = new JFrame(); 
		frame.setExtendedState(JFrame.MAXIMIZED_BOTH); 
		frame.setVisible(true);
		frame.setTitle("Expaple");
		frame.setBackground(Color.BLUE);
	}

}
Posted by: Guest on July-24-2020
0

JFrame background color

setBackground(Color.red);
Posted by: Guest on January-21-2020
1

how to add background color in jframe

import java.awt.Color;  //to be imported

		 JFrame frame = new JFrame("Figure");
	     frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
	     frame.getContentPane().setBackground(new Color(0,0,0)); //setting the background color
	     frame.setLocationRelativeTo(null);
	     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			frame.pack();
			frame.setVisible(true);
Posted by: Guest on July-08-2021

Code answers related to "how to add background color in jframe"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language