I need to make a frame pop up and have a color display on the screen with certain dimensions for the window using Jframe or something like that.
JFrame frame = new JFrame("Example");
frame.setBackground(Color.RED); //for color
frame.setPreferredSize(new Dimension(100, 100)); //for size
//...
OR for JPanel
JPanel panel = new JPanel();
panel.setBackground(Color.RED); //for color
panel.setPreferredSize(new Dimension(100, 100)); //for size
//...
Hope it is what you mean.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.