title image


Smiley Aber JWindow taucht auf dem Bildschirm nicht auf


import javax.swing.*;

import java.awt.event.*;

import java.awt.*;





public class testPleaseWait extends JFrame

{

public static void main (String args[])

{

JFrame frame = new testPleaseWait();

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.show();

}



public testPleaseWait() {

setTitle("testPleaseWait");

setSize(300, 400);

initPleaseWait();



JButton jb = new JButton("ClickMe");

jb.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent _e) {

showPleaseWait();

}});



Container contentPane = getContentPane();

contentPane.add(jb);



}//constructor



JWindow jd;

private void initPleaseWait() {

jd = new JWindow();

jd.setSize(100, 100);

jd.setLocation(200, 200);

JPanel jpBorder = new JPanel();

jpBorder.setBackground(Color.GREEN);

jpBorder.add(new Label(" "));

JPanel jp = new JPanel();

jp.setBackground(Color.GREEN);



JLabel jl = new JLabel("Please Wait");

jp.add(jl);

jd.getContentPane().add(jp, BorderLayout.CENTER);

}



private void showPleaseWait() {



jd.setVisible(true);

jd.show();

jd.pack();

int nCount = 0;

for (int n = 0; n < 40000; n++)

System.out.print(""+(++nCount)+"\b\b\b\b\b");



jd.setVisible(false);

}

}



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: