Using java technologies to develop graphical applications | Статья в журнале «Молодой ученый»

Отправьте статью сегодня! Журнал выйдет 14 сентября, печатный экземпляр отправим 18 сентября.

Опубликовать статью в журнале

Автор:

Рубрика: Информационные технологии

Опубликовано в Молодой учёный №35 (534) август 2024 г.

Дата публикации: 31.08.2024

Статья просмотрена: < 10 раз

Библиографическое описание:

Ухливанов, С. М. Using java technologies to develop graphical applications / С. М. Ухливанов. — Текст : непосредственный // Молодой ученый. — 2024. — № 35 (534). — URL: https://moluch.ru/archive/534/117383/ (дата обращения: 01.09.2024).

Препринт статьи



The article is devoted to the consideration of topical issues related to the use of Java technologies for the development of graphical applications. Special attention is paid to graphical capabilities of Java language and used class libraries. The methods of drawing offered by the Graphics class are described. In addition, a step-by-step plan of creating a graphical application based on Java 3D is developed.

Keywords: Java, graphics, application, drawing, scene, class.

Java is an extremely powerful and versatile programming language that has dominated software development for many years. Due to its platform independence and extensive libraries, it remains one of the most popular for developers in various fields. According to Statista, 30 % of developers use Java as their primary language. The latest data published in November 2023 by the TIOBE programming community put Java in third place in popularity with 11.98 %, just behind Python (17.18 %) and C (15.08 %) [1].

A special emphasis should be made on the fact that Java is a widely used programming language for web development, especially on the server side. Web applications in Java represent distributed systems running over the Internet. Java capabilities allow you to create dynamic web pages, facilitating user interaction with the interface. Java is also known for its portability, robust library ecosystem, and cross-platform compatibility. In addition to the noted, today Java possesses large and powerful libraries for working with 2D and 3D graphics, images, and the ability to build complex client-side interactive systems.

Originally, simple graphical capabilities were contained in Java AWT (Abstract Windowing Toolkit) classes, which were created in Java 1.1. In Java 2, there was the Swing system for creating graphical interfaces and Java 2D, which worked with graphics and images in a much more sophisticated way than AWT. Today, specialists already have access to the Java 3D API, which allows the creation of three-dimensional graphical applications and Internet applets. It provides high-level constructs for developing and manipulating three-dimensional geometry and building the structures used to visualize it. With this software, very large virtual worlds can be efficiently created and visualized [2].

In Java, custom drawing is done using the java.awt.Graphics class, which manages the graphics context and provides a set of device-independent methods for drawing text, figures, and images on the screen across platforms. java.awt.Graphics is an abstract class since the drawing process itself is system and device dependent. Each operating platform will provide a subclass of Graphics to perform the actual drawing under its platform, but according to the specification defined in Graphics.

Given the wide possibilities of Java for creating and manipulating images and various kinds of geometry, studying the features and prospects of this programming language for the development of graphical applications represents a relevant scientific and practical problem, the solution of which is devoted to this paper.

The works of K. V. Dergacheva, M. F. Essama, N. A. Kozyreva, P. P. Keino, V. M. Kvashnina, A.Yu. Novikova.

Graphical applications and applets in Java, as well as the features of graphics programming using this language, are analyzed in detail by S. F. Maslovich, R. O. Seglin, A. N. Caunitom, M. A. Temirov.

At the same time, despite the active interest of scholars in the problem at hand, the issues of the step-by-step development of the application design and some of the graphical capabilities of Java require a more detailed description.

Thus, the purpose of the article is to consider the features of using Java — technologies for creating graphical applications.

At the first stage of the study, note that Graphics is an abstract class provided by the Java AWT that is used to draw or color components. It consists of various fields that store information about components subject to coloring, font, color, as well as methods that allow you to draw various figures on GUI components. Graphics is an abstract class and therefore cannot be initialized directly.

The Graphics class provides methods for drawing three types of graphic objects:

  1. Text strings: using the drawString() method. Note that System.out.println() outputs data to the system console and not to the graphical screen.
  2. Vector Graphics Primitives and Figures: using drawXxx() and fillXxx() methods, where Xxx can be Line, Rect, Oval, Arc, PolyLine, RoundRect or 3DRect.
  3. Bitmaps: using the drawImage() method [3].

Also note that the Java language contains two class libraries designed to develop applications that implement a GUI: the AWT library is supplied as part of the JDK in the java.awt package; the JFC library better known as Swing comes as part of the JDK.

Taking into account the fact that today the interactive 3D development of web applications is gaining special popularity and importance, it is considered appropriate to consider the features of Java 3D.

Java 3D provides web application developers with undoubted advantages for working with 3D graphics — “write once, execute anywhere”. Java 3D is included in the JavaMedia set of APIs, making it available on a wide range of platforms. It also integrates well with the Internet since applications and applets written using the Java 3D API have access to the entire set of Java classes.

The Java 3D API draws its ideas from existing graphics APIs and new technologies. Java 3D graphics designs synthesize the best ideas found in low-level APIs such as Direct3D, OpenGL, QuickDraw3D, and XGL. Similarly, higher-level designs synthesize the best ideas found in several scene graph-based systems. In addition, while Java 3D presents some concepts that are not usually considered part of the graphics environment, such as three-dimensional spatial sound. The sound capabilities of Java 3D help enable the development of web applications that allow for a more complete user immersion in what is happening.

Creating a simple 3D application using Java 3D involves several steps.

Step 1: Create a basic Java class named “Simple3DApp” with the following code:

This class sets up a simple universe using the SimpleUniverse utility, sets the location and direction of the viewing platform, forms a scene graph, and adds the scene graph to the universe.

Step 2: Install the viewing platform. Adding the following method to the Simple3DApp class to set the location and direction of the viewing platform:

This method sets the view platform location to (0, 0, 10) by looking at the origin of the coordinates (0, 0, 0) with an upward vector (0, 1, 0).

Step 3: Create a scene graphic. Adding to the Simple3DApp class the following method to create a scene graph:

This method creates a branch group to store the scene graph, a transform group to store the cube and its rotation behavior, the colored cube and adds them to the scene graph.

Step 4: Launch the app.

Thus, the article describes the features of developing a graphical application using Java technology. A step-by-step plan for creating a Java 3D-based graphical application is described.

References:

  1. Dergachev K. V. Development of an automated system for the creation and testing of prototypes of user interfaces // Ergodesign. 2022. No 4 (18). S. 252–261.
  2. Dyatlova AA Development of an application for graphical analysis of functions by means of the programming language JAVA // Student Forum. 2022. No 39–2 (218). Р. 18–24.
  3. Sakovich VV Using Spring Projects family frameworks to develop web applications on the JAVA platform // Intelligent Technologies on Transportation. 2023. No 2 (34). Р. 58–66.
  4. Zditovets A. L. Basic technologies and frameworks for backend development in JAVA // Innovative science. 2023. No 8–2. Р. 16–26.


Задать вопрос