Home > Back-end >  Code optimization bosses to see come on come on
Code optimization bosses to see come on come on

Time:10-20

The import javax.mail. Swing. *;
Import the Java. The awt. *;

The class BorderLayoutPosition extends JFrame
{
BorderLayoutPosition ()
{
SetTitle (" the boundary of this forms use layout managers ");
The Container c=getContentPane ();
SetLayout (new BorderLayout ());
JButton centerBtn=new JButton (" "), northBtn=new JButton (" north "), westBtn=new JButton (" south "), easthBtn=new JButton (" east "), southBtn=new JButton (" west ");
CenterBtn. SetBackground (Color. White);
NorthBtn. SetBackground (Color BLACK);
WestBtn. SetBackground (Color BLACK);
EasthBtn. SetBackground (Color BLACK);
SouthBtn. SetBackground (Color BLACK);
C.a. dd (centerBtn, BorderLayout. CENTER);
C.s. etBackground (Color red);
C.a. dd (northBtn, BorderLayout. NORTH);
C.a. dd (southBtn, BorderLayout. SOUTH);
C.a. dd (westBtn, BorderLayout. WEST);
C.a. dd (easthBtn, BorderLayout. EAST);
SetSize (350200);
setVisible(true);
SetDefaultCloseOperation (WindowConstants DISPOSE_ON_CLOSE);
}
Public static void main (String args [])
{
New BorderLayoutPosition ();
}
}

CodePudding user response:

Can be run directly
  • Related