Chia sẻ kiến thức IT ứng dụng: AI, Backend, Frontend, Full Stack, DevOps & Cloud, and More.

Showing posts with label GUI. Show all posts
Showing posts with label GUI. Show all posts

Wednesday, August 24, 2016

NetBeans IDE hot keys

Shift + ESC = Maximize cửa sổ code. Lặp lại lần nữa sẽ trở về cửa sổ bình thường
Alt + shifft + F = Format source code
Ctrl + / = comment dòng hiện tại
Alt-Shift-I = Fix selected class's import
Ctrl-Shift-C = Add/remove comment lines
Ctrl-E Delete current line
Alt-Insert =open the Generate dialog and choose Getter and Setter
Ctrl-Space = autocomplete code
Ctrl + O = Go To Type
Alt + Shift + O = Go to File

Compiling, Testing, and Running
F6/Shift-F6 =Run main project/file
Ctrl + F5 = Debug project
F9 = Compile package/ file
F11 = Build main project
Shift-F11 = Clean & build main project
Ctrl-F6/Alt-F6 =Run Unit test on file/project

Opening and Toggling between Views
Ctrl-Tab =Switch between open documents by order used
Shift-Escape Maximize window (toggle)
Ctrl-F4/Ctrl-W =Close selected window
Ctrl-Shift-F4 =Close all windows
Shift-F10 =Open contextual menu
Ctrl-PgUp / PgDown =Switch between open
Ctrl-Alt-T =Reopen recently closed file
Alt-Mouse Wheel Up/Down =Zoom text in / out

Tài liệu tham khảo:
Ten Time-Savers in NetBeans
Netbeans IDE cheat Sheet

Monday, November 5, 2012

Màu cộng - Additive color & Màu trừ - Subtractive color

What Is Color?
Color is the byproduct of the spectrum of light, as it is reflected or absorbed, as received by the human eye and processed by the human brain.

Additive Color
The tools we use to describe color are different when the color is printed than from when it is projected. Projected color is additive. Printed color is subtractive.
Visible light is a small part of the electromagnetic spectrum, between the wavelengths of 400 and 700 nm (nanometers = billionth of a meter). In 1666 Sir Isaac Newton used a glass prism to refract white light at different angles according to wave length. He saw a rainbow of colors, which he passed through a second prism to re-form white light. He concluded that white light is a mixture of all the colors of the visible spectrum.

Sir Newton was playing with additive color. No light (or color) is black. All light (all colors) is white.

Each color of the spectrum has a specific frequency. Adding different colors of light together increases the number of frequencies present and the more colors you add the closer it becomes to white. Therefore, light is called an additive color mixing system. This type of color mixing is used in computer monitors, TV sets, and to illuminate actors on stage.
=> Có thể hiểu màu cộng là màu của quang phổ ánh sáng biểu kiến (nhìn thấy) với cách tiếp cận trên nền màu đen.

Subtractive Color
The color we see on paper is created using a subtractive model, where the frequencies that are not absorbed form the color we see.
When you project light, you are sending out frequencies of light that add together to form a certain color beam. Think of it as painting with light. In contrast, the color we put down on paper works exactly the opposite. The color we we see is the spectrum of light which is reflected by the paper or by the ink, crayon, or marker we put on the paper.
Historically artists and designers have not worked with light but with paints and pigments. Colors of paint absorb most of the light frequencies and reflect back only the wavelength that defines the color you see. Mixing different paints makes a darker color because more of the light frequencies are absorbed. This method of mixing colors is called subtractive because each color absorbs, light frequencies, subtracting them from the total mixture.

A subtractive color model is the very first type of color we learn as a child, when we are taught that the three primary colors of red, yellow, and blue can be mixed to form all colors. The printing inks magenta, yellow, and cyan are essentially a more sophisticated version of our childhood crayons.

