JOptionPane not displaying correctly?

后端 未结 1 1781
小鲜肉
小鲜肉 2020-12-11 07:20

Today I updated my jdk and docs from 7 to 8. I made a few changes to my program, and now when I try to have the program use JOptionPane, JLabel, ..., everything messes up. I

相关标签:
1条回答
  • 2020-12-11 08:01

    For reference, here's a complete example that shows no regression on Mac OS X 10.9, Java 8. It may help you pin down the apparent regression.

    Addendum: In helpful comments, @mKorbel cites a number of similar problems with Java 8 on Windows with certain NVIDIA cards.

    image

    Console:

    42
    

    Code:

    import java.awt.EventQueue;
    import javax.swing.JOptionPane;
    
    /**
     * @see https://stackoverflow.com/a/24875960/230513
     */
    public class Test {
    
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
    
                @Override
                public void run() {
                    String input = JOptionPane.showInputDialog(
                        "Enter the x coordinate of the circle");
                    int xc = Integer.parseInt(input);
                    System.out.println(xc);
                }
            });
        }
    }
    
    0 讨论(0)
提交回复
热议问题