Smilidon Sapiens

Ranch Hand
+ Follow
since Nov 02, 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 Smilidon Sapiens

Can you post a code example please... Thanks!
Why is it so important that you know my real name? OK, i will change my nickname, but is this realy my name :-) ?! I like this board, but you have a big problem with your usernames...
Regards Bonkers...
18 years ago
Hello Folks...
I tried to make a titled border for my JPanel.
The following code doesnt work :
<code>
JPanel mainPanel = new JPanel();
mainPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("A titled border")));
</code>
I get the error :
--------------------Configuration: j2sdk1.4.0 <Default>--------------------
C:\Dokumente und Einstellungen\IVOHMEJ\Eigene Dateien\PrestoMaske.java:28: <identifier> expected
mainPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("A titled border"), BorderFactory.createEmptyBorder(5,5,5,5)));
^
C:\..\testBorder.java:28: package mainPanel does not exist
mainPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("A titled border")));
^
2 errors
other Examples work fine, i cant find the difference! I imported the same packages.
Please help I think it is something simple
Thx a lot!
18 years ago
Hi,
can anybody tell me the function of the line:
if (drivers != null)
System.setProperty("jdbc.drivers", drivers);
Why that line?
Thanks!
Thanks it works, great!!! I'm happy...
It flickers a bit, is there a way to stop it?
Greetings Brain!
18 years ago
Hi,
thanks for your fast reply!
I changed my method to this:

There is still my problem...
18 years ago
Hi,
I write a little java app, where you can open a file and you see the content of the file in a textarea. When the file is loading, a progressBar should show the loaded bytes. My progressbar shows nothing.. bad or?
Can you help me please? The ProgressBar is changed in the method "openFile(..)".

[ January 31, 2002: Message edited by: Brain Tenner ]
18 years ago
Hi,
I wrote the following class:

Now, I want to create a lot of objects in my Main Class. This class extends a JFrame. I don't know before how many objects I need. So I tried to add them to a Vector with following code:

If I call the method aFunction() I always get a NullPointerException.
How can I create a count of objects? It seems to me that the object is not finished and so the Vector has nothing to add!?
Please help...
Thanks
18 years ago
Hi,
I wrote this code:


The question:
If I create a new object of this class in my JFrame ("JFrame.add(panel); TabbedPaneContainer cont = new TabbedPaneContainer("Test", panel);"), the ScrollPane has always the size 0. How can draw the ScrollPane correctly?
thanks...
18 years ago
Hi,
I want to insert some data from a txt-file in a table. If I use the object[][] I must know what data I have to insert there. How can I insert data to the table when I don't know how many cols I have?
Please help, thanks!
[This message has been edited by Brain Tenner (edited December 14, 2001).]
18 years ago
I solvd it!
I don't know how it works with the return statement, I use a parameter vector...
<code>
public static void listFilez(File tree, Vector endAll) throws IOException
{
File[] files = tree.listFiles();
for (int i = 0; i < files.length; i++)
{
String fileName = files[i].getName();
if (files[i].isFile())
{
// if (fileName.endsWith(".ini"))
{
endAll.addElement(files[i]);
}
}
if (files[i].isDirectory())
{
listFilez(files[i], endAll);
}
}
}
</code>
Please write your solution, too!
Thanks!
18 years ago

I try to write all file(names) from a drive into a vector.
Code:
<Code>
public static Vector listFilez(File tree) throws IOException
{
Vector endAll = new Vector();
File[] files = tree.listFiles();
for (int i = 0; i < files.length; i++)
{
String fileName = files[i].getName();
if (files[i].isFile())
{
if (fileName.endsWith(".ini"))
{
endAll.addElement(files[i]);
}
}
if (files[i].isDirectory())
{
listFilez(files[i]);
}
} return endAll;
}
</Code>
My Problem is: I get only the files from the parent directory. Can you help me, please? I don't know, what I did wrong ...
Thanks!
18 years ago
I will try it! Thanks!
18 years ago
Hi,
I have a basic java knowledge(Syntax, basic OOP), but I don't know how I can make a structure of my classes. I want to write a game with some sprites(rabbits) and background pictures. You kill the rabbits and they die. A simple game...
I thought I create for every sprite a thread that calculates the x,y position. Every Thread has an object of the sprite with some data about the health and so on.
My Problem is : Where can I get an example of a game like this?
I don't know how I should work with the mouseEvents. I add the mouseListener to the Panel, but create the threads in an other class. So how can I implement: If the user click on the rabbit at X,Y; the sprite thread must die(or init again). But I can't access the thread because it is created in an other class! Arggg... there are a lot of problems like this of structuring this game.
Please help with an example, or better with a discription...
Thanks a lot!
18 years ago
class panel extends Panel
{
Image image;
public void panel()
{
image = Toolkit.getDefaultToolkit().getImage("gif/Image.gif"); //init image
}
public void paint(Graphics g)
{
g.drawImage(1,1,image,this);
}
}
Hope this helps. It is possible that there are some mistakes, I can't test it with a compiler.
18 years ago
Hi,
I want to use the MediaTracker in a class SpriteData. This class don't extends a frame or a panel. I want to have all images that belongs to this sprite in its class. But there is no constructor for the MediaTracker, I always must use MediaTracker(this). But if I do it I get an error, because the class is no panel or frame.
Can you help me please?
Thanks!
18 years ago