Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

append button jframe

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 :: show input dialog java 
Java :: bat artifact 
Java :: how to solve simultaneous equations in mathematica 
Java :: react native android gif 
Java :: java eliminate numbers from string 
Java :: change text color in joptionpane 
Java :: org.mockito.exceptions.misusing.WrongTypeOfReturnValue 
Java :: creating modulu function withou using % java 
Java :: java get current date 
Java :: java delete files 
Java :: multiply two strings 
Java :: java coding standards variables 
Java :: random password generator java 
Java :: java int to hex 
Java :: how to use decimal format java 
Java :: hibernate create query count return 
Java :: how to count lines from txt java 
Java :: create file from byte array java 
Java :: java string to path 
Java :: java save file 
Java :: java gui 
Java :: Read from text file android studio 
Java :: JAVA_HOME not found in your environment. 
Java :: java find time between two dates 
Java :: java find longest string in list 
Java :: how to convert bitmap to uri in android 
Java :: turn java code to .exe 
Java :: how to hide menu items in android 
Java :: jframe visibility 
Java :: java 8 list stream delete by name 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =