更新后,IntellijIdea 14我发现项目中的排除文件夹现在可见.

我怎么隐藏它?
如何检查我是否可以删除Java中的文件?
例如,我应该能够删除文件,C:/file.txt但我永远不能删除C:/或Computer,My Documents等等.
可能重复描述的解决方案对我不起作用.
我想在我的系统上找到两个目录之间的相对路径。
例子:
如果我有pathA == <pathA>和pathB == <pathA>/dir1/dir2,它们之间的相对路径将是dir1/dir2.
我怎么能在python中找到它?有我可以使用的工具吗?
如果pathB包含在pathA 中,我可以做得到pathB.replace(pathA, '')这个相对路径,但是如果pathB不包含在pathA 中怎么办?
如何在调用函数时使用in 来在控制台(如System.out.println()in java)中打印值?如果我在值中使用的是在表单加载时打印但我希望它只在调用java脚本时打印.scripletjavascriptSystem.out.println("test")scripletjsp
大家新年快乐!:)
我有一个JTable内部JScrollPane(fillsViewportHeight是true),并希望在拖动开始在表外时从结尾启用行选择(如图中所示)

SSCCE:
public class SimpleTableDemo extends JPanel {
public SimpleTableDemo() {
super(new BorderLayout(0, 0));
String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" };
Object[][] data = { { "Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false) }, { "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) }, { "Jane", "White", "Speed reading", new Integer(20), new Boolean(true) }, { "Joe", …Run Code Online (Sandbox Code Playgroud) 我把String定义为
String s = "\\";
int length = s.length(); // returns 1
System.out.println(s); // prints only one "\"
Run Code Online (Sandbox Code Playgroud)
我怎样才能让它的大小等于2?
UPD:问题不在于获得完全2个大小的字符串.我需要得到我已经定义了我的String by的源字符数.
如何System Clipboard在Java中清除?我试过了
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(null, null);
Run Code Online (Sandbox Code Playgroud)
但它只是扔了一个NPE:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: contents
at sun.awt.datatransfer.SunClipboard.setContents(SunClipboard.java:98)
Run Code Online (Sandbox Code Playgroud) 我有两个班:Element和Display.
现在这两个类都有许多共同的属性,所以我考虑从一个基类继承.
现在出现了问题.对于序列化,Element类应该[XmlIgnore]在每个属性之前具有,但Display不是类.
我该怎么处理?
旧:
public class Element
{
[Browsable(false)]
[XmlIgnore]
public Brush BackgroundBrush { get; set }
}
public class Display
{
public Brush BackgroundBrush { get; set }
}
Run Code Online (Sandbox Code Playgroud)
新:
public class DispBase
{
public Brush BackgroundBrush { get; set; }
}
public class Element : DispBase
{
// what to write here, to achieve XmlIgnore and Browsable(false)?
}
public class Display : DispBase
{
}
Run Code Online (Sandbox Code Playgroud) SSCCE:
public class Test {
public static void main(String[] args) {
Long a = new Long(1L);
new A(a);
}
static class A {
A(int i) {
System.out.println("int");
}
A(double d) {
System.out.println("double");
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
double
Run Code Online (Sandbox Code Playgroud)
打印时不会出现编译错误,它可以正常工作并调用double-parameter构造函数.但为什么呢?
我有一个问题,这里也有描述。
我invertExpand在MyTree课堂上有这样的方法:
public void invertExpand(DefaultMutableTreeNode node) {
TreePath path = new TreePath(node.getPath()); // no better way to get TreePath from TreeNode :(
if (!isExpanded(path)) {
expandPath(path);
} else {
collapsePath(path);
}
}
Run Code Online (Sandbox Code Playgroud)
但问题是isExpanded()方法使用HashMap来存储扩展路径。新创建的似乎isExpanded()永远不会返回。(但它们确实被扩展了)trueTreePath
有什么办法可以解决这个问题吗?
java ×7
swing ×2
c# ×1
clipboard ×1
delete-file ×1
double ×1
file ×1
intellij-14 ×1
io ×1
javascript ×1
jscrollpane ×1
jsp ×1
jtable ×1
jtree ×1
long-integer ×1
python ×1
scriptlet ×1
string ×1
treenode ×1