小编Bil*_*ard的帖子

光标在两个字段中闪烁(JTextField)

你好?任何人都有这样的问题:光标一次闪烁多个字段?在我的情况下会发生以下情况:当你双击字段JTextField时,打开一个JDialog,所以在关闭它之后,焦点将被引导回打开屏幕之前单击的字段.

发生的事情是,执行此操作后,两个字段同时闪烁(通常是第一个字段屏幕,以及efetuei双击的字段).该介质是随机的,有些情况下不会发生.

当调试内部类Handler时,包含在类DefaultCaret中更具体的actionPerformed方法,意识到:时间是一个字段,时间是另一个,这正是闪烁的字段(我知道q似乎很明显).但它们是调用该方法的Java内部类.

使用Tab传递字段时,光标false会消失.

我正在使用JDK 6


我在invokeLater()中返回了焦点,但没有解决.现在两个同步闪光

第一个可聚焦的JComponent是闪烁不正确的字段之一

我正在使用自己的FocusTraversalPolicy,这可能会影响吗?有趣的是,我班上没有特别奇怪的待遇.

我注意到标准的Java类,使用Syncronized getFirstComponent()中的方法,但添加了相同的控件,但仍然不行

java swing focus caret jtextfield

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

在AsyncTask上的getApplication()上找不到符号

我正在使用AsyncTask并希望使用getApplication()来处理类Application.但getApplication()获取错误无法找到符号.

我的代码:

public class  splash extends AsyncTask {
  protected config app;
  public  splash(Context context) {
  super();
  app = ((config) getApplication());
  this.context=context;
}
Run Code Online (Sandbox Code Playgroud)

和我想要使用的类:

public class config extends Application
{
  public Boolean  con=true;
  public int status=-1;
  public String actNum; 
  public void onCreate()
  {
    super.onCreate();
  }
}
Run Code Online (Sandbox Code Playgroud)

android android-asynctask

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

没有在C#中带0个参数的构造函数

我在C#中编程时遇到此错误:'BankSystem.Account'不包含带0参数的构造函数

我的课程是:

首先,Account类:

 public abstract class Account : IAccount
{

    private static decimal minIncome = 0;
    private static int minAge = 18;

    private string name;
    private string address;
    private decimal age;
    private decimal balance;

