public static void setCursor(client client, int id) {
   Toolkit toolkit = Toolkit.getDefaultToolkit();
   Cursor cursor =
       toolkit.createCustomCursor(
           toolkit.getImage("C:/.hack3rClient/Sprites/Cursors/Cursor " + id + ".PNG"),
           new Point(0, 0),
           "C:/.hack3rClient/Sprites/Cursors/Cursor " + id + ".PNG");
   // Cursor cursor = toolkit.createCustomCursor(toolkit.getImage("Cursors/Cursor "+id+".PNG"), new
   // Point(0,0), ".Cursor/Cursor "+id+".PNG");
   frame.setCursor(cursor);
   //	client.gameFrame.setCursor(cursor);
 }
示例#2
0
  public introduction(String s) {

    super(s);
    Toolkit tool = this.getToolkit();
    Image image = tool.getImage("login.png");
    this.setIconImage(image);
    // Toolkit tool=this.getToolkit();
    // Image image=tool.getImage("¼ÆËãÆ÷.jpg");
    this.setIconImage(image);
    Icon icon = new ImageIcon("src//ѧÉú½éÉÜ.jpg");
    lab = new JLabel(icon);

    add(lab, BorderLayout.CENTER);
    setVisible(true);
    setBounds(450, 200, 420, 400);
  }
  /** Crea el JFrame, ajusta sus valores, y le agrega los componentes */
  public VentanaCarga(Listado lis) {
    listado = lis;
    jbAgregar = new JButton("Agregar");
    jtfNumero = new JTextField(60);
    jlMensaje = new JLabel("Ingrese un n�mero entero: ", SwingConstants.LEFT);

    jbAgregar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            jbAgregarActionPerformed(evt);
          }
        });

    setTitle("Ventana de Carga");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setBackground(new Color(153, 153, 255));

    Toolkit kit = Toolkit.getDefaultToolkit();
    Dimension dim = kit.getScreenSize();
    int alto = dim.height;
    int ancho = dim.width;

    // Fijamos el ancho, el alto y las coordenadas de arranque para mostrarla centrada
    int jfAncho = ancho / 2;
    int jfAlto = alto / 3;

    setSize(jfAncho, jfAlto);
    setLocation(ancho / 4, alto / 4);

    // Proveemos un �cono para la ventana
    Image img = kit.getImage("exclam.gif");
    setIconImage(img);

    getContentPane().setLayout(null);

    jlMensaje.setBounds(jfAncho / 2 - 110, jfAlto / 4, 160, 30);
    getContentPane().add(jlMensaje);

    jtfNumero.setBounds(jfAncho / 2 + 60, jfAlto / 4, 60, 30);
    getContentPane().add(jtfNumero);

    jbAgregar.setBounds(jfAncho / 2 - 40, jfAlto / 2, 80, 30);
    getContentPane().add(jbAgregar);
  }
示例#4
0
 /*
 	This could live in the desktop script.
 	However we'd like to get it on the screen as quickly as possible.
 */
 public static void startSplashScreen() {
   int width = 275, height = 148;
   Window win = new Window(new Frame());
   win.pack();
   BshCanvas can = new BshCanvas();
   can.setSize(width, height); // why is this necessary?
   Toolkit tk = Toolkit.getDefaultToolkit();
   Dimension dim = tk.getScreenSize();
   win.setBounds(dim.width / 2 - width / 2, dim.height / 2 - height / 2, width, height);
   win.add("Center", can);
   Image img = tk.getImage(Interpreter.class.getResource("/bsh/util/lib/splash.gif"));
   MediaTracker mt = new MediaTracker(can);
   mt.addImage(img, 0);
   try {
     mt.waitForAll();
   } catch (Exception e) {
   }
   Graphics gr = can.getBufferedGraphics();
   gr.drawImage(img, 0, 0, can);
   win.setVisible(true);
   win.toFront();
   splashScreen = win;
 }
 public Image getImage(java.net.URL url) {
   return ourToolkit.getImage(url);
 }
 private static Image getImage(String name) {
   Toolkit tk = Toolkit.getDefaultToolkit();
   name = "resources/" + name + ".png";
   return tk.getImage(BorderedComponent.class.getResource(name));
 }
示例#7
0
 public void init() {
   Toolkit tk = Toolkit.getDefaultToolkit();
   image = tk.getImage(getURL("castle.png"));
   addKeyListener(this);
 }