在一个JFrame里用了JTabbedPane窗格,其中一个窗格添加JPGPanel class JPGPanel extends JPanel{ public JPGPanel(){ Box BaseLayout = Box.createHorizontalBox() ;
add( BaseLayout ) ;
Box LeftLayout = Box.createVerticalBox() ;
BaseLayout.add( LeftLayout ) ;
Box LeftTopLayout = Box.createHorizontalBox() ;
LeftLayout.add( LeftTopLayout ) ;
Box RightLayout = Box.createVerticalBox() ;
BaseLayout.add( RightLayout ) ; JButton ImportButton = new JButton( "Import" ) ;
ImportButton.setAlignmentX( Component.CENTER_ALIGNMENT ) ;
LeftTopLayout.add( ImportButton ) ; JButton FullScreenButton = new JButton( "Full Screen" ) ;
FullScreenButton.setAlignmentY( Component.CENTER_ALIGNMENT ) ;
LeftTopLayout.add( FullScreenButton ) ; JPGModel jpgModel = new JPGModel() ; //另行定义
JTree jpgTree = new JTree( jpgModel ) ;
JScrollPane jpgScrollPane = new JScrollPane( jpgTree ) ;
jpgScrollPane.setAlignmentY( Component.CENTER_ALIGNMENT ) ;
LeftLayout.add( jpgScrollPane ) ; JPGMonitor jpgMonitor = new JPGMonitor() ;//问题所在
jpgMonitor.setAlignmentX( Component.CENTER_ALIGNMENT ) ;
RightLayout.add( jpgMonitor ) ; } } 请问JPGMonitor类应该extends什么类?
我试了一下JPanel类,但是测试的时候看不出来添加在哪个位置,可能与JPGPanel混成一起了,如果用JPanel怎样显示边界?
add( BaseLayout ) ;
Box LeftLayout = Box.createVerticalBox() ;
BaseLayout.add( LeftLayout ) ;
Box LeftTopLayout = Box.createHorizontalBox() ;
LeftLayout.add( LeftTopLayout ) ;
Box RightLayout = Box.createVerticalBox() ;
BaseLayout.add( RightLayout ) ; JButton ImportButton = new JButton( "Import" ) ;
ImportButton.setAlignmentX( Component.CENTER_ALIGNMENT ) ;
LeftTopLayout.add( ImportButton ) ; JButton FullScreenButton = new JButton( "Full Screen" ) ;
FullScreenButton.setAlignmentY( Component.CENTER_ALIGNMENT ) ;
LeftTopLayout.add( FullScreenButton ) ; JPGModel jpgModel = new JPGModel() ; //另行定义
JTree jpgTree = new JTree( jpgModel ) ;
JScrollPane jpgScrollPane = new JScrollPane( jpgTree ) ;
jpgScrollPane.setAlignmentY( Component.CENTER_ALIGNMENT ) ;
LeftLayout.add( jpgScrollPane ) ; JPGMonitor jpgMonitor = new JPGMonitor() ;//问题所在
jpgMonitor.setAlignmentX( Component.CENTER_ALIGNMENT ) ;
RightLayout.add( jpgMonitor ) ; } } 请问JPGMonitor类应该extends什么类?
我试了一下JPanel类,但是测试的时候看不出来添加在哪个位置,可能与JPGPanel混成一起了,如果用JPanel怎样显示边界?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货