E D R , A S I H C RSS

Standard Widget Toolkit

Eclipse์˜ ๊ทผ๊ฐ„์ด ๋˜๋Š” Java์šฉ ๊ทธ๋ž˜ํ”ฝ ํˆดํ‚ท Eclipse 2.1 ๋ถ€ํ„ฐ ๊ณต์‹์ ์œผ๋กœ SWT๊ฐ€ ๋ถ„๋ฆฌ๋˜์–ด ๋ฐฐํฌ๋˜๊ณ  ์žˆ๋‹ค.
"Eclipse์˜ ์†๋„๊ฐ€ ๋น ๋ฅด๋‹ค." ๋ผ๋Š” ์„ ์ž…๊ฒฌ์„ ๋งŒ๋“ค์–ด์ค€ ์žฅ๋ณธ์ธ์ธ Cross Platform Native Graphic Toolkit ์ด๋‹ค.

๋‚ด๋ถ€์—์„œ๋Š” ์ดˆ๊ธฐ๋ถ€ํ„ฐ SWT์™€ Eclipse ํ”„๋กœ์ ํŠธ์˜ ์—ญํ• ์ด ๋ถ„๋‹ด๋˜์–ด, ๊ณผ๊ฑฐ IBM developerworks ์— gcc๋ฅผ ์ด์šฉํ•œ ํ”„๋กœ๊ทธ๋žจ ์ž‘์„ฑ์— ๋Œ€ํ•œ ๋ฌธ์„œ๊ฐ€ ์žˆ์—ˆ์œผ๋‚˜, SWT๋ฅผ ์ด์šฉํ•œ ํ”„๋กœ๊ทธ๋žจ์˜ ๋“ฑ์žฅ์€ ๋ณด์ด์ง€ ์•Š์•˜๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋ถ„๋ฆฌ๋˜๋ฉด์„œ, ๊ทธ๋Ÿฌํ•œ ํ”„๋กœ๊ทธ๋žจ์„ ๊ธฐ๋Œ€ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค.

SWT ํ”„๋กœ์ ํŠธ ํŽ˜์ด์ง€
{{|
The most succinct description of the Standard Widget Toolkit component is this:
The SWT component is designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.
--SWT ํ”„๋กœ์ ํŠธ ํŽ˜์ด์ง€ ์—์„œ
|}}
  • SWT 2.1 ๋ฌธ์„œ - Code Snippets ๊ฐ€ ๋งŽ์•„์„œ, ๋”ฐ๋ผํ•˜๊ธฐ ์šฉ์ดํ•˜๋‹ค.

~cpp HelloWorld ๋ฅผ ๋งŒ๋“ค์–ด ๋ณด์ž.

  1. SWT๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๋Š”๋‹ค. Eclipse downlaod์—์„œ ๋ฐ›์„์ˆ˜ ์žˆ๋‹ค. Upload:swt-2.1-win32.zip
  2. swt.jar ๋ฅผ classpath ์— ์žก๊ณ  ๋‹ค์Œ ์†Œ์Šค๋ฅผ ์ปดํŒŒ์ผ ํ•œ๋‹ค.
    ~cpp 
    import org.eclipse.swt.SWT;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Label;
    import org.eclipse.swt.widgets.Shell;
    
    public class HelloWorld {
    	public static void main(String[] args) {
    		Display display = new Display();		
    		Shell shell = new Shell(display);
    		shell.setText("Hello World");		
    		
    		Label label = new Label(shell, SWT.NONE);		
    		label.setText("Hello World");
    		label.setBounds(20,20,100,100);							
    		
    		shell.setBounds(20,20,300,300);			 			
    		shell.open();		
    		while (!shell.isDisposed()) {
    			if (!display.readAndDispatch())
    				display.sleep();
    		}
    		display.dispose();
    	}	
    }
    
  3. ์‹คํ–‰์„ ์‹œํ‚ค๊ธฐ ์œ„ํ•ด์„œ, ์‹คํ–‰๋˜๋Š” ์œ„์น˜์— swt-win32-2133.dll (Windows ๊ฒฝ์šฐ)๊ฐ€ ์žˆ์–ด์•ผ ํ•œ๋‹ค.
  4. ์‹คํ–‰ ๋ชจ์Šต
    SWT_HelloWorld.png


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:06
Processing time 0.0075 sec