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();
 }
Example #2
0
    public void run() {
      if (url == null) {
        // restore the original cursor
        html.setCursor(cursor);

        Container parent = html.getParent();
        parent.repaint();
      } else {
        Document doc = html.getDocument();
        try {
          html.setPage(url);
        } catch (IOException ioe) {
          html.setDocument(doc);
          getToolkit().beep();
        } finally {
          url = null;
          SwingUtilities.invokeLater(this);
        }
      }
    }
    public void run() {
      if (url == null) {
        // restore the original cursor
        html.setCursor(cursor);

        // PENDING(prinz) remove this hack when
        // automatic validation is activated.
        Container parent = html.getParent();
        parent.repaint();
      } else {
        Document doc = html.getDocument();
        try {
          html.setPage(url);
        } catch (IOException ioe) {
          html.setDocument(doc);
          getToolkit().beep();
        } finally {
          // schedule the cursor to revert after
          // the paint has happended.
          url = null;
          SwingUtilities.invokeLater(this);
        }
      }
    }
 public void actionPerformed(ActionEvent e) {
   step.setWidth(200);
   cp.repaint();
   System.out.println(step.getSize());
 }