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控制項,他是一張圖片哦!