i created a list box component and created scroll bar component.
how can i add the scroll bar to the list box??
MyLstBx tx = new MyLstBx
JScrollBar z = new JScrollBar();
MyToggleScrlUI bg = new MyToggleScrlUI();
Printable View
i created a list box component and created scroll bar component.
how can i add the scroll bar to the list box??
MyLstBx tx = new MyLstBx
JScrollBar z = new JScrollBar();
MyToggleScrlUI bg = new MyToggleScrlUI();
tx.add(z) ?
i tried it but the scroll bar wont appear, it only appears when i add it to the frame.
z.setVisible(true);
...isn't there a scrollbox component that is exactly what you're trying to create?
i created my own list box extended from jlist and then created my own scroll bar extended from jscroll bar, now am trying to add the scroll bar component to the list box
MyLstBx tx = new MyLstBx
JScrollBar z = new JScrollBar();
MyScrlUI bg = new MyScrlUI();
hi!
i guess my question goes here.
i put a jPanel to a frame, and then in GridLayout added buttons to it, but the buttons didnt seem.what do i do about that?
here is my code
String str[]={"","1","2","3","4","5","6","7","8"};
int sira[]=new int[10];
JPanel content=new JPanel();
content.setLayout(new GridLayout(3,3));
int sayac=0;
//int sayac2=0;
boolean devam=true;
boolean calis=false;
int say;
do{
say=(int)Math.round(Math.random()*8);
sira[sayac]=say;
for (int i=0;i<sayac;i++){
if (sira[i]==sira[sayac]) sayac--;
}
sayac++;
if (sayac==9) devam=false;
}while(devam);
btn=new JButton[3][3];
int k=0;
for(int m=0;m<3;m++)
for(int l=0;l<3;l++){
int a=sira[k];
if (a==0){
bos_satir=m;
bos_sutun=l;
/*System.out.println (m);
System.out.println (l);*/
btn[m][l]=new JButton(str[a]);
btn[m][l].setEnabled(false);
btn[m][l].setVisible(false);
//btn[m][l].addActionListener(this);
content.add(btn[m][l]);
}
else{
//Icon icon=new ImageIcon("");
btn[m][l]=new JButton(str[a]);
//btn[m][l].setIcon(icon);
btn[m][l].setVisible(true);
content.add(btn[m][l]);
//btn[m][l].addActionListener(this);
}
k++;
}
No, actually it doesn't. Please start a new thread for your question rather than hijack someone else's thread.
Also, when you do this, you'll find that if you use code tags (see the faqs), your code will be easier to read, and more will read it (which is what you want). You'll also want to show just where you add the content JPanel to your JFrame or other component that is held by the JFrame.