Hi All,
I need to display some lines on graphics window. The length of the lines can reach upto any extend. Now I can see only upto the screen size of my computer. So i need a scrollbar on that window to scroll the outputwindow. can anyone please help me for that.
Many thanks in advance
What GUI library are you using here, AWT or Swing? What are you drawing your graphics in, a JComponent or JPanel? Have you tried simply placing a graphics JPanel into a JScrollPane? If so, has it not worked?
class Pseudo extends JPanel {
protected void paintComponent(Graphics g) {
// drawing code...
}
public Dimension getPreferredSize() {
// The parent scrollPane will ask for this
// and use it to set its scrollbars to
// make this component fully visible.
return new Dimension(desired width and height);
}
}
Pseudo drawingPanel = new Pseudo();
JScrollPane scrollPane = new JScrollPane(pseudo);
JFrame f = new JFrame();
...
f.add(scrollPane);
f.setSize(any size you like); // scrollPane does the rest