Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

frame background changing in java

import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class JFrameBackgroundColor
{

  public static void main(String[] args)
  {
    // schedule this for the event dispatch thread (edt)
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        displayJFrame();
      }
    });
  }

  static void displayJFrame()
  {
    // create our jframe as usual
    JFrame jframe = new JFrame("JFrame Background Color");
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    jframe.setBackground(Color.red);

    // set the jframe size and location, and make it visible
    jframe.setPreferredSize(new Dimension(400, 300));
    jframe.pack();
    jframe.setLocationRelativeTo(null);
    jframe.setVisible(true);
  }

}
Comment

PREVIOUS NEXT
Code Example
Java :: jsp initialization 
Java :: MyLinkedList 
Java :: an internal error occurred during initializing java tooling . java.lang.nullpointerexception 
Java :: java return new instance of generic type 
Java :: alphabet n vowelin java 
Java :: hdfs java read all files in directory 
Java :: nqueen problem with python 
Java :: how to return arraylist as array in java 
Java :: org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:876) 
Java :: how to covert array into a char 
Java :: java get year difference between two dates 
Java :: java foreach method 
Java :: double to string in java without tovalue 
Java :: java xml element get attribute value 
Java :: java scanner int to string 
Java :: make quotation a string 
Java :: is the function same as method in java 
Java :: Java Create a LinkedHashSet 
Java :: how to code java??????????? 
Java :: java string stringbuilder array list tostring 
Java :: jhow to check if a string is a punctuation java 
Java :: Java Access ConcurrentHashMap Elements 
Java :: indexof list java 
Java :: refresh sharedpreferences going back java 
Java :: HOW TO START ACTIVITY FROM FRAGMENT INSIDE? 
Java :: java animated gif example 
Java :: java user home directory macos 
Java :: how to multiply a number by itself using for loop in java 
Java :: java switch tutorial 
Java :: java switch statement 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =