小编abc*_*abc的帖子

在动态创建时,jbeel数组在netbeans中不可见

我无法查看动态创建的标签.代码如下:

JLabel[] labels = new javax.swing.JLabel[cur.length];
for (int i = 0 ;i < cur.length; i++)
{
   System.out.println("in");
   labels[i] = new JLabel( cur[i] );
    labels[i].setText(""+cur[i]);
   jPanel1.add(labels[i]);
   this.setVisible(true);
   }
 }
Run Code Online (Sandbox Code Playgroud)

java swing

5
推荐指数
0
解决办法
1623
查看次数

在JApplet中添加图像

ImageIcon icon= new ImageIcon("a.gif");
JLabel jLabel1=new JLabel(icon);
jLabel1.setVisible(true);
card1.add(jLabel1);
Run Code Online (Sandbox Code Playgroud)

我是Java的新手,我在applet中的面板中添加图像时遇到了问题.我的图片位于同一个文件夹中.我的小程序可见而没有任何问题,但只显示图像.

java swing image japplet imageicon

3
推荐指数
1
解决办法
2747
查看次数

等待特定线程的调用

是否可以为另一个线程而不是当前线程调用wait方法.我要问的是这样的:

码:

public class a extends JApplet{
 JButton start= new JButton("Start");
 JButton wait= new JButton("Wait");
 JButton notify = new JButton("Notify");
 final Thread bthread = new Thread(new B(), "BThread");

 @Override
 public void init(){
    //start
   this.getContentPane().setLayout(new FlowLayout()); 
   start.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("Started");
        }
    });
   this.getContentPane().add(start);
   //wait
   wait.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("Waited");
            synchronized(bthread)       //something like this
            {
                try {
                    bthread.wait();     //is it possible instead of the current thread the bthread get invoke
                 } …
Run Code Online (Sandbox Code Playgroud)

java multithreading wait

3
推荐指数
1
解决办法
351
查看次数

在java中调用main里面的main方法

我们可以在main中调用main方法吗?

public static void main(String[] args) {
    main({"a","b","c"});
}
Run Code Online (Sandbox Code Playgroud)

试图google.Can't找不到链接.对不起,如果这个问题很简单

java methods program-entry-point

3
推荐指数
1
解决办法
2万
查看次数

使用ESAPI getValidInput方法

我无法使用在ESAPI类“ 下存在的方法”

    java.lang.String getValidInput(java.lang.String context,
                                  java.lang.String input,
                                  java.lang.String type,
                                  int maxLength,
                                  boolean allowNull)
                                      throws ValidationException,
                                       IntrusionException

      Parameters:
         type - The regular expression name that maps to the actual regular expression from "ESAPI.properties". 
Run Code Online (Sandbox Code Playgroud)

如何从ESAPI.properties文件传递参数类型?我可以参考使用属性文件值的任何示例吗?

java esapi

0
推荐指数
1
解决办法
2万
查看次数