Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 330334
Collapse All | Expand All

(-)a/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Button.java (-4 / +4 lines)
Lines 391-399 public class Button extends Control { Link Here
391
      width += extent.x;
391
      width += extent.x;
392
      height = Math.max( height, extent.y );
392
      height = Math.max( height, extent.y );
393
    }
393
    }
394
    if( width == 0 ) {
395
      width = 1;
396
    }
397
    if( height == 0 ) {
394
    if( height == 0 ) {
398
      height = 10;
395
      height = 10;
399
    }
396
    }
Lines 405-411 public class Button extends Control { Link Here
405
    }
402
    }
406
    if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) {
403
    if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) {
407
      Point checkSize = themeAdapter.getCheckSize( this );
404
      Point checkSize = themeAdapter.getCheckSize( this );
408
      width += checkSize.x + themeAdapter.getCheckSpacing( this );
405
      width += checkSize.x;
406
      if (hasText || hasImage) {
407
        width += themeAdapter.getCheckSpacing( this );
408
      }
409
      height = Math.max( height, checkSize.y );
409
      height = Math.max( height, checkSize.y );
410
    }
410
    }
411
    Rectangle padding = themeAdapter.getPadding( this );
411
    Rectangle padding = themeAdapter.getPadding( this );
412
   bug 330334 [Button (CHECK)] Improve computeSize implementation for the case there is no Image / Text
412
   bug 330334 [Button (CHECK)] Improve computeSize implementation for the case there is no Image / Text
413
   
413
   
414
   Patch to reproduce the problem.
414
   Patch to reproduce the problem.
415
   
415
   
416
   ---
416
   ---
417
   
417
   
418
   Improve the computeSize implementation in the Button.java
418
   Improve the computeSize implementation in the Button.java
419
   class for the case
419
   class for the case
420
   - there is no Image and Text, and
420
   - there is no Image and Text, and
421
   - the Button is of type SWT.CHECK
421
   - the Button is of type SWT.CHECK
422
   
422
   
423
   ie.
423
   ie.
424
   - add the spacing to the width (that serves to separate the check symbol
424
   - add the spacing to the width (that serves to separate the check symbol
425
     and the text / image) only if there is a text or image.
425
     and the text / image) only if there is a text or image.
426
   - if there is no text and image, do not initialise the width with 1
426
   - if there is no text and image, do not initialise the width with 1
427
     (I couldn't find any usecase for that); 0 is appropriate
427
     (I couldn't find any usecase for that); 0 is appropriate
(-)a/runtime.ui/org.eclipse.rap.demo/src/org/eclipse/rap/demo/controls/ButtonTab.java (+3 lines)
Lines 43-48 public class ButtonTab extends ExampleTab { Link Here
43
  private Button radioButton3;
43
  private Button radioButton3;
44
  private Button defaultButton;
44
  private Button defaultButton;
45
45
46
  private Button checkButton3;
47
46
  public ButtonTab( final CTabFolder folder ) {
48
  public ButtonTab( final CTabFolder folder ) {
47
    super( folder, "Button" );
49
    super( folder, "Button" );
48
  }
50
  }
Lines 85-90 public class ButtonTab extends ExampleTab { Link Here
85
    checkButton2.setText( "Check with image" );
87
    checkButton2.setText( "Check with image" );
86
    createButtonImage( parent.getDisplay() );
88
    createButtonImage( parent.getDisplay() );
87
    checkButton2.setImage( buttonImage );
89
    checkButton2.setImage( buttonImage );
90
    checkButton3 = new Button( parent, style | SWT.CHECK );
88
    radioButton1 = new Button( parent, style | SWT.RADIO );
91
    radioButton1 = new Button( parent, style | SWT.RADIO );
89
    radioButton1.setText( "Radio 1" );
92
    radioButton1.setText( "Radio 1" );
90
    radioButton2 = new Button( parent, style | SWT.RADIO );
93
    radioButton2 = new Button( parent, style | SWT.RADIO );

Return to bug 330334