Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[GTK] Control.setBackgroundImage is ignored on ToolBar

Đang mở
#3,538 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
desktop

Hướng nghiên cứu

Start in the GTK implementation of SWT's ToolBar background painting and compare it with the Composite or Label behavior; the issue does not name source files or tests. Reproduce with the provided snippet and verify that the ToolBar paints its background image while preserving existing toolbar behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

On GTK a background image set on a ToolBar is never painted; the bar shows the GTK theme's toolbar colour. The same image on a Composite or Label paints fine.

Snippet

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class ToolBarBackgroundImage {

      public static void main(String[] args) {
              Display display = new Display();
              Shell shell = new Shell(display);
              shell.setText("ToolBar background image");
              shell.setLayout(new GridLayout(1, false));

              Image image = new Image(display, 10, 40);
              GC gc = new GC(image);
              gc.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));
              gc.fillRectangle(0, 0, 10, 40);
              gc.dispose();

              new Label(shell, SWT.NONE).setText("ToolBar: image is not painted");
              ToolBar bar = new ToolBar(shell, SWT.FLAT);
              bar.setLayoutData(new GridData(200, 40));
              new ToolItem(bar, SWT.PUSH).setText("Item");
              bar.setBackgroundImage(image);

              new Label(shell, SWT.NONE).setText("Composite: image is painted");
              Composite composite = new Composite(shell, SWT.NONE);
              composite.setLayoutData(new GridData(200, 40));
              composite.setBackgroundImage(image);

              shell.setSize(400, 250);
              shell.open();
              while (!shell.isDisposed()) {
                      if (!display.readAndDispatch()) display.sleep();
              }
              image.dispose();
              display.dispose();
      }
}

Expected on GTK: the composite is magenta, the tool bar is not.

Ngôn ngữ chính
Java
Star
202
Fork
206
Merge trung bình
21 giờ 55 phút
Pull request đã merge (30 ngày)
110

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-platform/eclipse.platform.swt

Tất cả issue của eclipse-platform/eclipse.platform.swt

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.