Topic: 请教各位高手一个问题,十万火急!!

  Print this page

1.请教各位高手一个问题,十万火急!! Copy to clipboard
Posted by: kkandcc
Posted on: 2006-10-28 06:55

下面这张图是窗口的背景,而空白的3个部分是3个处理框,请问在java gui的frame中如何使用背景图片,以及这3个window位置该如何设置才正好是这样的位置呢?谢谢

2.Re:请教各位高手一个问题,十万火急!! [Re: kkandcc] Copy to clipboard
Posted by: kkandcc
Posted on: 2006-10-28 06:56

不好意思,添加在附件里了

3.Re:请教各位高手一个问题,十万火急!! [Re: kkandcc] Copy to clipboard
Posted by: lisliefor
Posted on: 2006-10-28 09:52

Google please !

4.Re:请教各位高手一个问题,十万火急!! [Re: kkandcc] Copy to clipboard
Posted by: dejinzhao
Posted on: 2006-11-05 23:45

//我不知道“处理框”是什么组件、我用“文本框”代替、你看对你是否有用

public class MyPanel extends javax.swing.JPanel {
public MyPanel() {
//icon=new javax.swing.ImageIcon(getClass().getResource("/你的目录/你的图片.jpg"));
icon=new javax.swing.ImageIcon(getClass().getResource("/back.jpg"));
initComponents();
this.setPreferredSize(new java.awt.Dimension(800,276));
}
private void initComponents() {
rightBottomTextArea = new javax.swing.JTextArea();
leftTextArea = new javax.swing.JTextArea();
rightTopTextArea = new javax.swing.JTextArea();

setLayout(null);

setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
rightBottomTextArea.setBackground(new java.awt.Color(255, 153, 153));
rightBottomTextArea.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
add(rightBottomTextArea);
rightBottomTextArea.setBounds(452, 143, 333, 119);

leftTextArea.setBackground(new java.awt.Color(255, 153, 153));
leftTextArea.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
add(leftTextArea);
leftTextArea.setBounds(17, 10, 248, 251);

rightTopTextArea.setBackground(new java.awt.Color(255, 153, 153));
rightTopTextArea.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
add(rightTopTextArea);
rightTopTextArea.setBounds(452, 10, 333, 119);

}
public void paintComponent(java.awt.Graphics g){
g.drawImage(icon.getImage(),0,0,this);
paintComponents(g);
paintBorder(g);
}
public static void main (String args[]) {
javax.swing.JFrame frame=new javax.swing.JFrame();
frame.setResizable(false);
frame.setContentPane(new MyPanel());
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
private javax.swing.ImageIcon icon;
// Variables declaration - do not modify
private javax.swing.JTextArea rightBottomTextArea;
private javax.swing.JTextArea leftTextArea;
private javax.swing.JTextArea rightTopTextArea;
// End of variables declaration
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923