问题列表 - 第13385页

JFrame上的MouseListener

我希望在我的JFrame上收到有关鼠标事件(特别是鼠标输入和退出事件)的通知.但是当我向它添加一个mouselistener时,我得到的是框架边框上的事件,而不是整个框架的内容.

任何想法为什么?

编辑:或者至少你有另一种选择吗?我想要一个"gloabal"方式来捕获JFrame上的鼠标事件.也许一个mouselistener不是答案.

java events swing jframe mouseevent

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

在Delphi 2010中构建虚拟Treeview的步骤

刚刚买了Delphi 2010(已跳过2009),我正在努力让我的项目进行编译.但是,我正在编写一些编译Virtual Treeview 4.8.5的问题.有人可以概述一种在Delphi 2010中编译和安装Virtual Treeview的简单方法吗?

delphi virtualtreeview delphi-2010

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

xpath表达式,用于根据父属性选择子节点

<module>
<component>
   <section>
      <ptemplateId root="1.8"/>
      <entry>
    <observation>
       <templateId root="1.24"/>
    </observation>
      </entry>
   </section>
</component>
<component>
   <section>
      <ptemplateId root="1.10"/>
      <entry>
    <observation>
       <templateId root="1.24"/>
    </observation>
      </entry>
   </section>
</component>
<component>
   <section>
      <ptemplateId root="1.23"/>
      <entry>
    <observation>
       <templateId root="1.24"/>
    </observation>
     <entryRelation>
        <observation>
         <templateId root="1.24"/>
        </observation>
     </entryRelation>
      </entry>
   </section>
</component>
<component>
       <section>
          <ptemplateId root="1.8"/>
          <entry>
        <observation>
           <templateId root="1.24"/>
        </observation>
         <entryRelation>
            <observation>
             <templateId root="1.28"/>
            </observation>
         </entryRelation>
          </entry>
       </section>
    </component>
</module>
Run Code Online (Sandbox Code Playgroud)

我想在基于ptemplateId的模板中选择观察,我能知道匹配表达式吗?

<xsl:template match"******">
   <!-- some processing goes here to process
        observation if ptemplateId is 1.8... -->
</xsl:template>

<xsl:template …
Run Code Online (Sandbox Code Playgroud)

xml xslt xpath

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

iPhone Device 3.1 SDK中断UITableViewCellStyleValue1 textLabel的垂直对齐方式

任何人都可以解释以下现象吗?

由于iPhone设备3.1 SDK中,我发现,如果UITableViewCell是一个风格UITableViewCellStyleValue1和它detailTextLabel.text是未分配的,则textLabel不会在小区的中心显示正如所预料的.

一个值得注意的警告是,当我在设备上测试时,这只会发生在我身上- iPhone 模拟器 3.1 SDK会正确显示单元格.此外,使用iPhone Device 3.0 SDK时也不会出现问题.

下面是一个简单的UITableViewController子类实现,它演示了这个问题.

@implementation BuggyTableViewController

#pragma mark Table view methods


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 3;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview

5
推荐指数
1
解决办法
2318
查看次数

如何使用给定的Type对象调用泛型方法?

我想用给定的类型对象调用我的泛型方法.

void Foo(Type t)
{
     MyGenericMethod<t>();
}
Run Code Online (Sandbox Code Playgroud)

显然不起作用.

我怎样才能使它工作?

.net c# generics reflection types

53
推荐指数
2
解决办法
6万
查看次数

更改iPhone UITableView单元格中的边框颜色(未分组)

我已经阅读(并使用过)这里的代码,该代码说明了如何在iPhone上以分组模式更改UITableViewCell的背景颜色和边框颜色.我正在编写一个应用程序,它有一个非分组的UITableView,我需要更改单元格的边框颜色.我知道我可以修改代码并创建一个新的背景视图并应用它,但是有必要吗?

如果UITableViewCell是非分组样式,是否有一种简单的方法来指定UITableViewCell的边框颜色?

iphone uitableview

33
推荐指数
1
解决办法
5万
查看次数

这段简单的代码出了什么问题?

我有以下代码,应该在断点处显示123在eax和321在ecx.由于某些原因,没有发生.有人在乎解释原因吗?

    push ebp;
    mov ebp, esp;
    sub esp, 8;
    mov [ebp-4], 123;
    mov [ebp-8], 321;
    mov eax, [ebp-4];
    mov ecx, [ebp-8];
    pop ebp; <------------- breakpoint here
    retn;
Run Code Online (Sandbox Code Playgroud)

我想,我不能做的一切都是错的

mov [ebp-4], 123
Run Code Online (Sandbox Code Playgroud)

其他一切对我来说都很好.

谢谢

编辑:值为:eax 1505915; ecx 1720129;

assembly

4
推荐指数
1
解决办法
203
查看次数

SQL选择一列的值在另一个条件列中是通用的行

我有一个交叉引用表,如下所示:

id  document_id  subject_id
1   8            21
2   5            17
3   5            76
4   7            88
5   9            17
6   9            76
7   2            76
Run Code Online (Sandbox Code Playgroud)

它将文档与主题相匹配.文件可以是多个主题的成员.我想返回此表中的行,其中给定的文档与给定集合中的所有主题匹配.例如,给定一组主题:

(17,76)

我想只返回与交叉引用表中某处的所有主题(至少)匹配的文档的行.给定上述设置的期望输出集将是:

id  document_id  subject_id
2   5            17
3   5            76
5   9            17
6   9            76
Run Code Online (Sandbox Code Playgroud)

请注意,不返回表的最后一行,因为该文档仅匹配其中一个必需主题.

在SQL中查询此内容的最简单,最有效的方法是什么?

sql relational

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

在C#中处理时间的简单方法?

我目前的做法是这样的

DateTime startHour = new DateTime(1900,1,1,12,25,43);
DateTime endHour = new DateTime(1900,1,1,13,45,32);

// I need to, say, know if a complete DateTime instance 
// is later than startHour plus 15 minutes

DateTime now = DateTime.Now();

startHour = startHour.addMinutes(15);

if (now.CompareTo(new DateTime(now.Year, now.Month, now.Day, startHour.Hour, 
                    startHour.Minute, startHour.Second)) > 0) 
{
    //I can do something now
}
Run Code Online (Sandbox Code Playgroud)

这非常麻烦甚至容易出错.就我所见,TimeSpans不是解决方案,因为它们代表跨度并且不受24小时限制的约束(TimeSpan为56小时34分钟有效.)

这种计算的首选方法是什么?

我错过了什么?

编辑:我正在进行的计算是比较完整的DateTime实例与表示实际时间的小时,分​​钟,秒三元组以及操作这些三元组的方法(添加小时,分钟秒)的方法.

编辑2:谢谢大家,我认为我现在掌握了DateTime API的要点.:)我唯一想念的是一种指定TimeSpan的方法,该TimeSpan应仅代表TimeOfDay,但这是次要的.

.net c# time datetime date-math

5
推荐指数
1
解决办法
5070
查看次数

在Python中线程化本地存储

如何在Python中使用线程本地存储?

有关

python multithreading thread-local-storage

64
推荐指数
5
解决办法
5万
查看次数