Java can be used both for a client application, containing the interface that the user will use in his tasks, as in a server application, receiving HTTP requests and responding in the way that he wants.
In the first case, client-side application, you can make use of the Swing framework to mount the application windows and program the buttons and what you most want. And there are libraries to do the most varied things in GUI applications with Java, such as JFreeCharts that allows you to plot graphics in the window.
In the second case, as a server, you would use the HTTPRequests API to formulate, send, receive, and process HTML requests. Some frameworks help a lot here, such as Spring and Primefaces , this focused on the visual layer of the application. There is also the possibility of using the JEE edition, with features such as Servlets for processing and JSP for the pages that will be used to receive user data (forms).
In the mixed case, that Java acts both as a client and a server, you can use both of the above forms as long as the connection between them is made.
On databases, the connection is usually made by drivers and an API, JDBC J D B strong> C onnection). There are frameworks for this too, such as Hibernate .