I was looking at the Java Platform source code, and I became very confused very quickly. Not because I didn't understand the code (okay, there were parts I didn't understand), but because I didn't see anything different about lists than any other component. With a null layout manager, almost...
Create a java.awt.List.
java.awt.Component.setBounds,setSize, or setLocation it.
Add it to your Frame (or Applet).
ARRGH!!! The setBounds,setSize, or setLocation didn't work. If you are using a Layout Manager, the List just appears as normal (as expected). If you are using a null Layout...
Makes sense. Hmm... I'd better keep that in mind myself.
Note, raptor1, that another similar cause of NullPointerExceptions is the following:
Incorrect Code:
public class DoesntReallyMatter
{
Image buffer = new Image();
public void paint(Graphics g)
{
buffer.drawSomething(...);
}
}...
Dos problemos for you today.
Uno: I am sure there are hundreds of people that don't have this problem, but surely many hundreds more do. What is the most efficient, effective, and for heaven's sake non-error-inducing way of opening external files with Java applets? I have programs that...
Hi. When I ran one of my Java applets on a different computer from the one I had made it on, about half of my spaces (that were displayed on the screen) appeared as that weird box character that tells you when a letter doesn't exist in a certain font (do you know what I'm taking about?). Do...
What about the 'Graphics2D' error? Here's what I've tried:
- At home, I copied src.jar and rt.jar (the two jar files on my computer containg the Graphics2D class) into the Netscape 'Class' folder. To my amazement, the applet 'loaded' but wouldn't start.
- With the appletviewer, I...
Yo. I recently completed my Luge game (you may remember it from a previous thread). It works perfectly in appletviewer at my house, but it:
a) Didn't work in appletviewer at work
b) Didn't work in Netscape at home
c) Didn't work in Netscape at work
d) Didn't work in IE at work
e) Not sure...
The database I was trying to connect to was identified as a PHPMySQL Database. That's what I meant. I couldn't find a driver that worked specifically with this database, and this method works just fine. ***
Dammit Jim, I'm a programmer, not a doctor.
Whoa! I had my hands full trying to do this, but I finally found a way. It ain't purdy, but here it is:
Step 1: Make the following into a PHP file
<?php
mysql_connect("localhost",username,password) or die ("could not connect to database");
mysql_select_db(your_database)...
Is there a 'Mixed' data type in Java? Is it possible to return different types of data from a single method, or would you have to do this:
class Mixed
{
int i;
double d;
String s;
}
class Other
{
Mixed m = new Mixed();
Mixed method(int i)
{
Mixed ret = new Mixed;
ret.i = i;
retrun ret;
}...
Welcome to phpMyAdmin 2.2.3
MySQL 3.23.36 running on localhost
That's what the database 'homepage' on our server says. Does that help? ***
Dammit Jim, I'm a programmer, not a doctor.
Another mystery!:-)
Consider the following:
public void method()
{
//...
}
private void method()
{
//...
}
If you were to call method(), which method would run? Would it be possible to run the other one? ***
Dammit Jim, I'm a programmer, not a doctor.
I know that it is possible to do the following:
public void method(int int_value)
{
//...
}
public void method(float float_value)
{
//...
}
public void method(String string_value)
{
//...
}
And-so-on-and-so-forth. But is it possible to do this:
public int method()
{
//...
}
public float...
Does anyone have more advice? I downloaded a 'driver' (mm.mysql-2.0.12) and unjarred it, like they said to on the webpage, and it was just a lot of .xml and .class junk. Does anyone have a clue how I can install this driver in order to use it to connect to my database? ***
Dammit Jim, I'm a...
Thanx for the compliment. Unfortunately, I can only guess how to create 'drawing threads' as you suggest, because all of my Java programs up to this point have only used single threads. Is it something like this:
Thread runner;
Thread painter;
public void run()
{
Thread thisThread =...
Note that this code is in the process of debugging, so some parts may be embarrasingly redundant (I'm only a beginner after all):
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
public class Luge extends java.applet.Applet implements Runnable
{
double x = 100;
double y = 75...
For one thing, I'm not using swing. I'm not sure what you mean about doing my processing on a seperate thread - could you explain this? And a little tidbit that might help in your diagnosis:
When I took the code from a graphics method (WarpImage) out and put it directly into my paint method...
I have a 90-something Kb program (incomplete, too) that refuses to compile avec Q-Basic 4.5. I forget what error message it gives me - I'll add that when I find out - but I'm wondering if there is a size limit on compiling files. ***
Dammit Jim, I'm a programmer, not a doctor.
I'm confused. I'm working on a school project and I need step-by-step advice on how to:
1. Connect to 'localhost' with JAVA
2. Use SQL to query my database
I have a book that (sort of) tells me how to do this, but I've had troubles finding the right drivers and stuff. I would greatly...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.