Introduction to SWING

Method type


drawLine(x1, y1, x2, y2) Draw a straight line from the point (x1, y1) to the point (x2, y2).


drawString ("string", x, y)

Place the character string at the position where the point (x, y) is at the lower left.


drawRect(x, y, w, h) Draw a rectangle with a width w and a height h, with the point (x, y) at the upper left.


fillRect(x, y, w, h) With the point (x, y) at the upper left, draw a rectangle with a width w and a height h, and fill the inside.


drawOval(x, y, w, h) Draw an ellipse inscribed in a rectangle with a width w and a height h, with the point (x, y) at the upper left.


fillOval(x, y, w, h) With the point (x, y) at the upper left, draw an ellipse inscribed in a rectangle with a width w and a height h, and fill the inside.


drawPolygon(x, y, n) An array of x coordinates x and an array of y coordinates Draw a polygon consisting of n points defined by y.


fillPolygon(x, y, n) An array of x coordinates x and an array of y coordinates Draw a polygon consisting of n points defined by y and fill the inside.


drawPolyline(x, y, n) An array of x coordinates x and an array of y coordinates y Draw the n points defined by y as a continuous straight line.


drawRoundRect(x,y,w,h,aw,ah) Draw a contour rectangle with rounded corners.


fillRoundRect(x,y,w,h,aw,ah) Draw a contour rectangle with rounded corners and fill the interior.


Class type


JFrame Class to display a frame (window) on the screen of the terminal


JPanel Class to place GUI parts such as figures in the frame


Container Container class for holding GUI parts


Graphics Class to draw in the frame


Color Color handling class


Coordinates on the window

1キャプチャ.PNG

Recommended Posts

Introduction to SWING
Introduction to Ruby 2
Introduction to web3j
Introduction to Micronaut 1 ~ Introduction ~
[Java] Introduction to Java
Introduction to migration
Introduction to java
Introduction to Doma
Introduction to JAR files
Introduction to bit operation
Introduction to Ratpack (6) --Promise
Introduction to Ratpack (9) --Thymeleaf
Introduction to PlayFramework 2.7 ① Overview
Introduction to Android Layout
Introduction to design patterns (introduction)
Introduction to Practical Programming
Introduction to javadoc command
Introduction to jar command
Introduction to Ratpack (2)-Architecture
Introduction to lambda expression
Introduction to java command
Introduction to RSpec 2. RSpec setup
Introduction to Keycloak development
Introduction to javac command
Introduction to RSpec 5. Controller specs
Introduction to RSpec 6. System specifications
Introduction to Android application development
Introduction to RSpec 3. Model specs
Introduction to Ratpack (5) --Json & Registry
Introduction to Metabase ~ Environment Construction ~
Introduction to Ratpack (7) --Guice & Spring
(Dot installation) Introduction to Java8_Impression
Introduction to Design Patterns (Composite)
Introduction to Micronaut 2 ~ Unit test ~
Introduction to JUnit (study memo)
Introduction to Spring Boot ① ~ DI ~
Introduction to design patterns (Flyweight)
[Java] Introduction to lambda expressions
Introduction to Spring Boot ② ~ AOP ~
Introduction to Apache Beam (2) ~ ParDo ~
[Ruby] Introduction to Ruby Error statement
Introduction to EHRbase 2-REST API
Introduction to design patterns Prototype
GitHub Actions Introduction to self-made actions
[Java] Introduction to Stream API
Introduction to Design Patterns (Iterator)
Introduction to Spring Boot Part 1
Introduction to Ratpack (1) --What is Ratpack?
XVim2 introduction memo to Xcode12.3
to_ ○
Introduction to RSpec-Everyday Rails Summary-
Introduction to Design Patterns (Strategy)
[Introduction to rock-paper-scissors games] Java
Introduction to Linux Container / Docker (Part 1)
Introduction to swift practice output Chapter5
[Introduction to Java] About lambda expressions
Introduction to algorithms in java-cumulative sum
[Introduction to Java] About Stream API
Introduction to Functional Programming (Java, Javascript)
Introduction to Ruby processing system self-made
Introduction to algorithms with java-Shakutori method