How to start using IntelliJ IDEA's Swing GUI wizard. detailed instructions


For a long time I haven't written desktop applications in Java in general and using Swing in particular. However, there was a need a little on GUIt. As a tool, I chose IntelliJ IDEA Community edition, 2016.1 version.

I took it to sculpt and, of course, the first thing I ran into - although a lot of water has flowed under the bridge since Borland Java Builder 2006, creating screen interfaces has not become easier, rather the opposite. And one of the reasons for choosing IDEA was just the presence of the Swing designer “out of the box”, however, how to use it right off the bat is completely incomprehensible - the form is generated, the class is created, control variables are created from the designer ... but that’s all: when creating our class, the form does not appear on the screen appears

Fumbled around the Internet, information about zero. The people say, they say, "create and - go ahead!". HM…

Based on the results of small ordeals on this topic, I decided to publish the instructions, since, taking into account past experience, it was much easier for me to search than for a beginner who generally sculpts a form in Swing for the first time.

Creating Swing GUI Forms with JetBrains IntelliJ IDEA 2016.1

First, to understand the process, it is better to start with that. what to go to the IDEA menu "File -> Settings" - there "Editor -> GUI Designer" and check the box Generate GUI Into: in Java source code. (this will help a little understanding of the process at the first stage - then it will be possible to remove it back).

As a result, we actually generated a JDialog derived class (which can be created and used) and a form for it.
We launch our project for execution and ... oh, the horror of a miracle! when compiling, IDEA adds some additional code to the end of our file.

( // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!!<<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>>IMPORTANT!!<<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); .................... } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; }
It's easy to guess that our entire Swing form is configured in the auto-generated $$$setupUI$$$ method.

Remember the setting we set at the very beginning - "GUI Into: -> Java source code". If it is not set, then this method will simply appear directly in the _class_ file, bypassing the java file (decompile it if in doubt - I did it). Accordingly, you can return the “GUI Into:” setting to its original form so that this code (which is still strongly discouraged from editing) does not hurt your eyes.

Now that we understand how it works, let's move on to creating other forms - not necessarily dialogs.

Again, right-click on the folder or source code file, select "New -> GUI Form" - enter the class name for the form.

The class and the form to it is generated. We throw several controls on the form. In the GUI designer, look at the name root element(usually panel1, if IDEA did not set a name, but this happens, set it forcibly - for clarity, I called it rootPanel).

Let's move on to the source code of our class.

So:
1. We add for our class the inheritance "extends JFrame";
2. Add a class constructor with strings:

SetContentPane(panel1); setVisible(true);

Final class code

public class GUIFrame extends JFrame( private JButton button1; private JPanel rootPanel; public GUIFrame() ( setContentPane(rootPanel); setVisible(true); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); ) public static void main(String args) ( new GUIFrame() ; ) )


Everything. The form is ready to use. See the many Swing tutorials for the rest.

P.S. Alternatively, you can not inherit our class from JFrame, but create a view constructor:

JFrame frame = new JFrame(); frame.setContentPane(panel1); frame.setVisible(true);
This option also works - maybe someone will come in handy.

Tags: Add tags

MatLab includes a GUIDE environment for creating applications with a graphical user interface. Working in this environment is quite simple - controls (buttons, drop-down lists, etc.) are placed using the mouse, and then events are programmed that occur when the user accesses these controls.

An application can consist of one main window or several windows and display graphical and text information, to the main application window, and to individual windows. A number of MatLab functions are designed to create standard dialog boxes opening and saving a file, printing, font selection, data entry window, etc., which can be used in your own applications.

What do you need to know to create GUI applications? First, how file functions with subfunctions are programmed, file functions with a variable number of input and output arguments. Secondly, it is required to have an idea about the hierarchical structure and properties of graphical objects, to be able to handle pointers to them. Of course, work with numerical arrays, strings, structures, cells and arrays of strings, structures and cells, as well as the use of built-in programming language constructs, should not be difficult.

A GUI application can be written without using the GUIDE environment. An example is bspligui, which is part of the Spline ToolBox. Those who wish to understand the creation of applications without the GUIDE environment can be advised to run the bspligui application in debug mode, follow the creation of the application window, controls, and how events are handled (just open the bspligui.m file, set a breakpoint on the first executable line and run the application). We will return to this issue in due course.

