Пример #1
0
 public void setWidth(int width) {
   int height = 50;
   editorPane.setSize(width, 2000);
   try {
     height = (int) editorPane.modelToView(editorPane.getDocument().getLength() - 1).getY() + 25;
   } catch (BadLocationException e) {
   }
   editorPane.setSize(width, height);
   sp.setSize(width + 1, height + 1);
   sp.revalidate();
   editorPane.revalidate();
   cp.repaint();
 }
Пример #2
0
 private void init() {
   setSize(800, 600);
   cp = getContentPane();
   cp.setLayout(null);
   btnResize.addActionListener(this);
   btnResize.setLocation(0, 0);
   btnResize.setSize(100, 30);
   sp.setLocation(0, 31);
   sp.setBorder(BorderFactory.createLineBorder(Color.blue, 2));
   editorPane.setBorder(BorderFactory.createLineBorder(Color.red, 2));
   step.setLocation(0, 31);
   step.setSize(100, 100);
   cp.add(step);
   //		cp.add(sp);
   cp.add(btnResize);
 }