class

How do I intialize a Graphics object in Java?

this is the code: import java.awt.*; import java.applet.*; public class anim1 extends Applet{ public void paint (Graphics g) { g.drawString("",400,300); } public static void main(String ad[]) { anim1 a=new anim1(); Graphics g1; a.paint(g1); } } It says that g1 is not initializ...

Weird VB.NET array-property situation

I have this weird situation. I have these two classes: Public Class Entry End Class Public Class Core End Class One of the properties of the Core class will be an array of Entry objects. How can I declare it? Now, the only way to change (add/remove) this array from outside should be using two functions - AddEntry(Ent As Entry) an...

How do I send a class throught UDP socket connection?

I have a UDP server that I have being trying to send structures using send() method.. No luck so far... This is what I am using: H,G are structures... sender side: IFormatter formatter = new BinaryFormatter(); MemoryStream stream = new MemoryStream(); formatter.Serialize(stream, H); Byte[] buffer = stream.ToArray(); stream.Close(); ...

C# Public accessor doesn't work anymore

why this doesn't work anymore in my web control? it just throws a yellow error without any information about the code line. but just at this page... other errors are visible on other pages, it's enabled in web.config. strange is I don't know what I have changed but I think before a week that was running.. It seems a problem with: priv...

Adding a custom UI component as a panel titleIcon (should be easy, I'm kind of a newbie)

The concept of this seems easy, but I'm having trouble getting it right and can't find anything to help me on this. I have a panel I need to perform a drag and drop operation on, but I only want to perform that if the user mouses down on a particular area of the panel. I can add an Icon to the panel by doing this: [Embed("/img/icon.png...

homework: how to invoke a java method.

I have: /* * File: NameSurferEntry.java * -------------------------- * This class represents a single entry in the database. Each * NameSurferEntry contains a name and a list giving the popularity * of that name for each decade stretching back to 1900. */ import acm.util.*; import java.util.*; public class NameSurferEntry imple...

Class Composition in Objective-C Question: Is it possible to inherit a class variable?

Hi everyone, To help gather a sense of Objective-C I'm creating a very basic connect 4 game sans Cocoa. In my program I have three modules: "Game": Contains an array that holds the board information. Object that is created within main, and is responsible for turns. Player and Computer objects live within this module. "Player"...

Proper way to structure classes in Xcode framework

I'm building a custom Xcode framework, and I have a class called AXController that has a class method called showActivationWindow. showActivationWindow initializes and shows a window using AXWindowController which is a subclass of NSWindowController. Then, AXWindowController calls activate which is a class method in AXController on a but...

make a protected property public

I'm trying to extend a class like panel so that I can fire click events only when the title area is clicked on. The title area is a protected uicomponent of Panel called titleBar. So I want to make that component public. It seems like I'm almost there but I'm getting a "TypeError: Error #1009: Cannot access a property or method of a nul...

How do I use a class as a value to be used on set::find()? - C++

So I'm working on a project and I have to use the set library on class objects. Those objects have many attributes, ID being one of them. What I wanted to do was search for an object inside a "set" by its ID. The problem is set only has find and I don't know how to search for an ID this way since I'd have to use find(class object) and n...

Class versioning to support backwards compatibility

In the project I work on, we handle Medical Billing. Every time the state makes a change to the official form (which our data classes represent), in order to maintain backward compatibility with previous forms, we add the new properties but leave the old ones intact, and have a document version property which is used to determine what v...

Difference between access class methods

Up until the yesterday I though that both of these methods for accessing a class where identical. Google turned up noting (either that or my keywords were bad). What is the difference between accessing a class by defining a new instance of the class rather than just calling the class methods directly. I hardly understood what I just as...

Override public method in subclass in a way that restricts public access while still allowing access from parent class?

I have a generic Collection class, with a variety of public getter methods. To get one item from the Collection, you call get(). There are also several methods that return multiple items: getMany(), getRange(), getAll(), find(), findAll(), query(), queryAny(), etc. Internally, all of these methods that return multiple items have a loo...

extending a class and implementing an interface

I am creating objects for a game, they are all sprites. but I also want them to implement an interface. Is it possible to do both ? If not, how can i have an object have the capabilities of a sprite and also have it implement an interface. I am wanting to create another class that checks all my objects to see what datatype they are and e...

Performance advantages of using methods inside of classes verses data structures with libraries of functions?

Basically is the only advantage of object oriented languages the improved understanding of a programs purpose? Do the compilers of object oriented languages break apart the objects into structures and function libraries? ...

Access control's properties from another class in C# WPF

I'm in a mess with visibility between classes. Please, help me with this newbie question. I have two controls (DatePickers from default WPF toolbox) which are in different windows, so in different classes. I can easily access these controls properties like datePicker1.Text from within its native class, i.e. in its native window, but whe...

Asp.Net: Returning a Reader from a Class

Hi all, I was just wondering about the correct way to return a reader from a class? My code below works, but I'm unsure if this is correct. Also. I can't close the the connection in my class method and still access it from my ascx page, is that OK? // In my class I have the following method to return the record/reader -- it's a si...

What does class_getClassVariable() do?

If instance variables belong to an instance of a class, class variables would belong to an instance of a metaclass, I should think. But my experience with the Objective-C metaclass tells me that this is unlikely. I'm wondering what class_getClassVariable does as opposed to class_getInstanceVariable, and why there is not a class_setClass...

Asp.Net: Returning a DataSet from a Class

Hi all, I've decided to start another thread based on the responses I got in this thread: http://stackoverflow.com/questions/1980404/asp-net-returning-a-reader-from-a-class I was returning a reader, but members have suggested I'd be better off returning a Dataset instead and also try to seperate the data access tier from the presentati...

Setting public class variables in PHP

How do I set a public variable. Is this correct?: class Testclass { public $testvar = "default value"; function dosomething() { echo $this->testvar; } } $Testclass = new Testclass(); $Testclass->testvar = "another value"; $Testclass->dosomething(); ...