java - i have designed a j slider but cant pass the value on button click -


this question has answer here:

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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -