我有一个字符串,我想检测它是否包含至少一个问号.如果它确实返回false.我试图寻找它,但问号似乎是一个特殊的角色.你会怎么做?
谢谢.
我有一个带有 JPanel 和按钮的应用程序,用户可以点击这些按钮在面板上绘制形状。您可以对形状进行着色和调整大小,也可以在面板中移动它们。我将如何为这样的应用程序实现撤消和重做?我有一个 Actions 类,其中实际实现了所有操作。在这个类中,每个动作都是它自己的扩展 AbstractAction 的类。我的 Actions 类基本上是一个嵌套类。
例如,这是我的 Actions 类中的类之一:
private class RandomAction extends AbstractAction {
private static final long serialVersionUID = 1L;
public NewAction(String text, ImageIcon icon, String desc){
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
}
public void actionPerformed(ActionEvent e) {
}
}
Run Code Online (Sandbox Code Playgroud)
当我然后创建一个按钮时,我所做的就是:
randButton = new JButton(Actions.RandomAction);
Run Code Online (Sandbox Code Playgroud) 当我使用for循环时,调用UIATarget.localTarget().frontMostApp().mainWindow().elements(); 要搜索主视图上的特定元素,它运行速度非常慢.有没有人遇到过这个问题呢?如果是这样,任何提糖
我在emacs中使用perldb来调试Perl脚本(在Linux上).工作得很好,直到我调试一个分叉的脚本.如果我的脚本执行"fork",我得到这个:
######### Forked, but do not know how to create a new TTY. #########
Since two debuggers fight for the same TTY, input is severely entangled.
I know how to switch the output to a different window in xterms
and OS/2 consoles only. For a manual switch, put the name of the created TTY
in $DB::fork_TTY, or define a function DB::get_fork_TTY() returning this.
On UNIX-like systems one can get the name of a TTY for the given window
by typing …Run Code Online (Sandbox Code Playgroud) 为什么用户界面没有显示在我的代码中:
public class GUI extends JPanel{
public GUI(String name, String address, List<String> reviews, Icon icon){
setSize(600,600);
setLayout(new BorderLayout());
JLabel iconLabel = new JLabel(icon);
JLabel nameLabel = new JLabel(name);
JLabel addressLabel = new JLabel(address);
JPanel southReviewPanel = new JPanel();
southReviewPanel.setLayout(new BoxLayout(southReviewPanel, BoxLayout.Y_AXIS));
for (String review: reviews) {
southReviewPanel.add(new JTextArea(review));
}
add(southReviewPanel);
add(iconLabel, BorderLayout.WEST);
JPanel northPane = new JPanel();
northPane.add(nameLabel);
northPane.add(addressLabel);
add(northPane, BorderLayout.NORTH);
}
public static void main(String[] args) {
ImageIcon ic = new ImageIcon();
List<String> list = new ArrayList<String>();
list.add("review1");
list.add("review2"); …Run Code Online (Sandbox Code Playgroud) 我怀疑这可能是一个简单的答案,我只是没有看到,但每当我使用MSBuild或针对.csproj和目标"Package"的Visual Studio解决方案运行器运行TeamCity构建时,构建工件总是包含"csproj" .teamcity.patch"项目名称后面的字符串:

通过命令行运行相同的过程不包括这些.它导致我的问题是我的构建脚本有一个目标,它在程序包任务运行后查找"Web.deploy.cmd",显然当文件以这种方式命名时它找不到它.我不愿意在构建脚本中更改命令以包含TeamCity字符串,因为它将从构建服务器外部运行它,从而造成严重破坏.
任何人都可以告诉我为什么会发生这种情况以及当你需要能够通过名称引用工件时如何解决它?
我的Java应用程序需要知道本地机器上安装了哪个版本的IE(如果有的话),并且查询注册表似乎是最简单的方法.我应该查看哪个注册表项和值?
这需要在Windows XP,Windows Server 2003及更高版本上运行.
我有一个包含二进制数据的字符串(1110100)我想把文本输出所以我可以打印它(1110100会打印"t").我试过这个,它类似于我用来将我的文本转换为二进制文件,但它根本不起作用:
public static String toText(String info)throws UnsupportedEncodingException{
byte[] encoded = info.getBytes();
String text = new String(encoded, "UTF-8");
System.out.println("print: "+text);
return text;
}
Run Code Online (Sandbox Code Playgroud)
任何更正或建议将不胜感激.
谢谢!
是否可以在res/layout下创建子文件夹并将布局XML文件放在那里,以便可以调用视图setContentView(R.layout.questions.create);或setContentView(R.layout.questions/create);?