如何去掉状态栏

转自DevFaqRemoveStatusBar

 

How do I remove the status bar?

Never be afraid to read the code  :-) Looking at org.netbeans.core.windows.view.ui.MainWindow, there is getCustomStatusLine(), and it does this:

    private   static  JComponent getCustomStatusLine() {
       
try  {
           String fileName 
=  Constants.CUSTOM_STATUS_LINE_PATH;
           
if  (fileName  ==   null ) {
               
return   null ;
           }
           FileObject fo 
=  FileUtil.getConfigFile(fileName);
           
if  (fo  !=   null ) {
               DataObject dobj 
=  DataObject.find(fo);
               InstanceCookie ic 
=  (InstanceCookie)dobj.getCookie(InstanceCookie. class );
               
if  (ic  !=   null ) {
                   
return  (JComponent)ic.instanceCreate();
               }
           }
       } 
catch  (Exception e) {
           Exceptions.printStackTrace(e);
       }
       
return   null ;
   }

 

Constants.CUSTOM_STATUS_LINE_PATH is defined as System.getProperty("netbeans.winsys.status_line.path");

So, have a module which, in its ModuleInstall (or as a command-line parameter in their myApp.conf), does

System.setProperty("netbeans.winsys.status_line.path", "com/foo/com-foo-MyStatusBar.instance");

and in its layer file, does something like

< folder  name ="com" >

< folder  name ="foo" >
  
< file  name ="com-foo-MyStatusBar.instance" />
</ folder >

</ folder >

 

 

 

and then a class

 

 

 

package  com.foo;  public   class  MyStatusBar  extends  JLabel {

 
public  Dimension getPreferredSize() {  return   new  Dimension( 0 , 0 ); }
 
public  Dimension getMaximumSize() {  return   new  Dimension( 0 , 0 ); }  // may not be necessary

}

 

 

and you should get a status bar whose preferred size is to have no size at all.

Note you will probably want to provide your own instance of StatusDisplayer in the default lookup so there is *some* way for things to display status unless you really don't need it.

Another option (exception on Mac OS) is to move the status line to the main menu (it will use the space to the right of the last menu item) -

netbeans -Dnetbeans.winsys.statusLine.in.menuBar=true

or the equivalent System.setProperty() from a ModuleInstall

 

 

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/cuizhf/archive/2011/08/10/2133937.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值