11/******************************************************************************* 
2-  * Copyright (c) 2000, 2016  Red Hat, Inc. and others. 
2+  * Copyright (c) 2000, 2025  Red Hat, Inc. and others. 
33 * 
44 * This program and the accompanying materials 
55 * are made available under the terms of the Eclipse Public License 2.0 
1414 *******************************************************************************/ 
1515package  org .eclipse .swt .examples .controlexample ;
1616
17- 
1817import  static  org .eclipse .swt .events .SelectionListener .widgetSelectedAdapter ;
1918
2019import  java .util .HashMap ;
3433import  org .eclipse .swt .widgets .TableItem ;
3534import  org .eclipse .swt .widgets .Widget ;
3635
37- class  ColorTab  extends  Tab  {
38- 	Table  colors , cursors ;
39- 	Group  colorsGroup , cursorsGroup ;
36+ class  SystemTab  extends  Tab  {
37+ 	Table  colors , cursors ,  images ;
38+ 	Group  colorsGroup , cursorsGroup ,  imagesGroup ;
4039	HashMap  <Integer , String > hmap  = new  HashMap  <> ();
4140	HashMap  <Integer , String > cmap  = new  HashMap  <> ();
41+ 	HashMap  <Integer , String > imap  = new  HashMap  <> ();
4242	static  final  int  namedColorEnd  = 8 ;
4343	static  String  [] columnTitles 	= {ControlExample .getResourceString ("ColorTitle_0" ),
4444				ControlExample .getResourceString ("ColorTitle_1" ),
4545				ControlExample .getResourceString ("ColorTitle_2" ),
4646				ControlExample .getResourceString ("ColorTitle_3" )};
47+ 	static  String  [] columnTitles2 	= {ControlExample .getResourceString ("ColorTitle_0" ),
48+ 			ControlExample .getResourceString ("ColorTitle_4" )};
4749
4850	/* Size widgets added to the "Size" group */ 
4951	Button  packColumnsButton ;
5052
5153	/** 
5254	 * Creates the color tab within a given instance of ControlExample. 
5355	 */ 
54- 	ColorTab (ControlExample  instance ) {
56+ 	SystemTab (ControlExample  instance ) {
5557		super (instance );
5658		addTableElements ();
5759	}
@@ -110,6 +112,12 @@ void addTableElements () {
110112		cmap .put (SWT .CURSOR_UPARROW , "CURSOR_UPARROW" );
111113		cmap .put (SWT .CURSOR_IBEAM , "CURSOR_IBEAM" );
112114		cmap .put (SWT .CURSOR_NO , "CURSOR_NO" );
115+ 
116+ 		imap .put (SWT .ICON_ERROR , "ICON_ERROR" );
117+ 		imap .put (SWT .ICON_INFORMATION , "ICON_INFORMATION" );
118+ 		imap .put (SWT .ICON_QUESTION , "ICON_QUESTION" );
119+ 		imap .put (SWT .ICON_WARNING , "ICON_WARNING" );
120+ 		imap .put (SWT .ICON_WORKING , "ICON_WORKING" );
113121	}
114122
115123	/** 
@@ -118,7 +126,7 @@ void addTableElements () {
118126	@ Override 
119127	void  createExampleGroup  () {
120128		super .createExampleGroup  ();
121- 		exampleGroup .setLayout (new  GridLayout (2 , false ));
129+ 		exampleGroup .setLayout (new  GridLayout (3 , false ));
122130
123131		colorsGroup  = new  Group  (exampleGroup , SWT .NONE );
124132		colorsGroup .setLayout  (new  GridLayout  ());
@@ -129,6 +137,11 @@ void createExampleGroup () {
129137		cursorsGroup .setLayout  (new  GridLayout  ());
130138		cursorsGroup .setLayoutData  (new  GridData  (SWT .FILL , SWT .FILL , false , true ));
131139		cursorsGroup .setText  ("Cursors" );
140+ 
141+ 		imagesGroup  = new  Group  (exampleGroup , SWT .NONE );
142+ 		imagesGroup .setLayout  (new  GridLayout  ());
143+ 		imagesGroup .setLayoutData  (new  GridData  (SWT .FILL , SWT .FILL , false , true ));
144+ 		imagesGroup .setText  ("Images" );
132145	}
133146
134147	/** 
@@ -205,22 +218,44 @@ void createExampleWidgets () {
205218			Cursor  cursor  = (item  != null ) ? (Cursor ) item .getData () : null ;
206219			cursors .setCursor (cursor );
207220		});
221+ 
222+ 		/* Create the images table widget */ 
223+ 		images  = new  Table  (imagesGroup , style  | SWT .V_SCROLL );
224+ 		images .setLayoutData (new  GridData  (SWT .FILL , SWT .FILL , false , true ));
225+ 		images .setHeaderVisible (true );
226+ 		// fill in the table. 
227+ 		for  (String  columnTitle  : columnTitles2 ) {
228+ 			TableColumn  tableColumn1  = new  TableColumn (images , SWT .NONE );
229+ 			tableColumn1 .setText (columnTitle );
230+ 			tableColumn1 .setToolTipText (ControlExample .getResourceString ("Tooltip" , columnTitle ));
231+ 		}
232+ 		for  (Entry <Integer , String > entry  : imap .entrySet ()) {
233+ 			Integer  key  = entry .getKey ();
234+ 			String  value  = entry .getValue ();
235+ 			TableItem  item  = new  TableItem (images , SWT .NONE );
236+ 			item .setText (value );
237+ 			item .setText (0 , value );
238+ 			item .setImage (1 , display .getSystemImage (key ));
239+ 		}
240+ 		for  (int  i  = 0 ; i  < columnTitles2 .length ; i ++) {
241+ 			images .getColumn (i ).pack ();
242+ 		}
208243	}
209244
210245	/** 
211246	 * Gets the "Example" widget children. 
212247	 */ 
213248	@ Override 
214249	Widget  [] getExampleWidgets  () {
215- 		return  new  Widget  [] {colors , cursors };
250+ 		return  new  Widget  [] {colors , cursors ,  images };
216251	}
217252
218253	/** 
219254	 * Gets the Tab name. 
220255	 */ 
221256	@ Override 
222257	String  getTabText  () {
223- 		return  "Color " ;
258+ 		return  "System " ;
224259	}
225260
226261	/** 
0 commit comments