-
Replied To a Post in Problem calling a method from main
Best not to reinvent the wheel. List already has a `contains` method `boolean contains(Object o)` Returns true if this list contains the specified element. More formally, returns true if and … -
Replied To a Post in wargame design help
You wouldn't use Observer to transmit stuff down a hierarchy. Since each unit will presumably have a list of the units directly below it, it can simply call their appropriate … -
Replied To a Post in wargame design help
I'm not sure where you intend to use the Observer pattern. It's a common way to attach a GUI to a model, or to allow a "referee" to watch players … -
Replied To a Post in randomize queen board
There are more than one ways to do this, but here's one: Start with an ArrayList containing the numbers of the columns with no queen. Initially it will contain the … -
Replied To a Post in sodoko board
hey man - if it looks difficult then just break it down into small steps and do one at a time. As long as you keep trying things you'll get … -
Replied To a Post in sodoko board
Yes, that looks right, but I don't understand why you want the same buttons in all 9 blocks when each of the 81 cells can have different contents It looks … -
Replied To a Post in sodoko board
IMHO it's a mistake to see it as 9 3x3 blocks. That's no more valid or relevant than 9 x columns or 9 x rows. Treating any one of those … -
Replied To a Post in sodoko board
Why do you have a 3x3 array of buttons when the board is 9x9? -
Replied To a Post in Efficient way to fill Polygons with Patterns : Java Swing
What offset issues? You are unlikely to find anything faster than the standard API method, so the best approach is to work with it. Have you tried creating a transparent … -
Replied To a Post in fillPolygon code from Graphics
Change the BufferedImage to `TYPE_INT_ARGB` (RGB plus alpha channel). The alpha value (0-255) specifies how opaque the color is. Instead of black, use a totally transparent color, eg `new Color(0,0,0,0)` … -
Replied To a Post in fillPolygon code from Graphics
Why didn't you say that in the first place? Just setOpaque(false) on your JPanel, and instead of black use any color with an alpha value of 0 (which means fully … -
Replied To a Post in fillPolygon code from Graphics
Thise are examples of code that uses fillPolygon, but the OP was asking where to find the source code for fillPolygon. It's defined in Graphics, but its abstract. Graphics2D doesn't … -
Replied To a Post in fillPolygon code from Graphics
Interesting question. A quick Google doesnt reveal any subclasses for Graphics2d - maybe they are private? You could do something that gives you a Graphics2d object (eg overide paintComponent) then … -
Replied To a Post in Change Button
AWT was Sun's first try at a Java GUI and it wasn't very good. So in 1998 (yes, seventeen years ago) they released Swing to replace AWT. Since then all … -
Replied To a Post in How to check if your input is an integer in java
While (1) would be the obvious choice in real-life code, this code looks very much like an exercise in exception handling, so option (2) seems the one that is expected. … -
Replied To a Post in How to check if your input is an integer in java
That code looks sensible. What exactly is your question? -
Replied To a Post in Problem with *.jar files
Exactly which version of Eclipse have you installed, and exactly which version of Java? -
Replied To a Post in java program
You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others … -
Replied To a Post in How to sort string values in java
A Comparator is the right way to do it, so there seems to be something wrong with your implementation. If you post your code someone will help. -
Replied To a Post in JavaFX runnable JAR problem
Are you sure the .fxml file is in the correct directory structure inside your jar? -
Replied To a Post in How to get date stored in database and display it in jdatepicker
I don't use JDatePicker, but if nobody else wants to have a go... This isn't a part of the standard Java distribition, so your best source for support is its … -
Replied To a Post in Problem with *.jar files
What do you mean "will not allow me"? Is there an error message? What does your jar spec look like? -
Replied To a Post in program
You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others … -
Replied To a Post in how do we send an email with java codes
http://bfy.tw/Sdk -
Replied To a Post in Nadia Team
You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others … -
Replied To a Post in Help me please
Excellent! -
Replied To a Post in Help me please
You will need two nested loops One to generate the lines like I split them up above, and an inner loop to to generate the 2x4x6... sequences -
Replied To a Post in Help me please
2 + 2x4 + 2x4x6 + 2x4x6x8 + (etc) see the pattern? Exactly what help do you need? -
Replied To a Post in how to program to sort in ascending/descendin order random using LL and DLL
There are lots of people here who will freely give their time to help you become the best programmer you can be. There's nobody here who is interested in helping … -
Replied To a Post in min in o(1)
What exactly is the code supposed to do? What's the list `min` all about? -
Replied To a Post in Editing the File
You can't do this by editing in place. You have to read the file one line at a time and write those lines to a new file. When you read … -
Replied To a Post in program logic for eliminating the reoccurance of numbers?
"without arrays/stacks/queues" makes this a lot more interesting - presumably that bans dictionaries as well? You could use a nested loop like (pseudocode) for i = 0 to string length … -
Replied To a Post in java mvc
There's nothing wrong with repeating things like Cancel buttons. They all have their own place/size in ther own forms. If they all do exactly the same thing then it would … -
Replied To a Post in Guys please help me to solve this program as soon as possible
You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others … -
Replied To a Post in Ticket counter problem (a different problem)
You have methods called printXXX() that change the data values and print nothing. That's baffling. No surprise that the numbers change each time you try to print them. You repeat … -
Replied To a Post in Binary Tree String Split
It would help if you posted the correct code. Lines 19-24 (which seem to be important to the question) are not compilable as shown. Some comments would also be useful. -
Replied To a Post in Ticket counter problem
123,130: The variable `train` is declared as an instance variable - it has a different value for every instance of its class. You refer to that variable in a static … -
Replied To a Post in Binary Tree String Split
"If someone could help me with some code or psuedocode on where to start" https://docs.oracle.com/javase/tutorial/essential/io/walk.html -
Replied To a Post in Ticket counter problem
Lets try again: What is the complete exacact text of your error mesage, including the line number(s)? -
Replied To a Post in String Split help
That fragment of code makes no sense withoutall the other code that you didn't post here, so it's impossible to understand. You have shared variables, classes, and parameters that we … -
Replied To a Post in Ticket counter problem
Post the complete text of your error message, or a detailed deescription of your unexpected behaviour. Don't expect people to guess what "got error" means in this case. -
Replied To a Post in Two mouse events for closing the jdialog
You are doing a potentially slow database connect + SQL operation inside your actionPerformed - ie on the Swing Event Dispatch Thread. That's going to stop all GUI activity while … -
Replied To a Post in JButton listener not firing
You have TWO login dialogs - one created in main (line 24), the other created in showLoginDialog() (line 72). The line 24 one gets the action listener, but the line … -
Replied To a Post in can anyone explain me this snippet?
Debugging is not an answer. The behaviour of that code is undefined in the standards, so any compiler.now or in the future, can implement any order of evaulation it wants. … -
Replied To a Post in diagonals movements
(one tiny thought ... if you are using standard Java graphics convention then positive y speeds are downwards, not upwards) -
Replied To a Post in Is there a way to consolidate input in an ArrayList?
Yes, that's right. Preceed it with a @Override annotation so the compiler will check that you've done it right. @Override public boolean equals(Object o) { // first test - if … -
Replied To a Post in Is there a way to consolidate input in an ArrayList?
A couple of suggestions: override `equals(Object 0)` for your User class to test if two Users are "the same" by comparing their name, regName etc. Then you can use List's … -
Replied To a Post in diagonals movements
Yes, something like that. You will need to deal with moving in the other 3 quadrants, of course, but you could set up a test that's up/right to confirm before … -
Replied To a Post in diagonals movements
If your speed is a constant then you can only make 0, 45, 90 degree movements. To get any other angles you will need to vary the speed. Eg: if … -
Replied To a Post in Extract data from JOptionPane
Just for the archive... It turns out that you can put (almost) anything as the mesaage in a JOptionPane - inluding JTextFields, JPanels etc, and they are displayed and operate …
The End.