# Leopard Client Properties

**URL:** <https://forum.servoy.com/t/leopard-client-properties/10962>\
**Category:** Classic Servoy\
**Created:** [July 26, 2009, 8:48pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962 "2009-07-26T20:48:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [July 26, 2009, 8:48pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/1 "2009-07-26T20:48:43Z")

</div>

If you want to do a L&F targeted to Mac Leopard, here’s an example solution with various objects modified.

Note that you have to call the property code before a form loads.

Cheers Harjo ![:)]( "Smile")

```auto
//JComponent.sizeVariant
//MEMO: valid options: regular, small, mini

//push buttons
elements.btn_regular.putClientProperty('JComponent.sizeVariant','regular')
elements.btn_small.putClientProperty('JComponent.sizeVariant','small')
elements.btn_mini.putClientProperty('JComponent.sizeVariant','mini')

//checkboxes
elements.check_regular.putClientProperty('JComponent.sizeVariant','regular')
elements.check_small.putClientProperty('JComponent.sizeVariant','small')
elements.check_mini.putClientProperty('JComponent.sizeVariant','mini')

//combobox
elements.combo_regular.putClientProperty('JComponent.sizeVariant','regular')
elements.combo_small.putClientProperty('JComponent.sizeVariant','small')
elements.combo_mini.putClientProperty('JComponent.sizeVariant','mini')
elements.combo_square.putClientProperty('JComboBox.isSquare',true)

//search
elements.fld_search.putClientProperty('JTextField.variant','search')

//circular progress
elements.progressBar.indeterminate = true
elements.progressBar.putClientProperty("JProgressBar.style", "circular")

//more buttons
elements.btn_square.putClientProperty('JButton.buttonType','square')
elements.btn_gradient.putClientProperty('JButton.buttonType','gradient')
elements.btn_bevel.putClientProperty('JButton.buttonType','bevel')
elements.btn_texture.putClientProperty('JButton.buttonType','textured')
elements.btn_roundrect.putClientProperty('JButton.buttonType','roundRect')
elements.btn_recessed.putClientProperty('JButton.buttonType','recessed')
elements.btn_help.putClientProperty('JButton.buttonType','help')

```

