java gui

java gui frame jframe swing tutorial for beginners

#java #gui #frame #jframe #swing #tutorial #beginners

import java.awt.color;
import javax.swing.imageicon;
import javax.swing.jframe;

public class main {

public static void main(string[] args) {

// jframe = a gui window to add components to

jframe frame = new jframe(); //creates a frame
frame.settitle("jframe title goes here"); //sets title of frame
frame.setdefaultcloseoperation(jframe.exit_on_close); //exit from application
frame.setresizable(false); //prevent frame from being resized
frame.setsize(420,420); //sets the x-dimension, and y-dimension of frame
frame.setvisible(true); //make frame visible

imageicon image = new imageicon("logo.png"); //create an imageicon
frame.seticonimage(image.getimage()); //change icon of frame
frame.getcontentpane().setbackground(new color(0x123456)); //change color of background

}
}

java gui