I want to know more about the menu above, but I can't find a name for it.
This picture is taken from Spotify, and I guess everybody knows what it does: Stores all "Tracks" under Track, All Artists under Artist etc. Also when you click on e.g Track, it will sort them from a-z (same menu are used in Windows, inside folders).
I'm not even sure this is a Java feature, but I'll have to ask anyway!
Related
I need to find what method was called when I tap on something. The project is huge and find it by myself will take a good amount of time.
Is there any possible way to do that?
I'm using Android Studio and yeah I'm working with another person's project for the first time ever.
How I do this:
Let's say that the button has some text. Let's say, it is Login.
Go to the strings.xml, and find the text, matching the text on the button.
use Find Usages in Android Studio on the found string.
In layout XML file observe the button, which text is set to the Login string.
Use Find Usages on the ID of the button
Open the Java file, where the ID of the button is used (usually it is used in findViewById())
use Find Usages on the Button object which is found by id.
Find the setOnClickListener of that button.
see, what is called in that listener.
I'm not sure whether this somehow answers your questions, but at least I found "Analyzing Data Flow" very helpful in messed up projects.
Here's a nice article concerning the feature by Sebastiano Poggi.
Also a gif demostrating the feature in action:
It's also accessible through context menu:
I am trying to create a program in Javafx + Scenebuilder that has a tab pane for creating/loading a card set and another tab for quizzing yourself using that card set, I want to know how to take input from the user in a series of TextFields for a Title to the flash card set and tie that to the flashcard's Question & Answer(entered in TextFields). The user can then enter the flashcard's Title and hit a load button and then go to the other tab and be quizzed with that flashcard set. I also need to know how to store the set so that it doesn't have to be entered every time the program opens.
I had researched on my own for some way to do this but couldn't find a good way to do this, that is why I asked for help.
A HashMap is what I need, after asking someone that actually would give a straightforward answer this is what I was told.
I'll keep this short. I am creating an Android program to allow users to create test mech builds outside of a video game in order to determine if their build is possible in game before dropping money.
Currently, a user can click "add modules" to choose between a list of items in a dialog to populate the list view. Each mech is limited to certain variables. Such as weight, slots open, hard points, etc. Once your mech weighs so much for instance, the part cannot be added.
I am looking for a way to populate the list and change variables depending on the part chosen (I'm pretty sure a simple if/else statement will work here) and more importantly I am looking for a way to allow the user to click a list item and remove it from list along with removing the added change to the variables (weight, slots, etc). (example: Part A increases tonnage from 0/100 to 10/100 tons. User removes part A and tonnage drops to 0/100 again).
Thanks in advance!
Visual:
Screenshot I do not have the rep to post images.
I have a large set of data from which the user has to select one. I'm thinking of a way to implement it (of course, in a GUI). I have a few ideas. But just thought of posting here as there may be better alternatives..
Say, user has to select a name from a large set of user base. If I simply put a text field for user to enter the name, then there can be issues like entering same name in different formats, misspelling etc...
I see two options here
Using a combo box
Using a list (Actually i'm thinking of something like a tool tip. As I cant show the whole list always due to space issues)
But combo box won't be much user friendly i guess. As the user will have to scroll around the whole list to select an entry. If the number of entries are too large, this will be
Which means, now I'm left only one option. A popping up list, which will change the content according the text user is entering in the text field. So he can type first few letters and the list will show all the entries starting from the entered text. Got my point, right?
Are there any other better to achieve this kind of need?
If I'm going to implement above, what will be the best way to follow. I'm thinking of extending the JTextField to add required functionality. Well, I'll put some method to set the popup list entries. And I'll add some actionListner to watch the text field, and control the popup list accordingly...
Autocomplete is what you are probably looking for. Google for "java swing jcombobox autocomplete" and limit results for the last couple of years to get relevant results. There will be a lot of examples and ideas on how to implement this with custom code.
I believe there is also some custom libraries like "swingx" that provide at least partial or full implementations to save time.
http://swingx.java.net/
They have released code as recently as the beginning of this years so it appears active and might have what you need.
You could take a look at SwingLab's autocomplete feature, it allows you to attach it to a JCombBox, JList or JTextComponent
use AutoComplete JComboBox/JTextField
based on Standard Java Classes
no issue with larger sets of data
no issue with Focus, BackSpace Key, Caret
for better performance to required sort the array before use
simple workaround for setStrict(true/false), restrict input to array
is it possible, in Eclipse, to mark certain lines with Shortcuts and be able to quickly jump to those lines?
Example: Let's say I have maintenanceHeavyMethod() at line 120 in my class, gameLoop() at line 800 and some listener at line 1460.
I'd like to f.ex. press CTRL+SHIFT+1, 2, 3 etc. to mark those positions, and then use f.ex. CTRL+1, 2, 3 to immediately jump to them. I don't like split-screens etc, but I need to jump around when writing.
Is there such a feature?
I'm using latest Eclipse to write Java-programs.
You can add Bookmarks in your code. Select the code fragment you want to bookmark and then go to Edit > Add Bookmark... (also possible via the menu available with a right-click in the left hand column of the editor, like breakpoints).
Then, add the Bookmarks view. Select Window > Show View > Other... > Bookmarks and you'll get something like this:
Sadly, I don't think you can bind a shortcut to a particular bookmark.
Just in case, the shortcut to jump to a particular line is CTRL+L.
That would be best taken care by mylyn:
Define a task with this three method, and you will be to see only those 3 in the package explorer view
To jump to a particular method, I use ctrl+o and then start typing the method. If you're a proficient typist, this shouldn't take any longer; keep in mind that you only have to start typing the name of the method.
Unfortunately this isn't a proper solution for jumping to a line of code within a method.
You can jump to methods by using the outline view. Outline view shows all the Methods, Fields, and Inner-Classes (and their methods and fields and inner-classes...etc) of the source file you currently have open. I personally prefer this method, unless I have a stacktrace and know which line I want to jump to, in which case I use ctrl+L.