Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6536209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:27:53+00:00 2026-05-25T10:27:53+00:00

I am using Windows 7 with Aero, and have a very fast graphics card

  • 0

I am using Windows 7 with Aero, and have a very fast graphics card (Radeon 6870) that I use for gaming.

I have some issues when resizing very simple programs I make with java. For instance, this program does absolutely nothing. It has no action listeners, no loops. It’s simply a GUI interface with buttons.

Resizing with OpenGL acceleration off:

[View fullscreen]
Sluggish resizing

It takes about a second to resize the components. For me that’s very noticeable.

Resizing with OpenGL acceleration on:

enter image description here

I have tried to enable OpenGl acceleration to solve this problem. I compiled the JAR and
run it with java -Dsun.java2d.opengl=true -jar C:\Test.jar. The result is slightly less black areas around the window, but much more flickering. In fact the flickering shows up as grey in the screenshot above.

Is the issue present in any other software?

No. Eclipse, Netbeans, Chrome and other applications have been tested. None have this issue. Therfore I must conclude that there must be some problem with the code. Various people have run this code and said they have “No issues”. If you are going to test it, please make sure you resize the window from the smallest size to the largest size of the screen, whilst moving the mouse in circular motion.

Code:

import java.awt.*;
import javax.swing.*;

public class JFrameWithButtonsTest {
    private int iScreen = 25;  
    private int iLocation = 10;
    JFrame frame = new JFrame();
    Container contentPane = frame.getContentPane();

    public JFrameWithButtonsTest() {
        JPanel northButtonPanel = new JPanel();
        northButtonPanel.setLayout(new GridLayout(2,2));
        northButtonPanel.add(new JButton(" I do nothing"));
        northButtonPanel.add(new JButton(" I do nothing"));
        northButtonPanel.add(new JButton(" I do nothing"));
        northButtonPanel.add(new JButton(" I do nothing"));
        contentPane.add(northButtonPanel, BorderLayout.NORTH);

        JPanel southButtonPanel = new JPanel();
        southButtonPanel.setLayout(new GridLayout(2,2));
        southButtonPanel.add(new JButton(" I do nothing"));
        southButtonPanel.add(new JButton(" I do nothing"));
        southButtonPanel.add(new JButton(" I do nothing"));
        southButtonPanel.add(new JButton(" I do nothing"));
        contentPane.add(southButtonPanel, BorderLayout.SOUTH);

        JPanel eastButtonPanel = new JPanel();
        eastButtonPanel.setLayout(new GridLayout(2,2));
        eastButtonPanel.add(new JButton(" I do nothing"));
        eastButtonPanel.add(new JButton(" I do nothing"));
        eastButtonPanel.add(new JButton(" I do nothing"));
        eastButtonPanel.add(new JButton(" I do nothing"));
        contentPane.add(eastButtonPanel, BorderLayout.EAST);

        boolean packFrame = false;
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        frameSize.height = (int) (iScreen * screenSize.height / 100);
        frameSize.width = (int) (iScreen * screenSize.width / 100);
        frame.setSize(frameSize);
        frame.setLocation((screenSize.width - frameSize.width) / iLocation,
                (screenSize.height - frameSize.height) / iLocation);
        if (packFrame) {
            frame.pack();
            packFrame = true;
        } else {
            frame.validate();
        }
        frame.setVisible(true);
    }
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new JFrameWithButtonsTest();
            }
        });
    }
}

Note that the issue is still present without this line: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:27:54+00:00Added an answer on May 25, 2026 at 10:27 am

    I started to notice that for two of my recent Java programs.

    I had a look at NetBeans’ configuration file, and found the following would improve the situation a lot:

      public static void main(final String... args) {
        System.setProperty("sun.java2d.noddraw", Boolean.TRUE.toString());
        ...
    

    Which is the same as -Dsun.java2d.noddraw=true on the JVM command line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using windows server, I have a path to a file that, when you click
Using Windows 2003, I'm look for a way to create a logoff script that
I am currently using Windows Server 2008 Standard and have several Hyper V machines.
All windows in Aero have this kind of whiteish background on their text. I'd
I have a application that uses the Aero glass effect, so each pixel has
(Using Windows 2000 and 2003 Server) We use forfiles.exe to delete backup .zip files
Anyone have any good resources for Delphi and Windows Aero on 7 or Vista?
Possible Duplicate: How does Windows change Aero Glass color? using c# how do you
I'm using System.Windows.MessageBox in a WPF app, and for some reason its buttons are
Using Windows XP, I created a batch-file that takes two files as arguments, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.