posted 20 years ago
Hi I have added a JScrollBar,horizontally within a JTabbedPane.
The JTabbedPane contains JTextFields that are in a single line horizontally.Using the JScrollBar,I am unable to view all the Textfields that are out of the viewing area.
****************HERE'S MY SOURCE **********
public JTabbedPane nesTabs(JTabbedPane tabbedPane)
{
nesLabel = new JLabel[nesStr.length];
nesTextField = new JTextField[nesStr.length];
Nes = new JPanel();
Nes.setLayout(new BorderLayout());
JScrollBar scrollBar2 = new JScrollBar(JScrollBar.HORIZONTAL, 0, 5, 0, 100);
scrollBar2.setUnitIncrement(2);
scrollBar2.setBlockIncrement(1);
scrollBar2.addAdjustmentListener(this);
Nes.add(scrollBar2, BorderLayout.SOUTH);
tabbedPane.addTab(" MNN " ,null,Nes,"NES Table");
int al=10; int y_al=10;
for(int i=0;i<nesStr.length;i++)
{
nesLabel[i] = new JLabel(nesStr[i]);
nesLabel[i].setBounds( al, 15, 170, 20 );
Nes.add(nesLabel[i]);
nesTextField[i] = new JTextField();
nesTextField[i].setBounds(y_al,35,120,20);
Nes.add(nesTextField[i]);
al=al+140;
y_al = y_al+140;
}
for(int j=0;j<nesStr.length;j++)
{
nesTextField[j].setEditable(false);
}
return tabbedPane;
}