Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

append button java

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 :: jframe button 
Java :: java loop backwards through array 
Java :: java get longest string in array 
Java :: input array through scanner in java 
Java :: gradle require java version 
Java :: jlist set selected value 
Java :: get file extension java 
Java :: java pre increment 
Java :: decomposer chaine de caractère java 
Java :: groovy string to json 
Java :: Multiply two Strings Leetcode 
Java :: find duplicate value in array java 
Java :: create embeds jda discord 
Java :: java jcheckbox get value 
Java :: change color of jframe 
Java :: convert optional object to object java 
Java :: Caused by: java.lang.NoSuchMethodError: org.apache.logging.log4j.spi.LoggerContextFactory.isClassLoaderDependent()Z 
Java :: get logged-in user in Spring Security 
Java :: encode file to base64 java 
Java :: java get random char 
Java :: rewrite file java 
Java :: joptionpane 
Java :: space in java 
Java :: how to scan a string in java 
Java :: java settimeout 
Java :: java long to int 
Java :: java collection to list 
Java :: how to change image resolution in android programmatically 
Java :: make window visible java 
Java :: java remainder sign 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =