本文整理匯總了Java中org.eclipse.swt.widgets.ColorDialog.getRGB方法的典型用法代碼示例。如果您正苦於以下問題:Java ColorDialog.getRGB方法的具體用法?Java ColorDialog.getRGB怎麽用?Java ColorDialog.getRGB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.ColorDialog
的用法示例。
在下文中一共展示了ColorDialog.getRGB方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openDialogBox
import org.eclipse.swt.widgets.ColorDialog; //導入方法依賴的package包/類
protected Object openDialogBox(Control cellEditorWindow) {
ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell());
Object value = getValue();
if (value != null) {
dialog.setRGB((RGB) value);
}
value = dialog.open();
RGB rgb = dialog.getRGB();//return the same if cancelled
if (rgb != null){
return rgb;//rgbToString(rgb);
}
return null;
}
示例2: openDialogBox
import org.eclipse.swt.widgets.ColorDialog; //導入方法依賴的package包/類
protected Object openDialogBox(Control cellEditorWindow) {
ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell());
Object value = getValue();
if (value != null) {
dialog.setRGB((RGB) value);
}
value = dialog.open();
return dialog.getRGB();
}
示例3: openDialogBox
import org.eclipse.swt.widgets.ColorDialog; //導入方法依賴的package包/類
protected Object openDialogBox( Control cellEditorWindow )
{
Shell shell = new Shell( Display.getCurrent( ), SWT.SHELL_TRIM );
shell.setLocation( cellEditorWindow.toDisplay( 0, 0 ).x
+ cellEditorWindow.getBounds( ).width,
cellEditorWindow.toDisplay( 0, 0 ).y
- cellEditorWindow.getBounds( ).height );
ColorDialog dialog = new ColorDialog( shell, SWT.APPLICATION_MODAL );
RGB[] rgbs = ReportPlugin.getDefault( ).getCustomColorsPreference( );
if ( rgbs != null )
{
dialog.setRGBs( rgbs );
}
Object value = getValue( );
try
{
int color;
if ( value instanceof String )
{
color = ColorUtil.parseColor( (String) value );
}
else
{
color = ( (Integer) value ).intValue( );
}
dialog.setRGB( DEUtil.getRGBValue( color ) );
}
catch ( Exception e )
{
// ignore.
}
value = dialog.open( );
ReportPlugin.getDefault( )
.setCustomColorsPreference( dialog.getRGBs( ) );
if ( value != null && dialog.getRGB( ) != null )
{
deactivate( );
return ColorUtil.format( ColorUtil.formRGB( dialog.getRGB( ).red,
dialog.getRGB( ).green,
dialog.getRGB( ).blue ), ColorUtil.HTML_FORMAT );
}
comboBox.setFocus( );
shell.dispose( );
return value;
}