1. 변수와 자료형

자바에서의 int,boolen,String 등 변수의 자료형은 그대로 가지고 있으나 차이점은

그 자료형 상위에 var, val 2가지 자료형이 존재한다. var는 read,write가 가능한 일반적인

변수라고 생각하면 되면 val는 초기값이 정해진 이후에는 read,write가 불가능한 함수 상수변수라고 

생각하면된다.

 

코틀린은 기본적으로 'null'값 허용 하지 않으나 'null'값이 필요할 시에는 변수 선언시 자료형뒤에 '?'키워드를

넣어주미녀된다

null  허용하지 않는 변수선언 ex)


var a: Int = 123
a = 123
println(a)

 

nullable 변수 ex)
var b: Int? = null

변수 정수형 -> byte, Short, Int, Long
실수형 -> Float, Double
문자열 -> char, boolean
문자열은 기본 String
자바와 호환으로 거의 동일



Posted by 모과이IT
,

 

namespace WindowsFormsApplication5
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Drawing.Drawing2D;

    /// <summary>
    /// Main application form
    /// </summary>
    public partial class Form1 : Form
    {
        /// <summary>
        /// Initializes a new instance of the WindowsFormsApplication5.Form1 class
        /// </summary>
        public Form1() {
            InitializeComponent();
            DoubleBuffered = true;
        }

        private Point selectionStart;
        private Point selectionEnd;
        private Rectangle selection;
        private bool mouseDown;

        private void GetSelectedTextBoxes() {
            List<TextBox> selected = new List<TextBox>();

            foreach (Control c in Controls) {
                if (c is TextBox) {
                    if (selection.IntersectsWith(c.Bounds)) {
                        selected.Add((TextBox)c);
                    }
                }
            }

            // Replace with your input box
            MessageBox.Show("You selected " + selected.Count + " textbox controls.");
        }

        protected override void OnMouseDown(MouseEventArgs e) {
            selectionStart = PointToClient(MousePosition);
            mouseDown = true;
        }

        protected override void OnMouseUp(MouseEventArgs e) {
            mouseDown = false;

            SetSelectionRect();
            Invalidate();

            GetSelectedTextBoxes();
        }

        protected override void OnMouseMove(MouseEventArgs e) {
            if (!mouseDown) {
                return;
            }

            selectionEnd = PointToClient(MousePosition);
            SetSelectionRect();

            Invalidate();
        }

        protected override void OnPaint(PaintEventArgs e) {
            base.OnPaint(e);

            if (mouseDown) {
                using (Pen pen = new Pen(Color.Black, 1F)) {
                    pen.DashStyle = DashStyle.Dash;
                    e.Graphics.DrawRectangle(pen, selection);
                }
            }
        }

        private void SetSelectionRect() {
            int x, y;
            int width, height;

            x = selectionStart.X > selectionEnd.X ? selectionEnd.X : selectionStart.X;
            y = selectionStart.Y > selectionEnd.Y ? selectionEnd.Y : selectionStart.Y;

            width = selectionStart.X > selectionEnd.X ? selectionStart.X - selectionEnd.X : selectionEnd.X - selectionStart.X;
            height = selectionStart.Y > selectionEnd.Y ? selectionStart.Y - selectionEnd.Y : selectionEnd.Y - selectionStart.Y;

            selection = new Rectangle(x, y, width, height);
        }
    }
}

 

Posted by 모과이IT
,

https://stackoverflow.com/questions/33058358/jitpack-io-failed-to-resolve-github-repo

'개발지식창고 > Android_Java' 카테고리의 다른 글

blocked by play protect debug apk  (0) 2021.10.13
scrollable tab  (0) 2018.06.23
FLAG_ACTIVITY 사용법  (0) 2018.06.21
안드로이드 기기 해상도  (0) 2018.06.20
ScrollView 안에 LinearLayout의 weight를 사용하는 법  (0) 2018.06.19
Posted by 모과이IT
,