A. 怎么设置EXTJS 的win的网页背景图片
div设置背景图放最底层,或者PS一张这样的图然后定位文本框,
extjs速度真的很慢,慎用~
B. 用了个extjs的panel,然后其中不是有个title的属性吗然后我想要在title前面加一张图片怎么加在字前加图
CSS中加入代码(如图):
C. JPanel的背景图片如何设置
publicclassTest{privateJFrameframe=newJFrame("背景图片测试");
privateJPanelimagePanel;
privateImageIconbackground;
publicstaticvoidmain(String[]args){newTest();}
publicTest(){background=newImageIcon("1.jpg");//背景图片
JLabellabel=newJLabel(background);//把背景图片显示在一个标签里面
//把标签的大小位置设置为图片刚好填充整个面板
label.setBounds(0,0,background.getIconWidth(),background.getIconHeight());
//把内容窗格转化为JPanel,否则不能用方法setOpaque()来使内容窗格透明
imagePanel=(JPanel)frame.getContentPane();
imagePanel.setOpaque(false);
//内容窗格默认的布局管理器为BorderLayout
imagePanel.setLayout(newFlowLayout());
imagePanel.add(newJButton("测试按钮"));
frame.getLayeredPane().setLayout(null);
//把背景图片添加到分层窗格的最底层作为背景
frame.getLayeredPane().add(label,newInteger(Integer.MIN_VALUE));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
D. Extjs怎样用图片填充整个Panel
不知道你的填充是如何填充,不过一般panel中放图片的话可以这样写:
var panel = new Ext.Panel({
id:"panel",
html:'<img src="xxx/xxx.jpg"></img>'
});
接下来如果想让图片拉伸布满整个panel只要在<img>设置好width,height就行
E. extjs中怎样为一个panel设置背景色
是这样设置 bodyStyle: 'background:#ffc; padding:10px;',
var resultsPanel = Ext.create('Ext.panel.Panel', {
title: 'Results',
width: 600,
height: 400,
renderTo: Ext.getBody(),
bodyStyle: 'background:#ffc; padding:10px;',
layout: {
type: 'vbox', // Arrange child items vertically
align: 'stretch', // Each takes up full width
padding: 5
},
items: [{ // Results grid specified as a config object with an xtype of 'grid'
xtype: 'grid',
columns: [{header: 'Column One'}], // One header just for show. There's no data,
store: Ext.create('Ext.data.ArrayStore', {}), // A mmy empty data store
flex: 1 // Use 1/3 of Container's height (hint to Box layout)
}, {
xtype: 'splitter' // A splitter between the two child items
}, { // Details Panel specified as a config object (no xtype defaults to 'panel').
title: 'Details',
bodyPadding: 10,
items: [{
fieldLabel: 'Data item',
xtype: 'textfield'
}], // An array of form fields
flex: 2 // Use 2/3 of Container's height (hint to Box layout)
}]
});
F. extjs panel css的一个问题
bodyBorder:false
G. java中swing界面上怎么给jpanel上添加背景图片
//重写JPanel的这个方法就可以了
@Override
publicvoidpaintComponent(Graphicsgs){
Graphics2Dg=(Graphics2D)gs;
super.paintComponent(g);
//画背景图片
Imageimage=Toolkit.getDefaultToolkit().getImage(getClass().getResource(imgPath));
g.drawImage(image,0,0,width,height,this);
}
一个完整的代码:
packagetest;
importjava.awt.Graphics;
importjava.awt.Image;
importjava.net.URL;
importjavax.swing.ImageIcon;
importjavax.swing.JFrame;
importjavax.swing.JPanel;
//为窗口添加背景图片
publicclassJFrameBackground{
privateJFrameframe=newJFrame("带背景图片的JFrame");
privateJPanelimagePanel;
privateImageIconbackgroundimg;
publicJFrameBackground(){
imagePanel=newJPanel(){
@Override
protectedvoidpaintComponent(Graphicsg){
super.paintComponent(g);
URLlocation=this.getClass().getResource("grapes.gif");
backgroundimg=newImageIcon(location);
Imageimg=backgroundimg.getImage();
g.drawImage(img,0,0,backgroundimg.getIconWidth(),
backgroundimg.getIconHeight(),
backgroundimg.getImageObserver());
frame.setSize(backgroundimg.getIconWidth(),
backgroundimg.getIconHeight());
}
};
frame.add(imagePanel);
frame.setVisible(true);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
publicstaticvoidmain(String[]args){
newJFrameBackground();
}
}
这是运行的一个截图:
参考网址:
http://www.linuxidc.com/Linux/2011-08/41689.htm 两种设置背景的方法
http://blog.csdn.net/one_and_only4711/article/details/6594770 动态改变背景大小
H. 如何将Ext panel背景色设置为透明
这跟你把pictureBox Button 加入panel的顺序有关系~你先加入Button 然后在加入pictureBox ,则pictureBox在 Button 上面,反之相反
鼠标在Button 上点右键,选择【置于顶层】(vs2005)即可~
选择Button:
找到属性【BackColor】,然后选择【Transparent】~
找到属性【FlatStyle】,然后选择【Flat】或【Popup】~补充,:
动态创建的可以置于顶层~.net如果连这个都解决不了,也太对不起大家了~~
button1.BringToFront();//置于顶层
button1.SendToBack();//置于底层
2.还有透明效果在panel里实现不了,里面有pictureBox控件,他是一张图片哦!