Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

pack in swing

import java.awt.Container;
//  w  ww  .  j a v a 2 s  .co m
import javax.swing.JButton;
import javax.swing.JFrame;

public class Main {
  public static void main(String[] args) {
    JFrame frame = new JFrame("JFrame");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Add a close button
    JButton closeButton = new JButton("Close");
    Container contentPane = frame.getContentPane();
    contentPane.add(closeButton);

    // Calculates and sets appropriate size for the frame
    frame.pack();

    frame.setVisible(true);
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: Picked up _JAVA_OPTIONS: -Xmx256M intillij 
Java :: guava-18.0.jar 
Java :: arraycopy merging arrays 
Java :: Java TestNG Data Provider 
Java :: transform primitive float array to float array 
Java :: validate list of objects in javax validation 
Java :: How do I retrieve editors registered for a certain file extension in Eclipse? 
Java :: springBoot Register a Custom Auto-Configuration 
Java :: leap year java method 
Java :: how to use asynx task to make api connection java 
Java :: setlist arraylist java swing example 
Java :: retrofit with api key post 
Java :: lelen suratlari ramkasidagi oltinlar 
Java :: oxygen cylinder management program in java 
Java :: java.lang.String cannot be cast to java.util.Map 
Java :: skip list java 
Java :: how to read json object from text file in java 
Java :: java remove numbers from set 
Java :: JDA message 
Java :: jdbc insert example from input values 
Java :: nbubble sort java 
Java :: java.lang.stackoverflowerror null onetomany 
Java :: dynamic fib 
Java :: who was the mother of thomas elva edison 
Java :: opencv copy image java 
Java :: can you automate mouseclicks with java 
Java :: Java Create an OutputStreamWriter 
Java :: findby(xpath selenium java) 
Java :: variables en java 
Java :: flutter android studio Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =