'분류 전체보기'에 해당되는 글 84건

  1. 2010.09.22 [Qt Designer] 확장 다이얼로그
  2. 2010.09.19 [GUI] Empty Form
  3. 2010.09.18 Qt Designer
  4. 2010.09.07 정규식을 이용한 주민등록번호 추출
  5. 2010.08.31 java
  6. 2010.08.26 쓰레드
  7. 2010.08.24 오토박싱/언박싱
  8. 2010.08.23 [ImageButton, Toast]
  9. 2010.08.23 용어 tabstop shiftwidth
  10. 2010.08.23 Stream

[Qt Designer] 확장 다이얼로그

|
전체 다이얼로그 작성
More 버튼 (toggle) -> 확장될 위젯들 (setVisible)
cpp의 생성자에서 확장될 위젯들은 hide()
-

'Qt' 카테고리의 다른 글

qt 메뉴 등록  (0) 2010.09.23
Qt Designer  (0) 2010.09.18
Qt Creator Manual  (0) 2010.06.10
Qt Compile  (0) 2010.06.06
And

[GUI] Empty Form

|
-
1. File | new Project
Empty Project 선택, Name 지정 (EmptyForm)
2. Project | Add Reference
.Net 탭에서 System.Windows.Form 선택
3. 코드 작성
EmptyForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using System;
using System.Windows.Forms;

public class EmptyForm : System.Windows.Forms.Form
{
    public EmptyForm()
    {
    }

    public static int Main()
    {
        Application.Run(new EmptyForm());
        return 0;
    }
}

FirstWindowApplication
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class MyFirstWindow : System.Windows.Forms.Form
{
    public MyFirstWindow()
    {
        initializeComponent();
    }

    private void initializeComponent()
    {
        this.Size = new System.Drawing.Size(300, 300);
        this.Text = "MyFirstWindow";
    }

    public static void Main(string[] args)
    {
        Application.Run(new MyFirstWindow());
    }
}

AFormBasedWindowSkeleton.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;
using System.Windows.Forms;

class WinSkel : Form
{
    public WinSkel()
    {
        Text = "A Windows Skeleton";
    }

    [STAThread]
    public static void Main()
    {
        WinSkel skel = new WinSkel();
        Application.Run(skel);
    }
}

ExitApplication.cs
using System;
using System.Windows.Forms;
using System.Drawing;

class FormExit : Form
{
    Button StopButton;

    public FormExit()
    {
        Text = "Adding a Stop Button";

        StopButton = new Button();
        StopButton.Text = "Stop";
        StopButton.Location = new Point(100, 100);

        StopButton.Click += StopButtonClick;
        Controls.Add(StopButton);
    }

    [STAThread]
    public static void Main()
    {
        FormExit skel = new FormExit();

        Application.Run(skel);
    }

    protected void StopButtonClick(object who, EventArgs e)
    {
        Application.Exit();
    }
}

ButtonEventHnadler.cs
using System;
using System.Windows.Forms;
using System.Drawing;

public class ButtonClickEvent : System.Windows.Forms.Form
{
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox1;

    public ButtonClickEvent()
    {
        Text = "Test WinForm";

        ForeColor = System.Drawing.Color.Yellow;

        button1 = new System.Windows.Forms.Button();
        textBox1 = new System.Windows.Forms.TextBox();

        button1.Location = new System.Drawing.Point(8, 32);
        button1.Name = "button1";
        button1.Size = new System.Drawing.Size(104, 32);
        button1.TabIndex = 0;
        button1.Text = "Click Me";

        textBox1.Location = new System.Drawing.Point(24, 104);
        textBox1.Name = "textBox1";
        textBox1.Size = new System.Drawing.Size(184, 20);
        textBox1.TabIndex = 1;
        textBox1.Text = "textBox1";

        Controls.AddRange(new System.Windows.Forms.Control[]{textBox1, button1});
        
        button1.Click += new System.EventHandler(button1_Click);
    }

    private void button1_Click(object sender, System.EventArgs e)
    {
        textBox1.Text = "Button is clicked";
        MessageBox.Show("Button is clicked");
    }

    public static int Main()
    {
        Application.Run(new ButtonClickEvent());
        return 0;
    }
}

SeparateMainClass.cs
using System;
using System.Drawing;
using System.Windows.Forms;

class SeparateMain
{
    public static void Main()
    {
        Application.Run(new AnotherHelloWorld());
    }
}

class AnotherHelloWorld : Form
{
    public AnotherHelloWorld()
    {
        Text = "Another HelloWolrd";
        BackColor = Color.White;
    }

    protected override void OnPaint(PaintEventArgs pea)
    {
        Graphics graphics = pea.Graphics;

        graphics.DrawString("Hello, Windows Form!", Font, Brushes.Black, 0, 0);
    }
}

ResumeLayoutAndSuspendLayout.cs 
using System;
using System.Windows.Forms;

class MainForm : Form
{
    private Label label1;
    private TextBox textBox1;
    private Button button1;

