import java.util.*;
import javax.swing.*;
import java.awt.*;public class Test extends JFrame
{
public static void main(String[] args) {
Test test=new Test();
} public Test()
{
this.setSize(640,512);
JPanel p1=new JPanel();
p1.setBackground(Color.gray);
p1.setBorder(BorderFactory.createLineBorder(Color.red));
this.getContentPane().add(p1,BorderLayout.CENTER); JToolBar tb=new JToolBar();
tb.add(new JButton("One"));
tb.add(new JButton("Two"));
tb.add(new JButton("Three"));
this.getContentPane().add(tb,BorderLayout.NORTH);
tb.setLocation(145,145); this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
import javax.swing.*;
import java.awt.*;public class Test extends JFrame
{
public static void main(String[] args) {
Test test=new Test();
} public Test()
{
this.setSize(640,512);
JPanel p1=new JPanel();
p1.setBackground(Color.gray);
p1.setBorder(BorderFactory.createLineBorder(Color.red));
this.getContentPane().add(p1,BorderLayout.CENTER); JToolBar tb=new JToolBar();
tb.add(new JButton("One"));
tb.add(new JButton("Two"));
tb.add(new JButton("Three"));
this.getContentPane().add(tb,BorderLayout.NORTH);
tb.setLocation(145,145); this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货