问题列表 - 第38905页

WPF:按钮模板与ContentTemplate

我能说通常,在WPF中,属性Template包含ContentTemplate?或者,差异是什么?

wpf templates button

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

JFrame catch处理事件

我有一个Java项目。
我有一个附加了处理程序的JFrame像这样

frame.addWindowListener(new WindowAdapter() {

            public void windowClosing(WindowEvent evt) {
                this.setEnabled(true);

            }
        });
Run Code Online (Sandbox Code Playgroud)

但是,在该框架上,我还具有一个关闭按钮(以使其更加用户友好),并且该“关闭”按钮调用框架处理方法。现在,当我通过单击右上角的小x按钮关闭框架时,将调用WindowListener。但是,当我调用dispose方法时,该事件不会触发。
我应该调用其他方法关闭它,以便WindowListener触发,或者实现另一个侦听器吗?

java jframe

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

如何渲染JTable中的复选框?

这是我渲染JTable并更改行颜色的代码,但它没有在第6列中显示复选框,只显示字符串(true,false).

你能提供解决方案吗?

提前致谢.

    public class JLabelRenderer extends JLabel implements TableCellRenderer
{
  private MyJTable myTable;
  /**
   * Creates a Custom JLabel Cell Renderer
   * @param t your JTable implmentation that holds the Hashtable to inquire for
   * rows and colors to paint.
   */
  public JLabelRenderer(MyJTable t)
  {
    this.myTable = t;
  }

  /**
   * Returns the component used for drawing the cell.  This method is
   * used to configure the renderer appropriately before drawing.
   * see TableCellRenderer.getTableCellRendererComponent(...); for more comments on the …
Run Code Online (Sandbox Code Playgroud)

java checkbox swing jtable

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

如何在Android模拟器中模拟总网络丢失

我正在尝试编写一个应用程序,需要知道何时没有可用的IP网络连接.我正在使用android.net.conn.CONNECTIVITY_CHANGE广播事件和ConnectivityManager来响应状态的变化来实现这一点,但是我在模拟器中测试我的设置时遇到了问题.

我已经尝试了两种飞行模式并按下F8以禁用"蜂窝网络",但即使这两种情况都参与其中,应用程序仍"看到"底层网络.

有没有人设法找到模拟完全缺乏网络访问的方法?

android android-emulator

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

将JSF标签与JSTL标签混合使用会产生奇怪的结果

我有这段代码:

 <c:if test="#{utils.getCounterOfCharOccurence(hideTypes, ';') != 0}">
   <ui:repeat value="#{document.instanceList}" var="instance">
    <c:set var="columnRendered" value="true"></c:set>
    <c:forEach items="${hideTypes.split(';')}"
               var="hideType">
     <h:outputText value="#{hideType eq instance.documentInstanceType.mimeType}"/>
     <c:if test="#{hideType eq instance.documentInstanceType.mimeType}">
      <c:set var="columnRendered" value="false"></c:set>
      <h:outputText value="#{columnRendered}|"/>
     </c:if>
    </c:forEach>
    <a:outputPanel rendered="#{columnRendered == 'true'}">
     <up:mimeTypeIcon type="#{instance.documentInstanceType.mimeType}"
                      icon="#{instance.documentInstanceType.iconPath}"
                      key="#{instance.instanceKey}" referenced="false"/>
    </a:outputPanel>
   </ui:repeat>

  </c:if>
Run Code Online (Sandbox Code Playgroud)

如您所见,我仅在columnRendered为true时才渲染该outputPanel。

好吧,在某些情况下(仅用于测试以批准其应做的事情):

<h:outputText value="#{hideType eq instance.documentInstanceType.mimeType}"/>
Run Code Online (Sandbox Code Playgroud)

为true,因此应在c:if中输入,并将columnRendered切换为false。但是事实并非如此,因此columnRendered永远是正确的...

你知道为什么吗?

java jsf jstl

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

在C中使用sizeof

我有以下程序,崩溃了.有谁知道它为什么会崩溃?

/* writes a, b, c into dst 
** dst must have enough space for the result 
** assumes all 3 numbers are positive */ 
void concat3(char *dst, int a, int b, int c) { 
    sprintf(dst, "%08x%08x%08x", a, b, c); 
} 

/* usage */ 
int main(void) { 
    printf("The size of int is %d \n", sizeof(int));
    char n3[3 * sizeof(int) + 1]; 
    concat3(n3, 0xDEADFACE, 0xF00BA4, 42); 
    printf("result is 0x%s\n", n3); 
    return 0; 
} 
Run Code Online (Sandbox Code Playgroud)

c c++

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

我不明白ruby本地范围

在这个例子中,

def foo(x)
  if(x > 5)
    bar = 100
  end
  puts bar
end
Run Code Online (Sandbox Code Playgroud)

然后foo(6)输出:100和foo(3)什么都不输出.

但是,如果我将定义更改为

def foo(x)
  if(x > 5)
    bar = 100
  end
  puts bob
end
Run Code Online (Sandbox Code Playgroud)

我得到一个"未定义的局部变量或方法"错误.

所以我的问题是为什么当我调用foo(3)并且从未设置bar时我没有收到此错误?

ruby

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

C#通过HTTP发送图像

我有一个用C#编写的小型HTTP服务器,直到现在我只需要将原始文本发送回发件人.但现在我必须发送一个JPG-Image,我不知道如何.

这就是我现在拥有的:

// Read the HTTP Request
Byte[] bReceive = new Byte[MAXBUFFERSIZE];
int i = socket.Receive(bReceive, bReceive.Length, 0);

//Convert Byte to String
string sBuffer = Encoding.ASCII.GetString(bReceive);

// Look for HTTP request
iStartPos = sBuffer.IndexOf("HTTP", 1);

// Extract the Command without GET_/ at the beginning and _HTTP at the end
sRequest = sBuffer.Substring(5, iStartPos - 1 - 5);
String answer = handleRequest(sRequest);


// Send the response
socket.Send(Encoding.UTF8.GetBytes(answer));
Run Code Online (Sandbox Code Playgroud)

我想我必须做一些文件流而不是字符串,但我真的没有胶水..

c# tcplistener image http send

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

C#:读取嵌入在资源文件中的文件内容

如何在ResourceManager类的帮助下读取嵌入在resx文件中文本文件

以下代码段有什么问题?

ResourceManager resman = new ResourceManager("Mynamespace.RESXFileName", Assembly.GetExecutingAssembly());
Stream stream = resman2.GetStream("ResourceName");
Run Code Online (Sandbox Code Playgroud)

流是alway = null!

.net c# resources

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

如何在Symfony中为sfGuard用户创建自定义登录?

我在我的项目中使用Symfony 1.4和ORM作为Propel.我已经配置了Settings.yml来保护我的页面.但是我可以通过扩展所有functionality.i发现一个文章中的SfGuard插件我的行动使自定义登录/注销SymfonyLab,但还不够清楚.

php symfony1 sfguard

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

标签 统计

java ×3

c# ×2

.net ×1

android ×1

android-emulator ×1

button ×1

c ×1

c++ ×1

checkbox ×1

http ×1

image ×1

jframe ×1

jsf ×1

jstl ×1

jtable ×1

php ×1

resources ×1

ruby ×1

send ×1

sfguard ×1

swing ×1

symfony1 ×1

tcplistener ×1

templates ×1

wpf ×1