    public MainForm()
    {
        this.label1 = new Label();
        this.textBox1 = new TextBox();
        this.button1 = new Button();
        this.SuspendLayout();

        this.label1.Location = new System.Drawing.Point(16, 36);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(128, 16);
        this.label1.TabIndex = 0;
        this.label1.Text = "Please enter your name:";

        this.textBox1.Location = new System.Drawing.Point(152, 32);
        this.textBox1.Name = "textBox1";
        this.textBox1.TabIndex = 1;
        this.textBox1.Text = "";

        this.button1.Location = new System.Drawing.Point(109, 80);
        this.button1.Name = "button1";
        this.button1.TabIndex = 2;
        this.button1.Text = "Enter";
        this.button1.Click += new System.EventHandler(this.button1_Click);

        this.ClientSize = new System.Drawing.Size(292, 126);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.textBox1);
        this.Controls.Add(this.label1);
        this.Name = "form1";
        this.Text = "Visual C#";

        this.ResumeLayout(false);
    }

    private void button1_Click(object sender, System.EventArgs e)
    {
        System.Console.WriteLine("User entered: " + textBox1.Text);
        MessageBox.Show("Welcome, " + textBox1.Text, "Visual C#");
    }

    [STAThread]
    public static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new MainForm());
    }
}

23.2.7
ShowFormAndSleep.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using System.Threading;
using System.Windows.Forms;

class ShowFormAndSleep
{
    public static void Main()
    {
        Form form = new Form();
        form.Show();
        Thread.Sleep(2500);
        form.Text = "My First Form";
        Thread.Sleep(2500);
    }
}

















-

'C#' 카테고리의 다른 글

C# 기본  (0) 2010.07.26
And

Qt Designer

|
Qt Designer 실행
폼 작성
formname.ui로 저장 (XML 형식)
main.cpp 작성 (ui_formname.h 인클루드)
qmake -project
qmake gotocell.pro -> ui_formname.h (C++ 형식) 생성됨 (fornname.ui --> ui_formname.h : uic가 수행)

formname.h 작성 (ui_formname.h 인클루드, Ui::formname 상속받아야 함)
formname.cpp 작성 (생성자에서 setupUi(this);를 해주어야 함)
main.cpp 수정 (formname.h 인클루드)

-

'Qt' 카테고리의 다른 글

qt 메뉴 등록  (0) 2010.09.23
[Qt Designer] 확장 다이얼로그  (0) 2010.09.22
Qt Creator Manual  (0) 2010.06.10
Qt Compile  (0) 2010.06.06
And

정규식을 이용한 주민등록번호 추출

|
정규식을 이용한 주민등록 번호 추출 프로그램
RRNTest.java
import java.util.regex.Matcher;
import java.util.regex.Pattern;

//\d\d(0[1-9]|1[0-2])([0-2][1-9]|3[0-1])[1-4]\d{6}

//Regular Expression
class RRN {
	String rrn;
	String PatternStr = "\\d\\d(0[1-9]|1[0-2])([0-2][1-9]|3[0-1])[1-4]\\d{6}";
	Pattern pat = Pattern.compile(PatternStr);

	Matcher mat;
	boolean found;
	boolean more = true;

	public String FindRRN(String str) {
		mat = pat.matcher(str);
		found = mat.find();
		if (found)
		{
			rrn = mat.group();
			more = true;
			//end()는 mat.group() 후에 사용 가능
			str = str.substring(mat.end());
		}
		else
		{
			rrn = "Not found";
			more = false;
		}
		return str;
	}
}

public class RRNTest {
	public static void main(String[] args) {
		String str = "8204254093614abc128714cd7903241081511AE@5605047145666#";
		boolean more = true;
		RRN r = new RRN();
		while (r.more) {
			str = r.FindRRN(str);
			if (r.rrn != "Not found") System.out.println(r.rrn);
		}
	}
}


-

'Java' 카테고리의 다른 글

java  (0) 2010.08.31
쓰레드  (0) 2010.08.26
오토박싱/언박싱  (0) 2010.08.24
Stream  (0) 2010.08.23
Exception  (0) 2010.08.23
And

java

|
레이아웃 변경하기
setLayout(new CardLayout());
Container c = getContentPane();
c.setLayout(new GridLayout());

쓰레드
일시 정지 상태로 만드는 것 : suspend, join, sleep, wait
깨우는 것 : resume, notify

'Java' 카테고리의 다른 글

정규식을 이용한 주민등록번호 추출  (0) 2010.09.07
쓰레드  (0) 2010.08.26
오토박싱/언박싱  (0) 2010.08.24
Stream  (0) 2010.08.23
Exception  (0) 2010.08.23
And

쓰레드

|
run() 메소드는 Runnable 인터페이스에 존재
Thread 클래스는 Runnable 인터페이스를 임플러먼츠한다.
따라서 Thread클래스를 사용하여 쓰레드를 사용하려면 run() 메소드를 기술해줘야 하고, start() 메소드로 실행해야 한다. start() 메소드는 run() 메소드를 실행한다. 그냥 run()을 실행하면 멀티쓰레드로 동작하지 않는다.

