本文整理汇总了Java中org.jb2011.ninepatch4j.NinePatch类的典型用法代码示例。如果您正苦于以下问题:Java NinePatch类的具体用法?Java NinePatch怎么用?Java NinePatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NinePatch类属于org.jb2011.ninepatch4j包,在下文中一共展示了NinePatch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLabel_root
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* Creates a new N9Component object.
*
* @param text the text
* @param n9 the n9
* @param is the is
* @param foregroundColor the foreground color
* @param f the f
* @return the j label
*/
public static JLabel createLabel_root(String text
, final NinePatch n9, Insets is
, Color foregroundColor, Font f)
{
JLabel l = new JLabel(text){
public void paintComponent(Graphics g) {
n9.draw((Graphics2D)g, 0, 0, this.getWidth(), this.getHeight());
super.paintComponent(g);
}
};
if(is != null)
l.setBorder(BorderFactory.createEmptyBorder(is.top, is.left, is.bottom, is.right));
if(foregroundColor != null)
l.setForeground(foregroundColor);
if(f != null)
l.setFont(f);
return l;
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:30,代码来源:NPComponentUtils.java
示例2: createNinePatch
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* Creates the nine patch.
*
* @param fileUrl the file url
* @param convert the convert
* @return the nine patch
* @see NinePatch#load(URL, boolean)
*/
public static NinePatch createNinePatch(URL fileUrl, boolean convert)
{
try
{
return NinePatch.load(fileUrl, convert);
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:21,代码来源:NinePatchHelper.java
示例3: createPanel_root
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* Creates a new N9Component object.
*
* @param is the is
* @return the image bg panel
*/
public static JPanel createPanel_root(final NinePatch n9,Insets is)
{
JPanel p = new JPanel(){
public void paintChildren(Graphics g)
{
if(n9 != null)
n9.draw((Graphics2D)g, 0, 0, this.getWidth(), this.getHeight());
super.paintChildren(g);
}
};
if(is != null)
p.setBorder(BorderFactory.createEmptyBorder(is.top,is.left,is.bottom,is.right));
return p;
}
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:21,代码来源:NPComponentUtils.java
示例4: paintProgressBarContentImpl
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* 进度条当前值的绘制实现方法.
*
* @param isHorizontal true表示水平进度条,否则表示垂直进度条
* @param g the g
* @param x the x
* @param y the y
* @param amountFull the amount full
* @param barContentRectHeight the bar content rect height
* @param barSumHeightForVertival 本参数只在垂直进度条时有意义,目的是为了在当前值很
* 小的情况下为了达到N9图最小绘制高度时,作修正时需要
*/
protected void paintProgressBarContentImpl(boolean isHorizontal
,Graphics g,int x,int y,int amountFull,int barContentRectHeight
, int barSumHeightForVertival)
{
NinePatch np;
//当前的进度条内容.9.png图片的边缘非填充部分是17像素,如果要
//填充的总宽度小于此则会出现NinePatch填充算法无法解决的填充,
//以下判断将在总宽度小于此值时强制设置成最小宽度
final int n9min = 17;// TODO 14是相关于.9.png图片的最小填充宽度的,最好用常量实现
if(isHorizontal)
{
//如果最小填充长度小于n9图的最小长度最设定为最小长度,否则N9的填充会很难看哦
if(amountFull > 0 && amountFull < n9min)
{
amountFull = n9min;
}
np = __Icon9Factory__.getInstance().getProgressBar_green();
}
else
{
//如果最小填充长度小于n9图的最小长度最设定为最小长度,否则N9的填充会很难看哦
if(barContentRectHeight > 0 && barContentRectHeight < n9min)
{
y = barSumHeightForVertival - n9min;
barContentRectHeight = n9min;
}
np = __Icon9Factory__.getInstance().getProgressBar_blue_v();
}
//开始绘制N9图
np.draw((Graphics2D)g, x, y, amountFull, barContentRectHeight);
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:45,代码来源:BEProgressBarUI.java
示例5: getResource
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
@Override
protected NinePatch getResource(String relativePath, Class baseClass)
{
return NPHelper.createNinePatch(baseClass.getResource(relativePath), false);
}
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:6,代码来源:NPIconFactory.java
示例6: setNinePatch
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public void setNinePatch(BufferedImage image)
{
this.ninePatch = NinePatch.load(image, true, false);
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:NinePatchIcon.java
示例7: getResource
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
@Override
protected NinePatch getResource(String relativePath, Class baseClass)
{
return NinePatchHelper.createNinePatch(baseClass.getResource(relativePath), false);
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:6,代码来源:__Icon9Factory__.java
示例8: getNinePatch
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getNinePatch()
{
return ninePatch;
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:NinePatchIcon.java
示例9: NinePatchIcon
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatchIcon(int width, int height, NinePatch mPatch)
{
this.width = width;
this.height = height;
this.ninePatch = mPatch;
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:7,代码来源:NinePatchIcon.java
示例10: getSwitchable_btn_nornal
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getSwitchable_btn_nornal()
{
return getRaw(IMGS_ROOT+"/switchable_btn_nornal.9.png");
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:NPIconFactory.java
示例11: getSwitchable_btn_pressed
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getSwitchable_btn_pressed()
{
return getRaw(IMGS_ROOT+"/switchable_btn_pressed.9.png");
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:NPIconFactory.java
示例12: paint
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public void paint(Graphics g, JComponent c)
{
//~* @since 3.4, add by Jack Jiang 2012-11-05
//~* 【BeautyEye外观的特有定制属性】:true表示BEToolBarUI里,将使用其它典型外观
//~* 一样的默认纯色填充背景(颜色由ToolBar.background属性指定), 否则将使用BeautyEye
//~* 默认的渐变NinePatch图实现背景的填充。另外,还可以使用
//~* JToolBar.putClientProperty("ToolBar.isPaintPlainBackground", Boolean.TRUE);来进行
//~* 独立控制背景的填充方法,ClientProperty相比UIManager中的本方法拥有最高优先级
boolean isPaintPlainBackground = false;
String isPaintPlainBackgroundKey = "ToolBar.isPaintPlainBackground";//~* 【BeautyEye外观的特有定制属性】@since 3.4
//首先看看有没有独立在ClientProperty中设置"ToolBar.isPaintPlainBackground"属性(ClientProperty中设置拥有最高优先级)
Object isPaintPlainBackgroundObj = c.getClientProperty(isPaintPlainBackgroundKey);
//如果ClientProperty中没有设置,则尝试取UIManager中的该属性默认值
if(isPaintPlainBackgroundObj == null)
isPaintPlainBackgroundObj = UIManager.getBoolean(isPaintPlainBackgroundKey);
if(isPaintPlainBackgroundObj != null)
isPaintPlainBackground = (Boolean)isPaintPlainBackgroundObj;
//* 如果用户作了自定义颜色设置则使用父类方法来实现绘制,否则BE LNF中没法支持这些设置哦
if(isPaintPlainBackground || isUseParentPaint())
{
super.paint(g, c);
}
else
{
//* 根据工具条所放在父类的位置不同来决定它的背景该使用哪个图片(图片的差别在于方向不同,主要是边缘阴影的方向)
NinePatch np = __Icon9Factory__.getInstance().getToolBarBg_NORTH();
//int orientation = toolBar.getOrientation();
Container parent = toolBar.getParent();
if(parent != null)
{
LayoutManager lm = parent.getLayout();
if(lm instanceof BorderLayout)
{
Object cons = ((BorderLayout)lm).getConstraints(toolBar);
if(cons != null)
{
if(cons.equals(BorderLayout.NORTH))
np = __Icon9Factory__.getInstance().getToolBarBg_NORTH();
else if(cons.equals(BorderLayout.SOUTH))
np = __Icon9Factory__.getInstance().getToolBarBg_SOUTH();
else if(cons.equals(BorderLayout.WEST))
np = __Icon9Factory__.getInstance().getToolBarBg_WEST();
else if(cons.equals(BorderLayout.EAST))
np = __Icon9Factory__.getInstance().getToolBarBg_EAST();
}
}
}
np.draw((Graphics2D)g, 0, 0, c.getWidth(), c.getHeight());
}
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:52,代码来源:BEToolBarUI.java
示例13: getPhotoframeBg
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getPhotoframeBg()
{
return getRaw(getPhotoframeBg_PATH());
}
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:5,代码来源:NPIconFactory.java
示例14: getSwitchable_previous_pressed
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getSwitchable_previous_pressed()
{
return getRaw(IMGS_ROOT+"/switchable_previous_pressed.9.png");
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:NPIconFactory.java
示例15: getEditBox_normal
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getEditBox_normal()
{
return getRaw(IMGS_ROOT+"/editbox_background_normal.9.png");
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:WidgetDefaultNPIconFactory.java
示例16: getTab_normal
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getTab_normal()
{
return getRaw(IMGS_ROOT+"/tab_normal.9.png");
}
开发者ID:JackJiang2011,项目名称:DroidUIBuilder,代码行数:5,代码来源:WidgetDefaultNPIconFactory.java
示例17: getFixTipBg
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
public NinePatch getFixTipBg()
{
return getRaw(getFixTipBg_PATH());
}
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:5,代码来源:NPIconFactory.java
示例18: getPopupBg
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* Gets the popup bg.
*
* @return the popup bg
*/
public NinePatch getPopupBg()
{
return getRaw(IMGS_ROOT+"/shadow_bg_popup.9.png");
}
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:10,代码来源:NPIconFactory.java
示例19: getScrollBar_v
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* Gets the scroll bar_v.
*
* @return the scroll bar_v
*/
public NinePatch getScrollBar_v()
{
return getRaw(IMGS_ROOT+"/scroll_bar_v.9.png");
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:10,代码来源:__Icon9Factory__.java
示例20: getScrollBar_rover_v
import org.jb2011.ninepatch4j.NinePatch; //导入依赖的package包/类
/**
* Gets the scroll bar_rover_v.
*
* @return the scroll bar_rover_v
*/
public NinePatch getScrollBar_rover_v()
{
return getRaw(IMGS_ROOT+"/scroll_bar_rover_v.9.png");
}
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:10,代码来源:__Icon9Factory__.java
注:本文中的org.jb2011.ninepatch4j.NinePatch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论