Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8241156

Lanai: JPEG Image does not render

XMLWordPrintable

    • 2d

      The following code does not render with -Dsun.java2d.metal=true
      public class Render extends JPanel {
          static BufferedImage bi;

          public static void main(String[] args) throws IOException {
              bi = ImageIO.read(Render.class.getClassLoader().getResource("lion.jpeg"));
              SwingUtilities.invokeLater(() -> {
                  JFrame f = new JFrame();
                  f.add(new Render());
                  f.setPreferredSize(new Dimension(250, 250));
                  f.pack();
                  f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                  f.setVisible(true);
              });
          }

          @Override
          protected void paintComponent(Graphics g) {
              super.paintComponent(g);
              Graphics2D g2d = (Graphics2D)g;
              g2d.drawImage(bi, 0, 0, 100, 100, null);
          }
      }

            avu Alexey Ushakov
            avu Alexey Ushakov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: