No offence but, how is it you can write your own methods, use static, return statements and single-dimension arrays, yet don't know how to call them? Use whatever source(s) you're studying or...
Type: Posts; User: SunshineInABag
No offence but, how is it you can write your own methods, use static, return statements and single-dimension arrays, yet don't know how to call them? Use whatever source(s) you're studying or...
Since it is not entering the if-statement of if(!inputFile.exists()), the representation of the file or the file itself exists. It's now a matter of figuring out what the compiler thinks the file...
This if-statement will return true if a + c > b is false OR b is divisible by 3 without a remainder. The only time it will not return true is if a + c > b is true and b is not divisible by 3.
...
Most layout managers try to ensure each JComponent is side-by-side or some other arrangement other than overlapping. However, there are a few that rely on overlapping, such as CardLayout (not sure if...
What have you tried to code each of the 4 additional features of a help option, setParams option, FillArray option and DisplayResults option? I'll give a very rough outline of the logic and you may...
Since all the methods are static, you just need to call them without creating an instance of the class and make sure you assign a variable that is of the same data type as the return (for your...
I'm a bit confused, are you trying to get the buttons to have that overall appearance but function as 1 button OR are you trying to get 2 buttons with different functions/roles overlap each other?
...
Can you post the code so we can see what happens or make a SSCCE? It could possibly be the layout that you have chosen. If you want to have more control over the layout, try GridBagLayout.
Your if-statement is insanely large and impractical, especially if you want to compare more words. Instead, use another array or an arraylist, such as:
public class TestSentence {
public...
Multidimensional arrays can have any number of dimensions to them, from int[][] to int[][][][]. I understand how a multidimensional array with 2, 3 and 4 dimensions can be used practically but what...
Open a fully functional java program and use it as a checklist to see what the code needs to be functional. So far, you've identified there has to be a ; at the end, a class and a method (either a...
Can you post the contents of the .rar because many people (myself included) will not open a .rar for security reasons. You can use only the 1 JFrame you have and place the contents of the other...
It may not be causing a problem right now but have you tried using hasNext() instead of hasNextLine() as the latter may return true even if there is nothing in the next line.
As for your actual...
There are a few ways to achieve what you want but without seeing the entire code, it's impossible to know why your program is behaving the way it is. One way is to use 1 JFrame and use a Layout...
Try replacing the == with equals(searchKey), that should fix the problem. If you don't care whether letters are upper or lower case, you can instead use equalsIgnoreCase(searchKey).
Your Supplier class does not have the method getItemNumber().
Easiest way that you can do in 1 chained line or a few lines is to first keep jtf.Message.getText() as that retrieves and represents the value as a String object. To get that into a primitive int,...
There are many on YouTube, such as:
Brandonio Productions - YouTube
thenewboston - YouTube
In terms of compilers, there are numerous different ones and any one should suffice your needs. The...
When I write GUI code, I follow a specific layout of how I arrange my code. There are different ways of placing the event-listener code in the GUI, so feel free to use a different way if you wish....
If you already submitted your assignment, it's too late to add this but for future reference, your main method contains "throws IOException" but no where in the method do you use either a...
You already have a title called Login that you set using the JFrame method, setTitle("Login"). Do you want a JLabel to be in the top left corner but underneath the bar where the title is shown? If...
You can use the RandomAccessFile class found in the java.io. package. Here is a link containing the syntax and its methods. You may also want to look at the File class, which is treated as a...
You may want to re-organize your code to set it up for creating a listener, capturing the event and registering the listener to the appropriate JComponents. There are a few ways to do this, such as...
If I'm correctly understanding your question, then you can use:
int index = (int)(Math.random() * 5);
Normally, Math.random() will select random numbers from 0 to as close to 1 as possible...
When I first started learning Java, which wasn't all that long ago, I watched YouTube videos from thenewboston and BrandonioProductions. They have videos starting from the basics, such as downloading...