Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1

    come modificare un file .class

    ciao a tutti!
    allora..sto utilizzando l'applet di html.it all'indirizzo: http://www.html.it/java/47/47.html
    http://www.html.it/java/47/47.html
    e' una ottima applett ...se non che c'è un bellissimo effetto indesiderato...quando vai col mouse sopra l'applett nella barra di status del browser si setta il testo a:
    "BELSCROLA clicca sul titolo!"...devo ammettere che fa anche ridere...ma se si volesse ovviare a questo problemino...come si dovrebbe fare? E' ovvio che questo comando è settato nel file belscrola.class, che fa da corredo alla applett...
    non avendo nessuna cognizione di come modificare un file del genere mi rimetto ai vostri suggerimenti.
    (temo che sia una procedura non facilissima..dal momento che il file .class è precompilato...)
    cosa devo fare???
    grazie

    Roberto

  2. #2
    utilizza un decompilatore per java
    e edita/modifica/ricompila il sorgente decompilato (.java)
    ...Terrible warlords, good warlords, and an english song

  3. #3
    innanzitutto grazie!
    ho seguito il tuo consiglio, scaricato il decompilatore, editato le modifiche(ho cancellato il contenuto delle stringhe, lasciando delle stringhe vuote, così: "" ...funzionerà?)
    il problema è che per compilarlo ci vuole il compilatore installato..non vorrei incasinarmi troppo con cose che non conosco

    posso mandarti il file di testo decompilato cosi che tu cortesemente lo possa compilare per me come BELscrola.class?

    te ne sarei grato (ps..naturalmente quando hai 1 secondo libero)

    se puoi te lo spedisco via email o per posta o come vuoi tu


    grazie
    roberto

  4. #4
    non è per pigrizia che vi chiedo questo favorino:
    il problema è che non conosco il java, e pur leggendo il file decompilato non sono in grado di capire quali sono i file aggiuntivi necessari (classi, archivi etc) che sono inclusi nella applett, e che sono necessari per ricompilare.

    Grazie anticipatamente

    roberto

  5. #5
    Ragazzi per favore qualcuno mi aiuti!!!!!
    sono disperato:
    ho fatto come suggerito, ho decompilato il file .class...lo ho salvato come file sorgente .java ed ho cancellato le stringhe di testo indesiderate che apparivano nel browser, dopo di che ho ricompilato tutto nel file .class...ma le stringhe appaiono ancora!
    come è possibile?
    per ulteriore conferma ho provato a decompilare il file .class gia modificato, e nel sorgente le stringhe erano cancellate..
    cosa puo essere? non conoscendo il java non sono in grado di capire il significato del sorgente
    posso postare il codice sorgente originario qui sul forum?
    grazie

    Roberto

  6. #6
    Utente di HTML.it L'avatar di Fra
    Registrato dal
    Oct 1999
    Messaggi
    221
    Prova a postare il codice sorgente originale (quello che hai estratto alla prima decompilazione).
    SO : Windows XP - Linux Gentoo
    Java - Visual Basic - C++

  7. #7
    Ciao ecco il codice originale (non modificato) della applett...quello che vorrei è che sparissero quelle due string nella status bar del browser...cancellarle e rimpiazzarle con stringhe vuote non basta.
    Grazie anticipatamente
    // Decompiled by DJ v3.4.4.74 Copyright 2003 Atanas Neshkov Date: 27/01/03 16.41.40
    // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
    // Decompiler options: packimports(3)
    // Source File Name: C:\Windows\Desktop\Software\SSUp II\BELscrola\BELscrola.java

    import java.applet.Applet;
    import java.applet.AppletContext;
    import java.awt.*;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.StringTokenizer;
    import java.util.Vector;

    public class BELscrola extends Applet
    implements Runnable
    {

    public String[] NewLine(String temp, int margins)
    {
    int cur_width = 0;
    int i = 0;
    int next_i = 0;
    int last_i = 0;
    Vector v_the = new Vector();
    int line_start = 0;
    int tw = 0;
    boolean first_run = true;
    while(i != -1)
    {
    i = temp.indexOf(' ', next_i);
    if(i != -1)
    {
    first_run = false;
    tw = fm.stringWidth(temp.substring(last_i, i));
    cur_width += tw;
    if(cur_width >= d.width - margins)
    {
    v_the.addElement(CheckSPart(temp.substring(line_st art, last_i)));
    line_start = last_i;
    cur_width = tw;
    }
    next_i = i + 1;
    last_i = i;
    continue;
    }
    if(first_run)
    {
    v_the.addElement(CheckSPart(temp));
    break;
    }
    tw = fm.stringWidth(temp.substring(last_i));
    cur_width += tw;
    if(cur_width >= d.width - margins)
    {
    v_the.addElement(CheckSPart(temp.substring(line_st art, last_i)));
    v_the.addElement(CheckSPart(temp.substring(last_i) ));
    } else
    if(line_start < last_i)
    v_the.addElement(CheckSPart(temp.substring(line_st art)));
    }
    String the_string[] = new String[v_the.size()];
    v_the.copyInto(the_string);
    if(the_string.length < 1)
    {
    the_string = new String[1];
    the_string[0] = " ";
    }
    return the_string;
    }

    public BELscrola()
    {
    hLine = -1;
    l_h = -1;
    last_h = -1;
    m_def_delay = 10;
    m_scroll_delay = 20;
    m_def_size = 14;
    m_def_testcolor = Color.black;
    m_bgcolor = Color.white;
    m_def_hlcolor = Color.blue;
    m_def_fontface = "System";
    m_sb_text = "Belscrola - clicca sul titolo!";
    m_xoffset = 5;
    m_def_loadwhere = "_self";
    m_offxbtest = "Java Belscrola .";
    }

    public void start()
    {
    paused = false;
    if(first_run)
    WhereAmI();
    animator = new Thread(this);
    animator.start();
    }

    public String CheckSPart(String temp)
    {
    if(temp.trim().length() == 0)
    return " ";
    else
    return temp.trim();
    }

    public void stop()
    {
    if(animator != null)
    animator.stop();
    animator = null;
    }

    public boolean mouseExit(Event e, int x, int y)
    {
    mouseIn = false;
    showStatus(m_offxbtest);
    if(paused)
    mCheck();
    return true;
    }

    public boolean mouseMove(Event event, int cx, int cy)
    {
    my = cy;
    if(paused)
    mCheck();
    return true;
    }

    public boolean mouseDown(Event e, int x, int y)
    {
    mdown = true;
    hold_move = my;
    cur_dline = 0;
    if(paused)
    break_pause = true;
    return true;
    }

    public boolean mouseEnter(Event e, int x, int y)
    {
    mouseIn = true;
    showStatus(m_sb_text);
    return true;
    }

    public boolean mouseDrag(Event event, int cx, int cy)
    {
    my = cy;
    mCheck();
    if(hold_move != my)
    {
    scroll_y = scroll_y + (my - hold_move);
    if(scroll_y > d.height || scroll_y < -i_h)
    {
    scroll_y = scroll_y - (my - hold_move);
    } else
    {
    ScrollIt(false);
    int bk = Math.abs(my - hold_move);
    erase = createImage(d.width, bk);
    g_erase = erase.getGraphics();
    g_erase.setColor(m_bgcolor);
    g_erase.fillRect(0, 0, d.width, bk);
    if(scroll_y > 0)
    getGraphics().drawImage(erase, 0, scroll_y - bk, this);
    if(scroll_y + i_h < d.height)
    getGraphics().drawImage(erase, 0, scroll_y + i_h, this);
    hold_move = my;
    }
    }
    return true;
    }

    public void mCheck()
    {
    for(int i = 0; i < num_links; i++)
    {
    if(!mouseIn)
    {
    hLine = -1;
    chl(i);
    break;
    }
    if(my > link_cords[i * 3] + scroll_y && my < link_cords[i * 3 + 1] + scroll_y)
    {
    hLine = link_cords[i * 3 + 2];
    link_ref = i;
    chl(i);
    break;
    }
    if(i != num_links - 1)
    continue;
    hLine = -1;
    chl(i);
    break;
    }

    }

    public void DrawBG(Graphics g)
    {
    g.setColor(m_bgcolor);
    g.fillRect(0, 0, d.width, d.height);
    }

    public int FontType(String temp)
    {
    int i = 0;
    if(temp.equalsIgnoreCase("bold"))
    i++;
    if(temp.equalsIgnoreCase("bolditalic"))
    i += 3;
    if(temp.equalsIgnoreCase("italic"))
    i += 2;
    return i;
    }

    public boolean mouseUp(Event e, int x, int y)
    {
    WhereAmI();
    mdown = false;
    if(hLine != -1 && !link_urls[link_ref].equals("-1"))
    {
    try
    {
    goURL = new URL(getDocumentBase(), link_urls[link_ref]);
    }
    catch(MalformedURLException malformedurlexception) { }
    getAppletContext().showDocument(goURL, m_loadwhere[hLine]);
    }
    return true;
    }

    public void ScrollIt(boolean auto)
    {
    if(auto && scroll_y == -line_coords[cur_dline] && cur_dline != num_dexcrips - 1)
    {
    paused = true;
    if(m_delay[cur_dline] > 0)
    for(next_time = System.currentTimeMillis() + (long)m_delay[cur_dline]; System.currentTimeMillis() < next_time
    {
    try
    {
    Thread.sleep(10L);
    }
    catch(InterruptedException interruptedexception) { }
    if(break_pause)
    {
    break_pause = false;
    break;
    }
    }

    paused = false;
    cur_dline++;
    }
    getGraphics().drawImage(off, 0, scroll_y, this);
    if(scroll_y < -off.getHeight(this))
    {
    scroll_y = d.height;
    cur_dline = 0;
    }
    }

    private void chl(int i)
    {
    if(l_h != hLine)
    {
    if(l_h != -1)
    {
    HL(l_h, m_testcolor[l_h]);
    showStatus(m_sb_text);
    }
    if(hLine != -1)
    {
    HL(hLine, m_def_hlcolor);
    showStatus(link_urls[i]);
    }
    if(paused)
    soff = 1;
    else
    soff = 0;
    getGraphics().drawImage(off, 0, scroll_y + soff, this);
    }
    l_h = hLine;
    }

    }

  8. #8
    questa è la seconda parte(tutta non entrava in un solo post):
    public void run()
    {
    do
    {
    if(!first_run)
    {
    DrawBG(getGraphics());
    showStatus(m_sb_text);
    first_run = true;
    }
    if(!mdown)
    {
    scroll_y = scroll_y - 1;
    ScrollIt(true);
    mCheck();
    }
    try
    {
    Thread.sleep(m_scroll_delay);
    }
    catch(InterruptedException interruptedexception) { }
    } while(true);
    }

    public Color ConvertColor(String temp)
    {
    int r = 0;
    int g = 0;
    int b = 0;
    int i = 0;
    temp.trim();
    i = temp.indexOf("#");
    Color ctemp;
    if(i != -1 && i + 1 != temp.length())
    {
    ctemp = new Color(Integer.parseInt(temp.substring(i + 1), 16));
    return ctemp;
    }
    StringTokenizer st = new StringTokenizer(temp, ",");
    if(st.countTokens() > 3)
    return Color.black;
    while(st.hasMoreTokens())
    {
    r = Integer.parseInt(st.nextToken().trim());
    g = Integer.parseInt(st.nextToken().trim());
    b = Integer.parseInt(st.nextToken().trim());
    }
    st = null;
    if(r > 255)
    r = 255;
    if(g > 255)
    g = 255;
    if(b > 255)
    b = 255;
    ctemp = new Color(r, g, b);
    return ctemp;
    }

    public void init()
    {
    String crstr = "0000000000000000000000000000000000000000000000000 00000001 - Ver.1b";
    d = size();
    int i = 0;
    scroll_y = d.height;
    String param = getParameter("Notice");
    if(!param.equals(crstr))
    {
    m_sb_text = "Incorrect Copyright Notice in 'Notice' tag";
    return;
    }
    tag = true;
    param = getParameter("size");
    if(param != null)
    m_def_size = Integer.parseInt(param);
    param = getParameter("extrasize");
    if(param != null)
    m_def_size_extra = Boolean.valueOf(param).booleanValue();
    param = getParameter("fontface");
    if(param != null)
    m_def_fontface = param;
    param = getParameter("loadwhere");
    if(param != null)
    m_def_loadwhere = param;
    param = getParameter("testcolor");
    if(param != null)
    m_def_testcolor = ConvertColor(param);
    param = getParameter("bgcolor");
    if(param != null)
    m_bgcolor = ConvertColor(param);
    setBackground(m_bgcolor);
    param = getParameter("delay");
    if(param != null)
    m_def_delay = Integer.parseInt(param);
    param = getParameter("xcrolldelay");
    if(param != null)
    m_scroll_delay = Integer.parseInt(param);
    param = getParameter("lrmarginx");
    if(param != null)
    m_xoffset = Integer.parseInt(param);
    param = getParameter("hlcolor");
    if(param != null)
    m_def_hlcolor = ConvertColor(param);
    param = getParameter("centertest");
    if(param != null)
    m_def_centertest = Boolean.valueOf(param).booleanValue();
    param = getParameter("onxbtest");
    if(param != null)
    m_sb_text = param;
    param = getParameter("offxbtest");
    if(param != null)
    m_offxbtest = param;
    param = getParameter("fontxtyle");
    if(param != null)
    font_xtyle = FontType(param);
    while(getParameter("dexc" + i) != null)
    {
    i++;
    num_dexcrips++;
    }
    m_size = new int[num_dexcrips];
    m_xtyle = new int[num_dexcrips];
    m_delay = new int[num_dexcrips];
    m_testcolor = new Color[num_dexcrips];
    m_dexc = new String[num_dexcrips];
    m_linkurl = new String[num_dexcrips];
    m_fontface = new String[num_dexcrips];
    m_centertest = new boolean[num_dexcrips];
    m_loadwhere = new String[num_dexcrips];
    m_size_pause = new int[num_dexcrips];
    m_size_extra = new boolean[num_dexcrips];
    line_coords = new int[num_dexcrips];
    re_draw = new int[num_dexcrips];
    for(i = 0; i < num_dexcrips; i++)
    {
    param = getParameter("dexc" + i);
    if(param != null)
    m_dexc[i] = param;
    else
    m_dexc[i] = " ";
    param = getParameter("loadwhere" + i);
    if(param != null)
    m_loadwhere[i] = param;
    else
    m_loadwhere[i] = m_def_loadwhere;
    param = getParameter("fontface" + i);
    if(param != null)
    m_fontface[i] = param;
    else
    m_fontface[i] = m_def_fontface;
    param = getParameter("centertest" + i);
    if(param != null)
    m_centertest[i] = Boolean.valueOf(param).booleanValue();
    else
    m_centertest[i] = m_def_centertest;
    param = getParameter("size" + i);
    if(param != null)
    m_size[i] = Integer.parseInt(param);
    else
    m_size[i] = m_def_size;
    param = getParameter("delay" + i);
    if(param != null)
    m_delay[i] = Integer.parseInt(param);
    else
    m_delay[i] = m_def_delay;
    param = getParameter("xtyle" + i);
    if(param != null)
    m_xtyle[i] = FontType(param);
    else
    m_xtyle[i] = font_xtyle;
    param = getParameter("testcolor" + i);
    if(param != null)
    m_testcolor[i] = ConvertColor(param);
    else
    m_testcolor[i] = m_def_testcolor;
    param = getParameter("dexturl" + i);
    if(param != null)
    {
    num_links++;
    m_linkurl[i] = param;
    } else
    {
    m_linkurl[i] = "-1";
    }
    param = getParameter("xizepauxe" + i);
    if(param != null)
    m_size_pause[i] = Integer.parseInt(param);
    else
    m_size_pause[i] = 0;
    param = getParameter("extrasize" + i);
    if(param != null)
    m_size_extra[i] = Boolean.valueOf(param).booleanValue();
    else
    m_size_extra[i] = m_def_size_extra;
    }

    link_cords = new int[num_links * 3];
    link_urls = new String[num_links];
    DrawScroll();
    m_sb_text = "Belscrola - clicca sul titolo!";
    m_offxbtest = "Java Belscrola .";
    }

    public void paint(Graphics g)
    {
    if(done_draw)
    {
    DrawBG(g);
    g.drawImage(off, 0, scroll_y, this);
    g.setColor(m_bgcolor);
    }
    if(!tag)
    g.drawString("Incorrect 'Notice' tag", 5, 20);
    }

    public void HL(int i, Color h_c)
    {
    int cur_y = re_draw[i];
    g_off.setFont(font = new Font(m_fontface[i], m_xtyle[i], m_size[i]));
    fm = g_off.getFontMetrics(font);
    g_off.setColor(h_c);
    String multi_line[] = NewLine(m_dexc[i], m_xoffset * 2);
    for(int l = 0; l < multi_line.length; l++)
    {
    cur_y += fm.getHeight();
    if(m_centertest[i])
    g_off.drawString(multi_line[l], (d.width - fm.stringWidth(multi_line[l])) / 2, cur_y);
    else
    g_off.drawString(multi_line[l], m_xoffset, cur_y);
    }

    }

    public void DrawScroll()
    {
    String multi_line[] = null;
    int cur_y = 0;
    int prev_y = 0;
    int link_coord_pos = 0;
    int p_start_y = 0;
    boolean got_p = false;
    int j = 0;
    do
    {
    cur_y = 0;
    for(int i = 0; i < num_dexcrips; i++)
    if(j == 0)
    {
    fm = getFontMetrics(font = new Font(m_fontface[i], m_xtyle[i], m_size[i]));
    prev_y = cur_y;
    if(m_size_pause[i] == 1)
    {
    p_start_y = prev_y;
    got_p = true;
    } else
    if(!got_p)
    p_start_y = prev_y;
    multi_line = NewLine(m_dexc[i], m_xoffset * 2);
    for(int l = 0; l < multi_line.length; l++)
    cur_y += fm.getHeight();

    if(i == m_dexc.length - 1)
    {
    i_h = cur_y + fm.getDescent() + 5;
    off = createImage(d.width, i_h);
    g_off = off.getGraphics();
    g_off.setColor(m_bgcolor);
    g_off.fillRect(0, 0, d.width, i_h);
    } else
    if(cur_y - p_start_y < d.height && m_size_pause[i] == 2)
    {
    if(m_size_extra[i])
    cur_y = cur_y + (d.height - (cur_y - p_start_y)) + 1 + (cur_y - p_start_y);
    else
    cur_y = cur_y + (d.height - (cur_y - p_start_y)) + 1;
    got_p = false;
    }
    } else
    {
    g_off.setFont(font = new Font(m_fontface[i], m_xtyle[i], m_size[i]));
    fm = g_off.getFontMetrics(font);
    prev_y = cur_y;
    if(m_size_pause[i] == 1)
    {
    p_start_y = prev_y;
    got_p = true;
    } else
    if(!got_p)
    p_start_y = prev_y;
    line_coords[i] = cur_y + fm.getDescent() + 1;
    re_draw[i] = cur_y;
    multi_line = NewLine(m_dexc[i], m_xoffset * 2);
    for(int l = 0; l < multi_line.length; l++)
    {
    cur_y += fm.getHeight();
    g_off.setColor(m_testcolor[i]);
    if(m_centertest[i])
    g_off.drawString(multi_line[l], (d.width - fm.stringWidth(multi_line[l])) / 2, cur_y);
    else
    g_off.drawString(multi_line[l], m_xoffset, cur_y);
    }

    if(m_linkurl[i].length() > 3)
    {
    if(i == m_dexc.length - 1)
    cur_y += fm.getDescent();
    link_cords[link_coord_pos * 3] = prev_y;
    link_cords[link_coord_pos * 3 + 1] = cur_y;
    link_cords[link_coord_pos * 3 + 2] = i;
    link_urls[link_coord_pos] = m_linkurl[i];
    link_coord_pos++;
    }
    if(i != m_dexc.length - 1 && cur_y - p_start_y < d.height && m_size_pause[i] == 2)
    {
    if(m_size_extra[i])
    cur_y = cur_y + (d.height - (cur_y - p_start_y)) + 1 + (cur_y - p_start_y);
    else
    cur_y = cur_y + (d.height - (cur_y - p_start_y)) + 1;
    got_p = false;
    }
    }

    } while(++j < 2);
    done_draw = true;
    }

    public void WhereAmI()
    {
    for(int i = num_dexcrips - 1; i > -1; i--)
    if(scroll_y > -line_coords[i])
    cur_dline = i;

    }

    Font font;
    FontMetrics fm;
    Thread animator;
    Dimension d;
    Image off;
    Graphics g_off;
    Graphics g_erase;
    Image erase;
    URL goURL;
    boolean break_pause;
    boolean tag;
    long next_time;
    int my;
    int hLine;
    boolean mouseIn;
    int l_h;
    int soff;
    int m_size_pause[];
    int num_links;
    int link_cords[];
    String link_urls[];
    int line_coords[];
    int re_draw[];
    int font_xtyle;
    int num_dexcrips;
    int scroll_y;
    int last_h;
    int cur_dline;
    int hold_move;
    int link_ref;
    boolean done_draw;
    boolean first_run;
    boolean paused;
    boolean mdown;

  9. #9
    questa è l'ultima parte:
    private boolean m_def_size_extra;
    private boolean m_size_extra[];
    private boolean m_def_centertest;
    private int m_def_delay;
    private int m_scroll_delay;
    private int m_def_size;
    private Color m_def_testcolor;
    private Color m_bgcolor;
    private Color m_def_hlcolor;
    private String m_def_fontface;
    private String m_sb_text;
    private int m_xoffset;
    private String m_def_loadwhere;
    private String m_offxbtest;
    int i_h;
    private int m_size[];
    private int m_xtyle[];
    private int m_delay[];
    private Color m_testcolor[];
    private String m_dexc[];
    private String m_linkurl[];
    private String m_fontface[];
    private boolean m_centertest[];
    private String m_loadwhere[];
    private String d_temp[];

  10. #10
    Utente di HTML.it L'avatar di Fra
    Registrato dal
    Oct 1999
    Messaggi
    221
    Nel metodo init() devi cambiare questa assegnazione (alla fine del metodo):
    m_sb_text = "Belscrola - clicca sul titolo!";

    Ciao!
    :mavieni:
    SO : Windows XP - Linux Gentoo
    Java - Visual Basic - C++

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.