how to create a JFrame in java
Java
import javax.swing.JFrame;
import java.awt.Rectangle;
import javax.swing.JComponent;
import java.awt.Graphics2D;
import java.awt.Graphics;
import java.awt.Color;
public class ChrismasTree {
public static void main(String[] args) {
JFrame window = new JFrame();
window.setTitle("Christmas Tree");
window.setSize(800, 1000);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
DrawingComponent DC = new DrawingComponent();
window.add(DC);
}
}
class DrawingComponent extends JComponent{
public void paint(Graphics graph0){
Graphics2D graph = (Graphics2D) graph0;
graph.setColor(Color.LIGHT_GRAY);
graph.draw(new Rectangle(0, 710, 70, 60));
graph.setColor(Color.BLUE);
graph.draw(new Rectangle(70, 600, 50, 100));
graph.setColor(Color.BLACK);
}
}
Also in Java:
- Title
- character at index of string java
- Category
- Java
- Title
- FORM EN JAVA SCRIPT
- Category
- Java
- Title
- try block in java
- Category
- Java
- Title
- how to find length of array in java
- Category
- Java
- Title
- how to create a circle in java
- Category
- Java
- Title
- java simple jframe example
- Category
- Java
- Title
- print a string java
- Category
- Java
- Title
- guess the number java
- Category
- Java
- Title
- java get first char
- Category
- Java
- Title
- java 8 seconds to days
- Category
- Java
- Title
- iterate map in java
- Category
- Java
- Title
- java how to initialize an array
- Category
- Java
- Title
- int to binary java
- Category
- Java
- Title
- get preference value android
- Category
- Java
- Title
- how to replace in java
- Category
- Java
- Title
- hashmap get value java
- Category
- Java
- Title
- java for each
- Category
- Java
- Title
- print map java
- Category
- Java
- Title
- j
- Category
- Java
- Title
- from file to array java
- Category
- Java
- Title
- how to create a method java
- Category
- Java
- Title
- java how to put a string sentence in a map
- Category
- Java
- Title
- how to add to a file in java
- Category
- Java
- Title
- jq selector body
- Category
- Java
- Title
- how to init an array with objects in java
- Category
- Java
- Title
- how to loop through an array
- Category
- Java
- Title
- how to show the hex detail of a file in java
- Category
- Java
- Title
- read and write files pattern java
- Category
- Java
- Title
- java go troght loop object
- Category
- Java
- Title
- spring code in java
- Category
- Java
- Title
- com.android.builder.dexing.DexArchiveMergerException:
- Category
- Java
- Title
- toString convert to long
- Category
- Java
- Title
- covariant type in java
- Category
- Java
- Title
- java script zip function
- Category
- Java
- Title
- que es un length en java
- Category
- Java
- Title
- writing to a text file java
- Category
- Java
- Title
- java string to character stream
- Category
- Java
- Title
- java stream sort
- Category
- Java
- Title
- test function that call a function javascrip
- Category
- Java
- Title
- sort elements with sortedset
- Category
- Java
- Title
- java map foreach
- Category
- Java
- Title
- java how to get current date
- Category
- Java
- Title
- java remove duplicates
- Category
- Java
- Title
- compile java to jar in mac
- Category
- Java
- Title
- recursion in java
- Category
- Java
- Title
- read integer input java
- Category
- Java
- Title
- binary string to int java
- Category
- Java
- Title
- java check if int
- Category
- Java
- Title
- cannot lock java compile cache as it has already been locked by this process
- Category
- Java
- Title
- java get last element of list
- Category
- Java
- Title
- java how to call getReader twice
- Category
- Java
- Title
- inline foreach java
- Category
- Java
- Title
- android java how to stop users fromgoing back too much
- Category
- Java
- Title
- localdate to string java
- Category
- Java
- Title
- android get distance between two locations kotlin
- Category
- Java
- Title
- java s3 images
- Category
- Java
- Title
- java switch multiple values
- Category
- Java
- Title
- java stream collect to string
- Category
- Java
- Title
- javadoc reference general toString
- Category
- Java
- Title
- number of matches regex java
- Category
- Java
- Title
- java get int from double without rounding
- Category
- Java
- Title
- add two numbers bitwise
- Category
- Java
- Title
- arraylist array
- Category
- Java
- Title
- java nested for loop
- Category
- Java
- Title
- binary to int java
- Category
- Java
- Title
- how to return the first character in an array from a method java
- Category
- Java
- Title
- actionListener java
- Category
- Java
- Title
- Java arraylist if you don't want to use add()
- Category
- Java
- Title
- get cursor position in textarea java
- Category
- Java
- Title
- working with buttons in applet java
- Category
- Java
- Title
- discord jda remove @everyone from channel
- Category
- Java
- Title
- calculating the percentile in java
- Category
- Java
- Title
- java self signed certificate truststore
- Category
- Java
- Title
- how to sort collection in java
- Category
- Java
- Title
- java while loop example
- Category
- Java
- Title
- type javascirpt
- Category
- Java
- Title
- how to add objects in array java
- Category
- Java
- Title
- javafx datepicker
- Category
- Java
- Title
- java getter
- Category
- Java
- Title
- java mysql springboot jpa stackoverflow
- Category
- Java
- Title
- rock paper scissors java
- Category
- Java
- Title
- how do i print text in java
- Category
- Java
- Title
- iterate trough linked list java
- Category
- Java
- Title
- how to make an arraylist java
- Category
- Java
- Title
- dice in java
- Category
- Java
- Title
- import java.util.hashset
- Category
- Java
- Title
- java stack
- Category
- Java
- Title
- binary numbers java
- Category
- Java
- Title
- how to change all the text in a textArea java at once
- Category
- Java
- Title
- java read string input
- Category
- Java
- Title
- java singleton implementation
- Category
- Java
- Title
- http client java
- Category
- Java
- Title
- java replace all xml decoding
- Category
- Java
- Title
- validation list empty java
- Category
- Java
- Title
- fibonacci sequence java
- Category
- Java
- Title
- java map declaration
- Category
- Java
- Title
- python vs java
- Category
- Java
- Title
- how to get a user to add to an arraylist in java
- Category
- Java
- Title
- ceil function in java
- Category
- Java
- Title
- room insert and return id
- Category
- Java