我发现这个项目在独立运行时工作得很好。但是,当我尝试将其添加到另一个项目中的 JPanel 时(已经在完全相同的项目中执行此操作,但使用我自己的 JFrame 并且工作正常),会出现此错误:
UIDefaults.getUI() failed: no ComponentUI class for: doubleslider.MThumbSlider[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,isInverted=false,majorTickSpacing=0,minorTickSpacing=0,orientation=HORIZONTAL,paintLabels=false,paintTicks=false,paintTrack=true,snapToTicks=false,snapToValue=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:729)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:130)
at javax.swing.UIDefaults.getUI(UIDefaults.java:759)
at javax.swing.UIManager.getUI(UIManager.java:1002)
at javax.swing.JSlider.updateUI(JSlider.java:323)
at doubleslider.MThumbSlider.updateUI(MThumbSlider.java:44)
at javax.swing.JSlider.<init>(JSlider.java:275)
at javax.swing.JSlider.<init>(JSlider.java:182)
at doubleslider.MThumbSlider.<init>(MThumbSlider.java:24)
at doubleslider.DoubleSlider.<init>(DoubleSlider.java:29)
at com.einge.scadaremotecontrol.Ventana.<init>(Ventana.java:227)
at com.einge.scadaremotecontrol.ScadaRemoteControl.<init>(ScadaRemoteControl.java:92)
at com.einge.scadaremotecontrol.ScadaRemoteControl.main(ScadaRemoteControl.java:197)
UIDefaults.getUI() failed: no ComponentUI class for: doubleslider.MThumbSlider[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,isInverted=false,majorTickSpacing=0,minorTickSpacing=0,orientation=HORIZONTAL,paintLabels=false,paintTicks=false,paintTrack=true,snapToTicks=false,snapToValue=true]
java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:729)
at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:130)
at javax.swing.UIDefaults.getUI(UIDefaults.java:759)
at javax.swing.UIManager.getUI(UIManager.java:1002)
at javax.swing.JSlider.updateUI(JSlider.java:323)
at doubleslider.MThumbSlider.updateUI(MThumbSlider.java:44)
at doubleslider.MThumbSlider.<init>(MThumbSlider.java:26)
at doubleslider.DoubleSlider.<init>(DoubleSlider.java:29)
at com.einge.scadaremotecontrol.Ventana.<init>(Ventana.java:227)
at com.einge.scadaremotecontrol.ScadaRemoteControl.<init>(ScadaRemoteControl.java:92)
at com.einge.scadaremotecontrol.ScadaRemoteControl.main(ScadaRemoteControl.java:197)
我的第一个猜测是 MultiTumbSlider 类试图设置与我的 JFrame 不同的外观。有什么解决办法吗?我想不通,我真的需要两个滑块才能有一个时间范围
任何帮助将不胜感激!