奇怪的摆动边框瑕疵

huangapple go评论106阅读模式
英文:

Strange swing border artifact

问题

以下是翻译好的代码部分:

  1. public class TestPanel extends JPanel {
  2. private static void createAndShowGUI() {
  3. JFrame myFrame = new JFrame("");
  4. myFrame.setBounds(new Rectangle(100, 100, 240, 180));
  5. myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  6. JPanel box = new JPanel(null);
  7. box.setBackground(Color.BLUE);
  8. JPanel left = new JPanel();
  9. left.setOpaque(false);
  10. JPanel right = new JPanel();
  11. right.setOpaque(false);
  12. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
  13. splitPane.setResizeWeight(0.5);
  14. splitPane.setOpaque(false);
  15. box.setLayout(new BorderLayout());
  16. box.setBorder(new EmptyBorder(10, 10, 10, 10));
  17. box.add(splitPane);
  18. myFrame.getContentPane().add(box, BorderLayout.CENTER);
  19. myFrame.setVisible(true);
  20. }
  21. public static void main(String[] args) {
  22. SwingUtilities.invokeLater(TestPanel::createAndShowGUI);
  23. }
  24. }

它产生以下结果:

奇怪的摆动边框瑕疵

如果您仔细看左下角,您可能会注意到奇怪的边框失真:

奇怪的摆动边框瑕疵

有人知道出了什么问题吗?
在 macOS、jdk1.8.0_251 上进行了测试。

英文:

Here is my simplified code example:

  1. public class TestPanel extends JPanel {
  2. private static void createAndShowGUI() {
  3. JFrame myFrame = new JFrame("");
  4. myFrame.setBounds(new Rectangle(100, 100, 240, 180));
  5. myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  6. JPanel box = new JPanel(null);
  7. box.setBackground(Color.BLUE);
  8. JPanel left = new JPanel();
  9. left.setOpaque(false);
  10. JPanel right = new JPanel();
  11. right.setOpaque(false);
  12. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
  13. splitPane.setResizeWeight(0.5);
  14. splitPane.setOpaque(false);
  15. box.setLayout(new BorderLayout());
  16. box.setBorder(new EmptyBorder(10, 10, 10, 10));
  17. box.add(splitPane);
  18. myFrame.getContentPane().add(box, BorderLayout.CENTER);
  19. myFrame.setVisible(true);
  20. }
  21. public static void main(String[] args) {
  22. SwingUtilities.invokeLater(TestPanel::createAndShowGUI);
  23. }
  24. }

It produces following result:

奇怪的摆动边框瑕疵

If you look closely at the bottom left corner, you may notice strange border distortion:

奇怪的摆动边框瑕疵

Does anyone have an idea what is wrong?
Tested on macos, jdk1.8.0_251

答案1

得分: 1

Sure, here's the translated content:

似乎这是您本地的问题。我无法看到这个工件。

英文:

奇怪的摆动边框瑕疵

Seems that this is your local problem. I can't see this artifact.

huangapple
  • 本文由 发表于 2020年8月21日 02:52:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63511508.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定