package main;
|
|
import javax.swing.JPanel;
|
|
import java.awt.BorderLayout;
|
|
import javax.swing.JLabel;
|
import javax.swing.JScrollBar;
|
import javax.swing.JScrollPane;
|
import javax.swing.ScrollPaneConstants;
|
import javax.swing.JTextArea;
|
import java.awt.Font;
|
|
public class page_debug_inf extends JPanel {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
private JTextArea ta_debug;
|
private JScrollPane scrollPane;
|
private JLabel label;
|
/**
|
* Create the panel.
|
*/
|
public page_debug_inf() {
|
setLayout(new BorderLayout(0, 0));
|
|
label = new JLabel(" \u4FE1\u606F\u884C\u6570");
|
add(label, BorderLayout.NORTH);
|
|
scrollPane = new JScrollPane();
|
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
add(scrollPane, BorderLayout.CENTER);
|
|
ta_debug = new JTextArea();
|
ta_debug.setFont(new Font("ËÎÌå", Font.PLAIN, 13));
|
scrollPane.setViewportView(ta_debug);
|
|
}
|
|
public void addDebugInf(String inf) {
|
ta_debug.append(inf);
|
int line_cnt = ta_debug.getLineCount();
|
label.setText("ÐÅÏ¢ÐÐÊý: " + line_cnt);
|
if(line_cnt > 1000) {
|
ta_debug.setText(inf);
|
}
|
|
JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
|
scrollBar.setValue(scrollBar.getMaximum());
|
}
|
}
|