Tutorial by Examples: comp

A component is some sort of user interface element, such as a button or a text field. Creating a Component Creating components is near identical to creating a window. Instead of creating a JFrame however, you create that component. For example, to create a JButton, you do the following. JButton b...
Components have various parameters that can be set for them. They vary from component to component, so a good way to see what parameters can be set for components is to start typing componentName.set, and let your IDE's autocomplete (If you use an IDE) suggest methods. The default shortcut in many I...
DescriptionClassButtonJButtonCheckboxJCheckBoxDrop down menu / Combo boxJComboBoxLabelJLabelListJListMenu barJMenuBarMenu in a menu barJMenuItem in a menuJMenuItemPanelJPanelProgress barJProgressBarRadio buttonJRadioButtonScroll barJScrollBarSliderJSliderSpinner / Number pickerJSpinnerTableJTableTre...
Whenever AFNetworking is used the call is dispatched on a custom thread provided by AFNetworking. When the call returns to the completion block, it gets executed on the main thread. This example sets a custom thread that dispatch to the completion block: AFNetworking 2.xx: // Create dispatch_queu...
There are many cases when one has created an NSDate from only an hour and minute format, i.e: 08:12 that returns from a server as a String and you initiate an NSDate instance by these values only. The downside for this situation is that your NSDate is almost completely "naked" and what yo...
#include <stddef.h> // size_t, ptrdiff_t //----------------------------------- Machinery: using Size = ptrdiff_t; template< class Item, size_t n > constexpr auto n_items( Item (&)[n] ) noexcept -> Size { return n; } //----------------------------------- Us...
Sass supports all the usual comparison operators: <,>,==,!=,<=,>=. Examples (10px == 10) // Returns true ("3" == 3) // Returns false $padding: 10px; $padding <= 8px; // Returns false
A Button directive which accepts an @Input() to specify a click limit until the button gets disabled. The parent component can listen to an event which will be emitted when the click limit is reached via @Output: import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component(...
A custom control does not have to limit itself to trivial things like primitives; it can edit more interesting things. Here we present two types of custom controls, one for editing persons and one for editing addresses. The address control is used to edit the person's address. An example of usage wo...
The components in angularJS can be visualised as a custom directive (< html > this in an HTML directive, and something like this will be a custom directive < ANYTHING >). A component contains a view and a controller. Controller contains the business logic which is binded with an view , w...
Inside parent-component.hbs {{yield (hash child=( component 'child-component' onaction=(action 'parentAction') ) )}} Inside parent-component.js export default Ember.Component.extend({ actions: { // We pass this action to the child to call at it's discretion par...
Make project (compile modifed and dependent) Windows: Ctrl + F9 OS X / macOS: Cmd + F9 Compile selected file, package or module This is useful to know, as when debugging this shortcut can be used to quickly reload / hotswap classes. Windows: Ctrl + Shift + F9 OS X / macOS: Cmd + Shift + F9 Se...
Basic code completion (the name of any class, method or variable) Windows: Ctrl + Space OS X / macOS: Cmd + Space Smart code completion (filters the list of methods and variables by expected type) Windows: Ctrl + Shift + Space OS X / macOS: Cmd + Shift + Space Overwriting code with a suggestio...
A basic AppComponent that depends on a single AppModule to provide application-wide singleton objects. @Singleton @Component(modules = AppModule.class) public interface AppComponent { void inject(App app); Context provideContext(); Gson provideGson(); } A module to use to...
By default the Large Object Heap is not compacted unlike the classic Object Heap which can lead to memory fragmentation and further, can lead to OutOfMemoryExceptions Starting with .NET 4.5.1 there is an option to explicitly compact the Large Object Heap (along with a garbage collection): GCSettin...
Say we are working on a class representing a Person by their first and last names. We have created a basic class to do this and implemented proper equals and hashCode methods. public class Person { private final String lastName; //invariant - nonnull private final String firstName; //in...
The Comparable<T> interface requires one method: public interface Comparable<T> { public int compareTo(T other); } And the Comparator<T> interface requires one method: public interface Comparator<T> { public int compare(T t1, T t2); } These two met...
Download and install Visual Studio Community 2015 Open Visual Studio Community Click File -> New -> Project Click Templates -> Visual C++ -> Win32 Console Application and then name the project MyFirstProgram. Click Ok Click Next in the following window. Check the Empty proj...
_mycompletion() { local command_name="$1" # not used in this example local current_word="$2" local previous_word="$3" # not used in this example # COMPREPLY is an array which has to be filled with the possible completions # compgen is used to fi...
The method compareTo should be used to compare BigDecimals: BigDecimal a = new BigDecimal(5); a.compareTo(new BigDecimal(0)); // a is greater, returns 1 a.compareTo(new BigDecimal(5)); // a is equal, returns 0 a.compareTo(new BigDecimal(10)); // a is less, returns -1 Commonly you shou...

Page 10 of 34