Member Avatar

final Handler myHandler = new Handler(){ @Override public void handleMessage(Message msg) { updateUI((String)msg.obj); } }; Would someone please let me know what the curly brace '{' and its contents mean in this context? what is the purpose?

Member Avatar
0
6
Member Avatar

Do you need to implement a class in order for an object to access the class's functions/methods? When should you implement a class? When shouldn't you?

Member Avatar
0
4
Member Avatar

I want to create a java application where you can build simple logic circuits (just started learning java recently and it was just a random project idea I got off the net) Ultimately I want the gates as icons on a pane that users can drag and drop onto a canvas but drag and drop is a bit too far ahead for now. So I was thinking of a list next to a large white area (a panel or a canvas) and clicking on the canvas or panel should create a new instance of whatever is selected on the list. …

Member Avatar
0
15
Member Avatar

I need to instantiate a class during runtime based what a user has selected in a list, but these classes each have their own new specific functions and variables, they use the same named functions, but set different variables, and different numbers of variables. I made an example, since my actual code has classes i made which you'd need to import [CODE]class tester { public void tester(){}; public void main(){ int x=1; if (x==0){ class1 newobj = new class1(); } else if (x==1){ class2 newobj = new class2(); } newobj.testfunc(); } private class class1{ public void testfunc(){ System.out.println("class1"); } } …

Member Avatar
0
10
Member Avatar

Hi all, More of general question, than just about drop down objects, but that's where I noticed first, so I'm using that as my example. In the project I am working on, one of the programmers created a new drop down item using [CODE] new ListItem() {Text = "stuff", Value="someValue"}; [/CODE] I always used [CODE] new ListItem("stuff", "someValue"); [/CODE] Is there a difference or a reason why you would use one over the other? They both seem to end up with the same object. Maybe there is no difference, not really sure. The only reason that I can see it …

Member Avatar
0
3
Member Avatar

Hello all I'm having a major problem with instantiating objects across threads in WPF. For example, if I have the following: [icode]Line l = new Line[/icode] I get the following error: 'InvalidOperationException: The calling thread must be STA, because many UI components require this.' While I understand that in general, this error means that I must use the Dispatcher to perform what I need, I can't see anyway to use the dispatcher for the sake of instantiation. Is there anybody who could give me a little push in the right direction with this? Thanks so much. M

0
1

The End.