    public Account(string inName, decimal inAge, decimal inBalance, string inAddress)
    {
        if (AccountAllowed(inBalance, inAge))
        {
            name = inName;
            address = inAddress;
            balance = inBalance;
            age = inAge;

            Console.WriteLine("We created the account. \nName is " + name + " \nThe address is: "
            + address + "\nThe balance …
Run Code Online (Sandbox Code Playgroud)

c# constructor

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

在C#中的List中保存不同类型的数据

我有几个数据,如姓名,身份证,年龄,地址,电话.每次用户输入数据时,它都会保存到List<>.我正在使用List<>每个数据.还有其他选择我只能使用一个List<>.哪个可以保存所有数据?

这是我的代码.

List<String> list1 = new List<String>();
                list1.Add(name);
List<String> list2 = new List<String>();
                list2.Add(ID);
List<String> list3 = new List<String>();
                list3.Add(age);
List<String> list4 = new List<String>();
                list4.Add(address);
List<String> list5 = new List<String>();
                list5.Add(phone);

for (int a = 0; a < list.Count; a++) // Loop through List with for
{                        
    listBox1.Items.Add(list1[i]);
}
for (int a = 0; a < list.Count; a++) // Loop through List with for
{                        
    listBox2.Items.Add(list2[i]);
}
for (int a = 0; a …
Run Code Online (Sandbox Code Playgroud)

c# printing

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

大括号缺少退货声明?

我正在编写一个程序,其中我有一系列方法都设置基本相同.如果给出i = 1,他们将返回产品价格乘以订购数量.否则,他们只返回订购的数量.然而,每当我尝试编译它时,编译器都会说括号缺少返回语句.我已经多次浏览过代码了,我没有看到语法中有任何明显的错误.有没有猜到为什么会这样?

感谢您的任何帮助.

相关来源:

private class ButtonListener implements ActionListener {
        public void actionPerformed(ActionEvent e)
        {
            if (e.getSource() == switchCard)
            {
                cl.show(infoPanel, (String)candyList.getSelectedValue());
            }

        if (e.getSource() == checkoutButton)
        {
            double acidPops = acidPopsTotal(1);
            double bertieBotts = bertieBottsTotal(1);
            double bloodPops = bloodPopsTotal(1);
            double cauldronCakes = cauldronCakesTotal(1);
            double charmChoc = charmChocTotal(1);
            double chocoballs = chocoballsTotal(1);
            double chocCauldrons = chocCauldronsTotal(1);
            double chocFrogs = chocFrogsTotal(1);
            double chocWands = chocWandsTotal(1);
            double roachClusters = roachClustersTotal(1);
            double crystalPineapple = crystalPineappleTotal(1);
            double droobleGum = droobleGumTotal(1);
            double explodeBonbons = …
Run Code Online (Sandbox Code Playgroud)

java swing if-statement

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

Google App Engine,永久链接和CSS

我一直在研究Udacity Web Enginnering课程并且在其中一个作业中遇到困难.

我创建了一个基本博客,允许我创建帖子并在主页面上显示它们.此外,每次创建帖子时,都会生成永久链接并显示页面.但是,虽然我的HTML渲染得很好,但所有的CSS都丢失了.样式表当然在从服务器返回的源中引用,但不显示.

在其他地方成功使用相同的CSS文件(stlye.css).

目录结构如下所示:

blog:
    - app.yaml
    - main.py
templates:
    - index.html
    - newpost.html
    - styles.css
stylesheets
    - styles.css
Run Code Online (Sandbox Code Playgroud)

这是我的应用程序代码:

import os
import webapp2
import jinja2

from google.appengine.ext import db

jinja_environment = jinja2.Environment(autoescape=True,
    loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))

# Defines the database model
class Post(db.Model):
    subject = db.StringProperty(required = True)
    content = db.TextProperty(required = True)
    created = db.DateTimeProperty(auto_now_add = True)

# Base handler class with utility functions
class Handler(webapp2.RequestHandler):
    def write(self, *a, **kw):
        self.response.out.write(*a, **kw)
    def render_str(self, template, **params):
        t = …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine

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

SQL子查询 - 如何查找最小值

我创建了一个子查询,如下所示

select hospital.hospitalcode, name, wardno, annualbudget
from hospital, ward
where hospital.hospitalcode = ward.hospitalcode
Run Code Online (Sandbox Code Playgroud)

我想回答的问题是:考虑到所有医院病房,哪家医院的病房年度预算最低?您应该显示医院代码及其名称,病房号码和年度预算.

我如何找到这个问题的单一条目?我意识到我需要使用MIN,但在使用多个列名时不知道在哪里使用它

sql oracle min

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

uitableview第一个和最后一个可见的单元格颜色变化

我正试图在UITableViewiPhone中实现这个功能:总是只有FIRST和LAST VISIBLE单元格有不同的背景颜色,比如红色,而其他单元格的颜色保持白色.滚动期间的平滑变化.
我试过了:

.m文件中:

NSIndexPath *firstRow;
UITableViewCell* firstCell;

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"tableCell";    
    tableCell *cell = (tableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) 
    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"tableCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    } 

    cell.nameLabel.text = [tableData objectAtIndex:indexPath.row];
    //cell.thumbnailImageView.image = image;

    return cell;
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
{
    NSArray *visible = [tableView indexPathsForVisibleRows];
    firstRow = (NSIndexPath *)[visible objectAtIndex:0];
    firstCell = [tableView cellForRowAtIndexPath:firstRow]; …
Run Code Online (Sandbox Code Playgroud)

uitableview ios

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

在Android中的LinkedHashMap中打印所有键

LinkedHashMap我的代码中有一个:

 protected LinkedHashMap<String, String> profileMap;
Run Code Online (Sandbox Code Playgroud)

我想要打印出来的所有按键profileMap.如何使用Iterator或循环?

java android hashmap linkedhashmap

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

请帮助使用SPSS添加Likert类型的比例

由于表达不清楚,上一篇文章被关闭,因此这是一个经过编辑的文章.

来自问卷的5个李克特式量表问题共有20个项目.我需要从5个单独的问题中添加20个项目以创建总比例.我已经掌握了数据.

问题就像上面的图片一样.如何运行命令从5个单独的问题中添加20个项目?命令是什么?

它类似于Transform> Compute变量.输入一个变量名称,指定要添加的项目,并嘿presto(例如"V1 + V2 + V3"等)?

spss

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