高手,小弟希望您能够帮小弟看一下下面的代码:
public ChatWithPointORTeam(String URL, Integer MyNum,
String User_facia, final Integer ChatObjectNum,
final String ChatObjrolE, String MyFriIP, byte MyMemGrade, int j) {
this.setTitle("远程电子教育,让您足不出户,实现您的需求解决");
this.setResizable(false);
this.setVisible(false);
this.setBounds(419, 92, 590, 590);
MyURLLocal = URL;
MyIndex = MyNum;
roleLocal = "Mem";
mystatelog = ChatObjectNum;
MyChatObjrolE = ChatObjrolE;
LocalMyMemGrade = MyMemGrade;
if (MyChatObjrolE.equals("Mem")) {
MyFriRoleCh = "系统员工";
} else {
MyFriRoleCh = "系统顾客";
}
MyFriendIP = MyFriIP;
iPAddressLocal = GetMyLocalIP.catchLocalIP();
// TODO:
writeMyChatwordTextArea.addKeyListener(this);
showMyChatwordTextArea.setEditable(false);
jspanel0 = new JScrollPane(showMyChatwordTextArea);
jspanel1 = new JScrollPane(writeMyChatwordTextArea);
jspanel0.setBounds(new Rectangle(10, 50, 500, 220));
jspanel1.setBounds(new Rectangle(10, 280, 500, 220));
jL0.setBounds(new Rectangle(233, 230, 97, 50));
jspanel0
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
jspanel0
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1
.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jp1.setLayout(null);
jp1.setBounds(new Rectangle(10, 0, 590, 550));
jp1.add(jspanel0);
jp1.add(jL0);
jp1.add(jspanel1);
this.invalidate();
this.repaint();
BufferedImage bi = null;
try {
bi = ImageIO.read(getClass().getResourceAsStream(imgPath));
} catch (IOException e) {
}
int w = bi.getWidth();
int h = bi.getHeight();
try {
bi = ImageIO.read(getClass().getResourceAsStream(imgPath));
} catch (IOException e) {
}
oW = w;
oH = h;
bl = (w - 0.0) / h;
setBounds(100, 110, w, h);
double panelWidth = w;
double panelHeight = h - 25 - 25 - 20;
imgPanel = new CustomImgPanel((double) panelWidth,
(double) panelHeight, imgPath);
System.out.println(imgPanel);
System.out.println(jp1);
imgPanel.add(jp1);
this.add(imgPanel);
this.addWindowListener(this);
netfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
mystatelog=0;
new Complete_ChatForeUITeacherClient2ChatWithMyTeam("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct1Item);
netfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
mystatelog=1;
new Complete_ChatForeUITeacherClient("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct3Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
//这里使用多线程,避免TcpSendFile这个类阻塞在那里。
//这里使用多线程,避免TcpSendFile这个类阻塞在那里。
mystatelog =2;
new ChatWithPointORTeam("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct2Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
final String MyFriRolech = ChatObjrolE.equals("Mem") ? "系统员工" : "系统顾客";
SwingUtilities.invokeLater(new Runnable() {
public void run() {
cjco0 = new TcpSendFile(String.valueOf(Recv.MySystemserialnum),
"Mem", MyFriRolech, String.valueOf(ChatObjectNum),
"吴国仕", Recv.MyFriFileIP[ChatObjectNum]);
}});
}
};
netlistenerbox.add(netfuct4Item);
netlistenerbox.add(netfuct5Item);
netfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
int i = 0;
if (jL0.getText().equals("已付担保金")) {
i = 1;
}
new PayForMySysFunctionUserRights(
MyChatingFriUID,
MyChatObjrolE,
mystatelog,
LocalMyMemGrade,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
i);
}
};
netlistenerbox.add(netfuct6Item);
netfuct7Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
int i = 0;
if (jL0.getText().equals("已付担保金")) {
i = 1;
}
new PayForMyHyperRights(
MyChatObjrolE,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
mystatelog);
}
};
netlistenerbox.add(netfuct7Item);
netfuct8Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new PayforTheResponsibilityGuarantee(
ChatObjrolE,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
ChatObjectNum);
}
};
netlistenerbox.add(netfuct8Item);
localfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (cjco == null) {
cjco = new CaptureScreen();
} else if (cjco.isVisible()) { } else {
cjco.setVisible(true);
}
}
};
locallistenerbox.add(localfuct1Item);
localfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new ChatClientFriendlist(
ManageC_port_MDSpara0Channel_Thread.Locallog);
}
};
locallistenerbox.add(localfuct2Item);
localfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
ReadTxt.read(Login.MyChatLogPath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String str = "";
for (int i = 0; i < ReadTxt.logData.size(); i++) {
str = str + ReadTxt.logData.get(i);
}
int pagenum = CalcMyPage.counter(str);
MyChatLogFrame2 m0 = new MyChatLogFrame2(str, pagenum);
Thread obj = new Thread(m0);
obj.start();
}
};
locallistenerbox.add(localfuct3Item);
localfuct4Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new SaveMyChatlogtoFile(
showMyChatwordTextArea,
(ChatWithPointORTeam) ChatWithPointORTeam.this);
}
};
locallistenerbox.add(localfuct4Item);
localfuct5Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new MakeaTable(writeMyChatwordTextArea).initUI();
}
};
locallistenerbox.add(localfuct5Item);
localfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
// TODO:
new MyWorkValueFrame();
}
};
locallistenerbox.add(localfuct6Item);
localfuct7Item = new ActionListener(){ @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
System.exit(0);
}
};
locallistenerbox.add(localfuct7Item); }
求高手点拨:
上面的代码运行结果为:
希望高手指教:
小弟上文的代码,怎么写,能够让本该“垫底”的背景图片在底下,让Chat窗口中的诸组件,能够在窗口的背景图片的上面?
希望高手,能够不吝赐教!!
谢谢高手!!
public ChatWithPointORTeam(String URL, Integer MyNum,
String User_facia, final Integer ChatObjectNum,
final String ChatObjrolE, String MyFriIP, byte MyMemGrade, int j) {
this.setTitle("远程电子教育,让您足不出户,实现您的需求解决");
this.setResizable(false);
this.setVisible(false);
this.setBounds(419, 92, 590, 590);
MyURLLocal = URL;
MyIndex = MyNum;
roleLocal = "Mem";
mystatelog = ChatObjectNum;
MyChatObjrolE = ChatObjrolE;
LocalMyMemGrade = MyMemGrade;
if (MyChatObjrolE.equals("Mem")) {
MyFriRoleCh = "系统员工";
} else {
MyFriRoleCh = "系统顾客";
}
MyFriendIP = MyFriIP;
iPAddressLocal = GetMyLocalIP.catchLocalIP();
// TODO:
writeMyChatwordTextArea.addKeyListener(this);
showMyChatwordTextArea.setEditable(false);
jspanel0 = new JScrollPane(showMyChatwordTextArea);
jspanel1 = new JScrollPane(writeMyChatwordTextArea);
jspanel0.setBounds(new Rectangle(10, 50, 500, 220));
jspanel1.setBounds(new Rectangle(10, 280, 500, 220));
jL0.setBounds(new Rectangle(233, 230, 97, 50));
jspanel0
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
jspanel0
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1
.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jp1.setLayout(null);
jp1.setBounds(new Rectangle(10, 0, 590, 550));
jp1.add(jspanel0);
jp1.add(jL0);
jp1.add(jspanel1);
this.invalidate();
this.repaint();
BufferedImage bi = null;
try {
bi = ImageIO.read(getClass().getResourceAsStream(imgPath));
} catch (IOException e) {
}
int w = bi.getWidth();
int h = bi.getHeight();
try {
bi = ImageIO.read(getClass().getResourceAsStream(imgPath));
} catch (IOException e) {
}
oW = w;
oH = h;
bl = (w - 0.0) / h;
setBounds(100, 110, w, h);
double panelWidth = w;
double panelHeight = h - 25 - 25 - 20;
imgPanel = new CustomImgPanel((double) panelWidth,
(double) panelHeight, imgPath);
System.out.println(imgPanel);
System.out.println(jp1);
imgPanel.add(jp1);
this.add(imgPanel);
this.addWindowListener(this);
netfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
mystatelog=0;
new Complete_ChatForeUITeacherClient2ChatWithMyTeam("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct1Item);
netfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
mystatelog=1;
new Complete_ChatForeUITeacherClient("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct3Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
//这里使用多线程,避免TcpSendFile这个类阻塞在那里。
//这里使用多线程,避免TcpSendFile这个类阻塞在那里。
mystatelog =2;
new ChatWithPointORTeam("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct2Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
final String MyFriRolech = ChatObjrolE.equals("Mem") ? "系统员工" : "系统顾客";
SwingUtilities.invokeLater(new Runnable() {
public void run() {
cjco0 = new TcpSendFile(String.valueOf(Recv.MySystemserialnum),
"Mem", MyFriRolech, String.valueOf(ChatObjectNum),
"吴国仕", Recv.MyFriFileIP[ChatObjectNum]);
}});
}
};
netlistenerbox.add(netfuct4Item);
netlistenerbox.add(netfuct5Item);
netfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
int i = 0;
if (jL0.getText().equals("已付担保金")) {
i = 1;
}
new PayForMySysFunctionUserRights(
MyChatingFriUID,
MyChatObjrolE,
mystatelog,
LocalMyMemGrade,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
i);
}
};
netlistenerbox.add(netfuct6Item);
netfuct7Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
int i = 0;
if (jL0.getText().equals("已付担保金")) {
i = 1;
}
new PayForMyHyperRights(
MyChatObjrolE,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
mystatelog);
}
};
netlistenerbox.add(netfuct7Item);
netfuct8Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new PayforTheResponsibilityGuarantee(
ChatObjrolE,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
ChatObjectNum);
}
};
netlistenerbox.add(netfuct8Item);
localfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (cjco == null) {
cjco = new CaptureScreen();
} else if (cjco.isVisible()) { } else {
cjco.setVisible(true);
}
}
};
locallistenerbox.add(localfuct1Item);
localfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new ChatClientFriendlist(
ManageC_port_MDSpara0Channel_Thread.Locallog);
}
};
locallistenerbox.add(localfuct2Item);
localfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
ReadTxt.read(Login.MyChatLogPath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String str = "";
for (int i = 0; i < ReadTxt.logData.size(); i++) {
str = str + ReadTxt.logData.get(i);
}
int pagenum = CalcMyPage.counter(str);
MyChatLogFrame2 m0 = new MyChatLogFrame2(str, pagenum);
Thread obj = new Thread(m0);
obj.start();
}
};
locallistenerbox.add(localfuct3Item);
localfuct4Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new SaveMyChatlogtoFile(
showMyChatwordTextArea,
(ChatWithPointORTeam) ChatWithPointORTeam.this);
}
};
locallistenerbox.add(localfuct4Item);
localfuct5Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new MakeaTable(writeMyChatwordTextArea).initUI();
}
};
locallistenerbox.add(localfuct5Item);
localfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
// TODO:
new MyWorkValueFrame();
}
};
locallistenerbox.add(localfuct6Item);
localfuct7Item = new ActionListener(){ @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
System.exit(0);
}
};
locallistenerbox.add(localfuct7Item); }
求高手点拨:
上面的代码运行结果为:
希望高手指教:
小弟上文的代码,怎么写,能够让本该“垫底”的背景图片在底下,让Chat窗口中的诸组件,能够在窗口的背景图片的上面?
希望高手,能够不吝赐教!!
谢谢高手!!
String User_facia, final Integer ChatObjectNum,
final String ChatObjrolE, String MyFriIP, byte MyMemGrade, int j) {
this.setTitle("远程电子教育,让您足不出户,实现您的需求解决");
this.setResizable(false);
this.setVisible(false);
this.setBounds(419, 92, 590, 590);
MyURLLocal = URL;
MyIndex = MyNum;
roleLocal = "Mem";
mystatelog = ChatObjectNum;
MyChatObjrolE = ChatObjrolE;
LocalMyMemGrade = MyMemGrade;
if (MyChatObjrolE.equals("Mem")) {
MyFriRoleCh = "系统员工";
} else {
MyFriRoleCh = "系统顾客";
}
MyFriendIP = MyFriIP;
iPAddressLocal = GetMyLocalIP.catchLocalIP();
// TODO:
writeMyChatwordTextArea.addKeyListener(this);
showMyChatwordTextArea.setEditable(false);
jspanel0 = new JScrollPane(showMyChatwordTextArea);
jspanel1 = new JScrollPane(writeMyChatwordTextArea);
jspanel0.setBounds(new Rectangle(10, 50, 500, 220));
jspanel1.setBounds(new Rectangle(10, 280, 500, 220));
jL0.setBounds(new Rectangle(233, 230, 97, 50));
jspanel0
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
jspanel0
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1
.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jp1.setLayout(null);
jp1.setBounds(new Rectangle(10, 0, 590, 550));
jp1.add(jspanel0);
jp1.add(jL0);
jp1.add(jspanel1);
this.invalidate();
this.repaint();
BufferedImage bi = null;
try {
bi = ImageIO.read(getClass().getResourceAsStream(imgPath));
} catch (IOException e) {}
int w = bi.getWidth();
int h = bi.getHeight();
try {
bi = ImageIO.read(getClass().getResourceAsStream(imgPath));
} catch (IOException e) {}
oW = w;
oH = h;
bl = (w - 0.0) / h;
setBounds(100, 110, w, h);
double panelWidth = w;
double panelHeight = h - 25 - 25 - 20;
imgPanel = new CustomImgPanel((double) panelWidth,
(double) panelHeight, imgPath);
System.out.println(imgPanel);
System.out.println(jp1);
imgPanel.add(jp1);
this.add(imgPanel);
this.addWindowListener(this);
netfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
mystatelog=0;
new Complete_ChatForeUITeacherClient2ChatWithMyTeam("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct1Item);
netfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
mystatelog=1;
new Complete_ChatForeUITeacherClient("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct3Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
//这里使用多线程,避免TcpSendFile这个类阻塞在那里。
//这里使用多线程,避免TcpSendFile这个类阻塞在那里。
mystatelog =2;
new ChatWithPointORTeam("www.baidu.com", 0, "CJCO!!加油!!",
2, "Mem", "222.196.1.8", (byte) 1, 1).start();
}
};
netlistenerbox.add(netfuct2Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
final String MyFriRolech = ChatObjrolE.equals("Mem") ? "系统员工" : "系统顾客";
SwingUtilities.invokeLater(new Runnable() {
public void run() {
cjco0 = new TcpSendFile(String.valueOf(Recv.MySystemserialnum),
"Mem", MyFriRolech, String.valueOf(ChatObjectNum),
"吴国仕", Recv.MyFriFileIP[ChatObjectNum]);
}});
}
};netlistenerbox.add(netfuct4Item);
netlistenerbox.add(netfuct5Item);
netfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
int i = 0;
if (jL0.getText().equals("已付担保金")) {
i = 1;
}
new PayForMySysFunctionUserRights(
MyChatingFriUID,
MyChatObjrolE,
mystatelog,
LocalMyMemGrade,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
i);
}
};
netlistenerbox.add(netfuct6Item);
netfuct7Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
int i = 0;
if (jL0.getText().equals("已付担保金")) {
i = 1;
}
new PayForMyHyperRights(
MyChatObjrolE,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
mystatelog);
}
};
netlistenerbox.add(netfuct7Item);
netfuct8Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new PayforTheResponsibilityGuarantee(
ChatObjrolE,
(ChatWithPointORTeam) ChatWithPointORTeam.this,
ChatObjectNum);
}
};
netlistenerbox.add(netfuct8Item);
localfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (cjco == null) {
cjco = new CaptureScreen();
} else if (cjco.isVisible()) {} else {
cjco.setVisible(true);
}
}
};
locallistenerbox.add(localfuct1Item);
localfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new ChatClientFriendlist(
ManageC_port_MDSpara0Channel_Thread.Locallog);
}
};
locallistenerbox.add(localfuct2Item);
localfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
ReadTxt.read(Login.MyChatLogPath);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String str = "";
for (int i = 0; i < ReadTxt.logData.size(); i++) {
str = str + ReadTxt.logData.get(i);
}
int pagenum = CalcMyPage.counter(str);
MyChatLogFrame2 m0 = new MyChatLogFrame2(str, pagenum);
Thread obj = new Thread(m0);
obj.start();
}
};
locallistenerbox.add(localfuct3Item);
localfuct4Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new SaveMyChatlogtoFile(
showMyChatwordTextArea,
(ChatWithPointORTeam) ChatWithPointORTeam.this);
}
};
locallistenerbox.add(localfuct4Item);
localfuct5Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
new MakeaTable(writeMyChatwordTextArea).initUI();
}
};
locallistenerbox.add(localfuct5Item);
localfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
// TODO:
new MyWorkValueFrame();
}
};
locallistenerbox.add(localfuct6Item);
localfuct7Item = new ActionListener(){@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
System.exit(0);
}};
locallistenerbox.add(localfuct7Item);}
重新粘贴一下代码,谢谢高手的过目!!
但是我的时间有限!只能给你点提示!