Madhur Baheti

Greenhorn
+ Follow
since Nov 30, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Madhur Baheti

I was Facing the same problem 15 days back. I was trying to build a game of snake and its close to a finish. What i learnt is that i required more of 2d drawing and graphics for which u don't require swing, though i used it. However, if u r building a serious GUI, then swing is the best option.
19 years ago
I am creating a game of snake as an applet. What i am trying to acheive is that i draw a static background for the game only once in the content pane. To redraw the animation again and again, i am using the glass pane so that the background remains visible through it. Here are few lines of code:

pane = new Pane();
getContentPane().add(pane);
//pane.setVisible(true);

glassPane = new MyGlassPane();
setGlassPane(glassPane);
glassPane.setVisible(true);

//resize the screen
resize(appSize);
//setVisible(true);
:
:
class Pane extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
:
:
class MyGlassPane extends JPanel implements KeyListener
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
:
:

Here, Pane and MyGlassPane are two custom JPanels
However, when i try to make the glassPane visible as above, it hides the content pane and the background is not visble. I've tried all the combinations of 'setVisible' methods and reordered them in all the possible ways but nothing happens. If i don't set the glass pane's setVisible, then only content pane shows.
Disabling or enabling super.paintComponent()in both the classes doesen't help.
I need to get done with this project as soon as possible.
SOMEONE PLEASE HELPPPP!
[ April 01, 2003: Message edited by: Madhur Baheti ]
[ April 01, 2003: Message edited by: Madhur Baheti ]
19 years ago
You mentioned


you are better of just creating 3D-looking graphics and making it as normal.


How do i go about this. Can u please elaborate how to create 3D looking graphics myself.
19 years ago
Thanks. I got the idea.
19 years ago
Can someone please explain me that which should be used when:
1. Inner Nested classes
2. Including in one class the object/s of another class as its members
Please explain with examples.
19 years ago
I am planning to make a simple game of snake in java. I thought why not make a 3D snake, but i couldn't find any 3D drawing classes in java sdk.
I just require basic 3D shapes like cuboids and spheres. Would i have to go for the java 3D API? I really don't want to invest much time in that.
19 years ago
I am planning to make a simple game of snake in java. I thought why not make a 3D snake, but i couldn't find any 3D drawing classes in java sdk.
I just require basic 3D shapes like cuboids and spheres. Would i have to go for the java 3D API? I really don't want to invest much time in that.
19 years ago
What i am trying to accomplish by passing integers as references is to implement a simple MaxMin algorithm which finds the both max and min no in an array.It involves recursive calls which require that the intger variables passed to the subsequent recursive instance get changed in the original caller.
19 years ago
Isn't there any way to pass simple data types as references.I've come cross few options but none seem to be satisfactory
1. Declare the variables in a separate class and then include its object in the main class where the varibles were intended to be. Then pass the object.
2. Instead of declaring simple variables, create a single element array of the same type.
3. Use Wrappers. However, no basic operations can be applied like assignment of an integer, logical operators etc. I find it to be useless.
Is there any real nice way in which i can pass the primitive type variables as references so that any changes in the method reflect in the caller.
19 years ago
I am planning to design a game of snake. I haven't studied the Java GUI yet and wanna know which one should i go for, Swing or AWT.
19 years ago
Hi,
I'm brand new to java and the community.I was just kick starting with the sun's java tutorial and stuck up at Object's and classes fundamentals even though i've done c++(No projects or experience, just amateur).I'm pasting the text from the tutorial as it is:
:::::::::::::::::::
Recall that the new operator returns a reference to an object. So you could use the value returned from new to access a new object's variables:
height = new Rectangle().height;
This statement creates a new Rectangle object and immediately gets its height. Effectively, the statement calculates the default height of a Rectangle.
:::::::::::::::::::
where a rectangle class is already defined.Now as no variable holds the object value, is .height a class variable?
Consider this :
' creates a new Rectangle object and immediately gets its height '
Is this value of height defined in some costructor?


I'm eagerly waiting for your replies.
21 years ago