[leopard\_client\_property.servoy](https://forum.servoy.com/uploads/short-url/gBtajHN9fTNz7e5cJtGVs5K3dw0.servoy) (6.85 KB)

 ![client property.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/1X/6c92fb07b2aab98a724524d1d1e0d1c8754ea6ab.png)

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [July 26, 2009, 9:37pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/2 "2009-07-26T21:37:18Z")

</div>

Thanks David, for sharing this! ![:D]( "Very Happy") ![:D]( "Very Happy")

---

<div class="post-metadata">

**Author:** ![kazar](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@kazar](https://forum.servoy.com/u/kazar)\
**Post date:** [July 26, 2009, 9:37pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/3 "2009-07-26T21:37:39Z")

</div>

great. as one would expect ![:-)]( "Smile")

kazar

---

<div class="post-metadata">

**Author:** ![bobcusick](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bobcusick](https://forum.servoy.com/u/bobcusick)\
**Post date:** [July 31, 2009, 2:51am UTC](https://forum.servoy.com/t/leopard-client-properties/10962/4 "2009-07-31T02:51:54Z")

</div>

Harjo & David - this is AWESOME! Thanks very much for sharing!

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [August 14, 2009, 10:25am UTC](https://forum.servoy.com/t/leopard-client-properties/10962/5 "2009-08-14T10:25:10Z")

</div>

David, I have 2 questions:

1. Can I set the element property only once for ALL buttons, instead of every single element?
2. In Leopard you see many times, this kind of comboboxes:

[attachment=0]Afbeelding 11.png[/attachment]

Do you know if this is possible in Servoy?

![Afbeelding 11.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/0/0e3ff884926cb767c267be1c136d805ea574d30d.png)

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [August 14, 2009, 4:22pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/6 "2009-08-14T16:22:40Z")

</div>

1- Since these are runtime client properties you’re setting, each element needs to be set individually when they are created. Some Java guru may have a slick way to override L&F at startup but I would just do something like this and call it from each form onLoad method. Save a ton of time not having to call each element by name:

```auto
// fun-ction to set client properties on all form objects (call from form onLoad)

var formName = arguments[0]

for ( var i = 0 ; i < forms[formName].elements.length ; i++ ) {
	try {
		switch( forms[formName].elements[i].getElementType() ) {
			
			case "COMBOBOX" :
				forms[formName].elements[i].putClientProperty('JComboBox.isSquare',true)
				break
			
			case "BUTTON" :
				forms[formName].elements[i].putClientProperty('JButton.buttonType','square')
				break
				
			case "CHECK" :
				forms[formName].elements[i].putClientProperty('JComponent.sizeVariant','small')
				break
				
			case "TEXT_FIELD" :
				//
				break
				
			default:
		}
	}
	catch (e) {}
}

```

2- Doesn’t look like its available on Mac Java. The list of available properties to date:

> **[Technical Note TN2196: New Control Styles available within J2SE 5.0 on Mac OS...](https://developer.apple.com/library/archive/technotes/tn2007/tn2196.html)**
>
> TN2196: Details what new control styles are available within J2SE 5.0 on Mac OS X 10.5

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [August 14, 2009, 4:51pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/7 "2009-08-14T16:51:06Z")

</div>

Sorry, had a lazy coding moment there. Better without the try statement:

```auto
// fun-ction to set client properties on all form objects (call from form onLoad)

var formName = arguments[0]

for ( var i = 0 ; i < forms[formName].elements.length ; i++ ) {
	if ( forms[formName].elements[i].getElementType ) {
		switch( forms[formName].elements[i].getElementType() ) {
			
			case "COMBOBOX" :
				forms[formName].elements[i].putClientProperty('JComboBox.isSquare',true)
				break
			
			case "BUTTON" :
				forms[formName].elements[i].putClientProperty('JButton.buttonType','square')
				break
				
			case "CHECK" :
				forms[formName].elements[i].putClientProperty('JComponent.sizeVariant','small')
				break
				
			case "TEXT_FIELD" :
				//
				break
				
			default:
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [August 17, 2009, 7:52am UTC](https://forum.servoy.com/t/leopard-client-properties/10962/8 "2009-08-17T07:52:22Z")

</div>

> 1. Can I set the element property only once for ALL buttons, instead of every single element?

Yes: application.setUIProperty() should do the trick.

Paul

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [August 17, 2009, 8:04am UTC](https://forum.servoy.com/t/leopard-client-properties/10962/9 "2009-08-17T08:04:28Z")

</div>

ah, cool! ![:-)]( "Smile")

thanks Paul!

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [August 21, 2009, 8:39pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/10 "2009-08-21T20:39:00Z")

</div>

Paul, I have tried this, but this does not work: (I do this in the onOpen method)

```auto
	application.setUIProperty('JComboBox.isSquare',true)
	application.setUIProperty('JButton.buttonType','textured')

```

am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [August 21, 2009, 9:17pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/11 "2009-08-21T21:17:45Z")

</div>

> Harjo:  
> am I doing something wrong?

UI and client properties are two different things. There is some property overlap but there is no direct mapping of most of the “custom” apple leopard client properties at the UI level.

application.setUIProperty() function also takes java code in its parameters:

[http://www.servoy.com/forum/viewtopic.php?f=3&t=11217](http://www.servoy.com/forum/viewtopic.php?f=3&t=11217)

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [August 21, 2009, 9:27pm UTC](https://forum.servoy.com/t/leopard-client-properties/10962/12 "2009-08-21T21:27:19Z")

</div>

oke, thanks David.
