Topic: 如何使JInternalFrame自动添加滚动条?

  Print this page

1.如何使JInternalFrame自动添加滚动条? Copy to clipboard
Posted by: sc33
Posted on: 2003-11-11 12:14


2.Re:如何使JInternalFrame自动添加滚动条? [Re: sc33] Copy to clipboard
Posted by: mochow
Posted on: 2003-11-17 17:10

内置一个JScrollPane?

3.Re:如何使JInternalFrame自动添加滚动条? [Re: sc33] Copy to clipboard
Posted by: popwave
Posted on: 2003-12-11 16:50

不知道是不是要这样的结果?

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class internalFrame extends JFrame
{
  public internalFrame()
  {
    WindowAdapter adapter = new closeWindow();
    addWindowListener(adapter);
    
    JPanel pane = new JPanel();
    pane.setLayout(new GridLayout(1,1));

    JTextArea t1=new JTextArea(5,10);
    t1.setLineWrap(true);
    t1.setWrapStyleWord(true);
    
    JInternalFrame frame = new JInternalFrame();
    frame.setAutoscrolls(true);
    frame.getContentPane().add(new JScrollPane(t1));
    frame.setVisible(true);
    pane.add(frame);
    
    this.getContentPane().add(pane);
    this.pack();
    this.show();
  }
  
  class closeWindow extends WindowAdapter
  {
    public void windowClosing(WindowEvent e)
    {
      dispose();
      System.exit(0);
    }
  }

  public static void main(String[] args)
  {
    JFrame frame = new internalFrame();
  }
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923