Skip to content

Commit

Permalink
8320343: Generate GIF images for AbstractButton/5049549/bug5049549.java
Browse files Browse the repository at this point in the history
Reviewed-by: aivanov
  • Loading branch information
Renjithkannath authored and aivanov-jdk committed Jan 2, 2024
1 parent a5cf421 commit 9481d06
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 18 deletions.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/DE1.gif
Binary file not shown.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/DI1.gif
Binary file not shown.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/DS1.gif
Binary file not shown.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/PR1.gif
Binary file not shown.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/RO1.gif
Binary file not shown.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/RS1.gif
Binary file not shown.
Binary file removed test/jdk/javax/swing/AbstractButton/5049549/SE1.gif
Binary file not shown.
54 changes: 36 additions & 18 deletions test/jdk/javax/swing/AbstractButton/5049549/bug5049549.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -21,14 +21,10 @@
* questions.
*/

/* @test
@bug 5049549 7132413
@summary Tests that the proper icon is used for different states.
@library ../../regtesthelpers
@build Blocker
@run main/manual bug5049549
*/

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
Expand All @@ -39,17 +35,39 @@
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

/*
* @test
* @bug 5049549 7132413
* @summary Tests that the proper icon is used for different states.
* @library ../../regtesthelpers
* @build Blocker
* @run main/manual bug5049549
*/
public class bug5049549 {

private static ImageIcon DE = new ImageIcon(bug5049549.class.getResource("DE1.gif"));
private static ImageIcon DI = new ImageIcon(bug5049549.class.getResource("DI1.gif"));
private static ImageIcon DS = new ImageIcon(bug5049549.class.getResource("DS1.gif"));
private static ImageIcon RO = new ImageIcon(bug5049549.class.getResource("RO1.gif"));
private static ImageIcon RS = new ImageIcon(bug5049549.class.getResource("RS1.gif"));
private static ImageIcon SE = new ImageIcon(bug5049549.class.getResource("SE1.gif"));
private static ImageIcon PR = new ImageIcon(bug5049549.class.getResource("PR1.gif"));

private static Blocker blocker = new Blocker();
private static final Icon DE = generateImage("DE");
private static final Icon DI = generateImage("DI");
private static final Icon DS = generateImage("DS");
private static final Icon RO = generateImage("RO");
private static final Icon RS = generateImage("RS");
private static final Icon SE = generateImage("SE");
private static final Icon PR = generateImage("PR");

private static final Blocker blocker = new Blocker();

private static Icon generateImage(String str) {
BufferedImage img = new BufferedImage(40, 30,
BufferedImage.TYPE_INT_RGB);
Graphics g = img.createGraphics();
g.setColor(Color.WHITE);
g.fillRect(0, 0, img.getWidth(), img.getHeight());
g.setColor(Color.RED);
Font font = new Font(Font.SANS_SERIF, Font.BOLD, 22);
g.setFont(font);
g.drawString(str, 5, 25);
g.dispose();
return new ImageIcon(img);
}

private static class KButton extends JButton {

Expand Down

3 comments on commit 9481d06

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoniaZaldana
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 9481d06 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoniaZaldana the backport was successfully created on the branch backport-SoniaZaldana-9481d06e in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9481d06e from the openjdk/jdk repository.

The commit being backported was authored by Renjith Kannath Pariyangad on 2 Jan 2024 and was reviewed by Alexey Ivanov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-SoniaZaldana-9481d06e:backport-SoniaZaldana-9481d06e
$ git checkout backport-SoniaZaldana-9481d06e
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-SoniaZaldana-9481d06e

Please sign in to comment.