TicTacToe with GUI in Java

You only need to import import javax.swing.*; for the TicTacToe.java. Edit the win if statements and delete the static definitions: Add TicTacToe ticTacToe = new TicTacToe(); to the Gui variables. Change the action listener: Delete TicTacToe ticTacToe = new TicTacToe(); from the Control. Always check your errors, you had more NullPointerException exception than you can count.

String is immutable. What exactly is the meaning?

Before proceeding further with the fuss of immutability, let’s just take a look into the String class and its functionality a little before coming to any conclusion. This is how String works: This, as usual, creates a string containing “knowledge” and assigns it a reference str. Simple enough? Lets perform some more functions: Lets see how the below statement works: This appends a … Read more

What exactly is Ajax request? Is it different from Servlet Request?

An Ajax call is an asynchronous request initiated by the browser that does not directly result in a page transition. A servlet request is a Java-specifc term (servlets are a Java specification) for servicing an HTTP request that could get a simple GET or POST (etc) or an Ajax request. An Ajax (“Asynchronous Javascript and … Read more

Creating video player using Java

I used vlcj and it worked smoothly. It’s java binding to vlcj player and the good thing that you don’t have to provide any drives since vlcj already includes all of them in binary distribution. Give it a go, there is example of already working player built for you!

Increase heap size in Java

You can increase to 2GB on a 32 bit system. If you’re on a 64 bit system you can go higher. No need to worry if you’ve chosen incorrectly, if you ask for 5g on a 32 bit system java will complain about an invalid value and quit. As others have posted, use the cmd-line flags – e.g. You … Read more

What does .pack() do?

The pack method sizes the frame so that all its contents are at or above their preferred sizes. An alternative to pack is to establish a frame size explicitly by calling setSize or setBounds (which also sets the frame location). In general, using pack is preferable to calling setSize, since pack leaves the frame layout manager in charge of the frame size, … Read more

User Input not working with keyboard.nextLine() and String (Java)

For you code Change nextLine(); to next(); and it will work. to get an idea for you to what happened was this: nextLine(): Advances this scanner past the current line and returns the input that was skipped. next(): Finds and returns the next complete token from this scanner. Also like the many of the answers says use equals() instead of using == The == checks only the … Read more

Does java have “get line”?

Being new to Java, one of the resources you need to have on hand is the Oracle documentation pages, for example: https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html That will guide you on what a Scanner can do. Specifically, you should look for .nextLine()

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)