Skip to content

Instantly share code, notes, and snippets.

@altayalp
Created July 4, 2016 23:08
Show Gist options
  • Save altayalp/77f80ab4718e1f238073a433b5b87a59 to your computer and use it in GitHub Desktop.
Save altayalp/77f80ab4718e1f238073a433b5b87a59 to your computer and use it in GitHub Desktop.
Simple example to set hex background color for the JFrame
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
/**
*
* @author altayalp
*/
public class HexBackgorundFrame {
private static void createJframe() {
JFrame frame = new JFrame ("Hex color backgorund window");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setBackground( Color.decode("#000000") ); // set background color
frame.setPreferredSize(new Dimension(500, 300));
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
createJframe();
}
}
@nitishai
Copy link

thanks a lot

@patriceboccara
Copy link

thanks

@yohanthshetty
Copy link

Hey, thanks!

@ErrorisLife
Copy link

Thank you!

Copy link

ghost commented Aug 5, 2023

Thank you

@delaoalexx
Copy link

ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment