小编sap*_*Pro的帖子

声明匿名内部类

rb.addActionListener(new ActionEvent(ae) {
   public void actionPerformed(ActionEvent ae) {
     nowCall(ae);
    }
});
Run Code Online (Sandbox Code Playgroud)

其他方式

Thread th=new Thread(Runnable r) {
  public void run() {
    // do something
  }
};

// notice the ending of above 2 snippets
Run Code Online (Sandbox Code Playgroud)

看到这两个,我真的很困惑.似乎没有确切的模式来声明一个匿名的内部类.

请解释匿名内部类的语法.

java

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

DWORD,LPTSR,LPBYTE,HANDLE这些术语是什么意思?

我最近在研究课程时遇到过这些术语.我知道他们是data types......

他们真的吗?

你能解释一下这些术语到底意味着什么吗?我还没有找到documentation.

c++ gdi visual-c++

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

面板为什么不画?

import javax.swing.*;
import java.awt.*;

class tester {
   public static void main(String args[]) {
     JFrame fr = new JFrame();
     JPanel p = new JPanel();
     p.setBackground(Color.RED);
     p.paintImmediately(20,20,500,500);  
     fr.add(p);
     fr.setVisible(true);
     fr.setSize(2000,2000);
  }
}
Run Code Online (Sandbox Code Playgroud)

我得到一个完全是红色的面板.为什么我不接线?我怎么才能得到它?

java swing colors java-2d paintcomponent

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

无法对齐页面右侧的搜索栏

我想对齐search bar页面的最右侧.为此,我写了以下内容:

<form method="get" action="#">
    <input type="search" name="q" style="text-align:right" />
</form>
Run Code Online (Sandbox Code Playgroud)

但它没有对齐右侧的搜索栏.这是为什么 ?

在此输入图像描述

html alignment

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

为什么 class_exists 函数返回 false?

在下面的脚本中我检查了该class_exists函数。这个函数的范围是什么?false当我测试此类时,它会返回此脚本。

<?php
namespace my;
class Tester {      
    public function check() {
        $classname = 'Tester';
        if(class_exists($classname)) {
            echo "class exists ! <br />";
        } else {
            echo "class doesn't exist ! <br />";
        }
    }
}   

$obj = new Tester();
$obj->check();
Run Code Online (Sandbox Code Playgroud)

输出:类不存在

php

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

对于像fillOval这样的方法,'x'和'y'表示什么?它们的坐标是什么?

对于Graphics类的方法:fillOval,做什么xy表示什么?文件说:

x - the x coordinate of the upper left corner of the oval to be filled.
y - the y coordinate of the upper left corner of the oval to be filled.
Run Code Online (Sandbox Code Playgroud)

我不明白.这是什么意思 ?

java graphics swing

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

这几点意味着什么?

我创建了一个包含一个属性的表,并在其中tt插入了一个值.

CREATE TABLE tt(tm TIME);
INSERT INTO tt VALUES(2342342);
Run Code Online (Sandbox Code Playgroud)

执行select命令时,显示的结果如下:

234:23:42
Run Code Online (Sandbox Code Playgroud)

这几点意味着什么?

mysql sql time

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

这句话是什么意思

unlike SwingUtilities.invokeAndWait(), the event thread is permitted to call SwingUtilities.invokeLater().我无法理解这一点.

请帮帮我.

java swing

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

这些陈述是什么意思?

#include<stdio.h>
void main() {
 int s[4][2]={
               {1,2},
               {3,4},
               {5,6},
               {7,8}
             };
int (*p)[2]; // what does this statement mean? (A)
int i,j,*pint;

for(i=0;i<=3;i++) {
 p=&s[i];
 pint=(int*)p;  // what does this statement mean? (B)
 printf("\n");
  for(j=0;j<=1;j++) {
    printf("%d",*(pint+j));
  }
}
Run Code Online (Sandbox Code Playgroud)

我无法理解陈述'A'和'B'.如何做和做了什么?请非常清楚地解释一下.

c

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

如何从匿名类中访问封闭的类实例变量?

如何instance variables从匿名类的方法中访问?

class Tester extends JFrame {

   private JButton button;
   private JLabel label;
   //..some more

   public Tester() {
        function(); // CALL FUNCTION
   }

   public void function() {
      Runnable r = new Runnable() {
         @Override
         public void run() {
            // How do I access button and label from here ?
         }
      };
      new Thread(r).start();
   }
}
Run Code Online (Sandbox Code Playgroud)

java anonymous-inner-class anonymous-class

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