When creating applications with a graphical user interface, the following sections of the MatLab help system will be useful:

· "MATLAB: Creating Graphical User Interfaces".

"MATLAB: Functions -- Categorical List: Creating Graphical User Interfaces"

· "MATLAB: Handle Graphics Property Browser" (reference book of properties of graphical objects).

· In the MatLab 7 help system, in the "Demo" section, there is a 10-minute demonstration of creating an application with a graphical interface in the GUIDE environment.

As a simple example, consider creating a GUIDE application with a button hello, clicking on which leads to the output of the text "Hello, World!" to the application window.

Creating a hello application in the GUIDE environment

It is required to create an application with a hello graphical interface, the launch of which, for example, from the command line

would result in an application window appearing with a button hello(see figure 1.a). After clicking on hello the application window displays the text "Hello, World!" (see figure 1.b).

Rice. 1. Operation hello app

Switch to the GUIDE environment by running the command

This will bring up the GUIDE Quick Start dialog box (see Figure 2). It has two tabs.

  • The Create New GUI tab (creating a new application), which we will need now. You can select four presets on it: Blank GUI (blank application window), GUI with Uicontrols (blank with buttons, switches and input areas), GUI with Axes and Menu (blank with axes, menu, button and drop-down list), Modal Question Dialog (preparation for a modal window).
  • Open Existing GUI tab (opening an existing application).

In addition, at the bottom of the Create New GUI tab there is a flag, the setting of which allows you to immediately set the name of the file in which the graphical interface will be stored. But the application can always be saved during editing, so this flag is not required.

Rice. 2. GUIDE Quick Start Dialog Box

Select Blank GUI on the Create New GUI tab and click OK. At the same time, the main window of the GUIDE environment appears, containing a blank for the application window, a toolbar for adding interface elements, a control panel and a menu (see Fig. 3).

Rice. 3. GUIDE environment with a blank for the application window

First, add a button to the application window template. To do this, use the mouse to select the Push Button tool (its icon contains the OK button, and the name appears on the tooltip) and click to place the button on the application window blank (see Fig. 4)

Rice. 4. Adding a button to the application window template

After adding an interface element, you must specify its tag (name), which will identify this object among all other objects. The object tag is needed to get and set its properties and to program events that occur when the user accesses the control, for example, when a button is clicked.

To set a tag, go to the property inspector. The easiest way to do this is by double-clicking on the added button. This brings up the Property Inspector window, which displays the properties of the button (the Uicontrol object). Find the Tag property in the left column of the table and in the input area to the right of it change the current value of pushbutton1 to btnHello and click . It's always better to give objects meaningful tags!

Note that the tag and label on the button are not the same thing. Immediately in the Property inspector window, change the label by accessing the String property. Push Button should be Hello instead.

Our application should display text. But text cannot simply be displayed in the graphics window, since the text object is a child of the axes. We will not place the axes now, but we will do it differently. Position the control element in the application window - Static Text (static text, or an area for text output). To do this, use the Static Text tool in the same way as when adding a button (see Figure 5).

Note

When placing controls, you should select the appropriate tool and either click on the application window blank (then the control will take standard size), or draw a control on the window blank by holding down the left mouse button. You can always change the size by selecting the control in the window preset with the mouse (the selection mode must be on, that is, the appropriate Select tool is selected) and dragging the square handles with the mouse. In selection mode, you can also move controls around the application window preset.

Rice. 5. Adding a text output area

Set the text output area's txtWin tag and set its String property to an empty string by simply removing the default value in the Property inspector.

Note that the text output area is a Uicontrol graphical object, just like the button (this is written at the top of the property inspector). The type of the control, i.e. A UIcontrol object is determined by the value of its Style property. For a button it takes the value "pushbutton", for the text output area "text".

Let's assume that our application is already running. When the user clicks on the Hello button, its Callback event will be raised, which is not yet programmed. Obviously, when the Callback event fires, you need to set the String property of the text output area to "Hello, World!" and set the font color and size.