=> Để rõ hơn về mô hình màu trừ, chúng ta có thể xem thêm đoạn tài liệu sau:
Subtractive color: Illuminate objects that contain dyes or pigments that remove portions of the visible spectrum. The objects may either transmit light (transparencies) or reflect light (paper, for example). The subtractive primaries are C, M and Y. Cyan absorbs red; hence C is sometimes called "minus red" (-R). Similarly, M is -G and Y is -B. The two approaches are illustrated on the right and described in the table below. 
=> màu trừ có cách tiếp cận trên nền trắng, có sự trộn lẫn các màu cơ bản cyan, magenta, yellow (thực tế có thêm màu đen - black, ký hiệu là K); chính sự trộn lẫn đã làm mất đi một số thành phần màu đơn sắc (do bị hấp thụ) vì vậy mà người ta gọi cách tạo màu này là mô hình màu trừ.

Sunday, November 4, 2012

Tìm hiểu phần mềm autocad trong xây dựng

1. Khái niệm Autocad
Auto : tự động
CAD (Computer-Aided  Design) : Thiết kế nhờ máy tính
AutoCAD  là phần mềm của hãng AutoDESK dùng để  thực hiện các bản vẽ kỹ thuật 2D/3D trong các ngành Xây dựng, Cơ khí, Giao thông, Kiến trúc, Điện, Bản đồ...
Trong lĩnh vực xây dựng, autocad được dùng bởi các công ty xây dựng & kiến trúc để thực hiện các bản vẽ những công trình xây dựng quy mô vừa và lớn. Tuy nhiên, đối với những người thợ xây ở các làng quê Việt nam - làm ăn nhỏ lẻ, thì một bản vẽ nháp sơ bộ bằng bút chì cũng là quá đủ để tiến hành xây những ngôi nhà cấp 4 hoặc vài 3 tầng & việc thực hiện kết cấu chính như kỹ thuật đổ móng, dầm, xà, cột, cầu thang,.. được tiến hành theo kinh nghiệm; trước đây, ở các thị trấn, thị xã, người ta có thể làm các bản vẽ xây dựng bằng cách vẽ tay ở mức độ đơn giản.
Dù sao, Autocad  vẫn là xu thế của xã hội hiện đại, nó tạo ra một kiểu làm ăn chuyên nghiệp cho các công ty xây dựng. Autocad cho phép sử dụng lại những thiết kế trước đó thông qua block, bản in sạch sẽ hơn, nhưng nó vẫn bị thay thế bởi cách xử lý thủ công của những nhóm xây dựng nhỏ.

Tuesday, March 13, 2012

Java 2D: Composition Rules

In the standard RGB color model, every color is described by its red, green, and blue components. However, it is also convenient to be able to describe areas of an image that are transparent or partially transparent. When you superimpose an image onto an existing drawing, the transparent pixels do not obscure the pixels under them at all, whereas partially transparent pixels are mixed with the pixels under them. Figure 7-23 shows the effect of overlaying a partially transparent rectangle on an image. You can still see the details of the image shine through from under the rectangle.

Figure 7-23. Overlaying a partially transparent rectangle on an image

 

In the Java 2D API, transparency is described by an alpha channel. Each pixel has, in addition to its red, green, and blue color components, an alpha value between 0 (fully transparent) and 1 (fully opaque). For example, the rectangle in Figure 7-23 was filled with a pale yellow color with 50% transparency:
new Color(0.7F, 0.7F, 0.0F, 0.5F);

Monday, March 12, 2012

Java 2D: clipping

1. What isclipping
Clipping is the process of confining paint operations to a limited area or shape.

2. Clipping the Drawing Region
Any Shape object can be used as a clipping path that restricts the portion of the drawing area that will be rendered. The clipping path is part of the Graphics2Dcontext; to set the clip attribute, you call Graphics2D.setClip and pass in the Shape that defines the clipping path you want to use. You can shrink the clipping path by calling the clip method and passing in another Shape; the clip is set to the intersection of the current clip and the specified Shape.

Friday, March 9, 2012

Java 2D: Areas, Strokes, Paint

Areas
An Area object stores and manipulates a resolution-independent description of an enclosed area of 2-dimensional space. Area objects can be transformed and can perform various Constructive Area Geometry (CAG) operations when combined with other Area objects. The CAG operations include area addition, subtraction, intersection, and exclusive or. See the linked method documentation for examples of the various operations.
The Area class implements the Shape interface and provides full support for all of its hit-testing and path iteration facilities, but an Area is more specific than a generalized path in a number of ways..

With the Area class, you can perform boolean operations, such as union, intersection, and subtraction, on any two Shape objects. This technique, often referred to as constructive area geometry, enables you to quickly create complex Shape objects without having to describe each line segment or curve.

