1、调整按钮空间
在UBUNTU下,发现ECLIPSE明显不如WINDOWS下的排版和布局好,因为图标和按钮以及占的空间太大了,所以找啊找啊找。。。终于找到了不是很完美但也很不错的解决方法。
文章一:来自(http://www.javaeye.com/topic/88694)
如果你在Windows和Linux两个平台下都使用过Eclipse,那么你一定注意到Windows下Eclipse项目列表的显示要比Linux下紧凑许多。对于做开发的朋友来讲,在屏幕上同时看到的信息总是希望尽可能多,尽可能全,在这一点上目前的GNOME并不能让我们十分满意,它的GTK+控件本身和控件之间的间隙占掉了不少本来就很有限的屏幕空间,尤其当屏幕分辨率不是特别高的时候。
Linux版的Eclipse默认使用GTK+2.0的控件,所以在默认的情况下,会和其他GTK应用程序(如OpenOffice.org)一样给人一种不够密实的感觉。当然,这和GNOME的设计哲学不无关系,不过这不是本文主旨,就不深入讨论了,进入正题讲讲如何调整Eclipse树状列表的显示密度。
基于GTK+2.0的程序在启动时会到用户的home目录找GTK+2.0的配置文件,即~/.gtkrc-2.0,Ubuntu下默认没有这个文件,需要我们自己创建。打开你习惯的编辑器,加入如下代码:
style "eclipse" {
font_name="Sans 8"
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
}
class "GtkTreeView" style "eclipse"
重启Eclipse应该就能看到效果了。如果你想做得更彻底,对所有常用的GTK+2.0控件都开刀的话,可以这样写:
style "gtkcompact" {
font_name="Sans 8"
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkExpander::expander_size=10
GtkExpander::expander_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=8
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
}
class "GtkWidget" style "gtkcompact"
但这种方法并不是很完美,因为每个格子默认是有空间的。。所以无法比较紧凑的布局,继续找,终于黄天不负有心人啊,哈哈,见(http://blog.xam.dk/?p=70)
第二种配置,就很好啦,哈哈
style "gtkcompact" {
font_name="Sans 9"
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkToolbar::internal-padding=0
GtkToolbar::space-size=0
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkExpander::expander_size=10
GtkExpander::expander_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=8
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
}
class "GtkWidget" style "gtkcompact"
style "gtkcompactextra" {
xthickness=1
ythickness=1
}
class "GtkButton" style "gtkcompactextra"
class "GtkToolbar" style "gtkcompactextra"
class "GtkPaned" style "gtkcompactextra"
我现在就是用的这个,哈哈,但是所有基于GTK的软件都会这种。。。就是不仅eclipse,其它的软件也会这样去显示。。。哈哈哈
解决工具栏过大和 Javadoc背景色修改
解决方案:
修改或者新建(系统默认是没有的)
/home/Your_username/.gtkrc-2.0 (ubuntu中 . 开头的文件默认是隐藏文件,快捷键Ctrl+H可显示隐藏文件)
复制如下的内容:
style "gtkcompact" {
font_name="Sans 9"
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkToolbar::internal-padding=0
GtkToolbar::space-size=0
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkExpander::expander_size=10
GtkExpander::expander_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=8
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
}
class "GtkWidget" style "gtkcompact"
style "gtkcompactextra" {
xthickness=1
ythickness=1
}
class "GtkButton" style "gtkcompactextra"
class "GtkToolbar" style "gtkcompactextra"
class "GtkPaned" style "gtkcompactextra"
注销系统再次登录,打开Eclipse 的界面果然是紧凑来,感觉不错,打开其他的程序界面也同样是紧凑来不少。
界面美观了不少,但是Eclipse的自动提示的背景色是黑色的,看起来也非常的难受:
修改方案:
打开终端移动到当前主题目录下:
cd/usr/share/themes/当前的主题名/
打开gtk-2.0/gtkrc文件:
sudo gedit gtk-2.0/gtkrc
寻找到“ntooltip_fg_color”和“ntooltip_bg_color”兩個屬性的值,如果沒有改屬性,可以自行添加,其值仿照windows的默認值,分別設定位:
tooltip_fg_color:#000000
tooltip_bg_color:#f2edbc
然後保存退出,打開系統外觀配置,切換一下主題,當切換回來的時候,修改的效果就生效了。
Linux版的Eclipse默认使用GTK+2.0的控件,所以在默认的情况下,会和其他GTK应用程序(如OpenOffice.org)一样给人一 种不够密实的感觉。
基于GTK+2.0的程序在启动时会到用户的home目录找GTK+2.0的配置文件,即 ~/.gtkrc-2.0 如果装了kde4还有~/.gtkrc-2.0-kde4 (ubuntu下无这些文件需要自己创建) 确保这些文件里有这一行: include "/home/yourusername/.gtkrc.mine",如果不使用.gtkrc.mine文件那么就直接在~/.gtkrc-2.0文件中写入,同时也无需包括上述 include "/home/yourusername/.gtkrc.mine"语句。
打开~/.gtkrc.mine 没有就新建,写下以下代码
style "eclipse" {
font_name="Sans 8"
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
}
widget_class "GtkTreeView" style "eclipse"
重启Eclipse应该就能看到效果了。如果想做得更彻底,对所有常用的GTK+2.0控件都开刀的话,可以加入以下语句:
gtk_icon_sizes="panel_menu=16,16:panel=16,16:gtk_menu=12,12:gtk_small_toolbar=16,16:gtk_large_toolbar=16,16:gtk_button=16,16:gtk_dialog=16,16:gtk_dnd=16,16"
style"gtkcompact"{
# font_name="Sans9"
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButton::child_displacement_x=1
GtkButton::child_displacement_y=1
GtkButtonBox::child_min_height=20
GtkButtonBox::child_min_width=80
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkCheckButton::indicator_size=14
GtkMenu::vertical_padding=1
# GtkMenu::vertical_padding=0
GtkMenu::horizontal_padding=0
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkRange::stepper_size=15
GtkRange::slider_width=14
GtkScale::value_spacing=0
GtkScale::slider_length=23
GtkScale::trough_side_details=0#0=thinslider,>0=thickslider
GtkScrolledWindow::scrollbar_spacing=0
GtkScrollbar::min_slider_length=30
GtkExpander::expander_size=10
# GtkExpander::expander_size=11
GtkExpander::expander_spacing=0
GtkTreeView::vertical_separator=0
GtkTreeView::horizontal_separator=0
GtkTreeView::fixed_height_mode=TRUE
GtkTreeView::expander_size=9
GtkTreeView::expander_spacing=0
# GtkTreeView::expander_size=11
GtkTreeView::expander_indent=0
GtkTreeView::focus_line_width=0
GtkTreeView::spacing=0
GtkTreeView::row_ending_details=0
GtkTreeView::treeview_left=1
GtkTreeView::treeview_right=0
GtkTreeView::treeview_middle=0
GtkTreeView::passive_focus=0
GtkTreeView::separator_height=0
GtkTreeView::tree_line_pattern="\001\001"
GtkTreeView::grid_line_pattern="\001\001"
GtkTreeView::grid_line_width=0
GtkTreeView::tree_line_width=0
GtkToolbar::internal_padding=0
GtkToolbar::space_size=10
GtkWidget::focus_padding=0
xthickness=1
ythickness=1
#一下部分修改了按钮等的样式,大家可以选择使用
#engine"murrine"{
# animation=TRUE#FALSE=disabled,TRUE=enabled
# colorize_scrollbar=FALSE#FALSE=disabled,TRUE=enabled
# contrast=1.0#0.8forlesscontrast,morethan1.0formorecontrastonborders
# glazestyle=3#0=flathighlight,1=curvedhighlight,2=concavestyle,3=topcurvedhighlight,4=berylhighlight
# gradient_shades={1.09,1.06,1.04,1.01}#default:{1.1,1.0,1.0,1.1}
# gradients=TRUE#FALSE=disabled,TRUE=enabled
# highlight_ratio=1.04#sethighlightamountforbuttonsorwidgets
# lightborder_ratio=1.5#setslightborderamountforbuttonsorwidgets
# lightborderstyle=0#0=lightborderontopside,1=lightborderonallsides
# listviewheaderstyle=1#0=flat,1=glassy,2=raised
# listviewstyle=1#0=nothing,1=dotted
# menubaritemstyle=1#0=menuitemlook,1=buttonlook
# menubarstyle=2#0=flat,1=glassy,2=gradient,3=striped
# menuitemstyle=1#0=flat,1=glassy,2=striped
# menustyle=0#0=noverticalmenustripe,1=displayverticalmenustripe
# reliefstyle=2#0=flat,1=inset,2=shadow
# rgba=TRUE#FALSE=disabled,TRUE=enabled
# roundness=2#0=squared,1=olddefault,morewillincreaseroundness
# scrollbarstyle=2#0=nothing,1=circles,2=handles,3=diagonalstripes,4=diagonalstripesandhandles,5=horizontalstripes,6=horizontalstripesandhandles
# sliderstyle=1#0=nothingadded,1=handles
# stepperstyle=0#0=standard,1=integratedstepperhandles,2=unknown
# style=MURRINE#enginestyleoptions:CANDIDO,CLEARLOOKS,MIST,MURRINE,NODOKA
# toolbarstyle=0#0=flat,1=glassy,2=gradient
#}
}
widget_class"*"style"gtkcompact"
- style “gtkcompact” {
- font_name=“Sans 9″
- GtkButton::default_border={0,0,0,0}
- GtkButton::default_outside_border={0,0,0,0}
- GtkButtonBox::child_min_width=0
- GtkButtonBox::child_min_heigth=0
- GtkButtonBox::child_internal_pad_x=0
- GtkButtonBox::child_internal_pad_y=0
- GtkMenu::vertical-padding=1
- GtkMenuBar::internal_padding=0
- GtkMenuItem::horizontal_padding=4
- GtkToolbar::internal-padding=0
- GtkToolbar::space-size=0
- GtkOptionMenu::indicator_size=0
- GtkOptionMenu::indicator_spacing=0
- GtkPaned::handle_size=4
- GtkRange::trough_border=0
- GtkRange::stepper_spacing=0
- GtkScale::value_spacing=0
- GtkScrolledWindow::scrollbar_spacing=0
- GtkExpander::expander_size=10
- GtkExpander::expander_spacing=0
- GtkTreeView::vertical-separator=0
- GtkTreeView::horizontal-separator=0
- GtkTreeView::expander-size=8
- GtkTreeView::fixed-height-mode=TRUE
- GtkWidget::focus_padding=0
- }
- class “GtkWidget” style “gtkcompact”
- style “gtkcompactextra” {
- xthickness=1
- ythickness=1
- }
- class “GtkButton” style “gtkcompactextra”
- class “GtkToolbar” style “gtkcompactextra”
- class “GtkPaned” style “gtkcompactextra”