Getting GUI and Swing,

GUI

  • How to make a GUI ?
  1. Make a Jframe.(A JFrame is the object that represents a window on the screen. It’s where you put all the interface things like buttons, checkboxes, text fields, and so on)
Example of GUI interface
  • A method to be called when the user clicks.
  • A way to know when to trigger that method.

Getting a button’s ActionEvent,

Graphics,

  1. put widgets on a frame. It means you can Add buttons, menus, radio buttons to the frame.

Things to do in paintComponent()

  • Display a JPEG
  • Paint a randomly-colored circle on a black background
  • To cast a Graphics2D reference from a Graphics2D object like this
  • Methods you can call on a Graphics2D reference.Some of them are below

Inner classes,

Structure of inner class

How to make an instance of an inner class,

How to use Swing,

Layout Managers,

  1. Border Layout,
  • Only one background component per region is divided by a BorderLayout manager, such as NORTH, SOUTH, EAST, WEST, and CENTER. Let’s look at an example of a button being added to the eastern region.You can use this for other region changing BorderLayout.EAST .
  • Components laid out by this manager usually don’t get to have their preferred size.
  • default layout for a frame
  • If a panel is added to the frame ,the Border Layout manager will be in control of the panel by default, and the Flow Layout manager will be in control of the components within it.
  • components added left to right, wrapping to a new line when needed
  • FlowLayout is the default layout manager for a panel.
  • components will be lad top to bottom ,one per line.
  • each component gets to have its own size, and the components are placed in the order in which they’re added.
Example of box layout

References,

--

--

--

Works at Virtusa as Associate Engineer | Software Engineer | Java Tutor | Technology Reseacher

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to read, parse and update toml configuration file with Go

How to setup your website for that sweet, sweet HTTPS with Docker, Nginx, and letsencrypt

How to Set Up a Fusion Node Part 4a : SSH into your VPS and connect your node to the Fusion…

GraphQL | A query and manipulation language for your APIs

GraphQL

Next Generation Customer Experience — Web Augmented Reality

The Concept of Integration (Cont.)

A two cable like jigsaw puzzle piece representing integration

Solidity: The pure getter and view functions

Snowflake Top Concepts (Part -1)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gawesh Prabhashwara

Gawesh Prabhashwara

Works at Virtusa as Associate Engineer | Software Engineer | Java Tutor | Technology Reseacher

More from Medium

An implementation of TLS Handshake Part 5: Client Handshake Finished

HTTP keep alive and handshake

Qiskit Spring Challenge — Part 4

Elastic Adventures (Part 1)