1.放在ScrollPanel中的组件一般不需要设置大小.
2.
jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
2.
jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
解决方案 »
- 求教,Spring MVC实现JSP查询数据的分页显示
- struts2 <s:select>问题,action问题
- 数组的下标越界问题
- 在使用hibernate自动产生的映射文件和java类文件中,java类文件中的包提示找不到。在线等、、、
- 关于struts2校验框架的问题。例子如:登录,如果第一次输入不合法的信息后,第二次却再也登入不了了。就算输入正确的信息
- 如何在JavaScript中创建一个XML对象,并添加一个带属性的元素到该XML中的语句
- 【求助】要死人了!
- java 排序问题,高手进。
- 兄弟们帮忙讨论一下,拿个注意!!!!
- webservice\websphere\weblogic都是些什么东西啊?
- 我在TOMCAT中运行JSP程序,出现如下问题,请帮忙看一下,在线等好消息
- JDBC的小问题,快帮忙啊
import java.awt.event.*;
import javax.swing.*;public class Frame1 extends JFrame
{
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jTextArea1 = new JTextArea(); //Construct the frame
public Frame1()
{
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception
{
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
jTextArea1.setText("jTextArea1");
contentPane.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(jTextArea1, null);
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e)
{
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING)
{
System.exit(0);
}
}
}
///////////////////////////////////
import javax.swing.UIManager;
import java.awt.*;public class Application1
{
boolean packFrame = false; //Construct the application
public Application1()
{
Frame1 frame = new Frame1();
//Validate frames that have preset sizes
//Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame)
{
frame.pack();
}
else
{
frame.validate();
}
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height)
{
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width)
{
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
//Main method
public static void main(String[] args)
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e)
{
e.printStackTrace();
}
new Application1();
}
}
JEditTextArea jEditTextArea = new JEditTextArea();
jEditTextArea.setText("");
jEditTextArea.getDocument().addDocumentListener(new
EditorPanel_jEditTextArea_DocumentListener(this));
JScrollPane jScrollPane2 = new JScrollPane();
jTabbedPane1.add(jScrollPane2, "jsp source");
jScrollPane2.getViewport().add(jEditTextArea, null);