Windows 7外观上的Java Swing渲染错误?
发布时间:2020-12-14 04:05:54 所属栏目:Windows 来源:网络整理
导读:我的 Windows 7机器上的垂直JSlider上的旋钮(具有原生外观)在两个方向上都非常小巧.不仅是瘦,还有短. alt text http://img101.imageshack.us/img101/8946/verticalsliderproblemwi.jpg 谁能证实这一点?我应该报告吗?如果是这样,在哪里?谢谢! 以下是示例
我的
Windows 7机器上的垂直JSlider上的旋钮(具有原生外观)在两个方向上都非常小巧.不仅是瘦,还有短.
alt text http://img101.imageshack.us/img101/8946/verticalsliderproblemwi.jpg
谁能证实这一点?我应该报告吗?如果是这样,在哪里?谢谢! 以下是示例程序的代码(在屏幕截图中): import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.SwingConstants; import javax.swing.UIManager; public class SliderTest { public static void main( String[] args ) { // Set the look and feel to that of the system try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); } catch ( Exception e ) { System.err.println( e ); } // Launch the GUI from the event dispatch thread javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run () { JFrame window = new JFrame(); window.setDefaultCloSEOperation( JFrame.EXIT_ON_CLOSE ); JPanel contentPane = new JPanel(); contentPane.add( new JSlider(SwingConstants.HORIZONTAL) ); contentPane.add( new JSlider(SwingConstants.VERTICAL) ); window.setContentPane( contentPane ); window.pack(); window.setLocationRelativeTo( null ); // Center window window.setVisible( true ); } }); } }
首先,这也发生在Windows Vista中.似乎是这种情况,滑块试图占用尽可能少的空间.如果你想要一个更大的JSlider使用JSlider.setPaintTicks.所以你必须添加以下内容:
JSlider vertical = new JSlider( SwingConstants.VERTICAL ); vertical.setPaintTicks( true ); contentPane.add( vertical ); 这应该够了吧. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- xaml – 如何将图钉添加到Windows Phone 8.1地图控件?
- 我可以使用Microsoft Parallel Extensions to .NET Framewo
- 更改Windows IP 地址的bat脚本
- windows-server-2008 – “DEL:”在AD对象的Distinguished
- 检测Windows进程使用C#启动和退出事件而不使用WMI
- windows – 如何使用PowerShell切换当前用户?
- windows – 在应用程序运行时替换.dll文件?
- 用户界面 – 在Windows上选择GUI(wxPy vs pyQt)
- windows-server-2003 – 如何在Windows Server 2003上使用N
- Windows 2008 R2域用户无法更改键盘布局