You are not adding anything to the scrollpane.....so by default it is not shown.......
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
); -----Original Message-----
From: Pepelis, Aaron [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 2:50 PM
To: [EMAIL PROTECTED]
Subject: Help simple scroll pane problemHere is my simple little frame.
My problem is that the scroll panes don't scroll!
any ideas?
aaron
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
import COM.ctron.sti.awt.*;
import javax.swing.border.*;public class SMBSendFrame extends JFrame
{private JTabbedPane tabbedPane;
private JPanel outputAreaPanel;
private JPanel wordDecodePanel;
private JTextArea outputArea;
private JTable wordDecodeTable;
public SMBSendFrame (String title)
{
super(title);
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screen = tk.getScreenSize();
setSize(300, 500);
int screenHeight = screen.height;
int screenWidth = screen.width;
setLocation((screenWidth/2) - this.getWidth()/2, (screenHeight/2) - this.getHeight()/2);
setJMenuBar(getLocalMenuBar());
addWindowListener(new WinExit(this));
tabbedPane = new JTabbedPane();
tabbedPane.addChangeListener(new TabListener(this));
outputAreaPanel = getOutputAreaPanel();
tabbedPane.add(outputAreaPanel, 0);
wordDecodePanel = getWordDecodePanel();
tabbedPane.add(wordDecodePanel, 1);
this.getContentPane().add(tabbedPane);setResizable(false);
}private JPanel getWordDecodePanel()
{
JPanel panel = new JPanel(new BorderLayout());
//panel.add(new JLabel ("hello"));
wordDecodeTable = new JTable();
// wordDecodeTable.setPreferredSize(new Dimension(200,200));
JScrollPane scroll = new JScrollPane(wordDecodeTable);
panel.add(scroll, BorderLayout.CENTER);
return panel;
}private JPanel getOutputAreaPanel()
{
JPanel panel = new JPanel(new BorderLayout());
//panel.add(new JLabel ("no"));
this.outputArea = new JTextArea();
// outputArea.setPreferredSize(new Dimension(200,200));
JScrollPane scroll = new JScrollPane(outputArea);
panel.add(scroll, BorderLayout.CENTER);return panel;
}private JMenuBar getLocalMenuBar ()
{
JMenuBar menubar = new JMenuBar();
menubar.setBorderPainted(true);
// Create the file menu. Add to menubar.
JMenu file = new JMenu("File");
menubar.add(file);
// Create item for the file menu, setting the label, shortcut,
// action command and listener. Add to File menu.
// Note that we use the frame itself as the action listener
JMenuItem quit = new JMenuItem("Quit");
quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_MASK));
quit.setActionCommand("quit");
quit.addActionListener(new WinExit(this, false));
file.add(quit);
JMenu help = new JMenu("Help");
menubar.add(help);
JMenuItem about = new JMenuItem("About");
about.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
about.setActionCommand("About");
about.addActionListener(new ActionListener()
{public void actionPerformed (ActionEvent evt)
{
AboutDialog ab = new AboutDialog("Default", "no version");
ab.show();
}
});
help.add(about);
return menubar;
}
public void changePanes()
{
System.out.println("this tabb " + tabbedPane.getSelectedIndex());
}class TabListener
implements ChangeListener
{
SMBSendFrame tool;public TabListener (SMBSendFrame s)
{
tool = s;
}public void stateChanged (ChangeEvent evt)
{
tool.changePanes();
}
}public static void main (String[] args)
{
SMBSendFrame frame = new SMBSendFrame("Aaron and Leo Rule");
frame.show();
}
}
