就是
setTitle( "Welcome " );
这一句为什么不显示呢~???
// Tutorial 2: Welcome.java
// This application welcomes the user to Java programming.
import java.awt.*;
import javax.swing.*;
public class Welcome extends JFrame
{
private JLabel textJLabel; // JLabel that displays text
private JLabel pictureJLabel; // JLabel that displays an image
// no-argument constructor
public Welcome()
{
createUserInterface();
}
// create and position GUI components; register event handlers
private void createUserInterface()
{
// get content pane and set layout to null
Container contentPane = getContentPane();
contentPane.setLayout( null );
// set up textJLabel
textJLabel = new JLabel();
contentPane.add( textJLabel );
// set up pictureJLabel
pictureJLabel = new JLabel();
contentPane.add( pictureJLabel );
// set properties of application 's window
setTitle( "Welcome " );
setSize( 100, 100 ); // set width and height of JFrame
setVisible( true ); // display JFrame on screen
} // end method createUserInterface
// main method
public static void main( String[] args )
{
Welcome application = new Welcome();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
} // end method main
} // end class Welcome
------解决方案--------------------
我运行的时候是起到作用了的,不知道你的是为什么了
------解决方案--------------------
关注