Double handled slider android [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I was wondering if anyone had some code, or knew of a place that has code for creating a double handled slider. Example :
I am looking to do something similar using a double slider to search for a range of ages on a time array , like in the photo
Thanks in advance

I managed to build it myself... the idea I followed was different from the answers above. I created some items that can be dragged on the screen with the finger, and I fixed the Y position so it can only move from left to right. After that, I generated rectangles that signify the progress (between knobs and outside them). The good thing about this technique is that you can easily customize the slider to be vertical or horizontal, or if you want to put a custom picture in the background. The source is in the link below, and if anyone has any questions please ask.
link: eclipse project

Have you seen the range-seek-bar. It looks like it would work perfectly.!

You could try and extend the AbsSeekBar and have a look at the single-thumbed-SeekBar how it works.

I have looked through the entire Widgets package and incredibly, the ADT doesn't have any slider control! This obviously puts you at a serious disadvantage since there is nothing already implemented for you to extend or modify.
However, there is this guide on hacking together a custom slider component out of a ProgressBar component. This might be your solution. The author overrides the onTouchEvent method to set the progress bar's value according to the touch coordinates. Very clever. However, since a progress bar can only show one value, it's only possible to show the lower or upper bound using a single progress bar.
My suggestion is to create a compound component which has one progress bar that is always at 0%, and another progress bar which is always at 100%. The second bar is overlaid on top of the first one, and its coordinates and width set so its left edge represents the lower bound (x), and the right edge shows the upper bound (x + width). Your onTouchEvent will detect whether the touch coordinates are closer to the lower or upper bound, and then start adjusting that bound until released. When the bounds change, you simply reposition and resize the second bar. Provided you can position components absolutely and on top of other components, this should look great!

Related

Which steps should I follow to determine the level of a glass of any liquid? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm fairly new to OpenCV Java and I've been looking for methods to do what the title asks.
So far, from what I understood, the first step should be to use a detecting edges filter like Sobel or Laplace.
Coming from https://docs.opencv.org/3.4/d2/d2c/tutorial_sobel_derivatives.html, I get the following result : glass_sobel
From now on, I don't know what to do next... What should I do to get what I want ?
Thanks for your help !
Taking the vertical edge difference (sobel) is indeed the right step. But first I suggest fixing some parameters. For instance, is the position, size and shape of the glass fixed? then take an image without fluid and use that to extrapolate the glass from the result. If not, I would take the following steps:
Try to increase edge visibility. In your image you do see a clear edge, but the computer might see this as 4 edges, therefore try to make sure edges close to each other are seen as one edge (dilate operation might do that). Depending on the liquid, you could alternatively extract a certain color from the image. Water is here the most unfortunate case, but something as orange juice is easily detected.
With the more clear edges, I would try to get a vertical line out of the glass, and classify each edge (is it part of glass or part of liquid).

how do i set the size of my window gridbaglayout [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I'm using gridbaglayout and I want my window to be 700 x 500 always. I also was my JButtons to be the exact same size but if the word inside them is longer they get longer and I can't have this. How can I do this? Please help me with good code I been trying for hours.
I tried to do frame.setSize and panel.setSize but neither work and I need this fast! Please help!
The basic answer is, you don't. That's not the point of any layout manager.
A layout manager simple makes decisions about how best to layout it's children based on the sizing hints that they provide.
Remember, while it might look great on your screen, the next computer you run it on may make it look like crap.
If you "must" define the size of anything, then you need to override the getPreferredSize method of your component and return an appropriate size hint.
Having said that, I wouldn't do this for components like JButton (or actually anything other than JPanel and JComponent), the way they calculate their sizes are complicated and best left alone.
You can modify the size of components through the use of Borders and, in the case of GridBagLayout, Insets and modifying the GridBagConstraints properties.
Have a closer look at How to Use GridBagLayout for some more ideas

Java - Custom rendering Component supporting DnD & Zooming [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want to create a custom Swing component that renders certain enteties and connections between them. The user shall be allowed to select those entities and connections as well as moving them using Drag&Drop (only within that component). Additionally the user shall be able to zoom in and out of the overall view.
Do you know of any rendering framework that might help creating such a component or do I need to implement it all on my own?
A custom rendering program is an item that takes some understood data and turns it into drawing instructions.
If you want to add zooming, your custom rendering program will keep track of the size of the data item it is to draw, and the zoom scaling factor, such that if you were to zoom in 1.1 on a 12 pixel tall item, you would then draw that at 13.2 pixels high.
If you want to add drag and drop, you need to be able to receive a mouse click-and-drag event, which will give you a pixel coordinate. You back map that starting pixel coordinate to some non-zoomed pixel, then find out the non-zoomed item under that pixel. You then move that item the (translated for the zoom) correct number of non-zoomed pixels and request a redraw (remember the drawing layer will take care of the current zoom level).
As far as a rendering framework, there are two that come default with Java, and you've mentioned one. Swing is fine if you really want to build this functionality yourself, and AWT is also in Java, but it probably shouldn't be used independently of Swing unless you have some special requirements.
Outside of that there's SWT, and a number of high level convenience libraries like JGraph, etc which bind to one or other underlying frameworks to do the actual work. Whether those convenience libraries will do exactly what you wish, or even if they can be configured to do what you wish remains to be seen, depending on the very specific details that will only be discovered and handled after you start trying a convenience library.

Moving a JLabel in a circular path [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am.working. on a Netbeans Java project in JFrame form (a GUI application) where I want to move a JLabel into circular path. Can any tell or help to how to do that?
It sounds like you haven't done anything yet, and when that happens and you need to get started, then you should try to break the main problem into little steps, and then try to solve each little step one at a time, including looking at references for each of these steps such as using a Timer, doing animation, positioning components, etc...
So general recommendations:
Look up using a Swing Timer (or just click on link)
Use the Timer to drive your animation.
You can move a JLabel if the layout is null, but this is generally to be avoided.
Consider instead using a custom layout if you absolutely need to move a JComponent (the JLabel) along a prescribed path.
Or if you just want to move an image, then draw the image inside of a JPanel's paintComponent(...) method, setting its position with two int fields that are changed by the Timer. This JPanel of course will need to be displayed in your GUI. There are lots of examples on how to do this on this site, some written by me (for example), that simple searching can help you find.
But most important, take the first steps, do something, anything, that moves you forward with this project.
Then when you try this if it doesn't work, show your code and we'll be much better able to help.

Object detection/tracking within Java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking to do some image processing in Java and I'll be developing in Ubuntu with Eclipse.
So here is my objective:
From a greyscale image, I would like to be able to detect certain sized objects and draw a rectangular frame around them. However, the catch is that this image is captured from a thermal imaging camera so to detect body heat the pixels will have a value within a certain range.
After detecting all the objects in the image, I will need to count them, but that's later.
So here's my challenge. Which tools/apis/open classes can I use to do something like this. I looked around and found some basic manipulations such as rotate, crop, resize. But haven't really found anything I can use.
Where should I look/start?
thanks a lot in advance
ImageJ is very useful:
http://rsbweb.nih.gov/ij/
Although ImageJ is set up as a GUI, you can use it as a library too (I do that too)
You'll have to search for a proper object detection plugin (but there are some floating around...)
good luck!
Eelco
On this page you can find open-source tool for image processing and image mining:
http://spl.utko.feec.vutbr.cz/en/image-processing-extension-for-rapidminer-5
This article fully explains the algorithm you're looking for, and the accompanying source code is here. You can see it in action in this video.
(Disclaimer: I'm the author; but I do think this is very useful, and have successfully used the algorithm a lot myself.)
The algorithm tracks moving objects, finds their bounding rectangle (which the application draws), counts the number of pixels in each objects, correlates them throughout frames as the same object (with an int ID). You may need to do a trival conversion of your grayscale image to RGB (by copying the gray values to all three channels) since the algorithm was designed for color input.
When it comes to commercial computer vision applications, OpenCV and the Point Cloud Library aka PCL are your best friends. And articles like the one linked explains how to use tools like OpenCV to accomplish full stack motion tracking. (The pure Java implementation shows how it works down to the individual pixels.)

Categories

Resources