Before programming an event, save the application. To do this, in the GUIDE File menu, select Save as, a dialog box for saving the file appears, in which select a folder or create a new one and specify the file name hello (the fig extension will be automatically added). Note that after saving the application, hello.m opened in the M-file editor. By default, the application is contained in two files: with the fig extension (graphic window with controls placed on it) and with the m extension (hello function file with subfunctions that handle various events that occur during the application's interaction with the user).

Let's start programming the Callback event of the Hello button. To do this, go to the application window template and select the Callback sub-item in the View Callbacks item from the context menu of the button. In this case, the transition to the M-file editor to the btnHello_Callback event processing subfunction takes place, the title of which and comments are generated automatically:

% --- Executes on button press in btnHello.
function btnHello_Callback(hObject, eventdata, handles)
% hObject handle to btnHello (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

After the header, you need to place those statements that will be executed when the Hello button is clicked.

The name of the function file consists of the tag of the object (btnHello) whose Callback event will be processed and the name of the Callback event (there are other events as well). The meaning of its input arguments is as follows.

· The hObject argument contains a pointer to the Hello button, i.e. a Uicontrol object with a btnHello tag (we won't need it now).

· The eventdata argument is reserved for use in future versions of MatLab.

· The handles argument is a structure with pointers to all application objects. The fields of the handles structure are the tags of these objects. So handles.btnHello contains a pointer to the Hello button, handles.figure1 - a pointer to the application window, handles.txtWin - a pointer to the text output area (just this pointer will be useful to us now).

Let's now start programming the Callback event of the Hello button. After the btnHello_Callback subfunction header, place statements that change the value of the String property of the text output area (the Uicontrol object) to "Hello, World!", as well as the font color and size. The ForegroundColor and FontSize properties of the Uicontrol object control the font color and size. The font size is specified in the units specified by the FontUnits property (points by default, 1pt=1/72 of an inch). The properties of graphical objects are set using the set function.

So the btnHello_Callback subfunction should look like this (auto-generated comments removed):

function btnHello_Callback(hObject, eventdata, handles)
% text placement
set(handles.txtWin,"String","Hello, World!")
% set text color to red
set(handles.txtWin,"ForegroundColor","r")
% set font size to 16pt
set(handles.txtWin,"FontSize",16)

Now hello app can be run using the Run button on the GUIDE control panel. Before starting, the window shown in Fig. 6, which says that the folder with the application files is not the current one. In this window, you can either make it current (Change MATLAB current directory switch), or add the folder to the beginning of the MATLAB search path (Add directory to the top of the MATLAB path switch), or to the end of the search path (Add directory to the bottom of the MATLAB path). Set the top radio button (as default), it is hardly worth adding a folder with such a simple application to the search path. It probably won't be needed very often.

Rice. 6. Dialog box with a message that the folder with the application files is not the current one.

Pressing the Hello button in a running application results in the inscription "Hello, World!" at the top of the window. Close the running application by clicking on the button with a cross on the title bar. You are back in edit mode. You can add controls to the application window template, set their tags and other properties, program events, run the application, and view the result. For example, shrink the GUIDE application window (as in Figure 1) and run the application again.

Note that if the application is running, restarting it from GUIDE does not result in the second application window appearing. In this section, we have discussed building a simple application by assuming a number of GUI application options such as those offered by default in the GUIDE environment. We will discuss these options in a separate section.

GUIDE provides a number of tools that make it easier to design an application:

a grid with the ability to bind objects to it, rulers and alignment lines (Tools menu, Grid and Rules item);

Tools for aligning objects (Tools menu, Align Objects item or the Align Objects button on the GUIDE control panel);

The GUIDE environment also includes:

a menu editor that allows you to create application menus and context menus (Tools menu, Menu Editor item, or Menu Editor button on the GUIDE control panel);

object browser for fast transition to their properties (button Object Browser in the GUIDE control panel)

· Editor of the order of bypassing controls with the Tab key (Tools menu, Tab Order Editor item or Tab Order Editor button on the GUIDE control panel).

The property inspector is called not only after double-clicking on an object, but also from context menu object, or by using the Property Inspector button on the GUIDE control panel.

Running an application without a GUIDE and editing

Of course, the hello application created in the previous section does not require a GUIDE environment to run. Close the GUIDE window (if it is open) and go to the MatLab command window. Make sure the application folder is current (it must be selected in the Current Directory drop-down list of the MatLab workspace). If not, then make it current using the button to the right of the Current Directory drop-down list, or the Current Directory window.

To launch an application, just type its name in the command line and press :

The application can be called not only from the command line, but also from any other application, while MatLab must be able to find the path to it, i.e. the application folder must be current, or contained in the MatLab search path

There are two ways to edit an existing GUI application:

1. Launch the GUIDE environment with the guide command and in the GUIDE Quick Start dialog that appears (see Figure 2 of the previous section), go to the Open Existing GUI tab and select an application.

2. Call guide, specifying the name of the file with the application as an input argument:

>>guide("hello.fig")

With this method, the application folder must be current, or contained in the MatLab search path.

How does an application created in GUIDE work?

This important question for those who want to create complex applications. If your goal is to write simple applications, then it is enough to learn how to place interface elements and program their events in subfunctions, as described above in the "Creating a hello application in the GUIDE" section. A simple application consists of one main window that contains various controls, text display areas, and axes. The use of standard dialog boxes makes it easier to work with files, enter data, select fonts, colors, and print results. However, if you are planning on programming multi-window applications, then read this section now, or refer back to it as needed.

Let's discuss how the hello GUI application works, which is covered in the "Creating a hello application in the GUIDE" section. Switch to application editing mode using one of the methods described in the previous section, for example:

>>guide("hello.fig")

Open the function file hello in the M-file editor. This is a function with a variable number of input and output arguments, it is shown below without automatically generated comments and subfunctions.

function varargout = hello(varargin)

GUI_Singleton = 1; gui_State = struct("gui_Name", mfilename, ... "gui_Singleton", gui_Singleton, ... "gui_OpeningFcn", @hello_OpeningFcn, ... "gui_OutputFcn", @hello_OutputFcn, ... "gui_LayoutFcn", , ... "gui_Callback", ); if nargin && ischar(varargin(1)) gui_State.gui_Callback = str2func(varargin(1)); end if nargout = gui_mainfcn(gui_State, varargin(:)); else gui_mainfcn(gui_State, varargin(:)); end

Set a breakpoint in the M-file editor on the line with the first executable statement gui_Singleton = 1. Run the hello application, for example, from the command line:

and step through the hello statements using F10 (or the Step button).

First, the gui_Singleton variable is assigned 1, then the gui_State structure is formed with the fields:

  • gui_Name - the name of the M-file running in this moment the file function of the application, which is returned by the mfilename function;
  • gui_Singleton - how many copies of the application can be launched simultaneously, in our case this field contains 1, which means that only one copy of the application can be launched (0 means that several copies can be launched simultaneously);
  • gui_OpeningFcn is a pointer to the hello_OpeningFcn subfunction (in the hello.m file) that is executed before the application window appears on the screen;
  • gui_OutputFcn - a pointer to the hello_OutputFcn subfunction (in the hello.m file) that determines what the hello function returns when called with an output argument (by default, a pointer to the application's graphical window);
  • gui_LayoutFcn - empty array by default, can be a pointer to a function that defines how the application should appear.
  • gui_Callback - while an empty array, when an event occurs from some control, it will contain a pointer to the hello function with the necessary input arguments, which will determine the executable subfunction in hello.m.

After filling the gui_State structure, it checks if the hello function was called with input arguments (nargin contains the number of input arguments) and if the first one is a string. There were no input arguments when the application started. They appear when events from controls occur. Indeed, if you display the properties of the Hello button in the property inspector and look at the value of its Callback property, it will become clear that when the Callback event of the button occurs, the hello function is called: hello("btnHello_Callback",gcbo,,guidata(gcbo)). Then the corresponding pointer is entered into the gui_Callback field of the gui_State structure using the str2func function.

Note

The str2func function constructs a pointer to a function given by a string, for example:
>> f=str2func("exp")

F = @exp

The following if statement checks to see if the hello function was called with output arguments (nargout contains the number of input arguments) and calls the special function gui_mainfcn from the gui_State structure and hello input arguments. When first called, there were no input arguments and gui_mainfcn will create the application window. Subsequent calls to hello with input arguments, triggered by control events, will call the appropriate event-handling subfunctions in hello.m. This can be followed step by step in the M-file editor.

Note

The gui_mainfcn function is open source and is located in the \toolbox\matlab\uitools\ subdirectory of the main MatLab directory.

First, let's get acquainted with the format itself, with which we have to work. The Matroska format (Matryoshka) was originally developed as an open source project designed to serve as an alternative to existing proprietary containers. As a result, after several years of development, it entered the market and began to quickly gain popularity, especially in the Internet environment. What caused such a rapid rise in popularity? First of all, the fact that the creators listened to what users want to see in their video files and implemented it. In the vast majority of cases, the video file being played needs to support multiple audio tracks and subtitles. In the mkv format, all this is implemented as simply and conveniently as possible. You can place as many alternative audio files and subtitles as you like in the container and switch between them with a single click.

Let's consider in what cases it may be necessary to use the program. For example, you downloaded a movie in which the main track is a file with Russian translation, and other roads, including English, are separate files. And you just need the original English track to improve your knowledge of the language. You can, of course, connect an external road during playback, but many players have problems with this, some don’t provide such features at all, in others it can be done, but it’s quite difficult. How to be in this case? This is where the MKVmerge GUI comes in handy. Below we will tell you how to quickly and easily add external tracks to the microv container and then quickly and easily switch between them in the player itself.

Adding additional sound roads to the mkv container

We will carry out this procedure using the MKVtoolnix 5.9 program and the Secret of Kells cartoon as an example. We have the original container with 2 audio tracks and 4 external additional tracks. Which we will add to the first two in order to get one file at the output.

This is what the main program window looks like.

In order to add a file with which we will work, you must click the "add" button or simply drag it to the area designated as "Input files". After that, we will have information about this file in it.

As you can see in the screenshot, our container already contains 1 video file in mpeg4 format, 2 audio tracks (Russian and English comments), as well as 21 subtitle files and a chapter file. In addition, we want to add the original English road to the container, 2 more Russian alternative translations and 1 Ukrainian. To do this, we press the add button in the same way or drag and drop files with the mouse.

Now we have 5 positions in the input files. In principle, this is enough to complete the formation of the container. But small improvements can be made. As you can see in the screenshot, the new sound roads have been added to the very end of the list, in addition, they have no name and no language is defined. This can be corrected by making the appropriate changes. Firstly audio tracks You can "move" up in the list by selecting them and pressing the "Up" button several times. Second, we can add descriptions for them by entering the appropriate data in the "Track Name" field. We can also specify the language of the track in the "Language" field and set the "default" track (this is the one that will be included automatically when the video starts).

As we can see, now the English track is under the first two, it has a name - Original, the language is English and the default track flag is set. We will assume that this is all that we had to do and proceed to create the file. To do this, just click the "start processing" button. By the way, in order to make our file look prettier, we will also give it a different output name. Rippers often indicate in the file name a lot of information that the user does not need, so we will shorten it and leave only the name and permission. This can be done in the item "output file name".

In this screenshot you can see the program in the process of processing the file.

graphical user interface) - variety user interface, in which the interface elements (menus, buttons, icons, lists, etc.) presented to the user on the display are executed in the form of graphic images.

Unlike the command line interface, in the GUI, the user has random access (using input devices - keyboard, mouse, joystick, etc.) to all visible screen objects (interface elements) and directly manipulates them. Most often, the interface elements in the GUI are implemented on the basis of metaphors and display their purpose and properties, which makes it easier for unprepared users to understand and master programs.

The graphical user interface is part of the user interface and defines the user interaction at the level of the rendered information.

History

In the early seventies, most users worked on computers, sitting at character terminals - the system was controlled directly from the command line through text input.

Actually, on the first computers, the question of the user interface was not raised - the professionals who worked on them could well afford to spend time studying the most complex instructions on handling the ward car - sooner or later it paid off handsomely. However, even in the days of tube monsters, when the possibility of an invasion of numerous amateur users was not assumed even in the most daring forecasts, some people already began to think about how to make the interface of an impregnable-looking computer easier and more understandable for a person sitting at the terminal.

"Lamp Monsters"

Experiments have shown that the user learned to work with a new application much faster, using the graphical interface (aka Graphical User Interface, aka GUI) instead of diligently memorizing the next commands. The benefits of working with the GUI were obvious - increased productivity, obvious comfort and just a pleasure to work with.

Step into theory - so what is a user interface? Known Russian programmer M. Donskoy gives this concept the following definition: "This includes not only, and not even so much a picture on the screen - three-dimensional, animated, or simply made in a fashionable design - but how the user interacts with the system." One of the leading theorists in the field, Theo Mandrel, succinctly defined the best interface as one that "allows the user to do what they want, when they want, and how they want." In terms of most modern software tools from such a position, then a significant part of them (if not all) will have to be recognized as extremely unsatisfactory. However, we will return to this later, and now let's turn to history again - how did it all begin?

The theoretical foundations of the GUI were laid in the 1960s by the work of Doug Engelbart, an employee of the SRI research center - this person has a mouse manipulator, a cursor controlled by the manipulator on the display screen and a system of on-screen windows responsible for the applications executed by the computer. And the point of growth for Engelbart's ideas, which were subsequently implemented into a full-fledged GUI, was the Xerox Palo Alto Research Center, Xerox PARC, organized at the turn of the 1960-70s - they experimented with a prototype graphical user interface in which the character terminal and command line were replaced by dot- raster screen with icons and numerous windows.

At that time, Xerox Corporation had achieved worldwide fame, becoming almost a monopolist in the office copier market, and decided to diversify its business into the field of emerging computer technology. It is noteworthy that at that time no one knew exactly what to do - Xerox gathered under one roof hippie talented young people from university leftists who did not want to work for the government for political reasons, and provided their wards with relative freedom. Of course, the situation of student freemen gave the administration a lot of headaches, but at the same time it greatly contributed to the emergence huge amount advanced ideas (as an example, we can name the first PC created in PARC and laser printer). One of them was the so-called WIMP paradigm (Windows, Icons, Menus, Point-and-click - windows, icons, menus, "point and click"), which later developed into the GUI.

In 1980, the GUI from research labs entered the market, and a year later, Xerox introduced the GUI-equipped 8010 STAR Information System. The implementations that followed were popular mainly in the PC market, and only Sun began to equip its workstations with a graphical interface from the very beginning. But the GUI implemented by Xerox PARC in Alto and Star computers (the commercial version of the first one) did not receive success on the market.

In fact, from a purely commercial standpoint, virtually all of Xerox's revolutionary endeavors have invariably failed. It is difficult to unequivocally say why it turned out that way - among other things, the reason is that the company paid little attention to the patent protection of its developments, which is why new Xerox technologies diverged around the world free of charge.

First GUI: screenshot of Alto

In our case, a really resounding commercial success went to a completely different company - a "fruit company" under the guise of Apple Computers, where a similar development was created based on the ideas of Xerox. Not without the help of PARC employees who went to work at Apple, by 1984 they managed to release the famous Apple Macintosh here. A significant part of its popularity was due to the very successful Lisa GUI implemented in MacOS.

GUI Lisa: the first versions of MacOS looked almost the same

A huge number of non-professional users who have bought a Macintosh Classic is an eloquent confirmation of this. But it was Apple's Lisa that was the first personal computer equipped with a graphical user interface.

By the way, nine years later, Apple to some extent managed to repeat this success by squeezing a full-fledged window interface into a fundamentally new device - the Newton Message Pad with the Newton OS 1.0 (1993) operating system.

However, in many ways ahead of its time, the company was not always able to take full advantage of its own achievements - in November 1985, Microsoft released the first version of its graphical interface for its own MS-DOS operating system - Windows 1.0 (working label Interface Manager). It was probably the first operating system, which no one ordered, and Gates undertook to develop it at his own peril and risk. The windows in it did not overlap, and due to the obvious lack of optimization for the 8086 processor, the core was not childishly buggy. The famous IBM 286 PC/AT machines became the main platform for Windows 1.0. Exactly two years later, in November 1987, Windows 2.0 was born, and version 2.10 came out a year and a half later. There was nothing particularly new in these releases, except for the appearance of overlapping windows.

Apple leadership Windows exit 1.0 was extremely disliked, and Steve Jobs summed up the dissatisfaction of top management with the following phrase: "The graphical interface is, of course, the future of everyone, but if there is so much new ahead, then why did Microsoft simply copy our Lisa ?! .." As a result, the offended "fruit" company in 1988 filed a lawsuit against Microsoft for infringement on appearance macOS. The lawsuit dragged on for several years, gradually the amount of the claim grew to an astronomical for the beginning of the nineties, more than five billion dollars, which turned this already unpromising case into a practically hopeless case - hopeless primarily for the reason that Microsoft, starting to develop Windows, bought Apple licenses the GUI. It became extremely problematic to objectively assess the degree of "inadmissibility" of borrowing interface elements from Apple, and the source code hidden behind the GUI windows was completely different.

Windows 1.0 screenshot - no desktop, no file icons or shortcuts.

In the end, Gates agreed to sign an agreement that his company would not use the Apple interface for its Windows 1.0, but the document did not say anything about future versions. this product. This innocent circumstance fully backfired in 1995, when "chicago" appeared on sale - the famous Windows 95 with an interface design that is more similar to other versions than other versions. original design Apple GUI (however, at the same time he mimicked somewhat in the capable hands of Microsoft employees). And in August 1997, after a year and a half of Apple's most serious commercial failures, a prosperous Microsoft helped the company climb out of the financial abyss by purchasing 100,000 Apple shares for $150 million. A clear political step, after which the long-drawn-out litigation around the GUI was finally terminated. In fact, history does not tolerate subjunctive moods, but if Apple suddenly managed to win this case quickly, would the world witness the phenomenal explosive growth of the open architecture of IBM-compatible PCs in the 1990s? ..

Possible Future GUI - 3D Operating Systems

The modern average user can no longer imagine his work with a computer without numerous windows, buttons, arrows - that same "friendly and understandable interface", and only a cohort of advanced professionals still prefer to use the same command line. In principle, it’s convenient for anyone and what goals are pursued - even with the modern development of the user interface, many functions are either inaccessible or inconvenient when using the graphical windowed mode, and the GUI itself often leaves much to be desired ... But the fact remains - it is the graphical interface that has become one of the main reasons for the promotion of computers to the broad consumer masses.

A cohort of advanced professionals prefers to use the unchanged command line.

Classification

The following types of GUI can be distinguished:

  • simple: typical screen forms And standard elements interfaces provided by the GUI subsystem itself;
  • true graphic, two-dimensional: non-standard interface elements and original metaphors implemented by the application's own tools or by a third-party library;
  • three-dimensional.

DWIM

One of the requirements for a good graphical interface of a software system is the concept of "do what I mean" or DWIM (eng. Do What I Mean). DWIM requires the system to work predictably so that the user intuitively knows in advance what action the program will perform upon receiving his command.

Advantages

  • The graphical interface is "friendly" to users who have started to get to know the computer from the graphical interface.
  • In graphics processing programs, it is often the only possible

disadvantages

  • Greater memory consumption compared to the text interface
  • Harder to manage remote work
  • The impossibility of automation if it was not laid down by the author of the program
  • The graphical interface is not "friendly" to users who started to get to know the computer from the command line interface.
  • The GUI is harder to use for blind people.

List of popular GUIs

  1. GNOME
  • Windows
  1. Windows Vista
  2. Windows 7
  3. Windows 10
  • MacOS X
  1. Leopard

Links

  1. Graphical user interface. (2016, December 22). In Wikipedia, The Free Encyclopedia. Retrieved 00:07, December 22, 2016, from https://en.wikipedia.org/w/index.php?title=Graphical_user_interface&oldid=756097302
  2. imtime [Electronic resource]: GUI (Graphical User Interface) - so who is the first? / Date of access: 12/25/16. - Access mode:

Git is very popular system version control and collaborative development of open source projects. With Git, you can track changes in the source code of your projects, revert previous versions in case of critical errors, as well as share your code with everyone and accept corrections from them.

This is a powerful system that allows you to optimize the work on your projects. There are no language or file structure requirements, so developers have complete freedom of action. In this article, we will look at how to use git for beginners. Let's consider everything in great detail, from settings to project branches.

By tradition, before moving on to examples and working with the command, let's look at its main options and parameters. The git syntax is very simple:

$ git options command arguments

First, consider the options, they affect the operation of the entire utility:

  • -C- use the specified repository folder instead of the current folder;
  • -c parameter=value- use the specified configuration parameter value;
  • -p- scroll through the entire output with less;

Now consider git commands, there are a few more of them and it is with the help of them that you will perform all the basic actions:

  • add- add a file or folder to a git repository;
  • am- apply all patches from email;
  • archive- create a file archive;
  • bisect- use binary search to find the desired commit;
  • branch- management of project branches;
  • bundle- moving objects and links in the archive;
  • checkout- switching between branches;
  • cherry-pick- make changes to existing commits;
  • clean- delete all untracked files and folders of the project;
  • clone- create a copy of the remote repository in a folder;
  • commit- save changes to the repository;
  • diff- see changes between commits;
  • fetch- download remote repository;
  • init- create a repository;
  • merge- merge two branches;
  • pull- integrate a remote repository with a local one;
  • push- send changes to a remote repository;
  • tag- tag management;
  • worktree- management of development trees.

The arguments depend on the command used, so we will analyze them in more detail in the examples.

How does git work?

So, from all of the above, you probably already understood that version control allows you to see changes at any stage of development, as well as return to any point. But it is not so. Changes are saved as commits. In Russian - fixation. You make an initial commit to save the initial state of the project, and then for each change. It works like snapshots.

Also, git allows you to send data to remote server. Not only the finished version is sent, but all the snapshots, so anyone on the team can see the history of changes. Each snapshot needs to be commented, so working with git will be easier and clearer.

How to use Git?

Typically, the structure of a Git project will depend on the size and complexity of your program. But for starters, we will use a project that consists of only one branch. Each project contains one branch by default, it is called master. Our first project will be called test.

Create a project

When the git setup is complete let's move on to your project. At the very beginning, you just need to create a folder for the project files. If you're going to be working on multiple projects, create a git folder in your home directory and put your project folders there:

mkdir -p ~/git/testing ; cd ~/git/testing

This command will create the desired folder structure and change the current directory to the newly created one. Now let's create the first file of our project:

The project is ready, but the git version control system doesn't know about it yet.

Setting up a project in git

Before git starts tracking changes, we need to prepare all the necessary configuration files. First, we initialize an empty repository in our folder:

After the repository is created, you need to add your files to it. Each file must be added separately or tell the utility to add all files explicitly. Until you add the file itself, it will not be tracked. New files also need to be added in the future, they are not added automatically. First, let's add the current folder:

If everything went well, the command will not output anything.

Committing Changes

Changes are also not automatically tracked. Committing changes is done with commit commands. You need to indicate what has been changed with a small comment, literally in a few sentences. It's good practice to commit before every major change.

Thus, you will keep all versions of the project, from the very first to the current one, and you will also be able to know what, when and where was changed. To create your first commit, run:

git commit -m "Initial Commit" -a

The command needs to pass two parameters, the first is -m, your comment, the second -a, means that you need to apply the action to all changed files. For the first time, this option is used, but usually you need to specify the modified files or directories. For example, you can do this:

git commit -m "Changed file" file

Submitting Changes

Up to this point, we've done everything in a local repository. You can use git locally if you only need version control, but sometimes you need to exchange information with other developers and push data to a remote repository.

First you need to add a remote repository using the remote command. To do this, you need to pass it a URL:

git remote add origin https://github.com/Seriyyy95/testing.git

Then you can see the list of remote repositories:

You can use not only github servers, but also any others. Now, to submit your changes, use the following command:

git push origin master

The push command tells us to push the data to the remote repository, origin is our configured repository and master is the branch.

Branch management

For simple projects one branch is enough. But if the project is large and it has several versions, including a test version, then you may need to create a separate branch for each of them. First, let's look at the available branches:

The -a option tells you to list all branches, even if they are not synchronized. The asterisk indicates the active branch. Now let's create a development branch with the checkout command:

git checkout -b develop

You can also switch between branches using the same command:

git checkout master
$ git checkout develop

Now let's create another file:

And add it to our new develop branch:

Let's make a commit for the changes made:

git commit -m "develop file" develop

git branch
$ls

Then we switch to the master branch and look again:

git checkout master
$ git branch
$ls

There is no file here, as it should be. Git has such a useful thing as a merge. With it, you can merge two branches. For example, move the code from the working branch to the stable one. To do this, just run the merge command:

git merge develop --no-ff

Before the merge is performed, you need to enter a comment why this is needed. Then if you run ls again, you will see that there is already desired file. Our git examples have come to an end.

conclusions

In this article, we looked at how to use git to manage versions of our projects. This is just the most basic information, and the git version control system can do a lot more, but reviewing it additional features is beyond the scope of this article. I hope this article was helpful to you.







2022 gtavrl.ru.