MaterialPreviewWidgetManualTest.java 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2009-2024 jMonkeyEngine
  3. * All rights reserved.
  4. */
  5. package com.jme3.gde.materials.multiview.widgets;
  6. import javax.swing.JFrame;
  7. import javax.swing.SwingUtilities;
  8. /**
  9. * Simple manual test to verify animation toggle functionality
  10. *
  11. * @author copilot
  12. */
  13. public class MaterialPreviewWidgetManualTest {
  14. public static void main(String[] args) {
  15. SwingUtilities.invokeLater(() -> {
  16. JFrame frame = new JFrame("Material Preview Widget Test");
  17. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  18. MaterialPreviewWidget widget = new MaterialPreviewWidget();
  19. frame.add(widget);
  20. frame.setSize(300, 250);
  21. frame.setLocationRelativeTo(null);
  22. frame.setVisible(true);
  23. // Test animation toggle after 2 seconds
  24. new Thread(() -> {
  25. try {
  26. Thread.sleep(2000);
  27. System.out.println("Animation enabled: " + widget.isAnimationEnabled());
  28. Thread.sleep(1000);
  29. SwingUtilities.invokeLater(() -> {
  30. widget.setAnimationEnabled(true);
  31. System.out.println("Animation enabled: " + widget.isAnimationEnabled());
  32. });
  33. Thread.sleep(3000);
  34. SwingUtilities.invokeLater(() -> {
  35. widget.setAnimationEnabled(false);
  36. System.out.println("Animation enabled: " + widget.isAnimationEnabled());
  37. });
  38. } catch (InterruptedException e) {
  39. e.printStackTrace();
  40. }
  41. }).start();
  42. });
  43. }
  44. }