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.

ImageProcessing: Mở đầu với Java Images

In the Java 2D™ API an image is typically a rectangular two-dimensional array of pixels, where each pixel represents the color at that position of the image and where the dimensions represent the horizontal extent (width) and vertical extent (height) of the image as it is displayed.
There are bitmap and vector images. Bitmap images (also known as raster images) are made up of pixels in a grid.  Vector images are made up of many individual, scalable objects such as points, lines, curves or polygons. These objects are defined by mathematical equations rather than pixels.

HOWTO:Dynamically building components using NetAdvantage for JSF

Summary

This article will show you how to build components at run time as the component is rendered, using NetAdvantage for JSF dynamically. The components will be created in the Java server-side code of the backing bean, instead of using tags to create the components in the JSP page. This is useful if either the contents or the format of the component is not known until run time.

Additional Information

For this example, we are going to create a Sidebar and dynamically add Sidebar groups and links to the Sidebar.

Although the example shows how to dynamically create Sidebar groups in a Sidebar component, the same technique should work for any JSF component.

Saturday, November 5, 2011

JavaFX 2 — The new Java desktop client run on web browser

What Is JavaFX?

The JavaFX platform is the evolution of the Java client platform designed to enable application developers to easily create and deploy rich internet applications (RIAs) that behave consistently across multiple platforms. Built on Java technology, the JavaFX platform provides a rich set of graphics and media API with high-performance hardware-accelerated graphics and media engines that simplify development of data-driven enterprise client applications.

Wednesday, September 28, 2011

GWT pros and cons

What is the best approach towards styling GWT applications?
General approach in GWT is to use Panels and then apply custom CSS themes to get a customized look. While I can achieve a certain extent of personalization of my GWT app through CSS tinkering, I was wondering how others generally approach styling.
Some of the suggestions I came across the web were to manage layout with plain HTML, through use of HTMLPanel's. This way one can straightaway use the HTML mock-up within the application without having to code all the layout.
So what in your opinion is the best and least painful way to approach layout and custom styling of GWT application?

It all depends - on you, your experience, your team, etc:

Tuesday, September 13, 2011

Developing GWT Applications with NetBeans


Posted by Tom Stocky - Wednesday, December 12, 2007 at 10:04:00 AM

We're excited to have another guest blog post for you, brought to you by Jeet Kaul, VP of Sun's Developer Products and Programs. He's here to talk about using NetBeans to build web apps with GWT.
Google Web Toolkit is getting a lot of attention in the web developer community thanks to its interesting way of avoiding the need to write JavaScript code for interactive web applications. Developers from the NetBeans community recognized the benefits of such a solution and created a plug-in which integrates GWT support into the NetBeans IDE. NetBeans users can now choose GWT as one of the supported web frameworks, and NetBeans then helps them with all the important tasks such as editing, building, running and debugging GWT applications. Here's how to get started with GWT development in NetBeans and where to find more information about the plug-in.
Although GWT is not supported in NetBeans 6 out of the box, you can download this GWT plug-in and start

Friday, April 22, 2011

Getting Started With the NetBeans IDE Tutorial

By Dana Nourie, May 22, 2005, Updated July 2008
Content
Using an Integrated Development Environment (IDE) for developing applications saves you time by managing windows, settings, and data. In addition, an IDE can store repetitive tasks through macros and abbreviations. Drag-and-drop features make creating graphical user interface (GUI) components or accessing databases easy, and highlighted code and debugging features alert you to errors in your code.
The NetBeans IDE is open source and is written in the Java programming language. It provides the services common to creating desktop applications -- such as window and menu management, settings storage -- and is also the first IDE to fully support JDK 6.0 features. The NetBeans platform and IDE are free for commercial and noncommercial use, and they are supported by Sun Microsystems.

Wednesday, April 20, 2011

Building a Java Desktop Database Application

This tutorial shows how to create a desktop Java application through which you can access and update a database. The tutorial takes advantage of support in NetBeans IDE for the following technologies:
  • The Java Persistence API (JPA), which helps you use Java code to interact with databases.
  • Beans Binding (JSR-295), which provides a way for different JavaBeans components to have property values that are synchronized with each other. For example, you can use beans binding to keep the values of cells in a JTable visual component in synch with the values of fields in an entity class. (In turn, the entity class represents the database table.)
  • The Swing Application Framework (JSR-296), which provides some useful building blocks for quickly creating desktop applications.
We will create a database CRUD (create, read, update, delete) application with a custom component used for visualizing the data (car design preview).
This tutorial is largely based on a screencast that was based on a development build of a previous version of the IDE. Some of the user interface has changed since that demo was made, so you might notice some differences between this tutorial and the demo. You can view the demo (about 9 minutes) now or download a zip of the demo.

Tuesday, February 8, 2011

GDI+ Application

This article discusses vital concepts, including the life cycle of a graphics application. After reading this article, you should understand the basics of the GDI+ coordinate system, basic graphics structures used by GDI+, drawing surfaces, and how to write a graphics application using GDI+.

To write a graphics application, a good understanding of drawing surfaces and coordinates system is necessary. We will begin by discussing these concepts and how they are represented in GDI+. Then you'll learn step-by-step how to write a graphics application in the .NET Framework using GDI+. We will cover the following topics:
  • How to add a reference to the GDI+ library
  • How to get a drawing surface in the program
  • How to create pens and brushes
  • How to use pens and brushes to draw graphics objects

Using Transformations in c#

All of the discussion and examples so far have been drawn in C#’s native drawing units: pixels. By default, all of the Graphics object’s filling and drawing methods work in pixels.

However, pixels may not always be the most convenient unit for you. For example, suppose you want to draw a simple bar chart showing sales figures between $1M and $30M for the years 1990 through 2000. Since you can’t use pixel coordinates as large as (1995,1,000,000), you’ll need to perform some mathematical calculations to map these big values into something that will fit on your screen.
While you can perform those calculations yourself if you like, the Graphics object provides transformation methods that can do this for you. The main transformation methods are TranslateTransform, ScaleTransform, and RotateTransform, which translate, scale, and rotate subsequent graphics, respectively.

PHỔ BIẾN

CHUYÊN MỤC

TỔNG LƯỢT XEM