Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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 :: reverse string in java 
Java :: display image from database in java servlet 
Java :: Convert c# to xml string 
Java :: convert date to calendar java 
Java :: load a file from classpath spring boot 
Java :: how to set the backtound color in java 
Java :: java sort 2d array 
Java :: java create inputstream from string 
Java :: check if jcheckbox is checked java 
Java :: how to delete files in java 
Java :: How to efficiently multiply two numbers represented as Strings, in Java? 
Java :: java code to reverse an integer 
Java :: selet all elemnts 
Java :: spring @Bean destroyMethod 
Java :: create date java 
Java :: app dashboard cardview click effect and animation android studio 
Java :: android hide status bar and action bar daynamically 
Java :: spring boot logged in user 
Java :: java string array 
Java :: print queue in java 
Java :: java init arraylist string 
Java :: creating array java 
Java :: ripple effect textview android 
Java :: java resource file 
Java :: java create image 
Java :: sort 2d array by column java 
Java :: java gettime 
Java :: reading csv file in java 
Java :: groovy ternary operator short form 
Java :: insert data into list java 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =