Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

jframe button

import javax.swing.*;
import java.awt.*;

public class MyFrame {
  
MyFrame() 
  
     	JFrame frame = new JFrame("Title");

  		frame.setTitle("JFrame title"); // Frame title
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Exit out of app
        frame.setResizable(true); // Prevent frame from being resized, or not
        frame.setSize(500,500); // Sets x and y 
        frame.setVisible(true); //makes frame visible
  
		button = new JButton(); // creates button

 		Border border = BorderFactory.createLineBorder(Color.green, 3); // specifies border

        button.setBounds(200, 100, 100, 50); // button properties
        button.setBorder(border); // gives button border
        button.setText("A nice button"); // button text

		MyFrame.add(button); //adds button to frame
   
}}
Comment

PREVIOUS NEXT
Code Example
Java :: Lunar New Year 
Java :: convert string to short java 
Java :: list extension quarkus 
Java :: minecraft java arguments 
Java :: java for range loop 
Java :: java int length 
Java :: how to import jframe in java 
Java :: first and last digit sum java 
Java :: java get first 3 characters of string 
Java :: making android activity fullscreen android studio 
Java :: add certificate to java truststore 
Java :: fibunacci java 
Java :: java stream filter 
Java :: testException = com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field 
Java :: what is final in java 
Java :: java date time 
Java :: java if one sting on array match 
Java :: jave arrayList to Array 
Java :: min of an array java 
Java :: Get the first day of the current month in Java 
Java :: change color of action bar android studio 
Java :: for each java 
Java :: Failed to determine a suitable driver class 
Java :: java generate secure random password 
Java :: java string split from input string 
Java :: how to increment character in java 
Java :: selenide wait 
Java :: java guid 
Java :: java jframe example 
Java :: jframe actionlistener 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =