Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[GTK] Control.setBackgroundImage is ignored on ToolBar

Abierto
#3,538 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
66/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
java
Área
desktop

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
202
Forks
206
Merge medio
14 h 7 min
PR fusionados (30 d)
103

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-platform/eclipse.platform.swt

Todos los issues de eclipse-platform/eclipse.platform.swt

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.