Archive | EN Java

[Java] Remember to add the object to the file in java – Append object to file exist in java

After Reading scored objects from the file in java, there are many issues that you need to write more data on file. Usually we just declare, however after many attempts I have not done. Search for a while, apart from the extra stuff 2 is true as above, we need to override the following methods writeStreamHeader: 1. Quick Code to test 2. Code […]

[Java] Read the Excel file in Java with JXL – Read write Excel file in Java with jxl

In the course of work and data processing we often have to interact with the file especially Excel File. Today I'll show you the simple steps to read Excel files recorded with JXL. JXL is a library package allows us to interact called Excel as read, record,.., Detailed information about the JXL package you see here. First of […]

[Java] Execute the command line with java – Execute command line in java

You never want to execute a command from a terminal like java? This article will help you do it in a simple way. Note that I do on Ubuntu, so on Windows or some other distro of Linux may vary slightly. Assuming you've installed vlc and now you want to open with vlc video chim_trang_mo_coi.mp4 in /home/nguyenvanquan7826/Desktop/chim_trang_mo_coi.mp4. You write a program like […]

[Java] Get the size of the object – Get size of Object

There are several ways to get the size of an object, in this article I'll show you how to build a class to own property. Said the construction of this question but what people write and, we just copied and used only, without interest or impact on it at all.

[Java]Standardized strings in Java – Standardize string in java

To normalize the string in Java, we need to remove the extra white space at the top, end and mid-strings. First we manually delete the spaces at the beginning and end by methods trim(). For example we have: Then followed our work will be cut out for extra spaces in between the strings. To do this there are many ways, I outlined here 2 substantially […]

[Java] Read recorded in the Java Object – Read Write Object in Java

To read recorded in the Java Object in the Object class in which we need to interface java.io.Serializable A simple example of reading record 1 Object MyStudent as follows: Result: My name is Nguyen Van Quan. I am 21 years old Note: When you open a file student.dat will see this kind of data: A more specific example of how to read and write, in such […]

[Java swing] Using Border in Java

The simple border The border open border titled The combination of type long long time no border post on Swing, in this article I will guide you to learn how to use the Border. Literally is the contour in Java. We will turn to find out 4 contour as the category listed. Using simple border to create the Border, […]

[Java Swing] JComboBox in Java – JComboBox in Java

Creating Content for JComboBox JComboBox JComboBox Getting event is an object that allows you to select an element to click on the arrow of it. For example, I have a JFrame JComboBox selected from the following flags: Now we are going to learn by creating a JFrame JComboBox like on. How to create a JComboBox To create JComboBox we use the constructor […]

[Java swing] JToolBar in Java

JToolBar is a long bar with icons including the corresponding button is usually located under the menu, like toolbars in Word, excel with new buttons, open, save, … We will implement programs like the image above, including 3 new button, open, Save on the toolbar. When you click on the button below JTextArea will display the corresponding event. This toolbar you can […]

[Java swing] JFileChooser in Java

JFileChooser in Java is an object display frame allows you to open or save the file. It's like this: Now we will go as a simple example of open and save files. In the code above you noticed 2 displayed in order to open and save files are different. int select = fc.showOpenDialog(this); int select = fc.showSaveDialog(this); The next argument is that you can JFileChooser.APPROVE_OPTION […]