importjava.awt.Color;importjava.awt.Point;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JScrollPane;importjavax.swing.JText...
import java.awt.Color;
import java.awt.Point;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.UIManager;
//系统皮肤下滚动条外面出现边框
public class sco_area extends JFrame{
private JPanel areapanel ;
static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
}
public sco_area(){
setTitle("滚动条例子");
setBounds(200, 200, 330, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
areaPanelLayout();
add(areapanel);
setBackground(Color.orange);
setVisible(true);
}
public void areaPanelLayout(){
areapanel = new JPanel();
areapanel.setLayout(null);
areapanel.setBounds(0, 0, 330, 300);
areapanel.setBackground(Color.blue);
JLabel hislabel = new JLabel("历 史");
JPanel hispanel = new JPanel();
hispanel.setBounds(70, 50, 200, 85);
hispanel.setOpaque(false);
hispanel.setLayout(null);
hispanel.setBackground(Color.black);
final JTextArea hisarea = new JTextArea();
hisarea.setLineWrap(true);
JScrollPane areasco = new JScrollPane(hisarea);
hisarea.setBackground(Color.orange);
areasco.getViewport().setViewPosition(new Point(0,0));//到顶
areasco.setBounds(0, 0, 200, 85);
hispanel.add(areasco);
areapanel.add(hispanel);
}
public static void main(String[] args) {
new sco_area();
}
}
要怎么样设置才能去掉文本域旁边的白色边条呢?
展开