java - i have designed a j slider but cant pass the value on button click -
this question has answer here:
- why first panel added frame disappear? 2 answers
i have tried add slider,i need pass value window when press button,but not getting button on window new swing , cant identify error
import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jslider; public class sliding extends jframe{ public sliding() { jslider slider = new jslider(jslider.horizontal, 0, 50, 25); slider.setminortickspacing(2); slider.setmajortickspacing(10); jbutton b=new jbutton("click"); b.setbounds(100,150,80,30); add(b); setvisible(true); slider.setpaintticks(true); slider.setpaintlabels(true); jpanel panel=new jpanel(); panel.add(slider); add(panel); } public static void main(string s[]) { sliding frame=new sliding(); frame.pack(); frame.setvisible(true); } }
replace add(b); add(b,borderlayout.south);
Comments
Post a Comment