jslider

How do I correctly use FloatControl with the Java Sound API?

断了今生、忘了曾经 提交于 2019-12-25 04:03:06
问题 I am currently writing a test program in Java that I want to be able to control my computer's main SPEAKER with a JSlider on a GUI application. I have read through this page on the AudioSystem class and this page on Controls. It is my understanding that I need to get a Port or line through a mixer and then institute a Control on that line or port. Since I am controlling volume I need to implement a FloatControl . My program compiles with no problem, however when I run it and adjust the

JSlider in JTable

此生再无相见时 提交于 2019-12-23 20:50:28
问题 For putting a JSlider into a JTable I wrote am AbstractCellEditor which implements a TableCellRenderer and a TableCellEditor . It gets initialized with values from 0 to 100. I have the strange behaviour that when I first click onta a slider it jumps to the maximum. The second weird behaviour: I've added a ChangeListener . This Listener gets only called if I first click into the slider. A second click (which also changes the value) doesn't cause this event. Why? public class SliderTableColumn

Java JSlider set values

你。 提交于 2019-12-23 20:35:22
问题 How can I set the values of a JSlider ? I want to assign it specific values, with intervals that are not constant. Please help 回答1: You can set the min and max values of the slider with the constructor: JSlider mySlider = new Slider(10, 30); // min value of slider, maxValue of slider As far as I know the range of the slider is uniform and can't be changed. (I am not certain of this though.) What you could do is use the uniform value and map it to the intervals you want. For example, lets' say

Is there a way to flip a JSlider so that the slider arrow points upwards?

99封情书 提交于 2019-12-23 15:15:53
问题 I've been trying to find a way to do this for a while now and can't quite seem to figure it out. I know you can change the orientation of a JSlider, using setOrientation(HORIZONTAL|VERTICAL), and that you can also invert the scale, using setInverted(true). My problem is as follows: 1) The JSlider needs to be horizontal; 2) The JSlider needs to be below the data; 3) The arrow (pointy-tip) on the actual slider should be pointing upwards, not downwards (i.e.: towards the data). The only way I

Overlay multiple JSliders in Swing

一笑奈何 提交于 2019-12-22 18:48:08
问题 Is it possible to overlay multiple JSliders so I can see the "thumbs" on both (I've tried disabling the painting of the track and setting opacity to false but one still hides the other)? Basically I'd like to create a component that allows the user to define a range (and I didn't really want to write a custom one since it has most of the attributes of a slider). If there is another way I could do that with a slider, that would work too. thanks, Jeff 回答1: Ah, I found it (i must not have been

Java Swing, draw a line at a specific angle?

僤鯓⒐⒋嵵緔 提交于 2019-12-22 13:53:40
问题 I made a JSlider with Java that changes the angle the line needs to be slanted at. angle = new JSlider(SwingConstants.HORIZONTAL, 0, 180, 90); angle.setSize(300, 50); angle.setLocation(650, 60); angle.setPaintTicks(true); angle.setPaintTrack(true); angle.setMinorTickSpacing(10); angle.setMajorTickSpacing(30); angle.setPaintLabels(true); angle.addChangeListener(this); thepanel.add(angle); I want the code to draw that line that implements the angle from the JSlider. Here is my code: public void

Change displayable labels for a JSlider?

廉价感情. 提交于 2019-12-21 21:30:59
问题 I have a JSlider with a min of 0 and a max of 10,000. I have the major tick marks set at 1,000. If I were to paint the labels now they would show up as 0, 1000, 2000, 3000, 4000, etc. What I would like to be shown would be 0, 1, 2, 3, 4, 5, etc. What would be a good way to accomplish this task? 回答1: using JSlider.setLabelTable(Dictionary) EDIT Alternatively you can rely on predefined label UI and just change the label text: Enumeration e = jSlider.getLabelTable().keys(); while (e

How to draw 2d arrows with Java Swing?

大兔子大兔子 提交于 2019-12-20 07:55:32
问题 I'm trying to draw some rotatable arrows with Swing 2d, there are some sample code online, so I copied and combined them into one app, but there is something wrong with each of the 3 methods : 1st one doesn't rotate from it's center, the other 2 don't look correctly in the arrow head, can someone show me how to fix them ? import java.awt.*; import java.awt.geom.*; import javax.swing.*; import javax.swing.event.*; public class Arrow_Test extends JPanel implements ChangeListener { Path2D.Double

How to increase/decrease brightness of image using JSlider in java?

只谈情不闲聊 提交于 2019-12-17 05:14:12
问题 I m making App in netbeans platform using java swing Technology.I want to do image processing oncaptured image.This image is capture by X-Ray Gun.after that i want to increase/decrease brightness of image using JSlider.I done this using paintComponent(Graphics g) method. but i want to do direct effect of increased/decreased brightnees of image without using paintComponenet(Graphics g) method.so how can i do that? My code is shown below. In my code i use PlanarImage and BufferedImage class of

Update transparancy of jFreeChart in real time with JSlider

♀尐吖头ヾ 提交于 2019-12-13 17:11:48
问题 I would like to ask a follow up question to this Q&A question (How can I update a JFreeChart's appearance after it's been made visible?) from @trashgod. I am trying to give the user a JSlider to control the transparency of the graphs. I added a JSlider and a ChangeListener to repaint whenever there is a JSlider change. slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { chartPanel.repaint(); } }); However, the transparency is not updated until