Where to Update a JFrame - jframe

Hi I have a JFrame class that I update based on information I recieve from another class. I have created an update method within the JFrame which I use to update the different objects on the page. But my Question is is that the correct thing to do?

You can make it however you want, there is no "right" way. It's all a matter of preference. Personally, I like that way of doing it. In almost all of my GUI's I have a method called "update()" or something similar.

its depends on how updates are being triggered, but using event-listeners and actionCommands might be helpful. I don't necessarily like this methods but it is convenient.

Related

how to allow multi select on gwt combobox

I have combo-box and i want to allow multiple selection on it
how to do that??
newEmployee = new ComboBox<NctrUserDTO>();
newEmployee.setFieldLabel("Employee");
newEmployee.setDisplayField(NctrUserDTO.NAME);
newEmployee.setTriggerAction(TriggerAction.ALL);
newEmployee.setEditable(true);
newEmployee.setStore(employeeList);
newEmployee.setMaxHeight(200);
I don't know which API's ComboBox you're using since vanilla GWT doesn't have a ComboBox, but I'd guess it's not possible to do this unless you change the ComboBox class itself/write an actual MultiSelectComboBox class. Unless your version happens to have an "enableMultiSelect" method already in-built, but you probably wouldn't be asking here then.
If it helps, I found this thread which seems similar to what you're describing.

How can I take something in then out in Eclipse?

I have been looking for a way to pull something out of my main method into a outer method then plop the output of the outer method back into the main method (this is in Eclipse).
I have been looking for a strangely long time for a answer for this but everything seems way more advanced than what I am looking for. If anyone can help it would be a great help.
You want the extract method refactoring. Select the code block that you want move into a different method and press Shift-Ctrl-M. Or is it Ctrl-Alt-M? Can't remember right now.
And here I go giving refactorings to someone that doesn't even know what a method is....

Extend a GUI but now events are not working anymore

so I'm having a lot of classes that use the UIBinder to make the layout. Each one of those classes has a lot of added features in it though, so it's starting to get a little bit cluttered. My idea was to make a GUI class, where I will initialize the UiFields, and to make a class extend that one, and handle all the events in the subclass.
My problem is, the ClickHandlers are not working anymore. Anyone knows why?
Also is it bad practice to do it this way?
You probably have to implement HasHandlers interface and make sure you GUI extends composite

Retrieving data from database to a different view controller

http://www.techotopia.com/index.php/An_Example_SQLite_based_iOS_4_iPhone_Application_%28Xcode_4%29
I have found this sqlite tutorial on google and it worked great for my requirement.
In this tutorial both adding and retrieving data are done on the same viewcontroller. but i want that 'save' method in the tutorial in one viewcontroller and 'find' method in the other.
And also someone tell me whether this tutorial is an effective way to save data or not.because this is the easiest tutorial I found so far.
You might also create a new class ,or use inheritance (upper class) call it for example "SqliteClass"
that have both the 'Save' and 'Find' method
then you can use any method in SqliteClass from any other class ,,
in case you don't want to use inheritance make sure that the methods in SqliteClass are "class" methods the one begins with "+" not"-"
I used both ways and they work just fine ..
Hope that helps :)
Yes, you can to that. you can have n number of view and can save data from any view controller.
check this tutorial.
http://www.icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/

Trying to message a button from another class

I'm new to Objective-C so I may be doing this completely wrong, and if I am please correct me. I am trying to make a separate class in my iPhone app just for skinning buttons. My hope is that this will allow me to reuse as much code as possible but before I spend too much time on it, I would like to know if its possible/a good idea to send a message to a UI Control from another class, and if i can, how should I do it? right now im trying to pass the sender ID to my SkinTools class and message that but it doesn't look like it will allow me to message the layer object.
So, am I just completely off the wall here, or is this possible?
Consider looking into using the delegate pattern.
One could just use the addTarget:selector: method for this purpose. As target set the class you want to send the message to, as selector the method you want to call on the class.
You could add some iVars to your class, like id buttonTarget and SEL buttonSelector and create an initializer like -initButtonWithTarget:selector: to set these values on initialization.
It turns out categories was the answer I needed, then I can just add a skin method to each control I use. I can even put them all in the same file to make it easy to get to.