How to create JRule Component?
843807Feb 16 2010 — edited Feb 18 2010I have a custom JPanel class which displays a 2D curve, using a scaling from model to screen coordinates. I'd like to be able to put a ruler along the edges of the panel, showing the model units - this would be a new JRule component. I'm using Netbeans.
My first thought was a JSlider without the slider. The ticks etc could be set ok, but I don't see how to turn off the slider, or spin off just the 'ticked ruler' part of the JComponent. Has anyone done this or know how it could be done?
I then found a sun example which uses a rule mapping screen coordinates to cm or inches. http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html
the Rule class in this project extends JComponent. As a quick try, I attempted to use this on a GUI in Netbeans as described at http://wiki.netbeans.org/FaqFormUsingCustomComponent but it would not allow to paste to the GUI (I have had no trouble using this with my custom JPanels). Can anyone explain what would need to be done to enable Netbeans to apply this class as a GUI component?
Thanks