Area - Core Java™ 2 Volume II - Advanced Features, Seventh Edition

Sunday, March 4, 2012

Java 2D: Shapes

Here are some of the methods in the Graphics class to draw shapes:
drawLine
drawRectangle
drawRoundRect
draw3DRect
drawPolygon
drawPolyline
drawOval
drawArc
There are also corresponding fill methods. These methods have been in the Graphics class ever since JDK 1.0. The Java 2D API uses a completely different, object-oriented approach. Instead of methods, there are classes:
Line2D
Rectangle2D
RoundRectangle2D
Ellipse2D
Arc2D
QuadCurve2D
CubicCurve2D
GeneralPath
These classes all implement the Shape interface.
Finally, the Point2D class describes a point with an x- and a y-coordinate. Points are useful to define shapes, but they aren't themselves shapes.

Java 2D: Ví dụ ShapesDemo2D.java

GeneralPath class implements the Shape interface and represents a geometric path constructed from lines, and quadratic and cubic curves. The three constructors in this class can create the GeneralPath object with the default winding rule (WIND_NON_ZERO), the given winding rule (WIND_NON_ZERO or WIND_EVEN_ODD), or the specified initial coordinate capacity. The winding rule specifies how the interior of a path is determined.
public void Paint (Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    ...
} 

Saturday, February 25, 2012

Java 2D: Coordinate Transformations

Coordinates

The Java 2D™ API maintains two coordinate spaces:
  • User space – The space in which graphics primitives are specified
  • Device space – The coordinate system of an output device such as a screen, window, or a printer
User space is a device-independent logical coordinate system, the coordinate space that your program uses. All geometries passed into Java 2D rendering routines are specified in user-space coordinates.
When the default transformation from user space to device space is used, the origin of user space is the upper-left corner of the component’s drawing area. The xcoordinate increases to the right, and the y coordinate increases downward, as shown in the following figure. The top-left corner of a window is 0,0. All coordinates are specified using integers, which is usually sufficient. However, some cases require floating point or even double precision which are also supported.

Friday, February 24, 2012

ImageProcessing: Working with Images

As you have already learned from the Images lesson, Images are described by a width and a height, measured in pixels, and have a coordinate system that is independent of the drawing surface.
There are a number of common tasks when working with images.
  • Loading an external GIF, PNG JPEG image format file into Java 2D™'s internal image representation.
  • Directly creating a Java 2D image and rendering to it.
  • Drawing the contents of a Java 2D image on to a drawing surface.
  • Saving the contents of a Java 2D image to an external GIF, PNG, or JPEG image file.
This lesson teaches you the basics of loading, displaying, and saving images.
The are two main classes that you must learn about to work with images:
  • The java.awt.Image class is the superclass that represents graphical images as rectangular arrays of pixels.
  • The java.awt.image.BufferedImage class, which extends the Image class to allow the application to operate directly with image data (for example, retrieving or setting up the pixel color). Applications can directly construct instances of this class.
The BufferedImage class is a cornerstone of the Java 2D immediate-mode imaging API. It manages the image in memory and provides methods for storing, interpreting, and obtaining pixel data. Since BufferedImage is a subclass of Image it can be rendered by the Graphics and Graphics2D methods that accept an Image parameter.
A BufferedImage is essentially an Image with an accessible data buffer. It is therefore more efficient to work directly with BufferedImage. A BufferedImage has aColorModel and a Raster of image data. The ColorModel provides a color interpretation of the image's pixel data.
The Raster performs the following functions:
  • Represents the rectangular coordinates of the image
  • Maintains image data in memory
  • Provides a mechanism for creating multiple subimages from a single image data buffer
  • Provides methods for accessing specific pixels within the image
The basic operations with images are represented in the following sections:

Reading/Loading an image

This section explains how to load an image from an external image format into a Java application using the Image I/O API

Drawing an image

This section teaches how to display images using the drawImage method of the Graphics and Graphics2D classes.

Creating and drawing To an image

This section describes how to create an image and how to use the image itself as a drawing surface.

Writing/saving an image

This section explains how to save created images in an appropriate format.

PHỔ BIẾN

CHUYÊN MỤC

TỔNG LƯỢT XEM