Runnable 인터페이스를 임플러먼츠한 후,

객체를 생성하여 그 객체를 
Thread t = new Thread(rr, "Thread1"); 에 넘기고
t.start()로 실행하면 start()가 rr의 run()을 실행함

쓰레드 돌릴때 run()에 반드시 sleep(1)이라도 주어야 cpu 부하 줄어들고, 멀티 쓰레드시 효율이 높다

'Java' 카테고리의 다른 글

정규식을 이용한 주민등록번호 추출  (0) 2010.09.07
java  (0) 2010.08.31
오토박싱/언박싱  (0) 2010.08.24
Stream  (0) 2010.08.23
Exception  (0) 2010.08.23
And

오토박싱/언박싱

|
int n = 10;
Integer wrapN = new Integer(n); //박싱

n = wrapN.intValue(); //언박싱

wrapN = n; //오토 박싱
n = wrapN; //오토 언박싱

'Java' 카테고리의 다른 글

java  (0) 2010.08.31
쓰레드  (0) 2010.08.26
Stream  (0) 2010.08.23
Exception  (0) 2010.08.23
자바 주요 클래스  (0) 2010.08.19
And

[ImageButton, Toast]

|

C++pasted just now: 
package net.itisn.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;

public class FrameLayoutTest extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		ImageButton btn1 = (ImageButton) this.findViewById(R.id.ImageButton01);
		ImageButton btn2 = (ImageButton) this.findViewById(R.id.ImageButton02);
		ImageButton btn3 = (ImageButton) this.findViewById(R.id.ImageButton03);
		ImageButton btn4 = (ImageButton) this.findViewById(R.id.ImageButton04);

		btn1.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Toast.makeText(FrameLayoutTest.this, "Hi~~ north",
				        Toast.LENGTH_LONG).show();
			}
		});
	}
}


d
Haskellpasted 1 second ago: 
<?xml version="1.0" encoding="utf-8"?>

<FrameLayout
	android:id="@+id/FrameLayout01"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	xmlns:android="http://schemas.android.com/apk/res/android"
>
	<ImageButton
		android:id="@+id/ImageButton01"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_gravity="top|center"
		android:background="@drawable/su"
	></ImageButton>
	<ImageButton
		android:id="@+id/ImageButton02"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_gravity="left|center"
		android:src="@drawable/icon"
	></ImageButton>
	<ImageButton
		android:id="@+id/ImageButton03"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_gravity="right|center"
		android:src="@drawable/icon"
	></ImageButton>
	<ImageButton
		android:id="@+id/ImageButton04"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_gravity="bottom|center"
		android:src="@drawable/icon"
	></ImageButton>

</FrameLayout>


-

'Android' 카테고리의 다른 글

[CustomAdapter]  (0) 2010.09.30
[MyHandlerTest]  (0) 2010.09.28
[AlertDialog2]  (0) 2010.08.19
[AlertDialog]  (0) 2010.08.18
[MenuTest]  (0) 2010.08.18
And

용어 tabstop shiftwidth

|
tabstop : '\t' 문자 자체의 화면에서의 표시 간격
indent size(shiftwidth) : > 또는 <, 그리고 자동 인덴트 같은 곳에서 사용되는 화면에서의 표시 크기
soft tab stop : 탭 키를 눌렀을 때 화면에서 움직일 표시 크기, vim에서는 백스페이스 키에도 적용
et(탭 풀어쓰기) : 탭을 모두 공백 문자로 변환해서 파일에 저장
noet : 소프트탭이나 인덴트가 되었을 때, 탭 크기보다 작은 경우에는 공백 문자로, 탭보다 크면 탭 문자로 처리

'VIM 강좌' 카테고리의 다른 글

folding  (0) 2010.08.15
ctags & cscope  (0) 2010.08.15
vim 사용법  (0) 2010.06.12
And

Stream

|
Object
ㄴInputStream
   ㄴByteArrayInputStream
   ㄴFileInputStream
   ㄴFilterInputStream
      ㄴBufferedInputStream
   ㄴObjectInputStream
   ㄴPipedInputStream
   ㄴSequenceInputStream
   ㄴStringBufferInputStream
ㄴOutputStream
   ㄴByteArrayOutputStream
   ㄴFileOutputStream
   ㄴFilterOutputStream
      ㄴBufferedOutputStream
      ㄴPrintStream
   ㄴObjectOutputStream
   ㄴPipedOutputStream


'Java' 카테고리의 다른 글

쓰레드  (0) 2010.08.26
오토박싱/언박싱  (0) 2010.08.24
Exception  (0) 2010.08.23
자바 주요 클래스  (0) 2010.08.19
static vs final  (0) 2010.08.17
And
prev | 1 | 2 | 3 | 4 | 5 | ··· | 9 | next