Assume this Java code:
public class A {
public A(String g) {
x += g.length();
}
private int x = 0;
}
If I create an instance of A, like this:
A a = new A("geo");
after this call, the value of x will be 3. What am I doing wrong in my Scala code?
class A(val g:String) {
x += g.length
var x:Int = 0
}
object x ext...
I have a question about how to dynamically generate JTrees. Is there a way to set the Root Node invisible without making its children invisible too? I have tried to do the following but it shows all nodes as invisible. Keep in mind that I want to add and remove children of the Root Node at any point in time. I've added comments so you ca...
Hi,
I am trying something very basic:
I have a list of 5 buttons. They are in a FlowLayout and the general idea should be that once I click one it should disappear and the others should reorder themselves accordingly.
Now, if I call setVisible(false) the button becomes invisible, but it still occupies it's space in the Layoutmanager.
...
JAVA-
Hi,
I am writing a minesweeper program (first biggie) and am really stuck. The program itself is comprised of 2 classes (one for the logic, one for the GUI) as per the specifications that I am to follow. I have done a fair bit in both classes but am not finished either. However, I am attempting to test implementing call methods fro...
Hi I am trying to access an array and show it in a dropdown list using joptionpane. I have it sort of working using:
for (int i = 0; i < data.length; r++)
{
Object list = JOptionPane.showInputDialog(null, "Select Code",
"Code", JOptionPane.QUESTION_MESSAGE, null, data[i][0], data[0][0]);
}
This brings up a dropdown list...but...
I'm parsing a ServletRequest object(well, a HttpServletRequest really)
Have 2 parameters there, one of them I know to have a value which is an XML file.
How can I retrieve that XML as Doc or byte[] or similar, rather than String?
...
Is there a Java equivalent to the C & C++ compile-time constants __DATE__ and __TIME__. I need to print compile time and version info of the program being compiled.
Thanks
kodev19
...
Hi overflow'ers!
Is there a working example out there that demonstrates how to append additional rows in ListView dynamically?
For example:
you are pulling RSS feeds from
different domains
you then display the first 10 items
in the ListView (while you have
other threads running in the
background continue pulling feeds)
you scroll and ...
Hello these,
This does not compile, any suggestion appreciated.
...
List<Object> list = getList();
return (List<Customer>) list;
Compiler says: cannot cast List<Object> to List<Customer>
...
Hi
I wanted to know how to display a group of JButtons to look like smooth panel without raised portion.
thanks
...
I have a very simple page that is displaying canned data. I experienced this problem with data from a DB so I made this simple example and still have the issue. When this page is navigated to for the first time for a session, the first column in the first row shows no data.
It doesn't matter if I change the scope to request or session...
Hi
i want through Java to geocode a given place or anything similar like "Hungarian National Library, Budapest" or "úri utca, budapest". I want from these to get coordinates (geocoding).
I saw that for similar google applications like google translate there is an api for Java (http://code.google.com/p/google-api-translate-java/)
Is t...
I am working on a Web App with Eclipse for Java EE. I have JSP files that are built with HTML files as includes. My index.jsp looks like this:
<jsp:include page="include/top.html" />
<title>Title!</title>
<jsp:include page="include/header.html" />
<jsp:include page="include/menu.html" />
<div class="span-15 prepend-1 last">
...
I got some weird exception when trying to compile this:
Byte b = 2;
if (b < new Integer(5)) {
...
}
Is it a valid check (unboxing-implicit cast - unboxing)?
...
Why does this
int x = 2;
for (int y =2; y>0;y--){
System.out.println(x + " "+ y + " ");
x++;
}
prints the same as this?
int x = 2;
for (int y =2; y>0;--y){
System.out.println(x + " "+ y + " ");
x++;
}
As far, as I understand a post-increment is first used "as it is" ...
This:
Console c = System.console();
String readline;
String u = c.readLine("%s", "args");
Throws a NullPointerException. Yet the signature of the method is:
public String readLine(String fmt, Object... args)
Why's this exception being thrown?
...
I am a fairly experienced Java programmer that is interested in learning Java EE. Could someone point me to (or describe) how I can get a test environment set up locally so that I can start developing an application (i.e. what webserver I should use, framework if any - Spring? etc.). I am working on a linux machine. I think I will lea...
I have an algorithm which currently allocates a very large array of doubles, which it updates and searches frequently. The size of the array is N^2/2, where N is the number of rows on which the algorithm is operating. I also have to keep a copy of the entire thing for purposes associated with the application surrounding the algorithm.
...
Hello,
Im using Liferay Portal v5.2.3 Community Edition. I have the following two questions which i hope someone would be kind enough to answer.
1.) I want to add some content to the About Us Page of my intranet portal. I added Web Content Display portlet, and maximized the screen after adding content. But accessing the portal, it alwa...
I have a custom spinner dropdown xml file in /res/layout/:
spinner_view_dropdown.xml:
<?xml version="1.0" encoding="UTF-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/spinner_item_dropdown"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:col...