Answers for "gui java application"

107

java gui

import javax.swing.*;
class gui{
    public static void main(String args[]){
       JFrame frame = new JFrame("My First GUI");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.setSize(300,300);
       JButton button = new JButton("Click me");
       frame.getContentPane().add(button); // Adds Button to content pane of frame
       frame.setVisible(true);
    }
}
Posted by: Guest on January-26-2021
-1

java GUI

import javax.swing.*;
class main {
    public static void main(String args[]){
       JFrame frame = new JFrame("Hello World");
       frame.setSize(300,300)
         JButton button = new JButton("You should totally click me");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.getContentPane().add(button); // Adds Button to content pane of frame
       frame.setVisible(true);
    }
}
Posted by: Guest on September-04-2021

Code answers related to "gui java application"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language