求就,郁闷,几天自己解决不了的菜鸟问题 you should add a label in a Panel,which is added in a Frame. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.util.*;public class talkbean implements WindowListener,MouseMotionListener ,AdjustmentListener{ private Frame frame; private Label jj; void setframe(String frameTitle) { frame = new Frame( frameTitle); frame.setSize(10,400); frame.addWindowListener(this); frame.addMouseMotionListener(this); frame.setVisible(true); } public talkbean(String frameTitle) { setframe(frameTitle); } public static void main (String arg[]) { talkbean talk = new talkbean(arg[0]); talk.adduser(talk,arg[1]); } void adduser(talkbean talk,String labelName) { talk.frame.add(new Label (labelName)) ; } public void windowClosing(WindowEvent we) { System.exit(0); } public void windowOpened(WindowEvent we) { } public void windowIconified(WindowEvent we){} public void windowDeiconified(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowClosed(WindowEvent we){} public void mouseDragged(MouseEvent me){} public void mouseMoved(MouseEvent me){} public void adjustmentValueChanged(AdjustmentEvent ev) { AdjustmentEvent bx; if (ev.getAdjustmentType()==1) { //this is downs event } if (ev.getAdjustmentType()==2) { //this is up event } }} 试了次,不行:(~~ 问一下,老大你自己测试了么,我做,出不来LABEL! //需要刷新,刷新方案有二1、人为改变窗体大小2、加代码,如下: void adduser(talkbean talk){ talk.frame.add(new Label ("asdfasd")) ; frame.setVisible(true);//刷新 } 考思维,拼数组问题 jdbc动态代理的一个问题 挑战:如何生成多个前缀不重复的二进制数字符串? 大家快来啊。。。。单元测试,存放规范~~ 如何实现将一个JMenu下的JMenuItem用鼠标拖动到另一JMenu下 布局管理器GridBagLayout java数据库日期比较问题 j2sdk的一个例子 如何用java实现对com口的操作?请给出实例 关于java里类数组 为什么在jb7环境中编译一个项目时老是出现cannot access directory java\lang 如何把时间以固定字符串格式输出?
import java.awt.event.*;
import javax.swing.*;
import java.util.*;public class talkbean implements WindowListener,MouseMotionListener
,AdjustmentListener
{
private Frame frame;
private Label jj;
void setframe(String frameTitle)
{
frame = new Frame( frameTitle);
frame.setSize(10,400);
frame.addWindowListener(this);
frame.addMouseMotionListener(this);
frame.setVisible(true);
}
public talkbean(String frameTitle)
{
setframe(frameTitle);
}
public static void main (String arg[])
{
talkbean talk = new talkbean(arg[0]);
talk.adduser(talk,arg[1]);
}
void adduser(talkbean talk,String labelName)
{
talk.frame.add(new Label (labelName)) ;
}
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
public void windowOpened(WindowEvent we)
{
}
public void windowIconified(WindowEvent we){}
public void windowDeiconified(WindowEvent we){}
public void windowActivated(WindowEvent we){}
public void windowDeactivated(WindowEvent we){}
public void windowClosed(WindowEvent we){}
public void mouseDragged(MouseEvent me){}
public void mouseMoved(MouseEvent me){} public void adjustmentValueChanged(AdjustmentEvent ev)
{
AdjustmentEvent bx;
if (ev.getAdjustmentType()==1)
{
//this is downs event
}
if (ev.getAdjustmentType()==2)
{
//this is up event
}
}
}
1、人为改变窗体大小
2、加代码,如下: void adduser(talkbean talk){
talk.frame.add(new Label ("asdfasd")) ;
frame.setVisible(true);//刷新
}