Home > Back-end >  Why draw the Java thread shows not
Why draw the Java thread shows not

Time:10-14

Package the hello;
Import the Java. The awt. *;
The import javax.mail. Swing. *;
The class Windows extends JFrame
{
Windows ()
{
JFrame J=new JFrame (" form ");
J.s. etSize (300, 300);
//J.g etContentPane (.) setBackground (Color) lightGray);
J.s. etLocation (100100);
The Container c=J.g etContentPane ();
C.s. etLayout (new FlowLayout ());
C.a. dd (new JLabel (" bt "));
C.a. dd (new JButton (" a "));
J.s. etVisible (true);
}
}
The class Panl extends JPanel
{
Public void paint (Graphics p)
{
Conviction yourself rawLine (100100, 200, 200);
}
}
Public class g extends JPanel {
Public static void main (String [] args) {
Windows w=new ();
Panl d=new Panl ();
W. dd (d);
}
}

CodePudding user response:

The
7 big Ming reply: refer to the original poster
package hello;
Import the Java. The awt. *;
The import javax.mail. Swing. *;
The class Windows extends JFrame
{
Windows ()
{
JFrame J=new JFrame (" form ");
J.s. etSize (300, 300);
//J.g etContentPane (.) setBackground (Color) lightGray);
J.s. etLocation (100100);
The Container c=J.g etContentPane ();
C.s. etLayout (new FlowLayout ());
C.a. dd (new JLabel (" bt "));
C.a. dd (new JButton (" a "));
J.s. etVisible (true);
}
}
The class Panl extends JPanel
{
Public void paint (Graphics p)
{
Conviction yourself rawLine (100100, 200, 200);
}
}
Public class g extends JPanel {
Public static void main (String [] args) {
Windows w=new ();
Panl d=new Panl ();
W. dd (d);
}
}


This set has a problem, you should first add jpanel jframe, jframe set Visible is valid, here involves screen refresh,
  • Related