Josef Lundström

Greenhorn
+ Follow
since Apr 04, 2017
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 Josef Lundström

Hello!

I am trying to create a stored procedure in MYSQL, which I intend to count books in a table that is written by a certain author:



@bookCounter is null... How can I modify the stored procedure to get the expected result?
Thanks!
I am creating a JavaFX application. I want two labels on the same row to have different positions, but I don't know how to do! I want the first Label to be positioned to the center and the second label to be positioned to the right like this:



I am programming in FXML:


With the above code the result I get this, which is far from my intention:



How do I do to get the right alignments of the different labels? I am thankful for every suggestion!
2 years ago
Hello!

I am creating a view in FXML. I want two labels on the same row to have different positions, but I don't know how to do! I want the first Label to be positioned to the center and the second label to be positioned to the right on the same row (despite that the fonts have different sizes) like this:



Now it looks like this:



This is the code:



How do I do this?
2 years ago
I  am creating a multi-threaded web server. When I run the client I receive a NullPointException. Why is this happening and what can be done to solve it?

Here you can read exception message and the stack trace:



Here I am initializing the Executor which are handling the threads:



The origin of the String questions[1] is in the Broadcaster class:

I am using a get and set method to make it possible for the other inner class to work with



Here are the Strings and created:




The NullPointerException occurs in the HandleValidation class:


class HandlleValidation extends Thread {

The problem is caused by this line:



The Setter:



I have tried to include as little of the code as possible to describe the problem. I may be able to give more information if requested!
2 years ago
I am developing a game of Quiz, with a web server and a client. Now, when the client connects to the server, it crashes. The reason is that code which takes a long time to run, should be executed on a background thread and not on the FX Application Thread. This means that I have to:

Create a task, that handles the data from the web server.
Register a handler that sends the results to the UI when it's complete.
Invoke the task on a background thread.

But I how do I do this when it's a runnable method that is handling the input from the server? I am trying to implement the tutorial that you can find at  Using threads to make database request Using threads to make database requests

The problems occur when I am coming to this part of the code:

}

The Client Class:


2 years ago
Hello! The client is working now... But it doesn't print out to the TextArea.
2 years ago
I am creating a java web server that is a part of a game of quiz. For testing purposes, I have included a counter. The server has a FixedThreadPool that are handling the threads.

The server has a Bufferedreader that will collect data from a database and a Printstream which I will use to write the output to a client. Now, the intention with Printstream is to print out the result of the counter. But when I run the server nothing happens, the printStreamn is not working as intended. There is no output in the terminal and the client is not receiving anything from the server. I am trying to solve this, but it's over my head. What is wrong?

Server



Client
























2 years ago