Home > Back-end >  Help text centered problem bosses see!!!!!!!!!!!! thank you
Help text centered problem bosses see!!!!!!!!!!!! thank you

Time:10-18

The import javax.mail. Swing. *;
Import the Java. The awt. *;
Import the Java. The awt. Event. An ActionEvent;
Import the Java. The awt. Event. ActionListener;
The class MyJDialog extends JDialog
{
Public MyJDialog (MyFrame frame)
{
Super (frame, "44", true);
The Container Container=getContentPane ();//create a container
The container. The add (new JLabel (" love "));//add the label in the container!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

SetBounds (120120100100);//Settings dialog window on the desktop display coordinate and size
}
}
Class MyFrame extends JFrame//create a parent form class
{
MyFrame ()//the following set properties
{
The Container Container=getContentPane ();//get the form container
Container. SetLayout (null);//container using a NULL layout
JButton bl=new JButton (" pop-up dialog ");//define a button
Bl. SetBounds (10,10,100,21);//define button coordinates in the container and size
Bl. AddActionListener (new ActionListener ()//to a button to add click event
{
@ Override
Public void actionPerformed (an ActionEvent e)
{
MyJDialog dialog=new MyJDialog (MyFrame. This);
Dialog. SetVisible (true);
}
});
The container. The add (bl);//add button to the container
Container. SetBackground (Color. White);//container background color to white
SetSize (200200);//window size
//window closes after end program
SetDefaultCloseOperation (WindowConstants EXIT_ON_CLOSE);
SetVisible (true);//make the window visible
}
Public static void main (String args [])
{
New MyFrame ();//instantiate MyFrame class object
}
}
The love is always can't help center for bosses to see how changes in source thank you
  • Related