Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding buttons  RSS feed

 
David Henstridge
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to locate a bunch of buttons in java source code.

Whoever programmed this code was very devious. They were masters at hiding
buttons, at least visually (graphically).

I know the location of the panel where they should reside.
I know the button that opens/closes the panel where they reside.
But you can't see the buttons on the panel in the source.
How many buttons are we talking?
At least 14.

Technically they might not be buttons.
All I know is that in the app, when you click on these icons/buttons,
forms open up where you can do other things.

If it were you, how would you go about trying to find these hidden buttons
so you could get at their code?

I know the names that have been given to them.
At least when the program is running.
They're there for all to see.

TIA
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get a good IDE like NetBeans and start searching from what you know and work backward. Look at what you know and see what it ties to, then see what that ties to, and eventually you will find what you are looking for. I have been doing this type of thing on projects with no documentation, on code nobody ever meant for anyone else to see, and things that have been purposefully obfuscated. It comes down to how much patience do you have? One step at a time.
 
David Henstridge
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK thanks Les for your advice.
 
Fred Kleinschmidt
Bartender
Posts: 560
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If they are indeed buttons, just search all of the source code for "new JButton" or "addActionListener", or for methods named "actionPerformed" If they aren't buttons (the code is capturing button presses and determining where the press is), look for "addMouseListener" or "mousePressed". (It will be harder to find these things if the code is Java8 and the author used lambdas).
 
David Henstridge
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred Kleinschmidt wrote:If they are indeed buttons, just search all of the source code for "new JButton" or "addActionListener", or for methods named "actionPerformed" If they aren't buttons (the code is capturing button presses and determining where the press is), look for "addMouseListener" or "mousePressed". (It will be harder to find these things if the code is Java8 and the author used lambdas).


Thanks Fred you gave me a bit more to chew on/look for.
I did find a load of mouseListeners/mousePressed events but they were in JasperReports, not the area I am looking for.

There are tons of ActionListeners in the code.

I think I can confidently say now that the panel does not house buttons, but some other animal rather.
The items are two-part. They consist of an icon and a label to the right. If you click on either one, or even a little above or below each,
a new window will open up.

I will attach an image of the panel I am trying to find/get at in the code.

Also, as you can see in the attachment, when you hover near an item, the text becomes underlined, to show the selection.

Maybe it will give you some clues as to what else I can search for?

Just a side note. The program does allow the casual user to kind of get at the menu.
If you go into the Maintenance/Resources menu in the program you can _show/hide various items on the menu
we are looking at. But that's the extent of it.

BTW, that half button you see in my attached image is one that I added to the code.




MainMenuPanel.jpg
[Thumbnail for MainMenuPanel.jpg]
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's still a shot in the dark, but try searching for hyperlinks: <a href=
 
David Henstridge
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:It's still a shot in the dark, but try searching for hyperlinks: <a href=


Thanks Knute. Nothing turned up with that search.

I'm sure I'll eventually crack this.

I'll show you how close, yet so far I am currently.
As you can see in the menu above each item consists of an icon and a text label.

I know where to change the icons and text labels!
Yes I found where they reside.

However no code to go along with it.

Menu icons can be changed in a Menu.Root.txt file accessible inside the program itself
by typing in the name of the icon that is desired.

The labels for these menu items are found in a source code folder titled 'pos_messages_en_US.properties'.










 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!